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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Feb 3 09:28:00 EET 2009
Author: kihamala
Date: 2009-02-03 09:27:53 +0200 (Tue, 03 Feb 2009)
New Revision: 17346

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
Log:
assume _NET_WM_WINDOW_TYPE_NORMAL type for some typeless windows


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-02-02 15:34:23 UTC (rev 17345)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-02-03 07:27:53 UTC (rev 17346)
@@ -1,3 +1,12 @@
+2009-02-03  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
+
+	* matchbox/core/mb-wm-client-window.c
+	(mb_wm_client_window_sync_properties): Collect window attributes and
+	transiency information before determining the window type. Use
+	_NET_WM_WINDOW_TYPE_NORMAL type for typeless managed non-transient
+	windows and for typeless override-redirect windows as the FDO wm-spec
+	specifies. (This avoids the Maemoblocks crash.)
+
 2009-02-02  Adam Endrodi  <adam.endrodi at blumsoft.eu>
 
 	* matchbox/core/mb-window-manager.c (mb_adjust_dialog_title_position):

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-02-02 15:34:23 UTC (rev 17345)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-02-03 07:27:53 UTC (rev 17346)
@@ -348,6 +348,60 @@
   /* bundle all pending requests to server and wait for replys */
   XSync(wm->xdpy, False);
 
+  if (props_req & MBWM_WINDOW_PROP_TRANSIENCY)
+    {
+      Window *trans_win = NULL;
+
+      trans_win
+	= mb_wm_property_get_reply_and_validate (wm,
+						 cookies[COOKIE_WIN_TRANSIENCY],
+						 MBWM_ATOM_WM_TRANSIENT_FOR,
+						 32,
+						 1,
+						 NULL,
+						 &x_error_code);
+
+      if (x_error_code == BadWindow)
+        goto badwindow_error;
+
+      if (trans_win)
+	{
+	  MBWM_DBG("@@@ Window transient for %lx @@@", *trans_win);
+
+	  if (*trans_win != win->xwin_transient_for)
+	    changes |= MBWM_WINDOW_PROP_TRANSIENCY;
+
+	  win->xwin_transient_for = *trans_win;
+	  XFree(trans_win);
+	}
+      else MBWM_DBG("@@@ Window transient for nothing @@@");
+
+      changes |= MBWM_WINDOW_PROP_TRANSIENCY;
+    }
+
+  if (props_req & MBWM_WINDOW_PROP_ATTR)
+    {
+      xwin_attr = mb_wm_xwin_get_attributes_reply (wm,
+						   cookies[COOKIE_WIN_ATTR],
+						   &x_error_code);
+
+      if (!xwin_attr || x_error_code)
+	{
+	  MBWM_DBG("### Warning Get Attr Failed ( %i ) ###", x_error_code);
+
+          if (x_error_code == BadWindow)
+            goto badwindow_error;
+
+	  goto abort;
+	}
+
+      win->visual            = xwin_attr->visual;
+      win->colormap          = xwin_attr->colormap;
+      win->gravity           = xwin_attr->win_gravity;
+      win->override_redirect = xwin_attr->override_redirect;
+      win->window_class      = xwin_attr->class;
+    }
+
   if (props_req & MBWM_WINDOW_PROP_WIN_TYPE)
     {
       mb_wm_property_reply (wm,
@@ -366,9 +420,25 @@
 	  || result_atom == NULL
 	  )
 	{
-	  MBWM_DBG("### Warning net type prop failed ###");
+	  g_debug ("%s: ### Warning net type prop failed ###", __FUNCTION__);
 	  if (x_error_code == BadWindow)
 	    goto badwindow_error;
+
+          /* FDO wm-spec says that managed windows without type and without
+           * TRANSIENT_FOR must be taken as _NET_WM_WINDOW_TYPE_NORMAL. Also,
+           * override-redirect windows without type must be taken as such. */
+          if (!win->override_redirect && win->xwin_transient_for == None)
+            {
+	      g_debug ("%s: managed, non-transient window without a type",
+                       __FUNCTION__);
+	      win->net_type = wm->atoms[MBWM_ATOM_NET_WM_WINDOW_TYPE_NORMAL];
+            }
+          else if (win->override_redirect)
+            {
+	      g_debug ("%s: override-redirect window without a type",
+                       __FUNCTION__);
+	      win->net_type = wm->atoms[MBWM_ATOM_NET_WM_WINDOW_TYPE_NORMAL];
+            }
 	}
       else
 	{
@@ -496,29 +566,6 @@
       win->geometry = win->x_geometry;
     }
 
-  if (props_req & MBWM_WINDOW_PROP_ATTR)
-    {
-      xwin_attr = mb_wm_xwin_get_attributes_reply (wm,
-						   cookies[COOKIE_WIN_ATTR],
-						   &x_error_code);
-
-      if (!xwin_attr || x_error_code)
-	{
-	  MBWM_DBG("### Warning Get Attr Failed ( %i ) ###", x_error_code);
-
-          if (x_error_code == BadWindow)
-            goto badwindow_error;
-
-	  goto abort;
-	}
-
-      win->visual            = xwin_attr->visual;
-      win->colormap          = xwin_attr->colormap;
-      win->gravity           = xwin_attr->win_gravity;
-      win->override_redirect = xwin_attr->override_redirect;
-      win->window_class      = xwin_attr->class;
-    }
-
   if (props_req & MBWM_WINDOW_PROP_NAME)
     {
       if (win->name)
@@ -669,37 +716,6 @@
 	}
     }
 
-  if (props_req & MBWM_WINDOW_PROP_TRANSIENCY)
-    {
-      Window *trans_win = NULL;
-
-      trans_win
-	= mb_wm_property_get_reply_and_validate (wm,
-						 cookies[COOKIE_WIN_TRANSIENCY],
-						 MBWM_ATOM_WM_TRANSIENT_FOR,
-						 32,
-						 1,
-						 NULL,
-						 &x_error_code);
-
-      if (x_error_code == BadWindow)
-        goto badwindow_error;
-
-      if (trans_win)
-	{
-	  MBWM_DBG("@@@ Window transient for %lx @@@", *trans_win);
-
-	  if (*trans_win != win->xwin_transient_for)
-	    changes |= MBWM_WINDOW_PROP_TRANSIENCY;
-
-	  win->xwin_transient_for = *trans_win;
-	  XFree(trans_win);
-	}
-      else MBWM_DBG("@@@ Window transient for nothing @@@");
-
-      changes |= MBWM_WINDOW_PROP_TRANSIENCY;
-    }
-
   if (props_req & MBWM_WINDOW_PROP_PROTOS)
     {
       mb_wm_property_reply (wm,


More information about the maemo-commits mailing list