diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-08 09:42:17 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-08 09:42:17 -0400 |
commit | c3f6bd9fc193d59d79feb76f9007b7b06b2fcbb0 (patch) | |
tree | e229e0d689a731fb7a4e055fa832d319ad216d6f | |
parent | de6fbaaec46412d3fdef0c01810182c0b01cafbd (diff) | |
download | eclipse.platform.swt-gtk_widget_set_xy_.tar.gz eclipse.platform.swt-gtk_widget_set_xy_.tar.xz eclipse.platform.swt-gtk_widget_set_xy_.zip |
Omit use of GTK_WIDGET_SET_X and GTK_WIDGET_SET_Y in newer GTK+gtk_widget_set_xy_
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h | 8 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 20 |
2 files changed, 25 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index f21e8ca75a..1a5b65891a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -362,14 +362,22 @@ #define GTK_WIDGET_SET_WIDTH(arg0, arg1) (arg0)->allocation.width = arg1 #define GTK_WIDGET_WINDOW(arg0) (arg0)->window #define GTK_WIDGET_X(arg0) (arg0)->allocation.x +#if GTK_CHECK_VERSION(2,18,0) +#define GTK_WIDGET_SET_X(arg0, arg1) +#else #define GTK_WIDGET_SET_X(arg0, arg1) (arg0)->allocation.x = arg1 +#endif #define GTK_ENTRY_IM_CONTEXT(arg0) (arg0)->im_context #define GTK_TEXTVIEW_IM_CONTEXT(arg0) (arg0)->im_context #define GTK_TOOLTIPS_TIP_WINDOW(arg0) (arg0)->tip_window #define GTK_TOOLTIPS_SET_ACTIVE(arg0, arg1) (arg0)->active_tips_data = arg1 #define GTK_TOOLTIPS_GET_TIP_TEXT(arg0) (arg0)->tip_text #define GTK_WIDGET_Y(arg0) ((GtkWidget *)arg0)->allocation.y +#if GTK_CHECK_VERSION(2,18,0) +#define GTK_WIDGET_SET_Y(arg0, arg1) +#else #define GTK_WIDGET_SET_Y(arg0, arg1) (arg0)->allocation.y = arg1 +#endif #define GTK_WIDGET_REQUISITION_WIDTH(arg0) (arg0)->requisition.width #define GTK_WIDGET_REQUISITION_HEIGHT(arg0) (arg0)->requisition.height #define GDK_EVENT_TYPE(arg0) (arg0)->type 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 ed2c7673d2..06e09d73cc 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 @@ -4103,12 +4103,26 @@ void setInitialBounds () { * expected by SWT. */ int /*long*/ topHandle = topHandle (); + GtkAllocation allocation = new GtkAllocation(); if ((parent.style & SWT.MIRRORED) != 0) { - OS.GTK_WIDGET_SET_X (topHandle, parent.getClientWidth ()); + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + allocation.x = parent.getClientWidth (); + } else { + OS.GTK_WIDGET_SET_X (topHandle, parent.getClientWidth ()); + } + } else { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + allocation.x = 0; + } else { + OS.GTK_WIDGET_SET_X (topHandle, 0); + } + } + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + allocation.y = 0; + OS.gtk_widget_size_allocate (topHandle, allocation); } else { - OS.GTK_WIDGET_SET_X (topHandle, 0); + OS.GTK_WIDGET_SET_Y (topHandle, 0); } - OS.GTK_WIDGET_SET_Y (topHandle, 0); } else { resizeHandle (1, 1); forceResize (); |