From 49ddcc0adb99c65d3488fb29ff48ac09fabf497d Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Fri, 14 Oct 2011 22:28:31 +0300 Subject: Bug 364769 - Remove gtk_timeout_remove and gtk_timeout_add --- .../Eclipse SWT PI/gtk/library/os.c | 34 ++++++++-------------- .../Eclipse SWT PI/gtk/library/os_stats.c | 7 ++--- .../Eclipse SWT PI/gtk/library/os_stats.h | 3 +- .../gtk/org/eclipse/swt/internal/gtk/OS.java | 18 +++--------- .../gtk/org/eclipse/swt/widgets/Display.java | 22 +++++++------- .../gtk/org/eclipse/swt/widgets/ProgressBar.java | 4 +-- .../gtk/org/eclipse/swt/widgets/ToolTip.java | 6 ++-- 7 files changed, 36 insertions(+), 58 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 96cab92847..e1a979e69c 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 @@ -4460,6 +4460,18 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1thread_1supported) } #endif +#ifndef NO__1g_1timeout_1add +JNIEXPORT jint JNICALL OS_NATIVE(_1g_1timeout_1add) + (JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1timeout_1add_FUNC); + rc = (jint)g_timeout_add((guint32)arg0, (GSourceFunc)arg1, (gpointer)arg2); + OS_NATIVE_EXIT(env, that, _1g_1timeout_1add_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1type_1add_1interface_1static JNIEXPORT void JNICALL OS_NATIVE(_1g_1type_1add_1interface_1static) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) @@ -14146,28 +14158,6 @@ fail: } #endif -#ifndef NO__1gtk_1timeout_1add -JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1timeout_1add) - (JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1gtk_1timeout_1add_FUNC); - rc = (jint)gtk_timeout_add((guint32)arg0, (GtkFunction)arg1, (gpointer)arg2); - OS_NATIVE_EXIT(env, that, _1gtk_1timeout_1add_FUNC); - return rc; -} -#endif - -#ifndef NO__1gtk_1timeout_1remove -JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1timeout_1remove) - (JNIEnv *env, jclass that, jint arg0) -{ - OS_NATIVE_ENTER(env, that, _1gtk_1timeout_1remove_FUNC); - gtk_timeout_remove((guint)arg0); - OS_NATIVE_EXIT(env, that, _1gtk_1timeout_1remove_FUNC); -} -#endif - #ifndef NO__1gtk_1toggle_1button_1get_1active JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1toggle_1button_1get_1active) (JNIEnv *env, jclass that, jintLong arg0) 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 fd77e79455..582ae6d2ad 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 = 1387; -int OS_nativeFunctionCallCount[1387]; +int OS_nativeFunctionCount = 1386; +int OS_nativeFunctionCallCount[1386]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -390,6 +390,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1strtod", "_1g_1thread_1init", "_1g_1thread_1supported", + "_1g_1timeout_1add", "_1g_1type_1add_1interface_1static", "_1g_1type_1class_1peek", "_1g_1type_1class_1peek_1parent", @@ -1100,8 +1101,6 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1text_1view_1set_1tabs", "_1gtk_1text_1view_1set_1wrap_1mode", "_1gtk_1text_1view_1window_1to_1buffer_1coords", - "_1gtk_1timeout_1add", - "_1gtk_1timeout_1remove", "_1gtk_1toggle_1button_1get_1active", "_1gtk_1toggle_1button_1get_1inconsistent", "_1gtk_1toggle_1button_1new", 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 5f3bf23217..99f677c61a 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 @@ -398,6 +398,7 @@ typedef enum { _1g_1strtod_FUNC, _1g_1thread_1init_FUNC, _1g_1thread_1supported_FUNC, + _1g_1timeout_1add_FUNC, _1g_1type_1add_1interface_1static_FUNC, _1g_1type_1class_1peek_FUNC, _1g_1type_1class_1peek_1parent_FUNC, @@ -1108,8 +1109,6 @@ typedef enum { _1gtk_1text_1view_1set_1tabs_FUNC, _1gtk_1text_1view_1set_1wrap_1mode_FUNC, _1gtk_1text_1view_1window_1to_1buffer_1coords_FUNC, - _1gtk_1timeout_1add_FUNC, - _1gtk_1timeout_1remove_FUNC, _1gtk_1toggle_1button_1get_1active_FUNC, _1gtk_1toggle_1button_1get_1inconsistent_FUNC, _1gtk_1toggle_1button_1new_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 ca58f90f76..e92228f5eb 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 @@ -11039,24 +11039,14 @@ public static final void gtk_text_view_window_to_buffer_coords(int /*long*/ text } /** * @param interval cast=(guint32) - * @param function cast=(GtkFunction) + * @param function cast=(GSourceFunc) * @param data cast=(gpointer) */ -public static final native int _gtk_timeout_add(int interval, int /*long*/ function, int /*long*/ data); -public static final int gtk_timeout_add(int interval, int /*long*/ function, int /*long*/ data) { - lock.lock(); - try { - return _gtk_timeout_add(interval, function, data); - } finally { - lock.unlock(); - } -} -/** @param timeout_handler_id cast=(guint) */ -public static final native void _gtk_timeout_remove(int timeout_handler_id); -public static final void gtk_timeout_remove(int timeout_handler_id) { +public static final native int _g_timeout_add(int interval, int /*long*/ function, int /*long*/ data); +public static final int g_timeout_add(int interval, int /*long*/ function, int /*long*/ data) { lock.lock(); try { - _gtk_timeout_remove(timeout_handler_id); + return _g_timeout_add(interval, function, data); } finally { lock.unlock(); } 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 1e44e55bdc..69cb570608 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 @@ -630,8 +630,8 @@ int /*long*/ allChildrenProc (int /*long*/ widget, int /*long*/ recurse) { } void addMouseHoverTimeout (int /*long*/ handle) { - if (mouseHoverId != 0) OS.gtk_timeout_remove (mouseHoverId); - mouseHoverId = OS.gtk_timeout_add (400, mouseHoverProc, handle); + if (mouseHoverId != 0) OS.g_source_remove (mouseHoverId); + mouseHoverId = OS.g_timeout_add (400, mouseHoverProc, handle); mouseHoverHandle = handle; } @@ -3334,7 +3334,7 @@ void releaseDisplay () { allChildrenProc = 0; /* Dispose the caret callback */ - if (caretId != 0) OS.gtk_timeout_remove (caretId); + if (caretId != 0) OS.g_source_remove (caretId); caretId = 0; caretProc = 0; caretCallback.dispose (); @@ -3349,7 +3349,7 @@ void releaseDisplay () { /* Dispose the timer callback */ if (timerIds != null) { for (int i=0; i