summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-08-07 15:26:07 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-08-07 15:26:07 -0400
commit022b10ef2fee860fdb5cd9c55735cb0af24ca733 (patch)
treef36d4da78b56830ee3d5abdc912ebdc511ca9045
parentde6fbaaec46412d3fdef0c01810182c0b01cafbd (diff)
downloadeclipse.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.c21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java20
6 files changed, 64 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 155872e3dd..a12b224f9f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -15678,6 +15678,27 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1widget_1send_1expose)
}
#endif
+#ifndef NO__1gtk_1widget_1set_1allocation
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1allocation)
+ (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+{
+ GtkAllocation _arg1, *lparg1=NULL;
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1allocation_FUNC);
+ if (arg1) if ((lparg1 = getGtkAllocationFields(env, arg1, &_arg1)) == NULL) goto fail;
+/*
+ gtk_widget_set_allocation(arg0, (GtkAllocation *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_set_allocation)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GtkAllocation *))fp)(arg0, (GtkAllocation *)lparg1);
+ }
+ }
+fail:
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1allocation_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1widget_1set_1app_1paintable
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1app_1paintable)
(JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
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..3f512f52b1 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
@@ -68,6 +68,7 @@
#define XRenderSetPictureClipRectangles_LIB LIB_XRENDER
#define XRenderSetPictureTransform_LIB LIB_XRENDER
#define g_filename_display_name_LIB LIB_GLIB
+#define gtk_widget_set_allocation_LIB LIB_GTK
#define gtk_calendar_display_options_LIB LIB_GTK
#define gtk_calendar_get_date_LIB LIB_GTK
#define gtk_calendar_new_LIB LIB_GTK
@@ -362,14 +363,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 PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index b8074eb1de..9a78cf9d49 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1315;
-int OS_nativeFunctionCallCount[1315];
+int OS_nativeFunctionCount = 1316;
+int OS_nativeFunctionCallCount[1316];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -1247,6 +1247,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1remove_1accelerator",
"_1gtk_1widget_1reparent",
"_1gtk_1widget_1send_1expose",
+ "_1gtk_1widget_1set_1allocation",
"_1gtk_1widget_1set_1app_1paintable",
"_1gtk_1widget_1set_1default_1direction",
"_1gtk_1widget_1set_1direction",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 75194be58b..9d9480ba0d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -1255,6 +1255,7 @@ typedef enum {
_1gtk_1widget_1remove_1accelerator_FUNC,
_1gtk_1widget_1reparent_FUNC,
_1gtk_1widget_1send_1expose_FUNC,
+ _1gtk_1widget_1set_1allocation_FUNC,
_1gtk_1widget_1set_1app_1paintable_FUNC,
_1gtk_1widget_1set_1default_1direction_FUNC,
_1gtk_1widget_1set_1direction_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 0a5969cade..83b5df2fb2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -12490,6 +12490,19 @@ public static final void gtk_widget_size_request(int /*long*/ widget, GtkRequisi
}
}
/**
+ * @method flags=dynamic
+ * @param allocation cast=(GtkAllocation *),flags=no_out
+ */
+public static final native void _gtk_widget_set_allocation(int /*long*/ widget, GtkAllocation allocation);
+public static final void gtk_widget_set_allocation(int /*long*/ widget, GtkAllocation allocation) {
+ lock.lock();
+ try {
+ _gtk_widget_set_allocation(widget, allocation);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
* @param widget cast=(GtkWidget *)
* @param property_name cast=(const gchar *)
* @param terminator cast=(const gchar *),flags=sentinel
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..c5a54e49e2 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_set_allocation(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 ();