summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAlexander Kurtakov2011-10-14 15:28:31 (EDT)
committer Silenio Quarti2011-11-25 11:33:15 (EST)
commit49ddcc0adb99c65d3488fb29ff48ac09fabf497d (patch)
treeefe232fbcd9b97b778b3f21fc3ebb1cc4e05f8c4
parent5014eebfedd0f623cdc5c8c21ddc6fda2b771129 (diff)
downloadeclipse.platform.swt-49ddcc0adb99c65d3488fb29ff48ac09fabf497d.zip
eclipse.platform.swt-49ddcc0adb99c65d3488fb29ff48ac09fabf497d.tar.gz
eclipse.platform.swt-49ddcc0adb99c65d3488fb29ff48ac09fabf497d.tar.bz2
Bug 364769 - Remove gtk_timeout_remove and gtk_timeout_add
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java6
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 96cab92..e1a979e 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 fd77e79..582ae6d 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 5f3bf23..99f677c 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 ca58f90..e92228f 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 1e44e55..69cb570 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<timerIds.length; i++) {
- if (timerIds [i] != 0) OS.gtk_timeout_remove (timerIds [i]);
+ if (timerIds [i] != 0) OS.g_source_remove (timerIds [i]);
}
}
timerIds = null;
@@ -3362,7 +3362,7 @@ void releaseDisplay () {
windowTimerCallback = null;
/* Dispose mouse hover callback */
- if (mouseHoverId != 0) OS.gtk_timeout_remove (mouseHoverId);
+ if (mouseHoverId != 0) OS.g_source_remove (mouseHoverId);
mouseHoverId = 0;
mouseHoverHandle = mouseHoverProc = 0;
mouseHoverCallback.dispose ();
@@ -3529,7 +3529,7 @@ public void removeListener (int eventType, Listener listener) {
void removeMouseHoverTimeout (int /*long*/ handle) {
if (handle != mouseHoverHandle) return;
- if (mouseHoverId != 0) OS.gtk_timeout_remove (mouseHoverId);
+ if (mouseHoverId != 0) OS.g_source_remove (mouseHoverId);
mouseHoverId = 0;
mouseHoverHandle = 0;
}
@@ -4118,7 +4118,7 @@ public void timerExec (int milliseconds, Runnable runnable) {
index++;
}
if (index != timerList.length) {
- OS.gtk_timeout_remove (timerIds [index]);
+ OS.g_source_remove (timerIds [index]);
timerList [index] = null;
timerIds [index] = 0;
if (milliseconds < 0) return;
@@ -4138,7 +4138,7 @@ public void timerExec (int milliseconds, Runnable runnable) {
timerIds = newTimerIds;
}
}
- int timerId = OS.gtk_timeout_add (milliseconds, timerProc, index);
+ int timerId = OS.g_timeout_add (milliseconds, timerProc, index);
if (timerId != 0) {
timerIds [index] = timerId;
timerList [index] = runnable;
@@ -4165,7 +4165,7 @@ int /*long*/ caretProc (int /*long*/ clientData) {
if (currentCaret.blinkCaret()) {
int blinkRate = currentCaret.blinkRate;
if (blinkRate == 0) return 0;
- caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0);
+ caretId = OS.g_timeout_add (blinkRate, caretProc, 0);
} else {
currentCaret = null;
}
@@ -4234,12 +4234,12 @@ void sendEvent (int eventType, Event event) {
}
void setCurrentCaret (Caret caret) {
- if (caretId != 0) OS.gtk_timeout_remove(caretId);
+ if (caretId != 0) OS.g_source_remove(caretId);
caretId = 0;
currentCaret = caret;
if (caret == null) return;
int blinkRate = currentCaret.blinkRate;
- caretId = OS.gtk_timeout_add (blinkRate, caretProc, 0);
+ caretId = OS.g_timeout_add (blinkRate, caretProc, 0);
}
int /*long*/ shellMapProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
index 7b4d23e..811cecd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
@@ -90,7 +90,7 @@ void createHandle (int index) {
int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_BOTTOM_TO_TOP : OS.GTK_PROGRESS_LEFT_TO_RIGHT;
OS.gtk_progress_bar_set_orientation (handle, orientation);
if ((style & SWT.INDETERMINATE) != 0) {
- timerId = OS.gtk_timeout_add (DELAY, display.windowTimerProc, handle);
+ timerId = OS.g_timeout_add (DELAY, display.windowTimerProc, handle);
}
}
@@ -176,7 +176,7 @@ int /*long*/ gtk_realize (int /*long*/ widget) {
void releaseWidget () {
super.releaseWidget ();
- if (timerId != 0) OS.gtk_timeout_remove (timerId);
+ if (timerId != 0) OS.g_source_remove (timerId);
timerId = 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index cd5baff..8fa7d4b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -581,7 +581,7 @@ void releaseWidget () {
layoutText = 0;
if (layoutMessage != 0) OS.g_object_unref (layoutMessage);
layoutMessage = 0;
- if (timerId != 0) OS.gtk_timeout_remove(timerId);
+ if (timerId != 0) OS.g_source_remove(timerId);
timerId = 0;
text = null;
message = null;
@@ -782,7 +782,7 @@ public void setText (String string) {
*/
public void setVisible (boolean visible) {
checkWidget ();
- if (timerId != 0) OS.gtk_timeout_remove(timerId);
+ if (timerId != 0) OS.g_source_remove(timerId);
timerId = 0;
if (visible) {
if ((style & SWT.BALLOON) != 0) {
@@ -799,7 +799,7 @@ public void setVisible (boolean visible) {
OS.GTK_TOOLTIPS_SET_ACTIVE (handle, data);
OS.gtk_tooltips_set_tip (handle, vboxHandle, buffer, null);
}
- if (autohide) timerId = OS.gtk_timeout_add (DELAY, display.windowTimerProc, handle);
+ if (autohide) timerId = OS.g_timeout_add (DELAY, display.windowTimerProc, handle);
} else {
if ((style & SWT.BALLOON) != 0) {
OS.gtk_widget_hide (handle);