[maemo-commits] [maemo-commits] r19223 - in projects/haf/branches/libmatchbox2/bug.134557: . debian matchbox/comp-mgr matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Aug 27 16:13:09 EEST 2009
Author: aendrodi
Date: 2009-08-27 16:13:01 +0300 (Thu, 27 Aug 2009)
New Revision: 19223

Modified:
   projects/haf/branches/libmatchbox2/bug.134557/ChangeLog
   projects/haf/branches/libmatchbox2/bug.134557/debian/changelog
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.h
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.c
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.h
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-atoms.c
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-client-window.c
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-client-window.h
   projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-types.h
Log:
updated with trunk + latest patch


Modified: projects/haf/branches/libmatchbox2/bug.134557/ChangeLog
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/ChangeLog	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/ChangeLog	2009-08-27 13:13:01 UTC (rev 19223)
@@ -1,3 +1,14 @@
+2009-08-26  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
+
+	Release 0.2.58
+
+	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.[ch]
+	(mb_wm_comp_mgr_clutter_set_client_redirection): Make public and
+	(un)redirect child windows as well.
+	(mb_wm_comp_mgr_clutter_handle_damage): Track damage based on new
+	'damage_handling_off' priv member.
+	Almost Fixes: NB#126626
+
 2009-08-19  Adam Endrodi  <adam.endrodi at blumsoft.eu>
 
 	Made frequently used functions inline.  Based on measurements

Modified: projects/haf/branches/libmatchbox2/bug.134557/debian/changelog
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/debian/changelog	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/debian/changelog	2009-08-27 13:13:01 UTC (rev 19223)
@@ -1,9 +1,16 @@
-matchbox-window-manager-2 (0.2.58-1~unreleased) unstable; urgency=low
+matchbox-window-manager-2 (0.2.59-1~unreleased) unstable; urgency=low
 
   * foo
 
- -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Wed, 19 Aug 2009 13:28:26 +0300
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Wed, 26 Aug 2009 18:54:09 +0300
 
+matchbox-window-manager-2 (0.2.58-1) unstable; urgency=low
+
+  * Fixes: NB#126626 - Switching between non/composite modes, make screen
+    blank for short time  (not a complete fix but improvement)
+
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Wed, 26 Aug 2009 18:52:04 +0300
+
 matchbox-window-manager-2 (0.2.57-1) unstable; urgency=low
 
   * Downgrade bogus g_warning to g_debug.

Modified: projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-08-27 13:13:01 UTC (rev 19223)
@@ -75,6 +75,7 @@
   unsigned int            flags;
   Bool                    fullscreen;
   Damage                  window_damage;
+  Bool                    damage_handling_off;
   Bool                    bound;
 
   /* have we been unmapped - if so we need to re-create our texture when
@@ -162,16 +163,30 @@
 
 /* Clutter sets XComposite redirection for windows corresponding to textures;
  * this function is used to toggle redirection within Clutter. */
-void  __attribute__ ((visibility("hidden")))
+void
 mb_wm_comp_mgr_clutter_set_client_redirection (MBWMCompMgrClient *client,
                                                gboolean setting)
 {
   MBWMCompMgrClutterClient *cclient = MB_WM_COMP_MGR_CLUTTER_CLIENT(client);
 
+  mb_wm_util_trap_x_errors ();
+  XGrabServer (client->wm->xdpy);
   if (cclient->priv->texture)
     clutter_x11_texture_pixmap_set_redirection (
           CLUTTER_X11_TEXTURE_PIXMAP (cclient->priv->texture),
           setting);
+
+  if (setting && client->wm_client)
+    XCompositeRedirectSubwindows (client->wm->xdpy,
+                                  client->wm_client->xwin_frame,
+                                  CompositeRedirectManual);
+  else if (client->wm_client)
+    XCompositeUnredirectSubwindows (client->wm->xdpy,
+                                    client->wm_client->xwin_frame,
+                                    CompositeRedirectManual);
+  XSync (client->wm->xdpy, False);
+  XUngrabServer (client->wm->xdpy);
+  mb_wm_util_untrap_x_errors ();
 }
 
 /**
@@ -195,11 +210,6 @@
   if (!(cclient->priv->flags & MBWMCompMgrClutterClientMapped))
     return;
 
-  Bool fullscreen;
-
-  fullscreen = mb_wm_client_window_is_state_set (
-      wm_client->window, MBWMClientWindowEWMHStateFullscreen);
-
   xwin = wm_client->window->xwindow;
 
   mb_wm_comp_mgr_clutter_client_set_size(cclient, FALSE);
@@ -739,7 +749,7 @@
 
   MBWM_NOTE (COMPOSITOR, "REPAIRING %lx", client->wm_client->window->xwindow);
 
-  if (!cclient->priv->actor)
+  if (!cclient->priv->actor || cclient->priv->damage_handling_off)
     return;
 
   if (!cclient->priv->bound)
@@ -812,18 +822,23 @@
 {
   MBWindowManager           * wm   = mgr->wm;
   MBWindowManagerClient     * c;
-  Damage                      damage;
+  MBWMCompMgrClutterClient  * cclient;
 
-  if (wm->non_redirection)
-    /* avoid some Clutter/EGL errors when in non-composited mode */
-    return False;
-
   c = mb_wm_managed_client_from_frame (wm, de->drawable);
+  if (!c || !c->cm_client)
+    {
+      MBWM_NOTE (COMPOSITOR, "Failed to find client for window %lx\n",
+                 de->drawable);
+      g_debug ("Failed to find client for window %lx\n",
+               de->drawable);
+      return False;
+    }
 
-  if (c && c->cm_client)
+  cclient = MB_WM_COMP_MGR_CLUTTER_CLIENT (c->cm_client);
+
+  if (!cclient->priv->damage_handling_off)
     {
-      MBWMCompMgrClutterClient *cclient =
-	MB_WM_COMP_MGR_CLUTTER_CLIENT (c->cm_client);
+      Damage damage;
       int err;
 
 /* We ignore the DontUpdate flag for i386, as it uses the X11 Texture Pixmap
@@ -862,13 +877,6 @@
       if ((err = mb_wm_util_untrap_x_errors ()))
         g_debug ("%s: X error %d", __func__, err);
     }
-  else
-    {
-      MBWM_NOTE (COMPOSITOR, "Failed to find client for window %lx\n",
-		 de->drawable);
-      g_debug ("Failed to find client for window %lx\n",
-		 de->drawable);
-    }
 
   return False;
 }
@@ -1007,11 +1015,14 @@
   MBWindowManager *wm = MB_WM_COMP_MGR_CLIENT (cclient)->wm;
   MBWindowManagerClient *c = MB_WM_COMP_MGR_CLIENT (cclient)->wm_client;
 
-  /* printf ("%s: client win %lx\n", __func__,
+  /* g_printerr ("%s: client win %lx\n", __func__,
           c && c->window ? c->window->xwindow : 0); */
 
-  if (track_damage)
+  if (track_damage && (cclient->priv->damage_handling_off
+                       || !cclient->priv->window_damage))
     {
+      cclient->priv->damage_handling_off = False;
+
       if (!cclient->priv->window_damage)
         {
           cclient->priv->window_damage = XDamageCreate (wm->xdpy,
@@ -1036,25 +1047,33 @@
                 }
             }
         }
+      else
+        {
+          mb_wm_comp_mgr_clutter_fetch_texture (
+                                MB_WM_COMP_MGR_CLIENT (cclient));
+          XDamageSubtract (wm->xdpy, cclient->priv->window_damage, None, None);
+        }
     }
-  else if (cclient->priv->window_damage)
+  else if (!track_damage)
     {
-      int err;
+      if (cclient->priv->window_damage)
+        {
+          int err;
+          mb_wm_util_trap_x_errors();
+          XDamageDestroy (wm->xdpy, cclient->priv->window_damage);
+          XSync (wm->xdpy, False);
+          if ((err = mb_wm_util_untrap_x_errors()) != 0)
+            g_debug ("XDamageDestroy(0x%lx) for %p: %d",
+                     cclient->priv->window_damage, c, err);
+          cclient->priv->window_damage = 0;
+        }
 
-      /* Sing after me: "untrap" without XSync() is un*re*li*ab*le! */
-      mb_wm_util_trap_x_errors();
-      XDamageDestroy (wm->xdpy, cclient->priv->window_damage);
-      XSync (wm->xdpy, False);
-      if ((err = mb_wm_util_untrap_x_errors()) != 0)
-        g_debug ("XDamageDestroy(0x%lx) for %p: %d",
-                 cclient->priv->window_damage, c, err);
-      cclient->priv->window_damage = 0;
-
       if (cclient->priv->texture)
         /* release the window in Clutter */
         clutter_x11_texture_pixmap_set_window (
                 CLUTTER_X11_TEXTURE_PIXMAP (cclient->priv->texture),
                 0, FALSE);
+      cclient->priv->damage_handling_off = True;
     }
 }
 

Modified: projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.h
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.h	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.h	2009-08-27 13:13:01 UTC (rev 19223)
@@ -123,7 +123,7 @@
 ClutterActor *
 mb_wm_comp_mgr_clutter_get_arena (MBWMCompMgrClutter *cmgr);
 
-void  __attribute__ ((visibility("hidden")))
+void
 mb_wm_comp_mgr_clutter_set_client_redirection (MBWMCompMgrClient *client,
                                                gboolean setting);
 

Modified: projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.c	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.c	2009-08-27 13:13:01 UTC (rev 19223)
@@ -1056,6 +1056,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);
@@ -1218,24 +1251,6 @@
   mb_wm_client_stack(client, 0);
   mb_wm_update_root_win_lists (wm);
 
-  if (client == wm->stack_top && !client->transient_for && MB_WM_CLIENT_CLIENT_TYPE (client) & (MBWMClientTypeApp | MBWMClientTypeDialog))
-    {
-      Atom foo;
-      int bar;
-      unsigned long baz;
-      unsigned char *req;
-
-      if (XGetWindowProperty (wm->xdpy, client->window->xwindow, XInternAtom (wm->xdpy, "_HILDON_PORTRAIT_MODE_REQUEST", False), 0, 4, False, XA_CARDINAL, &foo, &bar, &baz, &baz, &req) == Success && foo == XA_CARDINAL && *(unsigned *)req)
-        {
-          if ((MB_WM_CLIENT_CLIENT_TYPE (client) & MBWMClientTypeApp) || *(unsigned *)req > 1)
-            {
-              extern void hd_transition_rotate_screen (MBWindowManager *, gboolean);
-              hd_transition_rotate_screen (wm, TRUE);
-            }
-          XFree(req);
-        }
-    }
-
   if (MB_WM_CLIENT_CLIENT_TYPE (client) == MBWMClientTypePanel)
     {
       mb_wm_update_root_win_rectangles (wm);

Modified: projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.h
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.h	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-window-manager.h	2009-08-27 13:13:01 UTC (rev 19223)
@@ -66,6 +66,7 @@
 typedef enum
 {
   MBWindowManagerSignalThemeChange = 1,
+  MBWindowManagerSignalPortraitForecast,
 } MBWindowManagerSignal;
 
 typedef enum

Modified: projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-atoms.c
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-atoms.c	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-atoms.c	2009-08-27 13:13:01 UTC (rev 19223)
@@ -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/matchbox/core/mb-wm-client-window.c
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-client-window.c	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-client-window.c	2009-08-27 13:13:01 UTC (rev 19223)
@@ -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/matchbox/core/mb-wm-client-window.h
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-client-window.h	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-client-window.h	2009-08-27 13:13:01 UTC (rev 19223)
@@ -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/matchbox/core/mb-wm-types.h
===================================================================
--- projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-types.h	2009-08-27 13:07:28 UTC (rev 19222)
+++ projects/haf/branches/libmatchbox2/bug.134557/matchbox/core/mb-wm-types.h	2009-08-27 13:13:01 UTC (rev 19223)
@@ -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