From 21331182885d36e87fd7aa26872a15a6f6734271 Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Wed, 29 Aug 2012 13:42:21 -0400 Subject: Bug 388369 Use gtk_separator_new () in GTK+3 This patch replaces old GTK2 API methods gtk_vseparator_new () and gtk_hseparator_new () with GTK+ 3 API method gtk_separator_new() and makes old 2 methods dynamic --- .../Eclipse SWT PI/gtk/library/os.c | 36 ++++++++++++++++++++++ .../Eclipse SWT PI/gtk/library/os_custom.h | 3 ++ .../Eclipse SWT PI/gtk/library/os_stats.c | 5 +-- .../Eclipse SWT PI/gtk/library/os_stats.h | 1 + .../gtk/org/eclipse/swt/internal/gtk/OS.java | 15 +++++++++ .../gtk/org/eclipse/swt/internal/theme/Theme.java | 16 +++++++++- .../gtk/org/eclipse/swt/widgets/Label.java | 18 +++++++++-- 7 files changed, 89 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 e2b6d7546d..e5d7b05768 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 @@ -9555,7 +9555,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1hseparator_1new) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1hseparator_1new_FUNC); +/* rc = (jintLong)gtk_hseparator_new(); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_hseparator_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1hseparator_1new_FUNC); return rc; } @@ -12606,6 +12614,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1separator_1menu_1item_1new) } #endif +#ifndef NO__1gtk_1separator_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1separator_1new) + (JNIEnv *env, jclass that, jint arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1separator_1new_FUNC); +/* + rc = (jintLong)gtk_separator_new((GtkOrientation)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_separator_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkOrientation))fp)((GtkOrientation)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1separator_1new_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1separator_1tool_1item_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1separator_1tool_1item_1new) (JNIEnv *env, jclass that) @@ -15545,7 +15573,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1vseparator_1new) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1vseparator_1new_FUNC); +/* rc = (jintLong)gtk_vseparator_new(); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_vseparator_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1vseparator_1new_FUNC); return rc; } 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 288a48cf4f..741eeb657c 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 @@ -143,6 +143,9 @@ #define gtk_scrollbar_new_LIB LIB_GTK #define gtk_hscrollbar_new_LIB LIB_GTK #define gtk_vscrollbar_new_LIB LIB_GTK +#define gtk_separator_new_LIB LIB_GTK +#define gtk_hseparator_new_LIB LIB_GTK +#define gtk_vseparator_new_LIB LIB_GTK #define gtk_toolbar_set_orientation_LIB LIB_GTK #define gtk_tooltip_trigger_tooltip_query_LIB LIB_GTK #define gtk_tooltips_set_tip_LIB LIB_GTK 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 0ca15f077d..fe80e26f18 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 = 1339; -int OS_nativeFunctionCallCount[1339]; +int OS_nativeFunctionCount = 1340; +int OS_nativeFunctionCallCount[1340]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -957,6 +957,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1selection_1data_1free", "_1gtk_1selection_1data_1set", "_1gtk_1separator_1menu_1item_1new", + "_1gtk_1separator_1new", "_1gtk_1separator_1tool_1item_1new", "_1gtk_1separator_1tool_1item_1set_1draw", "_1gtk_1set_1locale", 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 03201ea558..f336786e61 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 @@ -965,6 +965,7 @@ typedef enum { _1gtk_1selection_1data_1free_FUNC, _1gtk_1selection_1data_1set_FUNC, _1gtk_1separator_1menu_1item_1new_FUNC, + _1gtk_1separator_1new_FUNC, _1gtk_1separator_1tool_1item_1new_FUNC, _1gtk_1separator_1tool_1item_1set_1draw_FUNC, _1gtk_1set_1locale_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 4630423a17..2bdb8c00d2 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 @@ -7210,6 +7210,7 @@ public static final int /*long*/ gtk_scrollbar_new(int orientation, int /*long*/ lock.unlock(); } } +/** @method flags=dynamic */ public static final native int /*long*/ _gtk_hseparator_new(); public static final int /*long*/ gtk_hseparator_new() { lock.lock(); @@ -7219,6 +7220,19 @@ public static final int /*long*/ gtk_hseparator_new() { lock.unlock(); } } +/** + * @method flags=dynamic + * @param orientation cast=(GtkOrientation) + */ +public static final native int /*long*/ _gtk_separator_new(int orientation); +public static final int /*long*/ gtk_separator_new(int orientation) { + lock.lock(); + try { + return _gtk_separator_new(orientation); + } finally { + lock.unlock(); + } +} public static final native int /*long*/ _gtk_status_icon_position_menu_func(); public static final int /*long*/ gtk_status_icon_position_menu_func() { lock.lock(); @@ -12134,6 +12148,7 @@ public static final int /*long*/ gtk_vscrollbar_new(int /*long*/ adjustment) { lock.unlock(); } } +/** @method flags=dynamic */ public static final native int /*long*/ _gtk_vseparator_new(); public static final int /*long*/ gtk_vseparator_new() { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java index 1357fb9c9e..569bd5b822 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java @@ -37,7 +37,7 @@ public Theme(Device device) { progressHandle = OS.gtk_progress_bar_new(); toolbarHandle = OS.gtk_toolbar_new(); treeHandle = OS.gtk_tree_view_new_with_model(0); - separatorHandle = OS.gtk_vseparator_new(); + separatorHandle = gtk_separator_new (OS.GTK_ORIENTATION_VERTICAL); labelHandle = OS.gtk_label_new(null); OS.gtk_container_add (fixedHandle, labelHandle); OS.gtk_container_add (fixedHandle, frameHandle); @@ -215,4 +215,18 @@ void transferClipping(GC gc, int /*long*/ style) { OS.gdk_region_destroy(clipping); } } + +int /*long*/ gtk_separator_new (int orientation) { + int /*long*/ separator = 0; + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + separator = OS.gtk_separator_new (orientation); + } else { + if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) { + separator = OS.gtk_hseparator_new (); + } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) { + separator = OS.gtk_vseparator_new (); + } + } + return separator; +} } 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 d4326cdebb..345295fae7 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 @@ -205,9 +205,9 @@ void createHandle (int index) { gtk_widget_set_has_window (fixedHandle, true); if ((style & SWT.SEPARATOR) != 0) { if ((style & SWT.HORIZONTAL)!= 0) { - handle = OS.gtk_hseparator_new (); + handle = gtk_separator_new (OS.GTK_ORIENTATION_HORIZONTAL); } else { - handle = OS.gtk_vseparator_new (); + handle = gtk_separator_new (OS.GTK_ORIENTATION_VERTICAL); } if (handle == 0) error (SWT.ERROR_NO_HANDLES); } else { @@ -584,4 +584,18 @@ void showWidget () { if (frameHandle != 0) OS.gtk_widget_show (frameHandle); if (labelHandle != 0) OS.gtk_widget_show (labelHandle); } + +int /*long*/ gtk_separator_new (int orientation) { + int /*long*/ separator = 0; + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + separator = OS.gtk_separator_new (orientation); + } else { + if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) { + separator = OS.gtk_hseparator_new (); + } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) { + separator = OS.gtk_vseparator_new (); + } + } + return separator; +} } -- cgit From fcedd75ab00195e6ab4eff556609d14004db3d8c Mon Sep 17 00:00:00 2001 From: Arun Thondapu Date: Wed, 12 Sep 2012 23:51:00 +0530 Subject: Bug 388369 Remove redundant else check in Label and helper function in Theme --- .../gtk/org/eclipse/swt/internal/theme/Theme.java | 20 +++++--------------- .../gtk/org/eclipse/swt/widgets/Label.java | 4 ++-- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java index 569bd5b822..dddb83a991 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/Theme.java @@ -37,7 +37,11 @@ public Theme(Device device) { progressHandle = OS.gtk_progress_bar_new(); toolbarHandle = OS.gtk_toolbar_new(); treeHandle = OS.gtk_tree_view_new_with_model(0); - separatorHandle = gtk_separator_new (OS.GTK_ORIENTATION_VERTICAL); + if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) { + separatorHandle = OS.gtk_separator_new (OS.GTK_ORIENTATION_VERTICAL); + } else { + separatorHandle = OS.gtk_vseparator_new(); + } labelHandle = OS.gtk_label_new(null); OS.gtk_container_add (fixedHandle, labelHandle); OS.gtk_container_add (fixedHandle, frameHandle); @@ -215,18 +219,4 @@ void transferClipping(GC gc, int /*long*/ style) { OS.gdk_region_destroy(clipping); } } - -int /*long*/ gtk_separator_new (int orientation) { - int /*long*/ separator = 0; - if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { - separator = OS.gtk_separator_new (orientation); - } else { - if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) { - separator = OS.gtk_hseparator_new (); - } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) { - separator = OS.gtk_vseparator_new (); - } - } - return separator; -} } 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 345295fae7..d7f8ab56ee 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 @@ -587,12 +587,12 @@ void showWidget () { int /*long*/ gtk_separator_new (int orientation) { int /*long*/ separator = 0; - if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) { separator = OS.gtk_separator_new (orientation); } else { if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) { separator = OS.gtk_hseparator_new (); - } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) { + } else { separator = OS.gtk_vseparator_new (); } } -- cgit From 0d5ff2d1bd886c3158c6b1ddc492d0be811c0650 Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Fri, 31 Aug 2012 09:24:37 -0400 Subject: Bug 388461 Use gdk_device_grab() instead of gdk_pointer_grab() in GTK+3 and higher --- .../Eclipse SWT PI/gtk/library/os.c | 88 ++++++++++++++++++++++ .../Eclipse SWT PI/gtk/library/os_custom.h | 5 ++ .../Eclipse SWT PI/gtk/library/os_stats.c | 8 +- .../Eclipse SWT PI/gtk/library/os_stats.h | 4 + .../gtk/org/eclipse/swt/internal/gtk/OS.java | 56 ++++++++++++++ .../gtk/org/eclipse/swt/widgets/Sash.java | 2 +- .../gtk/org/eclipse/swt/widgets/Tracker.java | 2 +- .../gtk/org/eclipse/swt/widgets/Widget.java | 17 +++++ 8 files changed, 178 insertions(+), 4 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 e5d7b05768..4e3b0f2d57 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 @@ -4876,6 +4876,46 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1cursor_1unref) } #endif +#ifndef NO__1gdk_1device_1grab +JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1device_1grab) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jboolean arg3, jint arg4, jintLong arg5, jint arg6) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1device_1grab_FUNC); +/* + rc = (jint)gdk_device_grab((GdkDevice *)arg0, (GdkWindow *)arg1, arg2, (gboolean)arg3, (GdkEventMask)arg4, (GdkCursor *)arg5, (guint32)arg6); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_device_grab) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(GdkDevice *, GdkWindow *, jint, gboolean, GdkEventMask, GdkCursor *, guint32))fp)((GdkDevice *)arg0, (GdkWindow *)arg1, arg2, (gboolean)arg3, (GdkEventMask)arg4, (GdkCursor *)arg5, (guint32)arg6); + } + } + OS_NATIVE_EXIT(env, that, _1gdk_1device_1grab_FUNC); + return rc; +} +#endif + +#ifndef NO__1gdk_1device_1manager_1get_1client_1pointer +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1device_1manager_1get_1client_1pointer) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1device_1manager_1get_1client_1pointer_FUNC); +/* + rc = (jintLong)gdk_device_manager_get_client_pointer(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_device_manager_get_client_pointer) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gdk_1device_1manager_1get_1client_1pointer_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1display_1get_1default JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1display_1get_1default) (JNIEnv *env, jclass that) @@ -4896,6 +4936,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1display_1get_1default) } #endif +#ifndef NO__1gdk_1display_1get_1device_1manager +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1display_1get_1device_1manager) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1display_1get_1device_1manager_FUNC); +/* + rc = (jintLong)gdk_display_get_device_manager((GdkDisplay *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_display_get_device_manager) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkDisplay *))fp)((GdkDisplay *)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gdk_1display_1get_1device_1manager_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1display_1supports_1cursor_1color JNIEXPORT jboolean JNICALL OS_NATIVE(_1gdk_1display_1supports_1cursor_1color) (JNIEnv *env, jclass that, jintLong arg0) @@ -6109,7 +6169,15 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1pointer_1grab) { jint rc = 0; OS_NATIVE_ENTER(env, that, _1gdk_1pointer_1grab_FUNC); +/* rc = (jint)gdk_pointer_grab((GdkWindow *)arg0, (gboolean)arg1, (GdkEventMask)arg2, (GdkWindow *)arg3, (GdkCursor *)arg4, (guint32)arg5); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_pointer_grab) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(GdkWindow *, gboolean, GdkEventMask, GdkWindow *, GdkCursor *, guint32))fp)((GdkWindow *)arg0, (gboolean)arg1, (GdkEventMask)arg2, (GdkWindow *)arg3, (GdkCursor *)arg4, (guint32)arg5); + } + } OS_NATIVE_EXIT(env, that, _1gdk_1pointer_1grab_FUNC); return rc; } @@ -6694,6 +6762,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1children) } #endif +#ifndef NO__1gdk_1window_1get_1display +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1display) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1window_1get_1display_FUNC); +/* + rc = (jintLong)gdk_window_get_display((GdkWindow *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_window_get_display) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkWindow *))fp)((GdkWindow *)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gdk_1window_1get_1display_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1window_1get_1events JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1window_1get_1events) (JNIEnv *env, jclass that, jintLong arg0) 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 741eeb657c..08633b994f 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 @@ -165,6 +165,9 @@ #define gtk_entry_set_icon_sensitive_LIB LIB_GTK #define gtk_tooltips_new_LIB LIB_GTK #define gdk_cursor_new_from_pixbuf_LIB LIB_GDK +#define gdk_device_manager_get_client_pointer_LIB LIB_GDK +#define gdk_device_grab_LIB LIB_GDK +#define gdk_display_get_device_manager_LIB LIB_GDK #define gdk_display_get_default_LIB LIB_GDK #define gdk_display_supports_cursor_color_LIB LIB_GDK #define gdk_draw_arc_LIB LIB_GDK @@ -188,6 +191,7 @@ #define gdk_gc_set_values_LIB LIB_GDK #define gdk_gc_get_values_LIB LIB_GDK #define gdk_pixbuf_save_to_bufferv_LIB LIB_GDK +#define gdk_pointer_grab_LIB LIB_GDK #define gdk_screen_get_default_LIB LIB_GDK #define gdk_screen_get_monitor_at_point_LIB LIB_GDK #define gdk_screen_get_monitor_at_window_LIB LIB_GDK @@ -215,6 +219,7 @@ #define gdk_window_get_height_LIB LIB_GDK #define gdk_window_get_width_LIB LIB_GDK #define gdk_pixmap_get_size_LIB LIB_GDK +#define gdk_window_get_display_LIB LIB_GDK #define gdk_window_set_keep_above_LIB LIB_GDK #define gdk_window_set_accept_focus_LIB LIB_GDK #define gtk_window_set_opacity_LIB LIB_GTK 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 fe80e26f18..c664affb05 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 = 1340; -int OS_nativeFunctionCallCount[1340]; +int OS_nativeFunctionCount = 1344; +int OS_nativeFunctionCallCount[1344]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -420,7 +420,10 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1cursor_1new_1from_1pixbuf", "_1gdk_1cursor_1new_1from_1pixmap", "_1gdk_1cursor_1unref", + "_1gdk_1device_1grab", + "_1gdk_1device_1manager_1get_1client_1pointer", "_1gdk_1display_1get_1default", + "_1gdk_1display_1get_1device_1manager", "_1gdk_1display_1supports_1cursor_1color", "_1gdk_1drag_1status", "_1gdk_1draw_1arc", @@ -536,6 +539,7 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1window_1end_1paint", "_1gdk_1window_1focus", "_1gdk_1window_1get_1children", + "_1gdk_1window_1get_1display", "_1gdk_1window_1get_1events", "_1gdk_1window_1get_1frame_1extents", "_1gdk_1window_1get_1height", 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 f336786e61..9276e7f987 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 @@ -428,7 +428,10 @@ typedef enum { _1gdk_1cursor_1new_1from_1pixbuf_FUNC, _1gdk_1cursor_1new_1from_1pixmap_FUNC, _1gdk_1cursor_1unref_FUNC, + _1gdk_1device_1grab_FUNC, + _1gdk_1device_1manager_1get_1client_1pointer_FUNC, _1gdk_1display_1get_1default_FUNC, + _1gdk_1display_1get_1device_1manager_FUNC, _1gdk_1display_1supports_1cursor_1color_FUNC, _1gdk_1drag_1status_FUNC, _1gdk_1draw_1arc_FUNC, @@ -544,6 +547,7 @@ typedef enum { _1gdk_1window_1end_1paint_FUNC, _1gdk_1window_1focus_FUNC, _1gdk_1window_1get_1children_FUNC, + _1gdk_1window_1get_1display_FUNC, _1gdk_1window_1get_1events_FUNC, _1gdk_1window_1get_1frame_1extents_FUNC, _1gdk_1window_1get_1height_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 2bdb8c00d2..457369a96d 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 @@ -207,6 +207,7 @@ public class OS extends C { public static final int GDK_NOTIFY_INFERIOR = 2; public static final int GDK_Num_Lock = 0xFF7F; public static final int GDK_OVERLAP_RECTANGLE_OUT = 0x1; + public static final int GDK_OWNERSHIP_NONE = 0; public static final int GDK_PIXBUF_ALPHA_BILEVEL = 0x0; public static final int GDK_POINTER_MOTION_HINT_MASK = 0x8; public static final int GDK_POINTER_MOTION_MASK = 0x4; @@ -3658,6 +3659,42 @@ public static final int /*long*/ gdk_display_get_default() { lock.unlock(); } } +/** + * @method flags=dynamic + * @param window cast=(GdkWindow *) + */ +public static final native int /*long*/ _gdk_window_get_display(int /*long*/ window); +public static final int /*long*/ gdk_window_get_display(int /*long*/ window) { + lock.lock(); + try { + return _gdk_window_get_display(window); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic + * @param display cast=(GdkDisplay *) + */ +public static final native int /*long*/ _gdk_display_get_device_manager(int /*long*/ display); +public static final int /*long*/ gdk_display_get_device_manager(int /*long*/ display) { + lock.lock(); + try { + return _gdk_display_get_device_manager(display); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _gdk_device_manager_get_client_pointer(int /*long*/ device_manager); +public static final int /*long*/ gdk_device_manager_get_client_pointer(int /*long*/ device_manager) { + lock.lock(); + try { + return _gdk_device_manager_get_client_pointer(device_manager); + } finally { + lock.unlock(); + } +} /** @method flags=dynamic */ public static final native boolean _gdk_display_supports_cursor_color(int /*long*/ display); public static final boolean gdk_display_supports_cursor_color(int /*long*/ display) { @@ -4593,6 +4630,7 @@ public static final int /*long*/ gdk_pixmap_new(int /*long*/ window, int width, } } /** + * @method flags=dynamic * @param window cast=(GdkWindow *) * @param owner_events cast=(gboolean) * @param event_mask cast=(GdkEventMask) @@ -4609,6 +4647,24 @@ public static final int gdk_pointer_grab(int /*long*/ window, boolean owner_even lock.unlock(); } } +/** + * @method flags=dynamic + * @param device cast=(GdkDevice *) + * @param window cast=(GdkWindow *) + * @param owner_events cast=(gboolean) + * @param event_mask cast=(GdkEventMask) + * @param cursor cast=(GdkCursor *) + * @param time_ cast=(guint32) + */ +public static final native int _gdk_device_grab(int /*long*/ device, int /*long*/ window, int grab_ownership, boolean owner_events, int event_mask, int /*long*/ cursor, int time_); +public static final int gdk_device_grab(int /*long*/ device, int /*long*/ window, int grab_ownership, boolean owner_events, int event_mask, int /*long*/ cursor, int time_) { + lock.lock(); + try { + return _gdk_device_grab(device, window, grab_ownership, owner_events, event_mask, cursor,time_); + } finally { + lock.unlock(); + } +} /** @param time cast=(guint32) */ public static final native void _gdk_pointer_ungrab(int time); public static final void gdk_pointer_ungrab(int time) { 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 3dfad2887d..3d36953665 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 @@ -298,7 +298,7 @@ int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ eventPtr) { 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); + int ptrGrabResult = gdk_pointer_grab(window, OS.GDK_OWNERSHIP_NONE, false, grabMask, window, gdkCursor, OS.GDK_CURRENT_TIME); /* The event must be sent because its doit flag is used. */ Event event = new Event (); 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 9d16684e8f..55328b0627 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 @@ -368,7 +368,7 @@ public boolean getStippled () { boolean grab () { int /*long*/ cursor = this.cursor != null ? this.cursor.handle : 0; - int result = OS.gdk_pointer_grab (window, false, OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK, window, cursor, OS.GDK_CURRENT_TIME); + int result = gdk_pointer_grab(window, OS.GDK_OWNERSHIP_NONE, false, OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK, window, cursor, OS.GDK_CURRENT_TIME); return result == OS.GDK_GRAB_SUCCESS; } 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 5161141007..7be5a0e0ee 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 @@ -1849,6 +1849,23 @@ int /*long*/ gtk_box_new (int orientation, boolean homogeneous, int spacing) { return box; } +int gdk_pointer_grab (int /*long*/ window, int grab_ownership, boolean owner_events, int event_mask,int /*long*/ confine_to, int /*long*/ cursor, int time_) { + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + int /*long*/ display = 0; + if( window != 0){ + display = OS.gdk_window_get_display (window); + } else { + window = OS.gdk_get_default_root_window(); + display = OS.gdk_window_get_display (window); + } + int /*long*/ device_manager = OS.gdk_display_get_device_manager (display); + int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager); + return OS.gdk_device_grab(pointer, window, grab_ownership, owner_events, event_mask, cursor, time_); + } else { + return OS.gdk_pointer_grab(window, owner_events, event_mask, confine_to, cursor, time_); + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. -- cgit From 8690a7560fff2719b578c6e53fe8945b5f15f15c Mon Sep 17 00:00:00 2001 From: Arun Thondapu Date: Sat, 15 Sep 2012 00:02:16 +0530 Subject: Bug 388461 fix formatting --- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java | 2 +- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java | 2 +- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) 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 3d36953665..dbc04e8c55 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 @@ -298,7 +298,7 @@ int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ eventPtr) { 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 = gdk_pointer_grab(window, OS.GDK_OWNERSHIP_NONE, false, grabMask, window, gdkCursor, OS.GDK_CURRENT_TIME); + int ptrGrabResult = gdk_pointer_grab (window, OS.GDK_OWNERSHIP_NONE, false, grabMask, window, gdkCursor, OS.GDK_CURRENT_TIME); /* The event must be sent because its doit flag is used. */ Event event = new Event (); 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 55328b0627..17f929b3db 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 @@ -368,7 +368,7 @@ public boolean getStippled () { boolean grab () { int /*long*/ cursor = this.cursor != null ? this.cursor.handle : 0; - int result = gdk_pointer_grab(window, OS.GDK_OWNERSHIP_NONE, false, OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK, window, cursor, OS.GDK_CURRENT_TIME); + int result = gdk_pointer_grab (window, OS.GDK_OWNERSHIP_NONE, false, OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK, window, cursor, OS.GDK_CURRENT_TIME); return result == OS.GDK_GRAB_SUCCESS; } 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 7be5a0e0ee..89ae3596b4 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 @@ -1849,20 +1849,20 @@ int /*long*/ gtk_box_new (int orientation, boolean homogeneous, int spacing) { return box; } -int gdk_pointer_grab (int /*long*/ window, int grab_ownership, boolean owner_events, int event_mask,int /*long*/ confine_to, int /*long*/ cursor, int time_) { - if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { +int gdk_pointer_grab (int /*long*/ window, int grab_ownership, boolean owner_events, int event_mask, int /*long*/ confine_to, int /*long*/ cursor, int time_) { + if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) { int /*long*/ display = 0; - if( window != 0){ + if( window != 0) { display = OS.gdk_window_get_display (window); } else { - window = OS.gdk_get_default_root_window(); + window = OS.gdk_get_default_root_window (); display = OS.gdk_window_get_display (window); } int /*long*/ device_manager = OS.gdk_display_get_device_manager (display); int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager); - return OS.gdk_device_grab(pointer, window, grab_ownership, owner_events, event_mask, cursor, time_); + return OS.gdk_device_grab (pointer, window, grab_ownership, owner_events, event_mask, cursor, time_); } else { - return OS.gdk_pointer_grab(window, owner_events, event_mask, confine_to, cursor, time_); + return OS.gdk_pointer_grab (window, owner_events, event_mask, confine_to, cursor, time_); } } -- cgit