[maemo-commits] [maemo-commits] r18751 - in projects/haf/trunk/libmatchbox2: . matchbox/client-types matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Jun 18 05:05:03 EEST 2009
Author: tthurman
Date: 2009-06-18 05:04:54 +0300 (Thu, 18 Jun 2009)
New Revision: 18751

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-dialog.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
Log:
	NB#119560 Hiding a window affects the visibility of
	other transient windows
	* matchbox/client-types/mb-wm-client-dialog.c: Added
	function mb_wm_client_dialog_stacking_layer() to figure
	out the layer dynamically.
	* matchbox/core/mb-window-manager.c: Remove all transients
	before unmanaging a window.  Function is_system_modal()
	moved out to mb-wm-client.c.
	* matchbox/core/mb-wm-client-window.c: improved
	debugging message.
	* matchbox/core/mb-wm-client.[ch]: moved function
	mb_wm_client_is_system_modal() in from mb-window-manager.c
	and added function mb_wm_client_remove_all_transients().



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-06-17 15:29:30 UTC (rev 18750)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-06-18 02:04:54 UTC (rev 18751)
@@ -1,3 +1,20 @@
+2009-06-17  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	NB#119560 Hiding a window affects the visibility of
+	other transient windows
+	
+	* matchbox/client-types/mb-wm-client-dialog.c: Added
+	function mb_wm_client_dialog_stacking_layer() to figure
+	out the layer dynamically.
+	* matchbox/core/mb-window-manager.c: Remove all transients
+	before unmanaging a window.  Function is_system_modal()
+	moved out to mb-wm-client.c.
+	* matchbox/core/mb-wm-client-window.c: improved
+	debugging message.
+	* matchbox/core/mb-wm-client.[ch]: moved function
+	mb_wm_client_is_system_modal() in from mb-window-manager.c
+	and added function mb_wm_client_remove_all_transients().
+
 2009-06-16  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	Apply patch from Laszlo Pere for NB#121265.

Modified: projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-dialog.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-dialog.c	2009-06-17 15:29:30 UTC (rev 18750)
+++ projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-dialog.c	2009-06-18 02:04:54 UTC (rev 18751)
@@ -10,6 +10,9 @@
 static void
 mb_wm_client_dialog_theme_change (MBWindowManagerClient *client);
 
+static MBWMStackLayerType
+mb_wm_client_dialog_stacking_layer (MBWindowManagerClient *client);
+
 static void
 mb_wm_client_dialog_show (MBWindowManagerClient *client)
 {
@@ -72,6 +75,7 @@
   client->geometry     = mb_wm_client_dialog_request_geometry;
   client->show         = mb_wm_client_dialog_show;
   client->theme_change = mb_wm_client_dialog_theme_change;
+  client->stacking_layer = mb_wm_client_dialog_stacking_layer;
 
 #if MBWM_WANT_DEBUG
   klass->klass_name = "MBWMClientDialog";
@@ -115,9 +119,7 @@
       mb_wm_theme_create_decor (wm->theme, client, MBWMDecorTypeEast);
     }
 
-  if (win->xwin_transient_for
-      && win->xwin_transient_for != win->xwindow
-      && win->xwin_transient_for != wm->root_win->xwindow)
+  if (!mb_wm_client_is_system_modal (client))
     {
       MBWM_DBG ("Adding to '%lx' transient list",
 		win->xwin_transient_for);
@@ -125,17 +127,7 @@
 	(mb_wm_managed_client_from_xwindow (wm,
 					    win->xwin_transient_for),
 	 client);
-      client->stacking_layer = 0;  /* We stack with whatever transient too */
     }
-  else
-    {
-      if (win->hildon_stacking_layer == 0)
-        /* Stack with 'always on top' */
-        client->stacking_layer = MBWMStackLayerTopMid;
-      else
-        client->stacking_layer = client->window->hildon_stacking_layer
-                                 + MBWMStackLayerHildon1 - 1;
-    }
 
   /* center if window sets 0,0
    * Only do this for dialogs, not derived classes.
@@ -372,3 +364,22 @@
   return client;
 }
 
+static MBWMStackLayerType
+mb_wm_client_dialog_stacking_layer (MBWindowManagerClient *client)
+{
+  if (mb_wm_client_is_system_modal (client))
+    {
+      if (client->window->hildon_stacking_layer == 0)
+        /* Stack with 'always on top' */
+        return MBWMStackLayerTopMid;
+      else {
+        return client->window->hildon_stacking_layer
+	  + MBWMStackLayerHildon1 - 1;
+      }
+    }
+  else
+    {
+      /* Stack it with its parent */
+      return MBWMStackLayerUnknown;
+    }
+}

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-06-17 15:29:30 UTC (rev 18750)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-06-18 02:04:54 UTC (rev 18751)
@@ -498,6 +498,8 @@
 	  else if (!mb_wm_client_window_is_state_set (client->window,
 					    MBWMClientWindowEWMHStateHidden))
 	    {
+	      mb_wm_client_remove_all_transients (client);
+
 #if ENABLE_COMPOSITE
 	      if (mb_wm_compositing_enabled (wm))
 		mb_wm_comp_mgr_unmap_notify (wm->comp_mgr, client);
@@ -1990,24 +1992,6 @@
   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 void
 mb_wm_focus_client (MBWindowManager *wm, MBWindowManagerClient *c)
 {
@@ -2043,8 +2027,8 @@
          (you're allowed to switch to the non-system-modal transients
           of a system-modal window) */
       (wm->modality_type == MBWMModalitySystem &&
-       is_system_modal (wm->focused_client) &&
-       !is_system_modal (client) &&
+       mb_wm_client_is_system_modal (wm->focused_client) &&
+       !mb_wm_client_is_system_modal (client) &&
        wm->focused_client != mb_wm_client_get_transient_for (client))
       )
     return;

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-06-17 15:29:30 UTC (rev 18750)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-06-18 02:04:54 UTC (rev 18751)
@@ -447,7 +447,8 @@
 	  || result_atom == NULL
 	  )
 	{
-	  g_debug ("%s: ### Warning net type prop failed ###", __FUNCTION__);
+	  g_debug ("%s: ### Warning net type prop failed for %x ###",
+		   __FUNCTION__, xwin);
 	  if (x_error_code == BadWindow)
 	    goto badwindow_error;
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-06-17 15:29:30 UTC (rev 18750)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-06-18 02:04:54 UTC (rev 18751)
@@ -597,6 +597,23 @@
   client->transients = mb_wm_util_list_remove(client->transients, transient);
 }
 
+void
+mb_wm_client_remove_all_transients (MBWindowManagerClient *client)
+{
+  MBWMList *cursor = client->transients;
+
+  while (cursor)
+    {
+      MBWindowManagerClient *transient = cursor->data;
+      transient->transient_for = NULL;
+      transient->window->xwin_transient_for = None;
+      cursor = cursor->next;
+    }
+
+  mb_wm_util_list_free (client->transients);
+  client->transients = NULL;
+}
+
 /**
  * Returns the client next above the given client in the
  * stacking order.  Returns NULL if the client does not
@@ -698,6 +715,34 @@
 }
 
 
+/*
+ * 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.
+ */
+gboolean
+mb_wm_client_is_system_modal (MBWindowManagerClient *client)
+{
+  if (!client)
+    return FALSE;
+
+  if (MB_WM_CLIENT_CLIENT_TYPE (client)!=MBWMClientTypeDialog)
+    return FALSE;
+
+  return
+    /* It can be transient to nothing... */
+    client->window->xwin_transient_for == None ||
+    /* ...or to itself... */
+    client->window->xwin_transient_for == client->window->xwindow ||
+    /* ...or to the root. */
+    client->window->xwin_transient_for ==
+    client->wmref->root_win->xwindow;
+}
+
 const char*
 mb_wm_client_get_name (MBWindowManagerClient *client)
 {

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-06-17 15:29:30 UTC (rev 18750)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-06-18 02:04:54 UTC (rev 18751)
@@ -321,6 +321,9 @@
 mb_wm_client_remove_transient (MBWindowManagerClient *client,
 			       MBWindowManagerClient *transient);
 
+void
+mb_wm_client_remove_all_transients (MBWindowManagerClient *client);
+
 MBWindowManagerClient*
 mb_wm_client_get_next_focused_client (MBWindowManagerClient *client);
 
@@ -336,6 +339,9 @@
 MBWindowManagerClient*
 mb_wm_client_get_transient_for (MBWindowManagerClient *client);
 
+gboolean
+mb_wm_client_is_system_modal (MBWindowManagerClient *client);
+
 const char*
 mb_wm_client_get_name (MBWindowManagerClient *client);
 

More information about the maemo-commits mailing list