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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Sat Jun 13 02:32:27 EEST 2009
Author: tthurman
Date: 2009-06-13 02:32:17 +0300 (Sat, 13 Jun 2009)
New Revision: 18720

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
Log:
        NB#118850
	* matchbox/core/mb-window-manager.c: When a window is unmapped,
	check whether each window below it wants focus and is visible
	in order to find the window which should be focussed next.
	* matchbox/core/mb-wm-client.[ch]: Add functions to get whether
	a window is visible, and whether a window covers the screen.



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-06-12 16:50:31 UTC (rev 18719)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-06-12 23:32:17 UTC (rev 18720)
@@ -1,3 +1,13 @@
+2009-06-12  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+        NB#118850
+
+	* matchbox/core/mb-window-manager.c: When a window is unmapped,
+	check whether each window below it wants focus and is visible
+	in order to find the window which should be focussed next.
+	* matchbox/core/mb-wm-client.[ch]: Add functions to get whether
+	a window is visible, and whether a window covers the screen.
+
 2009-06-11  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	* matchbox/client-types/mb-wm-client-menu.c (mb_wm_client_menu_init):

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-06-12 16:50:31 UTC (rev 18719)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-06-12 23:32:17 UTC (rev 18720)
@@ -2093,11 +2093,20 @@
 
       mb_wm_stack_enumerate_reverse (wm, c)
 	{
-	  if (c != client && mb_wm_client_want_focus (c))
+	  if (c != client &&
+	      mb_wm_client_want_focus (c) &&
+	      mb_wm_client_is_visible (c))
 	    {
 	      next = c;
 	      break;
 	    }
+	  if (mb_wm_client_covers_screen (c))
+	    {
+	      /* anything below this is necessarily
+	       * invisible
+	       */
+	      break;
+	    }
 	}
     }
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-06-12 16:50:31 UTC (rev 18719)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-06-12 23:32:17 UTC (rev 18720)
@@ -1121,3 +1121,51 @@
   client->priv->hiding_from_desktop = False;
 }
 
+/**
+ * Returns true iff the client is visible: it must be
+ * mapped, not hiding from the desktop, and at least
+ * partially onscreen.
+ * Does not check whether it's obscured by a higher
+ * window (should it?)
+ */
+Bool
+mb_wm_client_is_visible (MBWindowManagerClient * client)
+{
+  MBGeometry geometry;
+  MBWindowManager *wm = client->wmref;
+
+  mb_wm_client_get_coverage (client, &geometry);
+  
+  return
+    mb_wm_client_is_mapped (client) &&
+    !mb_wm_client_is_hiding_from_desktop (client) &&
+    geometry.x < wm->xdpy_width &&
+    geometry.y < wm->xdpy_height &&
+    geometry.x+geometry.width >= 0 &&
+    geometry.y+geometry.height >= 0;
+}
+
+/**
+ * Returns true iff the client (including its frame)
+ * covers at least the whole screen: it must be either
+ * maximised or fullscreen.
+ */
+Bool
+mb_wm_client_covers_screen (MBWindowManagerClient * client)
+{
+  MBGeometry geometry;
+  MBWindowManager *wm = client->wmref;
+  int right, bottom,
+    right_of_screen = wm->xdpy_width,
+    bottom_of_screen = wm->xdpy_height;
+
+  mb_wm_client_get_coverage (client, &geometry);
+  right = geometry.x+geometry.width;
+  bottom = geometry.y+geometry.height;
+
+  return
+    geometry.x <= 0 &&
+    geometry.y <= 0 &&    
+    right >= right_of_screen &&
+    bottom >= bottom_of_screen;
+}

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-06-12 16:50:31 UTC (rev 18719)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-06-12 23:32:17 UTC (rev 18720)
@@ -417,4 +417,10 @@
 void
 mb_wm_client_reset_hiding_from_desktop (MBWindowManagerClient * client);
 
+Bool
+mb_wm_client_is_visible (MBWindowManagerClient * client);
+
+Bool
+mb_wm_client_covers_screen (MBWindowManagerClient * client);
+
 #endif

More information about the maemo-commits mailing list