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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jul 17 07:42:01 EEST 2009
Author: tthurman
Date: 2009-07-17 07:41:57 +0300 (Fri, 17 Jul 2009)
New Revision: 18860

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-stack.c
Log:
	* matchbox/core/mb-wm-stack.c: If an application has non-application-modal
	windows stacked above application-modal windows, force the application-modal
	windows to the top; otherwise the application will appear to have locked up.
	Fixes NB#115408.



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-16 13:58:27 UTC (rev 18859)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-17 04:41:57 UTC (rev 18860)
@@ -1,3 +1,10 @@
+2009-07-17  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	* matchbox/core/mb-wm-stack.c: If an application has non-application-modal
+	windows stacked above application-modal windows, force the application-modal
+	windows to the top; otherwise the application will appear to have locked up.
+	Fixes NB#115408.
+
 2009-07-16  Adam Endrodi  <adam.endrodi at blumsoft.eu>
 
 	Debug macro and hooks to trace window moves and resizes.

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-stack.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-stack.c	2009-07-16 13:58:27 UTC (rev 18859)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-stack.c	2009-07-17 04:41:57 UTC (rev 18860)
@@ -141,6 +141,58 @@
 	}
     }
 
+  /* One more pass.  Check that no application has a non-modal window
+   * stacked above an application-modal window.  Fixes #115408.
+   */
+  client = wm->stack_bottom;
+  seen   = NULL;
+
+  while (client != seen && client != NULL)
+    {
+      gboolean should_move = FALSE;
+
+      next = client->stacked_above;
+
+      /* Is it application-modal? */
+
+      if (mb_wm_client_get_transient_for (client) &&
+	  mb_wm_client_is_modal (client))
+	{
+	  /* Yes.  Go looking for windows above it which
+	   * are owned by the same process but are not modal.
+	   */
+	  MBWMClientWindow  *modal_win     = client->window;
+	  const char        *modal_machine = modal_win->machine;
+	  pid_t              modal_pid     = modal_win->pid;
+	  MBWindowManagerClient *candidate = next;
+
+	  while (candidate && !should_move)
+	    {
+	      MBWMClientWindow  *candidate_win     = candidate->window;
+	      const char        *candidate_machine = candidate_win->machine;
+	      pid_t              candidate_pid     = candidate_win->pid;
+
+	      if (candidate_pid == modal_pid &&
+		  strcmp (candidate_machine, modal_machine) == 0 &&
+		  (!mb_wm_client_get_transient_for (candidate) || !mb_wm_client_is_modal (candidate) ))
+		{
+		  should_move = TRUE;
+		}
+	      else
+		candidate = candidate->stacked_above;
+	    }
+
+	  if (should_move)
+	    {
+	      if (seen == NULL)
+		seen = client;
+
+	      mb_wm_client_stack (client, 0);
+	    }
+	}
+      client = next;
+    }
+
 //  ENABLE ME WHEN YOU NEED ME
 // mb_wm_stack_dump (wm, "FINISH");
 }

More information about the maemo-commits mailing list