[maemo-commits] [maemo-commits] r19275 - projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Aug 31 17:09:40 EEST 2009
Author: aendrodi
Date: 2009-08-31 17:09:29 +0300 (Mon, 31 Aug 2009)
New Revision: 19275

Modified:
   projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-window-manager.c
   projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client-base.c
   projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.c
   projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.h
Log:
giggle


Modified: projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-window-manager.c	2009-08-31 14:06:31 UTC (rev 19274)
+++ projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-window-manager.c	2009-08-31 14:09:29 UTC (rev 19275)
@@ -660,6 +660,7 @@
 			    void            *userdata)
 {
   MBWindowManager * wm = (MBWindowManager*)userdata;
+  MBWindowManagerClient * c;
 
   wm->xdpy_width = xev->width;
   wm->xdpy_height = xev->height;
@@ -676,6 +677,12 @@
     }
 #endif
 
+  /* Bastard hack part 2: now that the screen is reconfigured
+   * map and activate the client which caused us to rotate. */
+  for (c = wm->stack_top; c; c = c->stacked_below)
+    if (!mb_wm_client_is_map_confirmed (c) && c->window->portrait_on_map)
+      mb_wm_activate_client (wm, c);
+
   mb_wm_display_sync_queue (wm, MBWMSyncGeometry);
   return True;
 }
@@ -1063,39 +1070,6 @@
     {
       mb_wm_stack_ensure (wm);
 
-      /*
-       * If a freshly mapped client landed on the top of the window stack
-       * it is likely to receive focus and be activated, whatever the
-       * current state of the window manager is.  If it requests the
-       * desktop to be in p-mode switch now, before it really gets mapped,
-       * so the client window won't be mapped in lscape and needn't be
-       * reconfigured nor redrawn.
-       */
-      client = mb_wm_stack_get_highest_by_type (wm,
-                                MBWMClientTypeApp|MBWMClientTypeDialog);
-      if (client && !mb_wm_client_is_map_confirmed (client)
-          && client->window->portrait_on_map)
-        {
-          /*
-           * If @client is an application it covers the full application area,
-           * so it must be safe to rotate because no other client is exposed.
-           * Otherwise if @client is a dialog check if the request is a demand,
-           * in which case we must obey in any case.
-           */
-          if ((MB_WM_CLIENT_CLIENT_TYPE (client) & MBWMClientTypeApp)
-              || client->window->portrait_on_map > 1)
-            {
-              /* Go.  Note!  We're grabbing the server, is it a problem
-               * if we're blocking here for a few hundred milisecs? */
-              mb_wm_object_signal_emit (MB_WM_OBJECT (wm),
-                                 MBWindowManagerSignalPortraitForecast);
-
-              /* Reset the flag, so we won't bother the wm about it again. */
-              client->window->portrait_on_map = 0;
-            }
-
-        }
-
 #if ENABLE_COMPOSITE
       if (wm->comp_mgr && mb_wm_comp_mgr_enabled (wm->comp_mgr))
 	mb_wm_comp_mgr_restack (wm->comp_mgr);
@@ -1301,10 +1275,15 @@
     mb_wm_comp_mgr_register_client (wm->comp_mgr, client);
 #endif
 
-  if (activate && MB_WM_CLIENT_CLIENT_TYPE (client) != MBWMClientTypeDesktop)
+  if (!activate || MB_WM_CLIENT_CLIENT_TYPE (client) == MBWMClientTypeDesktop)
+    mb_wm_client_show (client);
+  else if (!mb_wm_client_wants_portrait(client))
     mb_wm_activate_client (wm, client);
   else
-    mb_wm_client_show (client);
+    /* Leave it up to the desktop to do something and we'll show
+     * and activate the client when the screen size changes. */
+    mb_wm_object_signal_emit (MB_WM_OBJECT (wm),
+                              MBWindowManagerSignalPortraitForecast);
 
   mb_wm_display_sync_queue (client->wmref, sync_flags);
 }

Modified: projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client-base.c
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client-base.c	2009-08-31 14:06:31 UTC (rev 19274)
+++ projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client-base.c	2009-08-31 14:09:29 UTC (rev 19275)
@@ -627,9 +627,9 @@
     }
 
   /*
-   * Sync up any geometry 
+   * Sync up any geometry.  Don't touch hidden (and not-yet-shown) clients.
    */
-  if (mb_wm_client_needs_geometry_sync (client))
+  if (mb_wm_client_is_mapped (client) && mb_wm_client_needs_geometry_sync (client))
     {
       int x, y, w, h;
       CARD32 wgeom[4];

Modified: projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.c	2009-08-31 14:06:31 UTC (rev 19274)
+++ projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.c	2009-08-31 14:09:29 UTC (rev 19275)
@@ -1221,3 +1221,26 @@
     right >= right_of_screen &&
     bottom >= bottom_of_screen;
 }
+
+/* Returns whether we're confident the newly mapped @client wants
+ * the screen to be rotated. */
+Bool
+mb_wm_client_wants_portrait (MBWindowManagerClient * client)
+{
+  if (!client->window->portrait_on_map)
+    /* Out of scope. */
+    return False;
+
+  if (!(MB_WM_CLIENT_CLIENT_TYPE (client)
+        & (MBWMClientTypeApp|MBWMClientTypeDialog)))
+    /* Only care about applications (full screen coverage) and dialogs. */
+    return False;
+
+  if ((MB_WM_CLIENT_CLIENT_TYPE (client) & MBWMClientTypeDialog)
+      && client->window->portrait_on_map < 2)
+    /* But only dialogs which demant rotation. */
+    return False;
+
+  /* If we cannot say for sure hd will decide. */
+  return True;
+}

Modified: projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.h
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.h	2009-08-31 14:06:31 UTC (rev 19274)
+++ projects/haf/branches/libmatchbox2/bug.134557.giggles/matchbox/core/mb-wm-client.h	2009-08-31 14:09:29 UTC (rev 19275)
@@ -436,6 +436,9 @@
 Bool
 mb_wm_client_covers_screen (MBWindowManagerClient * client);
 
+Bool
+mb_wm_client_wants_portrait (MBWindowManagerClient * client);
+
 static inline MBWMClientLayoutHints
 mb_wm_client_get_layout_hints (MBWindowManagerClient *client)
 {

More information about the maemo-commits mailing list