summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe@ca.ibm.com>2012-01-18 14:38:30 -0500
committerBogdan Gheorghe <gheorghe@ca.ibm.com>2012-01-18 14:38:30 -0500
commit7a90781a0b4efe2d1023e9b9e3985d7144df555d (patch)
tree365704170b742df3d564d27be5c13bdc425531ae /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
parent775f7cfbc59632723c3d9a6faa1c78275b5107ae (diff)
parent769e2f86b4a658a863e62444f6c5f651ce456752 (diff)
downloadeclipse.platform.swt-7a90781a0b4efe2d1023e9b9e3985d7144df555d.tar.gz
eclipse.platform.swt-7a90781a0b4efe2d1023e9b9e3985d7144df555d.tar.xz
eclipse.platform.swt-7a90781a0b4efe2d1023e9b9e3985d7144df555d.zip
Merge master into Bug354978
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java28
1 files changed, 19 insertions, 9 deletions
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 a3b3746401..919dcff28d 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
@@ -577,11 +577,12 @@ void register () {
void releaseWidget () {
super.releaseWidget ();
+ setVisible(false);
if (layoutText != 0) OS.g_object_unref (layoutText);
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 +783,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) {
@@ -794,18 +795,27 @@ public void setVisible (boolean visible) {
if (text.length () > 0) string.append ("\n\n");
string.append (message);
byte [] buffer = Converter.wcsToMbcs (null, string.toString(), true);
- OS.gtk_tooltips_set_tip (handle, vboxHandle, buffer, null);
- int /*long*/ data = OS.gtk_tooltips_data_get (vboxHandle);
- OS.GTK_TOOLTIPS_SET_ACTIVE (handle, data);
- OS.gtk_tooltips_set_tip (handle, vboxHandle, buffer, null);
+ if (OS.GTK_VERSION >= OS.VERSION(2, 12, 0)) {
+ OS.gtk_widget_set_tooltip_text(vboxHandle, buffer);
+ } else {
+ OS.gtk_tooltips_set_tip (handle, vboxHandle, buffer, null);
+ int /*long*/ data = OS.gtk_tooltips_data_get (vboxHandle);
+ 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);
} else {
- int /*long*/ tipWindow = OS.GTK_TOOLTIPS_TIP_WINDOW (handle);
- OS.gtk_widget_hide (tipWindow);
+ int /*long*/ vboxHandle = parent.vboxHandle;
+ byte[] buffer = Converter.wcsToMbcs(null, "", true);
+ if (OS.GTK_VERSION >= OS.VERSION(2, 12, 0)) {
+ OS.gtk_widget_set_tooltip_text(vboxHandle, buffer);
+ } else {
+ OS.gtk_tooltips_set_tip(handle, vboxHandle, buffer, null);
+ }
}
}
}