diff options
author | Marc-Andre Laperle | 2014-05-21 03:57:26 +0000 |
---|---|---|
committer | Arun Thondapu | 2014-05-22 12:09:53 +0000 |
commit | 9b2499a100ea32cbdcab7c6c87e6d1adf71751d5 (patch) | |
tree | 77d8b1e2a861784443ec979db65856a977400ea7 | |
parent | 20a78c3f41cf33cd567a5e2c6f2e5b079601072a (diff) | |
download | eclipse.platform.swt-9b2499a100ea32cbdcab7c6c87e6d1adf71751d5.tar.gz eclipse.platform.swt-9b2499a100ea32cbdcab7c6c87e6d1adf71751d5.tar.xz eclipse.platform.swt-9b2499a100ea32cbdcab7c6c87e6d1adf71751d5.zip |
Bug 431890 - [GTK3] Can only press debug buttons twice before having to move the mousev4426iI20140522-1100
Bug 82169 and Bug 271765 are not present when using GTK3 therefore the work arounds
for GTK2 are not necessary.
Change-Id: I6723090e0b7f543e0efd092e6ca5ce5dde5907d5
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java index 09e5730b56..084163fe4c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java @@ -930,31 +930,32 @@ public void setEnabled (boolean enabled) { long /*int*/ topHandle = topHandle (); if (gtk_widget_get_sensitive (topHandle) == enabled) return; OS.gtk_widget_set_sensitive (topHandle, enabled); - if (enabled) { - /* - * Bug in GTK. GtkButton requires an enter notify before it - * allows the button to be pressed, but events are dropped when - * widgets are insensitive. The fix is to hide and show the - * button if the pointer is within its bounds. - */ - int [] x = new int [1], y = new int [1]; - gdk_window_get_device_position (parent.paintWindow (), x, y, null); - if (getBounds ().contains (x [0], y [0])) { - OS.gtk_widget_hide (handle); - OS.gtk_widget_show (handle); - } - } else { - /* - * Bug in GTK. Starting with 2.14, if a button is disabled - * through on a button press, the field which keeps track - * whether the pointer is currently in the button is never updated. - * As a result, when it is re-enabled it automatically enters - * a PRELIGHT state. The fix is to set a NORMAL state. - * - * Note that on GTK 3 this code causes the item to be re-enabled. - */ - if (OS.GTK_VERSION >= OS.VERSION (2, 14, 0) && !OS.GTK3) { - OS.gtk_widget_set_state (topHandle, OS.GTK_STATE_NORMAL); + + if (!OS.GTK3) { + if (enabled) { + /* + * Bug in GTK (see Eclipse bug 82169). GtkButton requires an enter notify before it + * allows the button to be pressed, but events are dropped when + * widgets are insensitive. The fix is to hide and show the + * button if the pointer is within its bounds. + */ + int [] x = new int [1], y = new int [1]; + gdk_window_get_device_position (parent.paintWindow (), x, y, null); + if (getBounds ().contains (x [0], y [0])) { + OS.gtk_widget_hide (handle); + OS.gtk_widget_show (handle); + } + } else { + /* + * Bug in GTK. Starting with 2.14, if a button is disabled + * through on a button press, the field which keeps track + * whether the pointer is currently in the button is never updated. + * As a result, when it is re-enabled it automatically enters + * a PRELIGHT state. The fix is to set a NORMAL state. + */ + if (OS.GTK_VERSION >= OS.VERSION (2, 14, 0)) { + OS.gtk_widget_set_state (topHandle, OS.GTK_STATE_NORMAL); + } } } } |