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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Aug 31 13:03:59 EEST 2009
Author: aendrodi
Date: 2009-08-31 13:03:36 +0300 (Mon, 31 Aug 2009)
New Revision: 19261

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-window.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
Log:
	* matchbox/core/mb-wm-client-window.c
	* matchbox/core/mb-wm-client-window.h
	* matchbox/core/mb-wm-types.h
	* matchbox/core/mb-wm-atoms.c:
	  Get _HILDON_PORTRAIT_MODE_REQUEST of windows when they're mapped.
	* matchbox/core/mb-window-manager.h
	* matchbox/core/mb-window-manager.c:
	  Emit MBWindowManagerSignalPortraitForecast if the window being
	  mapped has _HILDON_PORTRAIT_MODE_REQUEST.


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-08-31 09:57:37 UTC (rev 19260)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-08-31 10:03:36 UTC (rev 19261)
@@ -1,3 +1,15 @@
+2009-08-30  Adam Endrodi  <adam.endrodi at blumsoft.eu>
+
+	* matchbox/core/mb-wm-client-window.c
+	* matchbox/core/mb-wm-client-window.h
+	* matchbox/core/mb-wm-types.h
+	* matchbox/core/mb-wm-atoms.c:
+	  Get _HILDON_PORTRAIT_MODE_REQUEST of windows when they're mapped.
+	* matchbox/core/mb-window-manager.h
+	* matchbox/core/mb-window-manager.c:
+	  Emit MBWindowManagerSignalPortraitForecast if the window being
+	  mapped has _HILDON_PORTRAIT_MODE_REQUEST.
+
 2009-08-29  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	Fixes for automatic non-compositing feature and NB#135950.

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-08-31 09:57:37 UTC (rev 19260)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-08-31 10:03:36 UTC (rev 19261)
@@ -1063,6 +1063,39 @@
     {
       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);

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.h	2009-08-31 09:57:37 UTC (rev 19260)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.h	2009-08-31 10:03:36 UTC (rev 19261)
@@ -66,6 +66,7 @@
 typedef enum
 {
   MBWindowManagerSignalThemeChange = 1,
+  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-08-31 09:57:37 UTC (rev 19260)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-atoms.c	2009-08-31 10:03:36 UTC (rev 19261)
@@ -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-window.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-08-31 09:57:37 UTC (rev 19260)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-08-31 10:03:36 UTC (rev 19261)
@@ -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/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h	2009-08-31 09:57:37 UTC (rev 19260)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.h	2009-08-31 10:03:36 UTC (rev 19261)
@@ -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-types.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-08-31 09:57:37 UTC (rev 19260)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-08-31 10:03:36 UTC (rev 19261)
@@ -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