[maemo-commits] [maemo-commits] r19313 - in projects/haf/branches/libmatchbox2: . bug.134557.nivea2/matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Sep 9 18:37:31 EEST 2009
Author: aendrodi
Date: 2009-09-09 18:36:57 +0300 (Wed, 09 Sep 2009)
New Revision: 19313

Added:
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/
Modified:
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-window-manager.c
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-window-manager.h
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-atoms.c
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-base.c
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-window.c
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-window.h
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client.c
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client.h
   projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-types.h
Log:
0.2.63-1 + nivea2


Copied: projects/haf/branches/libmatchbox2/bug.134557.nivea2 (from rev 19312, projects/haf/tags/libmatchbox2/0.2.63-1)

Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-window-manager.c	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-window-manager.c	2009-09-09 15:36:57 UTC (rev 19313)
@@ -660,7 +660,13 @@
 			    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)
+    return True;
+
   wm->xdpy_width = xev->width;
   wm->xdpy_height = xev->height;
 
@@ -676,6 +682,15 @@
     }
 #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);
   return True;
 }
@@ -1268,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/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-window-manager.h
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-window-manager.h	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-window-manager.h	2009-09-09 15:36:57 UTC (rev 19313)
@@ -66,6 +66,7 @@
 typedef enum
 {
   MBWindowManagerSignalThemeChange = 1,
+  MBWindowManagerSignalPortraitForecast,
 } MBWindowManagerSignal;
 
 typedef enum

Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-atoms.c
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-wm-atoms.c	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-atoms.c	2009-09-09 15:36:57 UTC (rev 19313)
@@ -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/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-base.c
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-wm-client-base.c	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-base.c	2009-09-09 15:36:57 UTC (rev 19313)
@@ -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.nivea2/matchbox/core/mb-wm-client-window.c
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-wm-client-window.c	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-window.c	2009-09-09 15:36:57 UTC (rev 19313)
@@ -44,6 +44,7 @@
   COOKIE_WIN_MWM_HINTS,
   COOKIE_WIN_HILDON_STACKING,
   COOKIE_WIN_HILDON_TYPE,
+  COOKIE_WIN_PORTRAIT_REQUEST,
 
   N_COOKIES
 };
@@ -359,6 +360,13 @@
 	  	wm->atoms[MBWM_ATOM_HILDON_STACKING_LAYER]);
     }
 
+  if (props_req & MBWM_WINDOW_PROP_PORTRAIT_REQUEST)
+    {
+      cookies[COOKIE_WIN_PORTRAIT_REQUEST]
+	= mb_wm_property_cardinal_req (wm, xwin,
+	  	wm->atoms[MBWM_ATOM_HILDON_PORTRAIT_MODE_REQUEST]);
+    }
+
   {
     int err;
     /* FIXME: toggling 'offline' mode in power menu can cause X error here */
@@ -1166,6 +1174,41 @@
       changes |= MBWM_WINDOW_PROP_HILDON_STACKING;
     }
 
+  if (props_req & MBWM_WINDOW_PROP_PORTRAIT_REQUEST)
+    {
+      unsigned char *value = NULL;
+
+      mb_wm_property_reply (wm,
+			    cookies[COOKIE_WIN_PORTRAIT_REQUEST],
+			    &actual_type_return,
+			    &actual_format_return,
+			    &nitems_return,
+			    &bytes_after_return,
+			    &value,
+			    &x_error_code);
+
+      if (x_error_code
+	  || actual_type_return != XA_CARDINAL
+	  || actual_format_return != 32
+	  || value == NULL
+	  )
+	{
+          if (x_error_code == BadWindow)
+	    {
+              if (value)
+	        XFree(value);
+              goto badwindow_error;
+	    }
+	}
+      else
+        win->portrait_on_map = *(unsigned *)value;
+
+      if (value)
+	XFree(value);
+
+      changes |= MBWM_WINDOW_PROP_PORTRAIT_REQUEST;
+    }
+
   if (changes)
     mb_wm_object_signal_emit (MB_WM_OBJECT (win), changes);
 

Modified: projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-window.h
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-wm-client-window.h	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client-window.h	2009-09-09 15:36:57 UTC (rev 19313)
@@ -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/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-wm-client.c	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client.c	2009-09-09 15:36:57 UTC (rev 19313)
@@ -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.nivea2/matchbox/core/mb-wm-client.h
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-wm-client.h	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-client.h	2009-09-09 15:36:57 UTC (rev 19313)
@@ -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/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-types.h
===================================================================
--- projects/haf/tags/libmatchbox2/0.2.63-1/matchbox/core/mb-wm-types.h	2009-09-09 14:06:11 UTC (rev 19312)
+++ projects/haf/branches/libmatchbox2/bug.134557.nivea2/matchbox/core/mb-wm-types.h	2009-09-09 15:36:57 UTC (rev 19313)
@@ -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