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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Feb 20 18:06:09 EET 2009
Author: tthurman
Date: 2009-02-20 18:06:08 +0200 (Fri, 20 Feb 2009)
New Revision: 17476

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
Log:
	Being intransient is now a sufficient condition to be considered
	system-modal.  A dialog's modality is not relevant to its
	system-modality.  After discussion with Kimmo.
	This isn't the change that fixes MB#97489 but is in sympathy
	with it.
	* matchbox/core/mb-window-manager.c: Change preresquisites for
	being system-modal.
	* matchbox/core/mb-wm-types.h: Update comment.



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-02-20 12:25:52 UTC (rev 17475)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-02-20 16:06:08 UTC (rev 17476)
@@ -1,3 +1,15 @@
+2009-02-20  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	Being intransient is now a sufficient condition to be considered
+	system-modal.  A dialog's modality is not relevant to its
+	system-modality.  After discussion with Kimmo.  
+	This isn't the change that fixes MB#97489 but is in sympathy
+	with it.
+
+	* matchbox/core/mb-window-manager.c: Change preresquisites for
+	being system-modal.
+	* matchbox/core/mb-wm-types.h: Update comment.
+
 2009-02-16  Thomas Thurman  <thomas.thurman at collabora.co.uk>
 
 	* matchbox/core/mb-wm-client-window.c: initialise cookies

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-02-20 12:25:52 UTC (rev 17475)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-02-20 16:06:08 UTC (rev 17476)
@@ -1955,10 +1955,15 @@
 mb_wm_focus_client (MBWindowManager *wm, MBWindowManagerClient *c)
 {
   MBWindowManagerClient *client = c,
-                        *last_focused_transient;
+    *last_focused_transient,
+    *focused_clients_parent;
  
   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
@@ -1971,31 +1976,33 @@
     }
 
   /*
-   * If the 
-   * 1) client is currently focused, 
-   * 2) client does not want focus,  
-   * 3) client is a parent of a currently focused modal client,
-   * 4) the currently focused client is system-modal while the client is not 
-   *    and not its transient either
+   * 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:
    */
-  gboolean has_modal_focused_client = 
-    wm->focused_client && mb_wm_client_is_modal (wm->focused_client);
 
-  gboolean system_modal_focused_client = 
-    has_modal_focused_client && 
-    !mb_wm_client_get_transient_for (wm->focused_client) && 
-    wm->modality_type == MBWMModalitySystem;
-
-  gboolean client_is_system_modal =
-    mb_wm_client_is_modal (client) && !mb_wm_client_get_transient_for (client);
-
-  if (wm->focused_client == client ||
+  if (
+      /* It's already focussed */
+      wm->focused_client == client ||
+      /* It doesn't want focus */
       !mb_wm_client_want_focus (client) ||
-      (has_modal_focused_client &&
-       client == mb_wm_client_get_transient_for (wm->focused_client)) ||
-      (system_modal_focused_client &&
-       !client_is_system_modal &&
-       wm->focused_client != mb_wm_client_get_transient_for (client)))
+      /* It's the parent of the current modal focus-holder */
+      (client == focused_clients_parent &&
+       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 &&
+       mb_wm_client_get_transient_for (client) &&
+       wm->focused_client != mb_wm_client_get_transient_for (client))
+      )
     return False;
 
   if (!mb_wm_client_is_realized (client))

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-02-20 12:25:52 UTC (rev 17475)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-02-20 16:06:08 UTC (rev 17476)
@@ -463,7 +463,7 @@
 typedef enum MBWMModality
 {
   MBWMModalityNormal = 0, /* Handle modality per EWMH */
-  MBWMModalitySystem,     /* Treat all modal dialogs as if system modal */
+  MBWMModalitySystem,     /* Treat all intransient dialogs as if system modal */
   MBWMModalityNone,       /* Ignore modality */
 }MBWMModality;
 


More information about the maemo-commits mailing list