Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-08-20 20:42:41 +0000
committerEric Williams2019-08-23 14:39:18 +0000
commit20eb8739f47fe7e097d2711c91719c4e8998495a (patch)
treecf548676a3ff80a2fc4e2a7e37bf5524d3f34f99
parentfe3b656ad96552704397c5c8dc397797c73c91a1 (diff)
downloadeclipse.platform.swt-20eb8739f47fe7e097d2711c91719c4e8998495a.tar.gz
eclipse.platform.swt-20eb8739f47fe7e097d2711c91719c4e8998495a.tar.xz
eclipse.platform.swt-20eb8739f47fe7e097d2711c91719c4e8998495a.zip
Bug 546914: [GTK] Git Reflog - branch symbol on the upper right corner does not react
Adding a control to a ToolItem via setControl() has a bug on GTK3 (all versions) where events sent to that control are no longer processed/fired. This is because SWT-GTK3 requires a few extra steps, namely fixing the Z-order (GdkWindow stacking order) after calling setControl(). Events in GTK3 travel via GdkWindow, so the wrong GdkWindow on top will block events from reaching the set control. This is visible in EGit and not SWT (Snippet58) because of the way ToolBar managers in JFace dynamically dispose/create ToolItems on the fly. The fix is call fixZOrder() in the parent ToolBar, everytime ToolItem.setControl() is called. Furthermore, the map signal needs to be connected on the ToolItem's topHandle(). Tested on GTK3.24, X11 and Wayland. Verified in a child Eclipse using EGit. No AllNonBrowser JUnit tests fail. Change-Id: I5bc5df8feda7482aa4180ee18d4d995c6942d463 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java18
1 files changed, 15 insertions, 3 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 46d3bc0372..71a664aa24 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
@@ -48,6 +48,8 @@ public class ToolItem extends Item {
Image hotImage, disabledImage;
String toolTipText;
boolean drawHotImage;
+ /** True iff map has been hooked for this ToolItem. See bug 546914. */
+ boolean mapHooked;
/**
* Constructs a new instance of this class given its parent
@@ -792,9 +794,11 @@ void hookEvents () {
} else {
OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [EVENT_AFTER], 0, display.getClosure (EVENT_AFTER), false);
}
-
- long topHandle = topHandle ();
- OS.g_signal_connect_closure_by_id (topHandle, display.signalIds [MAP], 0, display.getClosure (MAP), true);
+ if (!mapHooked) {
+ long topHandle = topHandle ();
+ OS.g_signal_connect_closure_by_id (topHandle, display.signalIds [MAP], 0, display.getClosure (MAP), true);
+ mapHooked = true;
+ }
}
/**
@@ -951,6 +955,14 @@ public void setControl (Control control) {
if (this.control == control) return;
this.control = control;
parent.relayout ();
+ // Fix the Z-order in order to ensure proper event traversal. See bug 546914.
+ if (control != null) {
+ parent.fixZOrder();
+ if (!mapHooked) {
+ OS.g_signal_connect_closure_by_id (topHandle(), display.signalIds [MAP], 0, display.getClosure (MAP), true);
+ mapHooked = true;
+ }
+ }
}
/**

Back to the top