diff options
author | Felipe Heidrich <fheidric> | 2004-07-14 21:09:48 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2004-07-14 21:09:48 +0000 |
commit | 12d130cb4332a4845bcf0cce6120014733136f99 (patch) | |
tree | cb4c30220f6cd91a6830341088342c34fa20df29 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org | |
parent | 857230dde8be1397ae2557844c139695d4aaa4a3 (diff) | |
download | eclipse.platform.swt-12d130cb4332a4845bcf0cce6120014733136f99.tar.gz eclipse.platform.swt-12d130cb4332a4845bcf0cce6120014733136f99.tar.xz eclipse.platform.swt-12d130cb4332a4845bcf0cce6120014733136f99.zip |
stack order work
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org')
20 files changed, 155 insertions, 96 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 6516767583..8c57b63b78 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -151,7 +151,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { void createHandle (int index) { state |= HANDLE; int bits = SWT.ARROW | SWT.TOGGLE | SWT.CHECK | SWT.RADIO | SWT.PUSH; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); switch (style & bits) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index 4fa729c4e1..b3fff6d6a3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -338,7 +338,7 @@ public void copy () { void createHandle (int index) { state |= HANDLE | MENU; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_combo_new (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index fe3a858430..0fb38ff2cc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -86,26 +86,26 @@ Control [] _getChildren () { int /*long*/ parentHandle = parentingHandle (); int /*long*/ list = OS.gtk_container_get_children (parentHandle); if (list == 0) return new Control [0]; - list = OS.g_list_reverse (list); int count = OS.g_list_length (list); Control [] children = new Control [count]; - int i = 0, j = 0; - while (i < count) { - int /*long*/ handle = OS.g_list_nth_data (list, i); + int i = 0; + int /*long*/ temp = list; + while (temp != 0) { + int /*long*/ handle = OS.g_list_data (temp); if (handle != 0) { Widget widget = display.getWidget (handle); if (widget != null && widget != this) { if (widget instanceof Control) { - children [j++] = (Control) widget; + children [i++] = (Control) widget; } } } - i++; + temp = OS.g_list_next (temp); } OS.g_list_free (list); - if (i == j) return children; - Control [] newChildren = new Control [j]; - System.arraycopy (children, 0, newChildren, 0, j); + if (i == count) return children; + Control [] newChildren = new Control [i]; + System.arraycopy (children, 0, newChildren, 0, i); return newChildren; } @@ -178,7 +178,7 @@ void createHandle (int index) { void createHandle (int index, boolean scrolled) { if (scrolled) { - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); int /*long*/ vadj = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 10); @@ -188,7 +188,7 @@ void createHandle (int index, boolean scrolled) { scrolledHandle = OS.gtk_scrolled_window_new (hadj, vadj); if (scrolledHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES); } - handle = OS.gtk_fixed_new (); + handle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (handle, true); OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_FOCUS); @@ -213,7 +213,6 @@ void createHandle (int index, boolean scrolled) { int hsp = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_NEVER; int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); - //TODO - CHECK WIDTH IS THERE ALREADY THEN DON'T SET if (hasBorder ()) { OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN); } @@ -285,6 +284,29 @@ void fixTabList (Control control) { tabList = newList; } +void fixZOrder () { + if ((state & CANVAS) != 0) return; + int /*long*/ parentHandle = parentingHandle (); + int /*long*/ parentWindow = OS.GTK_WIDGET_WINDOW (parentHandle); + if (parentWindow == 0) return; + int /*long*/ [] userData = new int /*long*/ [1]; + int /*long*/ windowList = OS.gdk_window_get_children (parentWindow); + if (windowList != 0) { + int /*long*/ windows = windowList; + while (windows != 0) { + int /*long*/ window = OS.g_list_data (windows); + if (window != redrawWindow) { + OS.gdk_window_get_user_data (window, userData); + if (userData [0] == 0 || OS.G_OBJECT_TYPE (userData [0]) != display.gtk_fixed_get_type ()) { + OS.gdk_window_lower (window); + } + } + windows = OS.g_list_next (windows); + } + OS.g_list_free (windowList); + } +} + int /*long*/ focusHandle () { if (socketHandle != 0) return socketHandle; return super.focusHandle (); @@ -459,6 +481,11 @@ int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) { return (state & CANVAS) != 0 ? 1 : result; } +int /*long*/ gtk_map (int /*long*/ widget) { + fixZOrder (); + return 0; +} + int /*long*/ gtk_realize (int /*long*/ widget) { int /*long*/ result = super.gtk_realize (widget); if ((style & SWT.NO_BACKGROUND) != 0) { @@ -575,15 +602,15 @@ void moveAbove (int /*long*/ child, int /*long*/ sibling) { temp = OS.g_list_next (temp); } children = OS.g_list_remove_link (children, childLink); - if (siblingLink == 0 || OS.g_list_next (siblingLink) == 0) { + if (siblingLink == 0 || OS.g_list_previous (siblingLink) == 0) { OS.g_list_free_1 (childLink); - children = OS.g_list_append (children, childData); + children = OS.g_list_prepend (children, childData); } else { - temp = OS.g_list_next (siblingLink); - OS.g_list_set_next (childLink, temp); - OS.g_list_set_previous (temp, childLink); - OS.g_list_set_previous (childLink, siblingLink); - OS.g_list_set_next (siblingLink, childLink); + temp = OS.g_list_previous (siblingLink); + OS.g_list_set_previous (childLink, temp); + OS.g_list_set_next (temp, childLink); + OS.g_list_set_next (childLink, siblingLink); + OS.g_list_set_previous (siblingLink, childLink); } fixed.children = children; OS.memmove (parentHandle, fixed); @@ -616,15 +643,15 @@ void moveBelow (int /*long*/ child, int /*long*/ sibling) { temp = OS.g_list_next (temp); } children = OS.g_list_remove_link (children, childLink); - if (siblingLink == 0 || OS.g_list_previous (siblingLink) == 0) { + if (siblingLink == 0 || OS.g_list_next (siblingLink) == 0) { OS.g_list_free_1 (childLink); - children = OS.g_list_prepend (children, childData); + children = OS.g_list_append (children, childData); } else { - temp = OS.g_list_previous (siblingLink); - OS.g_list_set_previous (childLink, temp); - OS.g_list_set_next (temp, childLink); - OS.g_list_set_next (childLink, siblingLink); - OS.g_list_set_previous (siblingLink, childLink); + temp = OS.g_list_next (siblingLink); + OS.g_list_set_next (childLink, temp); + OS.g_list_set_previous (temp, childLink); + OS.g_list_set_previous (childLink, siblingLink); + OS.g_list_set_next (siblingLink, childLink); } fixed.children = children; OS.memmove (parentHandle, fixed); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index 577d3d2314..3f620aea09 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -1347,6 +1347,26 @@ void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, De oldDecorations.fixDecorations (newDecorations, this, menus); } +int /*long*/ fixedMapProc (int /*long*/ widget) { + OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED); + int /*long*/ widgetList = OS.gtk_container_get_children (widget); + if (widgetList != 0) { + int /*long*/ widgets = widgetList; + while (widgets != 0) { + int /*long*/ child = OS.g_list_data (widgets); + if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !OS.GTK_WIDGET_MAPPED (child)) { + OS.gtk_widget_map (child); + } + widgets = OS.g_list_next (widgets); + } + OS.g_list_free (widgetList); + } + if ((OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0) { + OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget)); + } + return 0; +} + /** * Forces the receiver to have the <em>keyboard focus</em>, causing * all keyboard events to be delivered to it. @@ -1841,26 +1861,6 @@ int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) { return 0; } -int /*long*/ gtk_map (int /*long*/ widget) { - /* - * Feature in GTK. The gdk window is raised to the top of the stack - * when gdk_window_show() is called. The fix is restore the stacking - * order after the window is mapped. - */ - int index = 0; - Control [] children = parent._getChildren (); - while (index < children.length) { - if (children [index] == this) break; - index++; - } - if (index == 0) { - setZOrder (null, true); - } else { - setZOrder (children [index - 1], false); - } - return 0; -} - int /*long*/ gtk_mnemonic_activate (int /*long*/ widget, int /*long*/ arg1) { int result = 0; int /*long*/ eventPtr = OS.gtk_get_current_event (); @@ -2238,6 +2238,7 @@ void releaseWidget () { OS.gdk_window_destroy (enableWindow); enableWindow = 0; } + redrawWindow = 0; if (menu != null && !menu.isDisposed ()) { menu.dispose (); } @@ -2973,17 +2974,8 @@ void setZOrder (Control sibling, boolean above, boolean fixChildren) { parent.moveBelow (topHandle, siblingHandle); } } - /* - * Make sure that the parent handle is on the bottom of the stack - * when the parent children are siblings of the parent handle. - */ - if (!above && fixChildren && parent.parentingHandle () == parent.fixedHandle) { - int /*long*/ parentHandle = parent.handle; - if ((OS.GTK_WIDGET_FLAGS(parentHandle) & OS.GTK_NO_WINDOW) == 0) { - window = OS.GTK_WIDGET_WINDOW (parentHandle); - if (window != 0) OS.gdk_window_lower (window); - } - } + /* Make sure that the parent internal windows are on the bottom of the stack */ + if (!above && fixChildren) parent.fixZOrder (); } boolean showMenu (int x, int y) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java index 40104ed38e..8af58960ec 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java @@ -209,6 +209,12 @@ public class Display extends Device { Menu [] popups; int popupTime; + /* Fixed Subclass */ + static int /*long*/ fixed_type; + static int /*long*/ fixed_info_ptr; + static Callback fixedClassInitCallback, fixedMapCallback; + static int /*long*/ fixedClassInitProc, fixedMapProc; + /* Key Mappings */ static final int [] [] KeyTable = { @@ -708,8 +714,6 @@ synchronized void createDisplay (DeviceData data) { if (!OS.gtk_init_check (new int /*long*/ [] {0}, null)) { SWT.error (SWT.ERROR_NO_HANDLES); } - OS.gtk_widget_set_default_direction (OS.GTK_TEXT_DIR_LTR); - OS.gdk_rgb_init (); int /*long*/ ptr = OS.gtk_check_version (MAJOR, MINOR, MICRO); if (ptr != 0) { int length = OS.strlen (ptr); @@ -720,6 +724,24 @@ synchronized void createDisplay (DeviceData data) { int major = OS.gtk_major_version (), minor = OS.gtk_minor_version (), micro = OS.gtk_micro_version (); System.out.println ("***WARNING: Detected: " + major + "." + minor + "." + micro); } + if (fixed_type == 0) { + byte [] type_name = Converter.wcsToMbcs (null, "SwtFixed", true); + fixedClassInitCallback = new Callback (getClass (), "fixedClassInitProc", 2); + fixedClassInitProc = fixedClassInitCallback.getAddress (); + if (fixedClassInitProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + fixedMapCallback = new Callback (getClass (), "fixedMapProc", 1); + fixedMapProc = fixedMapCallback.getAddress (); + if (fixedMapProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); + GTypeInfo fixed_info = new GTypeInfo (); + fixed_info.class_size = (short) OS.GtkFixedClass_sizeof (); + fixed_info.class_init = fixedClassInitProc; + fixed_info.instance_size = (short) OS.GtkFixed_sizeof (); + fixed_info_ptr = OS.g_malloc (GTypeInfo.sizeof); + OS.memmove (fixed_info_ptr, fixed_info, GTypeInfo.sizeof); + fixed_type = OS.g_type_register_static (OS.GTK_TYPE_FIXED (), type_name, fixed_info_ptr, 0); + } + OS.gtk_widget_set_default_direction (OS.GTK_TEXT_DIR_LTR); + OS.gdk_rgb_init (); byte [] buffer = Converter.wcsToMbcs (null, APP_NAME, true); OS.gdk_set_program_class (buffer); byte [] flatStyle = Converter.wcsToMbcs (null, "style \"swt-flat\" { GtkToolbar::shadow-type = none } widget \"*swt-toolbar-flat*\" style : highest \"swt-flat\"", true); @@ -905,6 +927,21 @@ public Widget findWidget (int /*long*/ handle) { return getWidget (handle); } +static int /*long*/ fixedClassInitProc (int /*long*/ g_class, int /*long*/ class_data) { + GtkWidgetClass klass = new GtkWidgetClass (); + OS.memmove (klass, g_class); + klass.map = fixedMapProc; + OS.memmove (g_class, klass); + return 0; +} + +static int /*long*/ fixedMapProc (int /*long*/ handle) { + Display display = getCurrent (); + Widget widget = display.getWidget (handle); + if (widget != null) return widget.fixedMapProc (handle); + return 0; +} + void flushExposes (int /*long*/ window, boolean all) { OS.gdk_flush (); OS.gdk_flush (); @@ -1138,6 +1175,10 @@ public Point getDPI () { return new Point (dpi, dpi); } +int /*long*/ gtk_fixed_get_type () { + return fixed_type; +} + /** * Returns the default display. One is created (making the * thread that invokes this method its user-interface thread) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java index ef0e83d6d1..b2c357d1d5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java @@ -112,7 +112,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { void createHandle(int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_frame_new (null); @@ -121,7 +121,7 @@ void createHandle(int index) { if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (labelHandle); OS.gtk_object_sink (labelHandle); - clientHandle = OS.gtk_fixed_new(); + clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); OS.gtk_container_add (handle, clientHandle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java index 8ba6db6205..7478059d2e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java @@ -133,7 +133,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); if ((style & SWT.SEPARATOR) != 0) { @@ -142,6 +142,7 @@ void createHandle (int index) { } else { handle = OS.gtk_vseparator_new (); } + if (handle == 0) error (SWT.ERROR_NO_HANDLES); } else { handle = OS.gtk_hbox_new (false, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); @@ -152,7 +153,6 @@ void createHandle (int index) { OS.gtk_container_add (handle, labelHandle); OS.gtk_container_add (handle, imageHandle); } - if (handle == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.BORDER) != 0) { frameHandle = OS.gtk_frame_new (null); if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java index 6e76050e53..8cbcf89bfb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java @@ -184,7 +184,7 @@ static int checkStyle (int style) { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); scrolledHandle = OS.gtk_scrolled_window_new (0, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java index 644213d21a..f3fe2b605f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java @@ -76,8 +76,12 @@ static int checkStyle (int style) { void createHandle (int index) { state |= HANDLE; + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); + if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_progress_bar_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_container_add (fixedHandle, handle); int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_BOTTOM_TO_TOP : OS.GTK_PROGRESS_LEFT_TO_RIGHT; OS.gtk_progress_bar_set_orientation (handle, orientation); if ((style & SWT.INDETERMINATE) != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java index 971a2ef527..ca128629ae 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java @@ -129,8 +129,9 @@ public Point computeSize (int wHint, int hHint, boolean changed) { void createHandle (int index) { state |= HANDLE; - handle = OS.gtk_drawing_area_new (); + handle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_fixed_set_has_window (handle, true); OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); int type = (style & SWT.VERTICAL) != 0 ? OS.GDK_SB_H_DOUBLE_ARROW : OS.GDK_SB_V_DOUBLE_ARROW; defaultCursor = OS.gdk_cursor_new (type); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java index 8c3ecc8c38..adde9194b4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java @@ -115,7 +115,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); int /*long*/ hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index ad9b733678..5307ca2f39 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -781,11 +781,6 @@ int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) { return 0; } -int /*long*/ gtk_map (int /*long*/ widget) { - if (enableWindow != 0) OS.gdk_window_raise (enableWindow); - return 0; -} - int /*long*/ gtk_map_event (int /*long*/ widget, int /*long*/ event) { minimized = false; sendEvent (SWT.Deiconify); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java index 4abec07a6b..b7f0621b11 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java @@ -145,7 +145,7 @@ static int checkStyle (int style) { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); int /*long*/ hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 10); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java index 65ee0ebc94..694beb9405 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java @@ -181,7 +181,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_notebook_new (); @@ -220,7 +220,7 @@ void createItem (TabItem item, int index) { if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (boxHandle, imageHandle); OS.gtk_container_add (boxHandle, labelHandle); - int /*long*/ pageHandle = OS.gtk_fixed_new (); + int /*long*/ pageHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (pageHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, SWITCH_PAGE); OS.gtk_notebook_insert_page (handle, pageHandle, boxHandle, index); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index 410f001dff..4dc6956e5b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -381,7 +381,7 @@ public void clearAll () { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); scrolledHandle = OS.gtk_scrolled_window_new (0, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java index 770fa193f6..ac5992f21b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java @@ -111,9 +111,13 @@ static int checkStyle (int style) { void createHandle (int index) { state |= HANDLE | MENU; + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); + if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_fixed_set_has_window (fixedHandle, true); if ((style & SWT.SINGLE) != 0) { handle = OS.gtk_entry_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); + OS.gtk_container_add (fixedHandle, handle); OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0); OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); OS.gtk_entry_set_visibility (handle, (style & SWT.PASSWORD) == 0); @@ -124,9 +128,6 @@ void createHandle (int index) { OS.gtk_entry_set_alignment (handle, alignment); } } else { - fixedHandle = OS.gtk_fixed_new (); - if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); - OS.gtk_fixed_set_has_window (fixedHandle, true); scrolledHandle = OS.gtk_scrolled_window_new (0, 0); if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES); handle = OS.gtk_text_view_new (); @@ -148,20 +149,6 @@ void createHandle (int index) { if ((style & SWT.RIGHT) != 0) just = OS.GTK_JUSTIFY_RIGHT; OS.gtk_text_view_set_justification (handle, just); } - /* - * Bug in GTK. When the parent is realized before the GtkTextView - * widget is created, the GTK_TEXT_WINDOW_TEXT window does not have - * its event mask properly set to match gtk_widget_add_events(). - * The fix is to detect this and set the window event mask if - * necessary. - */ - if ((style & SWT.MULTI) != 0) { - int /*long*/ window = OS.gtk_text_view_get_window (handle, OS.GTK_TEXT_WINDOW_TEXT); - if (window != 0) { - int mask = OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK; - OS.gdk_window_set_events (window, OS.gdk_window_get_events (window) | mask); - } - } } void createWidget (int index) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index e2b3279bbf..5dfef89fe8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -133,7 +133,7 @@ static int checkStyle (int style) { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_toolbar_new (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java index fb0181d3b4..4671e7ff4a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java @@ -516,6 +516,11 @@ int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) { return 0; } +int /*long*/ gtk_map (int /*long*/ widget) { + parent.fixZOrder (); + return 0; +} + int /*long*/ gtk_mnemonic_activate (int /*long*/ widget, int /*long*/ arg1) { return parent.gtk_mnemonic_activate (widget, arg1); } @@ -554,6 +559,9 @@ void hookEvents () { OS.g_signal_connect (handle, OS.button_press_event, windowProc3, BUTTON_PRESS_EVENT); OS.g_signal_connect (handle, OS.button_release_event, windowProc3, BUTTON_RELEASE_EVENT); OS.g_signal_connect (handle, OS.event_after, windowProc3, EVENT_AFTER); + + int /*long*/ topHandle = topHandle (); + OS.g_signal_connect_after (topHandle, OS.map, windowProc2, MAP); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index c796883816..718ee00443 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -168,7 +168,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { void createHandle (int index) { state |= HANDLE; - fixedHandle = OS.gtk_fixed_new (); + fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_fixed_set_has_window (fixedHandle, true); scrolledHandle = OS.gtk_scrolled_window_new (0, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index 30ce4c0735..82f56530dd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -708,6 +708,10 @@ int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long* return 0; } +int /*long*/ fixedMapProc (int /*long*/ widget) { + return 0; +} + char [] fixMnemonic (String string) { int length = string.length (); char [] text = new char [length]; |