26051
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
index 357ea3c..26244bc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
@@ -492,16 +492,25 @@
}
int gtk_hide (int widget) {
+ if ((style & SWT.POP_UP) != 0) {
+ Shell shell = getShell ();
+ shell.hasFocus = true;
+ }
sendEvent (SWT.Hide);
return 0;
}
int gtk_show (int widget) {
- if ((style & SWT.POP_UP) != 0) return 0;
+ if ((style & SWT.POP_UP) != 0) {
+ Shell shell = getShell ();
+ shell.hasFocus = true;
+ return 0;
+ }
sendEvent (SWT.Show);
return 0;
}
+
int gtk_show_help (int widget, int helpType) {
if (sendHelpEvent (helpType)) OS.gtk_menu_shell_deactivate (handle);
return 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 7e1cf46..16a9400 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -393,8 +393,13 @@
void bringToTop (boolean force) {
if ((style & SWT.ON_TOP) != 0) return;
if (!OS.GTK_WIDGET_VISIBLE (shellHandle)) return;
+ if (hasFocus) return;
Shell shell = display.getActiveShell ();
- if (shell == this) return;
+ if (!force) {
+ if (shell == null) return;
+ int focusHandle = OS.gtk_window_get_focus (shell.shellHandle);
+ if (focusHandle == 0 || !OS.GTK_WIDGET_HAS_FOCUS (focusHandle)) return;
+ }
if (shell != null) shell.hasFocus = false;
OS.gtk_window_present (shellHandle);
hasFocus = true;