[maemo-commits] [maemo-commits] r18519 - in projects/haf/trunk/libmatchbox2: . matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed May 27 19:00:19 EEST 2009
Author: tthurman
Date: 2009-05-27 19:00:07 +0300 (Wed, 27 May 2009)
New Revision: 18519

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
Log:
	Fixes: NB#117084 System-modal windows lose focus
	                 if an app sends _NET_ACTIVE_WINDOW
	* matchbox/core/mb-window-manager.c: System modality is tested
	using a separate function; this means we don't mistakenly allow
	focus to transfer to non-dialogues merely because they're intransient.



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-05-27 14:52:03 UTC (rev 18518)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-05-27 16:00:07 UTC (rev 18519)
@@ -1,3 +1,12 @@
+2009-05-27  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	Fixes: NB#117084 System-modal windows lose focus
+	                 if an app sends _NET_ACTIVE_WINDOW
+	
+	* matchbox/core/mb-window-manager.c: System modality is tested
+	using a separate function; this means we don't mistakenly allow
+	focus to transfer to non-dialogues merely because they're intransient.
+
 2009-05-27  Gordon Williams <gordon.williams at collabora.co.uk>
 
 	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c: Added explicit enable of

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-05-27 14:52:03 UTC (rev 18518)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-05-27 16:00:07 UTC (rev 18519)
@@ -1936,19 +1936,32 @@
   wm->sync_type |= (MBWMSyncGeometry | MBWMSyncVisibility);
 }
 
+/*
+ * Returns TRUE iff the named client is a system-modal dialogue.
+ *
+ * Note: We now say that a system-modal dialogue is any dialogue which
+ * is intransient, or is transient to itself or to the root; a system-
+ * modal dialogue is not required to be modal.  In other words, testing
+ * "!mb_wm_client_get_transient_for(w)" is equivalent to testing whether
+ * w is system-modal.
+ */
+static inline gboolean
+is_system_modal (MBWindowManagerClient *c)
+{
+  return
+    c &&
+    MB_WM_CLIENT_CLIENT_TYPE (c)==MBWMClientTypeDialog &&
+    !mb_wm_client_get_transient_for (c);
+}
+
 static Bool
 mb_wm_focus_client (MBWindowManager *wm, MBWindowManagerClient *c)
 {
   MBWindowManagerClient *client = c,
-    *last_focused_transient,
-    *focused_clients_parent;
+    *last_focused_transient;
 
   last_focused_transient = mb_wm_client_get_last_focused_transient (c);
 
-  focused_clients_parent = wm->focused_client?
-    mb_wm_client_get_transient_for (wm->focused_client):
-    NULL;
-
   /*
    * If the last focused transient for this client is modal, we try to focus
    * the transient rather than the client itself
@@ -1960,15 +1973,7 @@
       client = last_focused_transient;
     }
 
-  /*
-   * Note: We now say that a system-modal dialogue is any dialogue which
-   * is intransient, or is transient to itself or to the root; a system-
-   * modal dialogue is not required to be modal.  In other words, testing
-   * "!mb_wm_client_get_transient_for(w)" is equivalent to testing whether
-   * w is system-modal.
-   *
-   * We refuse to focus a window if:
-   */
+  /* We refuse to focus a window if: */
 
   if (
       /* It's already focussed */
@@ -1976,18 +1981,16 @@
       /* It doesn't want focus */
       !mb_wm_client_want_focus (client) ||
       /* It's the parent of the current modal focus-holder */
-      (client == focused_clients_parent &&
-       wm->focused_client &&
+      (wm->focused_client &&
+       client == mb_wm_client_get_transient_for (wm->focused_client) &&
        mb_wm_client_is_modal (wm->focused_client)) ||
       /* It isn't system-modal but the current focus-holder is,
          unless its parent is the current focus-holder
          (you're allowed to switch to the non-system-modal transients
           of a system-modal window) */
       (wm->modality_type == MBWMModalitySystem &&
-       !focused_clients_parent &&
-       wm->focused_client &&
-       MB_WM_CLIENT_CLIENT_TYPE (wm->focused_client)==MBWMClientTypeDialog &&
-       mb_wm_client_get_transient_for (client) &&
+       is_system_modal (wm->focused_client) &&
+       !is_system_modal (client) &&
        wm->focused_client != mb_wm_client_get_transient_for (client))
       )
     return False;


More information about the maemo-commits mailing list