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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Sep 10 15:09:34 EEST 2009
Author: aendrodi
Date: 2009-09-10 15:09:20 +0300 (Thu, 10 Sep 2009)
New Revision: 19318

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.h
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
Log:
nivea2g


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-09-10 12:09:20 UTC (rev 19318)
@@ -1,3 +1,30 @@
+2009-09-10  Adam Endrodi  <adam.endrodi at blumsoft.eu>
+
+	NB#134557 Rotation suffers from too early mapping
+
+	nivea2g
+
+	* matchbox/core/mb-wm-types.h
+	* matchbox/core/mb-wm-atoms.c:
+	  Added _HILDON_PORTRAIT_MODE_REQUEST.
+	* matchbox/core/mb-wm-client-window.h:
+	  Added MBWMClientWindow::portrait_on_map.
+	* matchbox/core/mb-wm-client-window.c:
+	  Get the value of this property when the client is registerd
+	  (but don't keep it updated).
+	* matchbox/core/mb-wm-client.h
+	* matchbox/core/mb-wm-client.c:
+	  mb_wm_client_wants_portrait() added.
+	* matchbox/core/mb-window-manager.h:
+	  MBWindowManagerSignalPortraitForecast added.
+	* matchbox/core/mb-window-manager.c:
+	  * mb_wm_manage_client(): if mb_wm_client_wants_portrait()
+	    don't activate it but emit the signal.
+	  * mb_wm_handle_root_config_notify(): 
+	    Activate the first unmapped portrait-desiring client it finds.
+	* matchbox/core/mb-wm-client-base.c (mb_wm_client_base_display_sync):
+	  Don't move-resize unshown clients.
+
 2009-09-09  Gordon Williams <gordon.williams at collabora.co.uk>
 
 	Fixes: NB#119749 - Redundant exposure causing glitches on rotation

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-09-10 12:09:20 UTC (rev 19318)
@@ -660,11 +660,11 @@
 			    void            *userdata)
 {
   MBWindowManager * wm = (MBWindowManager*)userdata;
+  MBWindowManagerClient * c;
 
-  /* We get some spurious events from X here, so just make sure to ignore them
-   * or we spend ages checking window sizes on rotation. */
-  if (wm->xdpy_width == xev->width &&
-      wm->xdpy_height == xev->height)
+  /* We get some spurious events from X here, so just make sure
+   * to ignore them or we spend ages checking window sizes on rotation. */
+  if (wm->xdpy_width == xev->width && wm->xdpy_height == xev->height)
     return True;
 
   wm->xdpy_width = xev->width;
@@ -682,11 +682,16 @@
     }
 #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);
+        break;
+      }
+
   mb_wm_display_sync_queue (wm, MBWMSyncGeometry);
-
-  mb_wm_object_signal_emit (MB_WM_OBJECT (wm),
-                            MBWindowManagerSignalRootConfigure);
-
   return True;
 }
 
@@ -1278,10 +1283,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/trunk/libmatchbox2/matchbox/core/mb-window-manager.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.h	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.h	2009-09-10 12:09:20 UTC (rev 19318)
@@ -66,7 +66,7 @@
 typedef enum
 {
   MBWindowManagerSignalThemeChange = 1,
-  MBWindowManagerSignalRootConfigure, 
+  MBWindowManagerSignalPortraitForecast,
 } MBWindowManagerSignal;
 
 typedef enum

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c	2009-09-10 12:09:20 UTC (rev 19318)
@@ -107,6 +107,7 @@
     "_HILDON_WM_WINDOW_TYPE_ANIMATION_ACTOR",
     "_HILDON_WM_WINDOW_TYPE",
     "_HILDON_WM_WINDOW_TYPE_LEGACY_MENU",
+    "_HILDON_PORTRAIT_MODE_REQUEST",
 
     "_MAEMO_SUPPRESS_ROOT_RECONFIGURATION",
   };

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c	2009-09-10 12:09:20 UTC (rev 19318)
@@ -631,9 +631,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/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h	2009-09-10 12:09:20 UTC (rev 19318)
@@ -48,6 +48,7 @@
 #define MBWM_WINDOW_PROP_MWM_HINTS       (1<<18)
 #define MBWM_WINDOW_PROP_HILDON_STACKING (1<<19)
 #define MBWM_WINDOW_PROP_WIN_HILDON_TYPE (1<<20)
+#define MBWM_WINDOW_PROP_PORTRAIT_REQUEST (1<<21)
 
 #define MBWM_WINDOW_PROP_ALL        (0xffffffff)
 
@@ -161,6 +162,9 @@
 
   /* value of the atom _HILDON_STACKING_LAYER (1-10) */
   unsigned int                   hildon_stacking_layer;
+
+  /* value of _HILDON_PORTRAIT_MODE_REQUEST when the window was mapped */
+  unsigned                       portrait_on_map;
 };
 
 struct MBWMClientWindowClass

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-09-10 12:09:20 UTC (rev 19318)
@@ -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/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-09-10 12:09:20 UTC (rev 19318)
@@ -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)
 {

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-09-10 09:34:18 UTC (rev 19317)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-09-10 12:09:20 UTC (rev 19318)
@@ -305,6 +305,9 @@
   MBWM_ATOM_HILDON_WM_WINDOW_TYPE,
   MBWM_ATOM_HILDON_WM_WINDOW_TYPE_LEGACY_MENU,
 
+  /* See the description in hildon-desktop. */
+  MBWM_ATOM_HILDON_PORTRAIT_MODE_REQUEST,
+
   /*
    * This doesn't exactly suppress root reconfigs, but almost.
    * More importantly it enables/disables Expose event generation

More information about the maemo-commits mailing list