aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-08-07 15:26:07 (EDT)
committerArun Thondapu2012-08-09 06:46:23 (EDT)
commit6207053cbabec2bceac5c0fcadb16091fc8a4c80 (patch)
tree0ba846507e3ec6af38f74e21130f1b9c770f3625
parent61f50052042e8e5211eed2203f3ae39ad0765025 (diff)
downloadeclipse.platform.swt-6207053cbabec2bceac5c0fcadb16091fc8a4c80.zip
eclipse.platform.swt-6207053cbabec2bceac5c0fcadb16091fc8a4c80.tar.gz
eclipse.platform.swt-6207053cbabec2bceac5c0fcadb16091fc8a4c80.tar.bz2
Bug 386778 Omit use of GTK_WIDGET_SET_X and GTK_WIDGET_SET_Y in newer GTK+
-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 e48a8f9..b71852b 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
@@ -16034,6 +16034,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 050eae6..2671afd 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
@@ -71,6 +71,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
@@ -437,7 +438,11 @@
#else
#define GTK_WIDGET_X(arg0) (arg0)->allocation.x
#endif
+#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
#if GTK_CHECK_VERSION(2,12,0)
@@ -454,7 +459,11 @@
#else
#define GTK_WIDGET_Y(arg0) ((GtkWidget *)arg0)->allocation.y
#endif
+#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 aa5d1ea..aeb340c 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 = 1336;
-int OS_nativeFunctionCallCount[1336];
+int OS_nativeFunctionCount = 1337;
+int OS_nativeFunctionCallCount[1337];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -1262,6 +1262,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_1can_1default",
"_1gtk_1widget_1set_1can_1focus",
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 34e4638..6b46369 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
@@ -1270,6 +1270,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_1can_1default_FUNC,
_1gtk_1widget_1set_1can_1focus_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 d79646c..d221129 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
@@ -12739,6 +12739,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 83d1920..209fada 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
@@ -4190,12 +4190,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 ();