summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe <gheorghe>2008-02-01 20:37:19 +0000
committerBogdan Gheorghe <gheorghe>2008-02-01 20:37:19 +0000
commitb48f47315274da6406e90da95302589c7ab9c724 (patch)
tree7211966eb14f3a40ff42fdd1f170fdcc79fda3dc
parent57439e032637b0f1d624fb58ad55485a0db0e4a3 (diff)
downloadeclipse.platform.swt-b48f47315274da6406e90da95302589c7ab9c724.tar.gz
eclipse.platform.swt-b48f47315274da6406e90da95302589c7ab9c724.tar.xz
eclipse.platform.swt-b48f47315274da6406e90da95302589c7ab9c724.zip
184932 [SWT] Popup window with SWT.ON_TOP style bit stays opened when minimize the application window
217319 Fix Iconify/DeIconify events on Shell
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java49
1 files changed, 46 insertions, 3 deletions
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 2e9bff262d..3693225509 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
@@ -115,7 +115,7 @@ import org.eclipse.swt.events.*;
*/
public class Shell extends Decorations {
int /*long*/ shellHandle, tooltipsHandle, tooltipWindow, group, modalGroup;
- boolean mapped, moved, resized, opened, fullScreen;
+ boolean mapped, moved, resized, opened, fullScreen, showWithParent;
int oldX, oldY, oldWidth, oldHeight;
int minWidth, minHeight;
Control lastActive;
@@ -1021,7 +1021,13 @@ int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
int /*long*/ gtk_map_event (int /*long*/ widget, int /*long*/ event) {
minimized = false;
- sendEvent (SWT.Deiconify);
+ /*
+ * Feature in GTK. When an ancestor of an override redirect shell is
+ * minimized or restored, the override redirect shell is not minimized
+ * or restored. The fix is to explicitly hide and show all override
+ * redirect shells.
+ */
+ updateShells ();
return 0;
}
@@ -1066,7 +1072,13 @@ int /*long*/ gtk_realize (int /*long*/ widget) {
int /*long*/ gtk_unmap_event (int /*long*/ widget, int /*long*/ event) {
minimized = true;
- sendEvent (SWT.Iconify);
+ /*
+ * Feature in GTK. When an ancestor of an override redirect shell is
+ * minimized or restored, the override redirect shell is not minimized
+ * or restored. The fix is to explicitly hide and show all override
+ * redirect shells.
+ */
+ updateShells ();
return 0;
}
@@ -1076,6 +1088,13 @@ int /*long*/ gtk_window_state_event (int /*long*/ widget, int /*long*/ event) {
minimized = (gdkEvent.new_window_state & OS.GDK_WINDOW_STATE_ICONIFIED) != 0;
maximized = (gdkEvent.new_window_state & OS.GDK_WINDOW_STATE_MAXIMIZED) != 0;
fullScreen = (gdkEvent.new_window_state & OS.GDK_WINDOW_STATE_FULLSCREEN) != 0;
+ if ((gdkEvent.changed_mask & OS.GDK_WINDOW_STATE_ICONIFIED) != 0) {
+ if (minimized) {
+ sendEvent (SWT.Iconify);
+ } else {
+ sendEvent (SWT.Deiconify);
+ }
+ }
return 0;
}
@@ -1754,6 +1773,30 @@ void updateModal () {
modalGroup = group;
}
+void updateShells () {
+ Shell [] shells = getShells ();
+ for (int i=0; i<shells.length; i++) {
+ boolean update = false;
+ Shell shell = shells [i];
+ if (shell.isUndecorated ()) {
+ update = true;
+ } else {
+ do {
+ shell = (Shell) shell.getParent ();
+ } while (shell != null && shell != this && !shell.isUndecorated ());
+ if (shell != null && shell != this) update = true;
+ }
+ if (update) {
+ if (minimized) {
+ OS.gtk_widget_hide (shells [i].shellHandle);
+ } else if (showWithParent) {
+ OS.gtk_widget_show (shells [i].shellHandle);
+ }
+ }
+ }
+ showWithParent = minimized;
+}
+
void deregister () {
super.deregister ();
display.removeWidget (shellHandle);