diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-03 10:07:07 -0400 |
---|---|---|
committer | Arun Thondapu <arunkumar.thondapu@in.ibm.com> | 2012-08-06 17:49:12 +0530 |
commit | 31b7a613958123368d896ee9b0a636412f2a598b (patch) | |
tree | 8733974da7d036726370ceac33b28dad40240962 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt | |
parent | 2c810dc09ebe584d949d1446e7fe61dd64fa3e80 (diff) | |
download | eclipse.platform.swt-31b7a613958123368d896ee9b0a636412f2a598b.tar.gz eclipse.platform.swt-31b7a613958123368d896ee9b0a636412f2a598b.tar.xz eclipse.platform.swt-31b7a613958123368d896ee9b0a636412f2a598b.zip |
Bug 386145 Use gtk_widget_get_window() instead of GTK_WIDGET_WINDOW in newer GTK+
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt')
15 files changed, 72 insertions, 53 deletions
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 c8cf6b11d7..db7c8c5518 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 @@ -1441,7 +1441,7 @@ boolean isFocusHandle(int widget) { int /*long*/ paintWindow () { int /*long*/ childHandle = entryHandle != 0 ? entryHandle : handle; OS.gtk_widget_realize (childHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (childHandle); + int /*long*/ window = gtk_widget_get_window (childHandle); if ((style & SWT.READ_ONLY) != 0) return window; int /*long*/ children = OS.gdk_window_get_children (window); if (children != 0) window = OS.g_list_data (children); 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 2f3366309d..84c8a8e26e 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 @@ -504,7 +504,7 @@ void fixTabList (Control control) { void fixZOrder () { if ((state & CANVAS) != 0) return; int /*long*/ parentHandle = parentingHandle (); - int /*long*/ parentWindow = OS.GTK_WIDGET_WINDOW (parentHandle); + int /*long*/ parentWindow = gtk_widget_get_window (parentHandle); if (parentWindow == 0) return; int /*long*/ [] userData = new int /*long*/ [1]; int /*long*/ windowList = OS.gdk_window_get_children (parentWindow); @@ -797,7 +797,7 @@ int /*long*/ gtk_map (int /*long*/ widget) { int /*long*/ gtk_realize (int /*long*/ widget) { int /*long*/ result = super.gtk_realize (widget); if ((style & SWT.NO_BACKGROUND) != 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); if (window != 0) OS.gdk_window_set_back_pixmap (window, 0, false); } if (socketHandle != 0) { @@ -815,7 +815,7 @@ int /*long*/ gtk_scroll_child (int /*long*/ widget, int /*long*/ scrollType, int int /*long*/ gtk_style_set (int /*long*/ widget, int /*long*/ previousStyle) { int /*long*/ result = super.gtk_style_set (widget, previousStyle); if ((style & SWT.NO_BACKGROUND) != 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); if (window != 0) OS.gdk_window_set_back_pixmap (window, 0, false); } return result; 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 2fdee0e79a..27e8a5be3f 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 @@ -157,7 +157,7 @@ void drawBackground (Control control, int /*long*/ window, int /*long*/ region, boolean drawGripper (int x, int y, int width, int height, boolean vertical) { int /*long*/ paintHandle = paintHandle (); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle); + int /*long*/ window = gtk_widget_get_window (paintHandle); if (window == 0) return false; int orientation = vertical ? OS.GTK_ORIENTATION_HORIZONTAL : OS.GTK_ORIENTATION_VERTICAL; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x; @@ -180,7 +180,7 @@ int /*long*/ eventHandle () { int /*long*/ eventWindow () { int /*long*/ eventHandle = eventHandle (); OS.gtk_widget_realize (eventHandle); - return OS.GTK_WIDGET_WINDOW (eventHandle); + return gtk_widget_get_window (eventHandle); } void fixFocus (Control focusControl) { @@ -360,7 +360,7 @@ int /*long*/ paintHandle () { int /*long*/ paintWindow () { int /*long*/ paintHandle = paintHandle (); OS.gtk_widget_realize (paintHandle); - return OS.GTK_WIDGET_WINDOW (paintHandle); + return gtk_widget_get_window (paintHandle); } /** @@ -386,7 +386,7 @@ public boolean print (GC gc) { if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); int /*long*/ topHandle = topHandle (); OS.gtk_widget_realize (topHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); GCData data = gc.getGCData (); OS.gdk_window_process_updates (window, true); int /*long*/ drawable = data.drawable; @@ -399,7 +399,7 @@ void printWidget (GC gc, int /*long*/ drawable, int depth, int x, int y) { boolean obscured = (state & OBSCURED) != 0; state &= ~OBSCURED; int /*long*/ topHandle = topHandle (); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); printWindow (true, this, gc, drawable, depth, window, x, y); if (obscured) state |= OBSCURED; } @@ -825,7 +825,7 @@ void modifyStyle (int /*long*/ handle, int /*long*/ style) { * has had a region set on it, the region is lost. The * fix is to set the region again. */ - if (region != null) OS.gdk_window_shape_combine_region (OS.GTK_WIDGET_WINDOW (topHandle ()), region.handle, 0, 0); + if (region != null) OS.gdk_window_shape_combine_region (gtk_widget_get_window (topHandle ()), region.handle, 0, 0); } void moveHandle (int x, int y) { @@ -1144,7 +1144,7 @@ public void setSize (Point size) { public void setRegion (Region region) { checkWidget (); if (region != null && region.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle ()); + int /*long*/ window = gtk_widget_get_window (topHandle ()); int /*long*/ shape_region = (region == null) ? 0 : region.handle; OS.gdk_window_shape_combine_region (window, shape_region, 0, 0); this.region = region; @@ -2382,7 +2382,7 @@ int /*long*/ fixedMapProc (int /*long*/ widget) { OS.g_list_free (widgetList); } if (gtk_widget_get_has_window (widget)) { - OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget)); + OS.gdk_window_show_unraised (gtk_widget_get_window (widget)); } return 0; } @@ -3199,7 +3199,7 @@ int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) { int /*long*/ gtk_realize (int /*long*/ widget) { int /*long*/ imHandle = imHandle (); if (imHandle != 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); OS.gtk_im_context_set_client_window (imHandle, window); } if (backgroundImage != null) { @@ -3891,7 +3891,7 @@ public void setBackgroundImage (Image image) { } void setBackgroundPixmap (Image image) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); if (window != 0) { if (image.pixmap != 0) { OS.gdk_window_set_back_pixmap (window, image.pixmap, false); @@ -4068,7 +4068,7 @@ public void setEnabled (boolean enabled) { if (!OS.GDK_WINDOWING_X11 ()) { OS.gdk_window_raise (enableWindow); } else { - restackWindow (enableWindow, OS.GTK_WIDGET_WINDOW (topHandle), true); + restackWindow (enableWindow, gtk_widget_get_window (topHandle), true); } if (gtk_widget_get_visible (topHandle)) OS.gdk_window_show_unraised (enableWindow); } @@ -4615,7 +4615,7 @@ void setZOrder (Control sibling, boolean above, boolean fixRelations, boolean fi int /*long*/ topHandle = topHandle (); int /*long*/ siblingHandle = sibling != null ? sibling.topHandle () : 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); if (window != 0) { int /*long*/ siblingWindow = 0; if (sibling != null) { 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 4631d4d3b5..d478017676 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 @@ -1011,7 +1011,12 @@ void createDisplay (DeviceData data) { OS.gdk_window_add_filter (0, filterProc, 0); if (OS.GDK_WINDOWING_X11 ()) { - int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW (shellHandle)); + int /*long*/ xWindow; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + xWindow = OS.gdk_x11_drawable_get_xid (OS.gtk_widget_get_window (shellHandle)); + } else { + xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW (shellHandle)); + } byte[] atomName = Converter.wcsToMbcs (null, "SWT_Window_" + APP_NAME, true); //$NON-NLS-1$ int /*long*/ atom = OS.XInternAtom (xDisplay, atomName, false); OS.XSetSelectionOwner (xDisplay, atom, xWindow, OS.CurrentTime); @@ -4220,7 +4225,12 @@ int /*long*/ signalProc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ u byte[] name = Converter.wcsToMbcs (null, "org.eclipse.swt.filePath.message", true); //$NON-NLS-1$ int /*long*/ atom = OS.gdk_x11_atom_to_xatom (OS.gdk_atom_intern (name, true)); if (atom == OS.gdk_x11_atom_to_xatom (gdkEvent.atom)) { - int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW( shellHandle)); + int /*long*/ xWindow; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + xWindow = OS.gdk_x11_drawable_get_xid (OS.gtk_widget_get_window( shellHandle)); + } else { + xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW( shellHandle)); + } int /*long*/ [] type = new int /*long*/ [1]; int [] format = new int [1]; int [] nitems = new int [1]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java index 519cd150b2..65c035644f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java @@ -375,7 +375,7 @@ void fixMenus (Decorations newParent) { if (!gtk_widget_get_mapped (handle)) { return new Rectangle (0, 0, 0, 0); } - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); int [] origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); int x = 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 0094b87af4..036c84cb51 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 @@ -145,7 +145,7 @@ void createHandle (int index) { void drawBand (int x, int y, int width, int height) { if ((style & SWT.SMOOTH) != 0) return; //TODO: Use Cairo - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); + int /*long*/ window = gtk_widget_get_window (parent.paintHandle()); if (window == 0) return; byte [] bits = {-86, 85, -86, 85, -86, 85, -86, 85}; int /*long*/ stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8); @@ -172,7 +172,7 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ eventPtr) if (button != 1) return 0; if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) return 0; if (gdkEvent.type == OS.GDK_3BUTTON_PRESS) return 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (widget); + int /*long*/ window = gtk_widget_get_window (widget); int [] origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); startX = (int) (gdkEvent.x_root - origin_x [0]); @@ -329,7 +329,7 @@ int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ eventPtr) { if (newX == lastX && newY == lastY) return result; /* Ensure that the pointer image does not change */ - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); int grabMask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK; int /*long*/ gdkCursor = cursor != null ? cursor.handle : defaultCursor; int ptrGrabResult = OS.gdk_pointer_grab (window, false, grabMask, window, gdkCursor, OS.GDK_CURRENT_TIME); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java index 8172a57080..3bcf23ded3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java @@ -368,11 +368,11 @@ public Rectangle getThumbBounds () { } Rectangle rect = new Rectangle(x, y, width, height); int [] origin_x = new int [1], origin_y = new int [1]; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parent.scrolledHandle); + int /*long*/ window = gtk_widget_get_window (parent.scrolledHandle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x += origin_x [0]; rect.y += origin_y [0]; - window = OS.GTK_WIDGET_WINDOW (parent.handle); + window = gtk_widget_get_window (parent.handle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x -= origin_x [0]; rect.y -= origin_y [0]; @@ -456,11 +456,11 @@ public Rectangle getThumbTrackBounds () { } Rectangle rect = new Rectangle(x, y, width, height); int [] origin_x = new int [1], origin_y = new int [1]; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parent.scrolledHandle); + int /*long*/ window = gtk_widget_get_window (parent.scrolledHandle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x += origin_x [0]; rect.y += origin_y [0]; - window = OS.GTK_WIDGET_WINDOW (parent.handle); + window = gtk_widget_get_window (parent.handle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x -= origin_x [0]; rect.y -= origin_y [0]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java index a2e8c07f8a..697d33939f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java @@ -374,7 +374,7 @@ void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boole if (!trim) return; int /*long*/ topHandle = topHandle (), paintHandle = paintHandle (); if (topHandle == paintHandle) return; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); GdkRectangle rect = new GdkRectangle (); if (redrawAll) { GtkAllocation allocation = new GtkAllocation (); 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 8b376ae180..b173703434 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 @@ -462,7 +462,7 @@ void adjustTrim () { width = OS.GTK_WIDGET_WIDTH (shellHandle); height = OS.GTK_WIDGET_HEIGHT (shellHandle); } - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); GdkRectangle rect = new GdkRectangle (); OS.gdk_window_get_frame_extents (window, rect); int trimWidth = Math.max (0, rect.width - width); @@ -545,7 +545,7 @@ void bringToTop (boolean force) { * window. The fix is to use XSetInputFocus() to force * the focus. */ - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); if ((xFocus || (style & SWT.ON_TOP) != 0) && OS.GDK_WINDOWING_X11 ()) { int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (window); @@ -747,7 +747,7 @@ int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long* sendEvent (SWT.Activate); if (isDisposed ()) return 0; if (isCustomResize ()) { - OS.gdk_window_invalidate_rect (OS.GTK_WIDGET_WINDOW (shellHandle), null, false); + OS.gdk_window_invalidate_rect (gtk_widget_get_window (shellHandle), null, false); } break; } @@ -770,8 +770,9 @@ int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long* display.activePending = false; } if (isDisposed ()) return 0; - if (isCustomResize ()) { - OS.gdk_window_invalidate_rect (OS.GTK_WIDGET_WINDOW (shellHandle), null, false); + if (isCustomResize ()) { + OS.gdk_window_invalidate_rect (gtk_widget_get_window (shellHandle), null, false); + } break; } @@ -824,7 +825,7 @@ void hookEvents () { OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MAP_EVENT], 0, display.shellMapProcClosure, false); OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false); OS.g_signal_connect_closure (shellHandle, OS.move_focus, display.closures [MOVE_FOCUS], false); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); OS.gdk_window_add_filter (window, display.filterProc, shellHandle); if (isCustomResize ()) { int mask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK | OS.GDK_BUTTON_PRESS_MASK | OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK; @@ -1252,7 +1253,7 @@ int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ event) { GdkEventExpose gdkEventExpose = new GdkEventExpose (); OS.memmove (gdkEventExpose, event, GdkEventExpose.sizeof); int /*long*/ style = OS.gtk_widget_get_style (widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (widget); + int /*long*/ window = gtk_widget_get_window (widget); int [] width = new int [1]; int [] height = new int [1]; OS.gdk_drawable_get_size (window, width, height); @@ -1299,7 +1300,7 @@ int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) { GdkEventCrossing gdkEvent = new GdkEventCrossing (); OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof); if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) == 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); OS.gdk_window_set_cursor (window, 0); display.resizeMode = 0; } @@ -1371,14 +1372,14 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) { break; } if (x != display.resizeBoundsX || y != display.resizeBoundsY) { - OS.gdk_window_move_resize (OS.GTK_WIDGET_WINDOW (shellHandle), x, y, width, height); + OS.gdk_window_move_resize (gtk_widget_get_window (shellHandle), x, y, width, height); } else { OS.gtk_window_resize (shellHandle, width, height); } } else { int mode = getResizeMode (gdkEvent.x, gdkEvent.y); if (mode != display.resizeMode) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); int /*long*/ cursor = OS.gdk_cursor_new (mode); OS.gdk_window_set_cursor (window, cursor); OS.gdk_cursor_unref (cursor); @@ -1445,7 +1446,7 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) { int /*long*/ gtk_realize (int /*long*/ widget) { int /*long*/ result = super.gtk_realize (widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); if ((style & SWT.SHELL_TRIM) != SWT.SHELL_TRIM) { int decorations = 0; if ((style & SWT.NO_TRIM) == 0) { @@ -1780,7 +1781,7 @@ public void setEnabled (boolean enabled) { } else { int /*long*/ parentHandle = shellHandle; OS.gtk_widget_realize (parentHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle); + int /*long*/ window = gtk_widget_get_window (parentHandle); Rectangle rect = getBounds (); GdkWindowAttr attributes = new GdkWindowAttr (); attributes.width = rect.width; @@ -2463,7 +2464,7 @@ void releaseWidget () { tooltipsHandle = 0; if (group != 0) OS.g_object_unref (group); group = modalGroup = 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); OS.gdk_window_remove_filter(window, display.filterProc, shellHandle); lastActive = null; } @@ -2498,7 +2499,7 @@ void setToolTipText (int /*long*/ rootWidget, int /*long*/ tipWidget, String str * contain the proper x and y coordinates. */ int /*long*/ eventPtr = 0; - int /*long*/ tipWindow = OS.GTK_WIDGET_WINDOW (rootWidget); + int /*long*/ tipWindow = gtk_widget_get_window (rootWidget); if (tipWindow != 0) { int [] x = new int [1], y = new int [1]; int /*long*/ window = OS.gdk_window_at_pointer (x, y); 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 5b27e9ad3b..240749f2ea 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 @@ -1119,7 +1119,7 @@ public Rectangle getClientArea () { checkWidget (); forceResize (); OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binX = new int [1], binY = new int [1]; OS.gdk_window_get_origin (binWindow, binX, binY); @@ -1366,7 +1366,7 @@ public int getHeaderHeight () { return height; } OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binY = new int [1]; OS.gdk_window_get_origin (binWindow, null, binY); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java index 53ef0845bc..13425ad071 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java @@ -137,7 +137,7 @@ public void addSelectionListener (SelectionListener listener) { void configure () { int /*long*/ screen = OS.gdk_screen_get_default (); OS.gtk_widget_realize (handle); - int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, OS.GTK_WIDGET_WINDOW (handle)); + int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (handle)); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); Point point = getSize (dest.width / 4); @@ -251,7 +251,7 @@ void configure () { } int /*long*/ rgn = OS.gdk_region_polygon (polyline, polyline.length / 2, OS.GDK_EVEN_ODD_RULE); OS.gtk_widget_realize (handle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); OS.gdk_window_shape_combine_region (window, rgn, 0, 0); OS.gdk_region_destroy (rgn); } @@ -345,7 +345,7 @@ Point getLocation () { y = area.y + area.height / 2; } else { OS.gtk_widget_realize (itemHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (itemHandle); + int /*long*/ window = gtk_widget_get_window (itemHandle); int [] px = new int [1], py = new int [1]; OS.gdk_window_get_origin (window, px, py); x = px [0] + OS.GTK_WIDGET_WIDTH (itemHandle) / 2; @@ -480,7 +480,7 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) { if ((state & OBSCURED) != 0) return 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); int x = BORDER + PADDING; int y = BORDER + PADDING; if (OS.USE_CAIRO) { @@ -587,7 +587,7 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) { int y = point.y; int /*long*/ screen = OS.gdk_screen_get_default (); OS.gtk_widget_realize (widget); - int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, OS.GTK_WIDGET_WINDOW (widget)); + int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget)); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); int w = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java index 812ce787bc..af86c4f365 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java @@ -308,7 +308,7 @@ Rectangle [] computeProportions (Rectangle [] rects) { void drawRectangles (Rectangle [] rects) { int /*long*/ window = OS.gdk_get_default_root_window(); if (parent != null) { - window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); + window = gtk_widget_get_window (parent.paintHandle()); } if (window == 0) return; //TODO: Use Cairo @@ -664,7 +664,7 @@ public boolean open () { checkWidget(); window = OS.gdk_get_default_root_window(); if (parent != null) { - window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); + window = gtk_widget_get_window (parent.paintHandle()); } if (window == 0) return false; cancelled = false; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java index ac59b4c9c0..108a0830a0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java @@ -348,7 +348,7 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) { } } OS.gtk_widget_realize (handle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); OS.gdk_window_shape_combine_region (window, region.handle, 0, 0); region.dispose (); } 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 58842aaf64..94065d380d 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 @@ -1120,7 +1120,7 @@ public Rectangle getClientArea () { checkWidget (); forceResize (); OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binX = new int [1], binY = new int [1]; OS.gdk_window_get_origin (binWindow, binX, binY); @@ -1377,7 +1377,7 @@ public int getHeaderHeight () { return height; } OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binY = new int [1]; OS.gdk_window_get_origin (binWindow, null, binY); 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 3f019dec9f..0c8ec24ccd 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 @@ -1738,6 +1738,14 @@ boolean gtk_widget_get_has_window (int /*long*/ widget) { } } +int /*long*/ gtk_widget_get_window (int /*long*/ widget){ + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + return OS.gtk_widget_get_window (widget); + } else { + return OS.GTK_WIDGET_WINDOW (widget); + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. |