[maemo-commits] [maemo-commits] r17798 - in projects/haf/trunk/libmatchbox2: . matchbox/comp-mgr matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Mar 25 14:21:07 EET 2009
Author: kihamala
Date: 2009-03-25 14:21:03 +0200 (Wed, 25 Mar 2009)
New Revision: 17798

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
   projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-xrender.c
   projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr.h
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
Log:
revert stuff and add explanation for it


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-03-25 12:21:03 UTC (rev 17798)
@@ -1,3 +1,14 @@
+2009-03-25  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
+
+	Revert Thomas' event handler changes, because it makes HD to crash
+	easily when pressing the close button. Needs more work to fix the
+	issue --- maybe some handler works only because it was not called?
+
+	* matchbox/core/mb-wm-client-window.c: Revert Thomas' transiency
+	setting because it wasn't working for stackable windows, and add a
+	note for it. For stackables, the transiency is set at mapping and
+	unmapping time.
+
 2009-03-24  Thomas Thurman  <thomas.thurman at collabora.co.uk>
 
 	Event handlers now return void and cannot stop processing
@@ -3,5 +14,5 @@
 	of further events.
 	Accoding to Kimmo:
-	Fixes NB#105014.
+	Fixes NB#105014. (Kimmo: didn't quite, see above...)
 
 	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c:

Modified: projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-03-25 12:21:03 UTC (rev 17798)
@@ -455,7 +455,7 @@
 mb_wm_comp_mgr_clutter_select_desktop (MBWMCompMgr * mgr,
 				       int desktop, int old_desktop);
 
-static void
+static Bool
 mb_wm_comp_mgr_clutter_handle_damage (XDamageNotifyEvent * de,
 				      MBWMCompMgr        * mgr);
 
@@ -739,7 +739,7 @@
   mb_wm_comp_mgr_clutter_client_set_size(cclient, FALSE);
 }
 
-static void
+static Bool
 mb_wm_comp_mgr_clutter_handle_damage (XDamageNotifyEvent * de,
 				      MBWMCompMgr        * mgr)
 {
@@ -756,7 +756,7 @@
 
       if (!cclient->priv->actor ||
 	  (cclient->priv->flags & MBWMCompMgrClutterClientDontUpdate))
-	return;
+	return False;
 
       MBWM_NOTE (COMPOSITOR,
 		 "Repairing window %lx, geometry %d,%d;%dx%d; more %d\n",
@@ -781,6 +781,8 @@
       g_debug ("Failed to find client for window %lx\n",
 		 de->drawable);
     }
+
+  return False;
 }
 
 static void

Modified: projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-xrender.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-xrender.c	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-xrender.c	2009-03-25 12:21:03 UTC (rev 17798)
@@ -380,7 +380,7 @@
 static void
 mb_wm_comp_mgr_xrender_render_real (MBWMCompMgr *mgr);
 
-static void
+static Bool
 mb_wm_comp_mgr_xrender_handle_damage (XDamageNotifyEvent * de,
 				      MBWMCompMgr        * mgr);
 
@@ -1346,7 +1346,7 @@
   mb_wm_comp_mgr_xrender_add_damage (mgr, damage);
 }
 
-static void
+static Bool
 mb_wm_comp_mgr_xrender_handle_damage (XDamageNotifyEvent * de,
 				      MBWMCompMgr        * mgr)
 {

Modified: projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr.h	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr.h	2009-03-25 12:21:03 UTC (rev 17798)
@@ -60,7 +60,7 @@
   void   (*restack)           (MBWMCompMgr * mgr);
   void   (*map_notify)        (MBWMCompMgr * mgr, MBWindowManagerClient *c);
   void   (*unmap_notify)      (MBWMCompMgr * mgr, MBWindowManagerClient *c);
-  void   (*handle_damage)     (XDamageNotifyEvent * xev, MBWMCompMgr * mgr);
+  Bool   (*handle_damage)     (XDamageNotifyEvent * xev, MBWMCompMgr * mgr);
   Bool   (*my_window)         (MBWMCompMgr * mgr, Window xwin);
   void   (*client_event)      (MBWMCompMgr * mgr,
 			       MBWindowManagerClient *c1,

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-03-25 12:21:03 UTC (rev 17798)
@@ -373,7 +373,7 @@
   return wm;
 }
 
-static void
+static Bool
 mb_wm_handle_key_press (XKeyEvent       *xev,
 			void            *userdata)
 {
@@ -382,21 +382,23 @@
   mb_wm_keys_press (wm,
 		    XKeycodeToKeysym(wm->xdpy, xev->keycode, 0),
 		    xev->state);
+
+  return True;
 }
 
-static void
+static Bool
 mb_wm_handle_button_press (XButtonEvent *xev, void *userdata)
 {
   MBWindowManager *wm = (MBWindowManager*)userdata;
   MBWindowManagerClient *client = NULL;
 
   if (xev->button != 1)
-    return;
+    return True;
 
   mb_wm_is_my_window (wm, xev->window, &client);
 
   if (!client)
-    return;
+    return True;
 
   /*
    * If the client is not application, we make sure it has focus.
@@ -418,9 +420,11 @@
     }
 
   XAllowEvents (wm->xdpy, ReplayPointer, CurrentTime);
+
+  return True;
 }
 
-static void
+static Bool
 mb_wm_handle_destroy_notify (XDestroyWindowEvent  *xev,
 			     void                 *userdata)
 {
@@ -459,9 +463,11 @@
       else
 	mb_wm_unmanage_client (wm, client, True);
     }
+
+  return True;
 }
 
-static void
+static Bool
 mb_wm_handle_unmap_notify (XUnmapEvent          *xev,
 			   void                 *userdata)
 {
@@ -472,7 +478,7 @@
 
   /* Ignoring syntetic events, not even decrementing the skip_unmaps counter. */
   if (xev->send_event) 
-    return;
+    return True;
   
   /*
    * When the XCompositeRedirectWindow() is used we get an extra unmap event
@@ -480,7 +486,7 @@
    * with the xany.window set to the parent window.
    */
   if (xev->window == xev->event) 
-    return;
+    return True;
 
   client = mb_wm_managed_client_from_xwindow(wm, xev->window);
 
@@ -538,9 +544,11 @@
 	    }
 	}
     }
+
+  return True;
 }
 
-static void
+static Bool
 mb_wm_handle_property_notify (XPropertyEvent          *xev,
 			      void                    *userdata)
 {
@@ -565,20 +573,20 @@
 			      (unsigned char **)&theme_path);
 
 	  if (!type || !items)
-	    return;
+	    return True;
 
 	  mb_wm_set_theme_from_path (wm, theme_path);
 
 	  XFree (theme_path);
 	}
 
-      return;
+      return True;
     }
 
   client = mb_wm_managed_client_from_xwindow(wm, xev->window);
 
   if (!client)
-    return;
+    return True;
 
   if (xev->atom == wm->atoms[MBWM_ATOM_NET_WM_USER_TIME])
     flag = MBWM_WINDOW_PROP_NET_USER_TIME;
@@ -606,11 +614,11 @@
   if (flag)
     mb_wm_client_window_sync_properties (client->window, flag);
 
-  return;
+  return True;
 }
 
 #if ENABLE_COMPOSITE
-static void
+static  Bool
 mb_wm_handle_composite_config_notify (XConfigureEvent *xev,
 			    void            *userdata)
 {
@@ -625,7 +633,7 @@
       if (client)
 	mb_wm_comp_mgr_client_configure (client->cm_client);
     }
-  return;
+  return True;
 }
 #endif
 
@@ -633,7 +641,7 @@
  * This is called if the root window resizes itself, which happens when RANDR is
  * used to resize or rotate the display.
  */
-static void
+static  Bool
 mb_wm_handle_root_config_notify (XConfigureEvent *xev,
 			    void            *userdata)
 {
@@ -655,9 +663,10 @@
 #endif
 
   mb_wm_display_sync_queue (wm, MBWMSyncGeometry);
+  return True;
 }
 
-static void
+static  Bool
 mb_wm_handle_config_request (XConfigureRequestEvent *xev,
 			     void                   *userdata)
 {
@@ -689,7 +698,7 @@
 
       XConfigureWindow (wm->xdpy, xev->window, xev->value_mask, &xwc);
 
-      return;
+      return True;
     }
 
   value_mask = xev->value_mask;
@@ -720,6 +729,8 @@
 				     &req_geom,
 				     MBWMClientReqGeomIsViaConfigureReq);
     }
+
+  return True;
 }
 
 /*
@@ -764,7 +775,7 @@
 /*  For the compositing engine we need to track overide redirect
  *  windows so the compositor can paint them.
  */
-static void
+static Bool
 mb_wm_handle_map_notify   (XMapEvent  *xev,
 			   void       *userdata)
 {
@@ -779,12 +790,12 @@
 
   /* For the same reason as in mb_wm_handle_unmap_notify(). */
   if (xev->window == xev->event) 
-    return;
+    return True;
 
   if (!wm_class->client_new)
     {
       MBWM_DBG("### No new client hook exists ###");
-      return;
+      return True;
     }
 
   if (mb_wm_is_my_window (wm, xev->window, &client))
@@ -817,7 +828,7 @@
 	    }
 	}
 
-      return;
+      return True;
     }
 
   XGetWindowAttributes(wm->xdpy, xev->window, &attrs);
@@ -825,7 +836,7 @@
     {
       g_debug ("%s: unmap for %lx has happened after MapRequest",
                __FUNCTION__, xev->window);
-      return;
+      return True;
     }
 
   win = mb_wm_client_window_new (wm, xev->window);
@@ -833,13 +844,13 @@
   if (!win)
     {
       g_debug ("%s: mb_wm_client_window_new failed", __FUNCTION__);
-      return;
+      return True;
     }
 
   if (win->window_class == InputOnly)
     {
       mb_wm_object_unref (MB_WM_OBJECT (win));
-      return;
+      return True;
     }
 
   client = wm_class->client_new (wm, win);
@@ -847,15 +858,17 @@
   if (!client)
     {
       mb_wm_object_unref (MB_WM_OBJECT (win));
-      return;
+      return True;
     }
 
   mb_wm_manage_client (wm, client, True);
   mb_wm_comp_mgr_map_notify (wm->comp_mgr, client);
+
+  return True;
 }
 #endif
 
-static void
+static Bool
 mb_wm_handle_map_request (XMapRequestEvent  *xev,
 			  void              *userdata)
 {
@@ -874,32 +887,34 @@
       if (client)
 	mb_wm_activate_client (wm, client);
 
-      return;
+      return True;
     }
 
   if (!wm_class->client_new)
     {
       MBWM_DBG("### No new client hook exists ###");
-      return;
+      return True;
     }
 
   win = mb_wm_client_window_new (wm, xev->window);
 
   if (!win)
-    return;
+    return True;
 
   client = wm_class->client_new (wm, win);
 
   if (!client)
     {
       mb_wm_object_unref (MB_WM_OBJECT (win));
-      return;
+      return True;
     }
 
   if (mb_wm_client_window_is_state_set (win, MBWMClientWindowEWMHStateFullscreen))
     mb_wm_client_fullscreen_mark_dirty (client);
 
   mb_wm_manage_client (wm, client, True);
+
+  return True;
 }
 
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-03-25 12:21:03 UTC (rev 17798)
@@ -369,44 +369,27 @@
       if (x_error_code == BadWindow)
         goto badwindow_error;
 
+      /* FIXME: we cannot really change transiency lists after mapping the
+       * window because the compositor cannot handle that. Maybe we should
+       * have a virtual function for window classes for change in transiency,
+       * so that the compositor could implement it and handle it. */
       if (trans_win)
 	{
 	  MBWM_DBG("@@@ Window transient for %lx @@@", *trans_win);
 
 	  if (*trans_win != win->xwin_transient_for)
 	    {
-	      MBWindowManagerClient *new_parent =
-		mb_wm_managed_client_from_xwindow (wm, *trans_win);
-
 	      changes |= MBWM_WINDOW_PROP_TRANSIENCY;
 
-	      if (!new_parent)
-		{
-		  g_warning ("Window %07x attempted to become transient to %07x "
-			     "which isn't a real window; ignoring",
-			     (int) win->xwindow, *trans_win);
-		}
-	      else
-		{
-		  MBWindowManagerClient *child =
-		    mb_wm_managed_client_from_xwindow (wm, win->xwindow);
-
-		  win->xwin_transient_for = *trans_win;
-
-		  if (child)
-		    {
-		      /* it's already mapped */
-		      mb_wm_client_remove_transient (child->transient_for, child);
-		      mb_wm_client_add_transient (new_parent, child);
-		    }
-		}
+	      win->xwin_transient_for = *trans_win;
 	    }
 
 	  XFree(trans_win);
 	}
-      else MBWM_DBG("@@@ Window transient for nothing @@@");
-
-      changes |= MBWM_WINDOW_PROP_TRANSIENCY;
+      else
+        {
+          MBWM_DBG("@@@ Window transient for nothing @@@");
+        }
     }
 
   if (props_req & MBWM_WINDOW_PROP_ATTR)

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c	2009-03-25 12:21:03 UTC (rev 17798)
@@ -200,7 +200,7 @@
 static Bool
 mb_wm_decor_reparent (MBWMDecor *decor);
 
-static void
+static Bool
 mb_wm_decor_release_handler (XButtonEvent    *xev,
 			     void            *userdata)
 {
@@ -213,14 +213,17 @@
   decor->release_cb_id = 0;
 
   XUngrabPointer (wm->xdpy, CurrentTime);
+
+  return False;
 }
 
-static void
+static Bool
 mb_wm_decor_press_handler (XButtonEvent    *xev,
 			   void            *userdata)
 {
   MBWMDecor       *decor  = userdata;
   MBWindowManager *wm = decor->parent_client->wmref;
+  Bool             retval = True;
 
   if (xev->window == decor->xwin)
     {
@@ -306,7 +309,7 @@
 		case ButtonRelease:
 		  {
 		    XUngrabPointer (wm->xdpy, CurrentTime);
-		    return;
+		    return False;
 		  }
 		default:
 		  ;
@@ -314,6 +317,8 @@
 	    }
 	}
     }
+
+  return retval;
 }
 
 static Bool
@@ -762,7 +767,7 @@
   return button->themedata;
 }
 
-static void
+static Bool
 mb_wm_decor_button_press_handler (XButtonEvent    *xev,
 				  void            *userdata)
 {
@@ -770,6 +775,7 @@
   MBWMDecor       *decor  = button->decor;
   MBWindowManager *wm = decor->parent_client->wmref;
   MBWMList        *transients = NULL;
+  Bool             retval = True;
 
   mb_wm_object_ref (MB_WM_OBJECT(button));
 
@@ -790,6 +796,7 @@
 	  if (MB_WM_CLIENT_CLIENT_TYPE (c) != MBWMClientTypeInput &&
 	      mb_wm_client_is_modal (c))
 	    {
+	      retval = True;
 	      goto done;
 	    }
 
@@ -806,6 +813,7 @@
 	  xev->y < ymin ||
 	  xev->y > ymax)
 	{
+	  retval = True;
 	  g_debug("%s not on button -- send GRAB_TRANSFER", __FUNCTION__);
 	  XUngrabPointer(wm->xdpy, CurrentTime);
 	  mb_wm_client_deliver_message (decor->parent_client,
@@ -946,6 +954,7 @@
 			    if (pev->x < xmin || pev->x > xmax ||
 				pev->y < ymin || pev->y > ymax)
 			      {
+				retval = False;
 				goto done;
 			      }
 
@@ -955,6 +964,7 @@
 			      mb_wm_decor_button_stock_button_action (button);
 
 			    mb_wm_object_unref (MB_WM_OBJECT(button));
+			    return False;
 			  }
 			}
 		    }
@@ -969,11 +979,14 @@
 		}
 	    }
 	}
+
+      retval = False;
     }
 
  done:
   mb_wm_util_list_free (transients);
   mb_wm_object_unref (MB_WM_OBJECT(button));
+  return retval;
 }
 
 static void

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c	2009-03-25 12:21:03 UTC (rev 17798)
@@ -169,24 +169,7 @@
   return ctx;
 }
 
-static inline void
-call_event_handlers (MBWMList *iter, Window xwin, void *event_data)
-{
-#define XE_ITER_GET_FUNC(i) (((MBWMXEventFuncInfo *)((i)->data))->func)
-#define XE_ITER_GET_DATA(i) ((MBWMXEventFuncInfo *)((i)->data))->userdata
-#define XE_ITER_GET_XWIN(i) ((MBWMXEventFuncInfo *)((i)->data))->xwindow
-  while (iter)
-    {
-      Window msg_xwin = XE_ITER_GET_XWIN(iter);
-	      
-      if (msg_xwin == None || msg_xwin == xwin)
-	XE_ITER_GET_FUNC(iter) (event_data, XE_ITER_GET_DATA(iter));
-
-      iter = iter->next;
-    }
-}
-
-void
+Bool
 mb_wm_main_context_handle_x_event (XEvent          *xev,
 				   MBWMMainContext *ctx)
 {
@@ -195,76 +178,48 @@
   Window           xwin = xev->xany.window;
 
 #if (MBWM_WANT_DEBUG)
-  if (mbwm_debug_flags & MBWM_DEBUG_EVENT)
-    {
-      MBWindowManagerClient *ev_client;
-      
-      ev_client = mb_wm_managed_client_from_xwindow(wm, xev->xany.window);
-      
-      printf ("  @ XEvent: '%s:%i' for %lx %s%s\n",
-	      xev->type < sizeof (MBWMDEBUGEvents)/sizeof(MBWMDEBUGEvents[0])
-	      ? MBWMDEBUGEvents[xev->type] : "unknown",
-	      xev->type,
-	      xev->xany.window,
-	      xev->xany.window == wm->root_win->xwindow ? "(root)" : "",
-	      ev_client ? ev_client->name : ""
-	      );
+  {
+   if (mbwm_debug_flags & MBWM_DEBUG_EVENT)
+     {
+       MBWindowManagerClient *ev_client;
 
-      switch (xev->type)
-	{
-	case ConfigureNotify:
-	  {
-	    XConfigureEvent * cev = & xev->xconfigure;
-	    printf ("    window %x, event %x, [%d,%d;%dx%d]\n",
-		    cev->window,
-		    cev->event,
-		    cev->x,
-		    cev->y,
-		    cev->width,
-		    cev->height);
-	  }
-	  break;
-	case UnmapNotify:
-	  {
-	    XUnmapEvent * uev = & xev->xunmap;
-	    printf ("    window %x, event %x, %d\n",
-		    uev->window,
-		    uev->event,
-		    uev->from_configure);
-	  }
-	  break;
-	case ConfigureRequest:
-	  {
-	    XConfigureRequestEvent * cev = & xev->xconfigurerequest;
-	    printf ("    window %x, parent %x, [%d,%d;%dx%d]\n",
-		    cev->window,
-		    cev->parent,
-		    cev->x,
-		    cev->y,
-		    cev->width,
-		    cev->height);
-	  }
-	  break;
-	case PropertyNotify:
-	  {
-	    XPropertyEvent * pev = & xev->xproperty;
-	    char * prop = XGetAtomName (wm->xdpy, pev->atom);
-	    printf ("    window %x, prop %s, state %d\n",
-		    pev->window,
-		    prop,
-		    pev->state);
-	    if (prop)
-	      XFree (prop);
-	  }
-	  break;
-	}
-    }
-#endif /* MBWM_WANT_DEBUG */
+       ev_client = mb_wm_managed_client_from_xwindow(wm, xev->xany.window);
 
+       printf ("  @ XEvent: '%s:%i' for %lx %s%s\n",
+	       xev->type < sizeof (MBWMDEBUGEvents)/sizeof(MBWMDEBUGEvents[0])
+	       ? MBWMDEBUGEvents[xev->type] : "unknown",
+	       xev->type,
+	       xev->xany.window,
+	       xev->xany.window == wm->root_win->xwindow ? "(root)" : "",
+	       ev_client ? ev_client->name : ""
+	       );
+     }
+  }
+#endif
+
+#define XE_ITER_GET_FUNC(i) (((MBWMXEventFuncInfo *)((i)->data))->func)
+#define XE_ITER_GET_DATA(i) ((MBWMXEventFuncInfo *)((i)->data))->userdata
+#define XE_ITER_GET_XWIN(i) ((MBWMXEventFuncInfo *)((i)->data))->xwindow
+
 #if ENABLE_COMPOSITE
   if (xev->type == wm->damage_event_base + XDamageNotify)
     {
-      call_event_handlers (ctx->event_funcs.damage_notify, xev->xany.window, xev);
+      iter = ctx->event_funcs.damage_notify;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWMXEventFunc)XE_ITER_GET_FUNC(iter)
+		  (xev, XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
     }
   else
 #endif
@@ -274,69 +229,294 @@
       /* give the EWMH handler the first crack at it */
       if (!mb_wm_root_window_handle_message (wm->root_win,
 					     (XClientMessageEvent *)xev))
-	call_event_handlers (ctx->event_funcs.client_message,
-			     xev->xany.window,
-			     &xev->xclient);
+	{
+	  iter = ctx->event_funcs.client_message;
+
+	  while (iter)
+	    {
+	      Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	      MBWMList * next = iter->next;
+	      
+	      if (msg_xwin == None || msg_xwin == xwin)
+		{
+		  if (!(MBWindowManagerClientMessageFunc)XE_ITER_GET_FUNC(iter)
+		      ((XClientMessageEvent*)&xev->xclient,
+		       XE_ITER_GET_DATA(iter)))
+		    break;
+		}
+	      
+	      iter = next;
+	    }
+	}
       break;
     case Expose:
-      /* we do nothing */
       break;
     case MapRequest:
-      call_event_handlers (ctx->event_funcs.map_request,
-			   xev->xany.window,
-			   (XMapRequestEvent*)&xev->xmaprequest);
+      iter = ctx->event_funcs.map_request;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerMapRequestFunc)XE_ITER_GET_FUNC(iter)
+		  ((XMapRequestEvent*)&xev->xmaprequest,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case MapNotify:
-      call_event_handlers (ctx->event_funcs.map_notify,
-			   xev->xany.window,
-			   (XMapEvent*)&xev->xmap);
+      iter = ctx->event_funcs.map_notify;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerMapNotifyFunc)XE_ITER_GET_FUNC(iter)
+		  ((XMapEvent*)&xev->xmap,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case UnmapNotify:
-      call_event_handlers (ctx->event_funcs.unmap_notify,
-			   xev->xunmap.window,
-			   (XUnmapEvent*)&xev->xunmap);
+#if MBWM_WANT_DEBUG
+   if (mbwm_debug_flags & MBWM_DEBUG_EVENT)
+     {
+       XUnmapEvent * uev = & xev->xunmap;
+       printf ("    window %x, event %x, %d\n",
+	       uev->window,
+	       uev->event,
+	       uev->from_configure);
+     }
+#endif
+      xwin = xev->xunmap.window;
+      iter = ctx->event_funcs.unmap_notify;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerUnmapNotifyFunc)XE_ITER_GET_FUNC(iter)
+		  ((XUnmapEvent*)&xev->xunmap,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case DestroyNotify:
-      call_event_handlers (ctx->event_funcs.destroy_notify,
-			   xev->xany.window,
-			   (XDestroyWindowEvent*)&xev->xdestroywindow);
+      iter = ctx->event_funcs.destroy_notify;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerDestroyNotifyFunc)XE_ITER_GET_FUNC(iter)
+		  ((XDestroyWindowEvent*)&xev->xdestroywindow,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case ConfigureNotify:
-      call_event_handlers (ctx->event_funcs.configure_notify,
-			   xev->xconfigure.window,
-			   (XConfigureEvent*)&xev->xconfigure);
+#if MBWM_WANT_DEBUG
+   if (mbwm_debug_flags & MBWM_DEBUG_EVENT)
+     {
+       XConfigureEvent * cev = & xev->xconfigure;
+       printf ("    window %x, event %x, [%d,%d;%dx%d]\n",
+	       cev->window,
+	       cev->event,
+	       cev->x,
+	       cev->y,
+	       cev->width,
+	       cev->height);
+     }
+#endif
+      xwin = xev->xconfigure.window;
+      iter = ctx->event_funcs.configure_notify;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerConfigureNotifyFunc)XE_ITER_GET_FUNC(iter)
+		  ((XConfigureEvent*)&xev->xconfigure,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case ConfigureRequest:
-      call_event_handlers (ctx->event_funcs.configure_request,
-			   xev->xconfigurerequest.window,
-			   (XConfigureRequestEvent*)&xev->xconfigurerequest);
+#if MBWM_WANT_DEBUG
+   if (mbwm_debug_flags & MBWM_DEBUG_EVENT)
+     {
+       XConfigureRequestEvent * cev = & xev->xconfigurerequest;
+       printf ("    window %x, parent %x, [%d,%d;%dx%d]\n",
+	       cev->window,
+	       cev->parent,
+	       cev->x,
+	       cev->y,
+	       cev->width,
+	       cev->height);
+      }
+#endif
+      xwin = xev->xconfigurerequest.window;
+      iter = ctx->event_funcs.configure_request;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerConfigureRequestFunc)XE_ITER_GET_FUNC(iter)
+		  ((XConfigureRequestEvent*)&xev->xconfigurerequest,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case KeyPress:
-      call_event_handlers (ctx->event_funcs.key_press,
-			   xev->xany.window,
-			   (XKeyEvent*)&xev->xkey);
+      iter = ctx->event_funcs.key_press;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerKeyPressFunc)XE_ITER_GET_FUNC(iter)
+		  ((XKeyEvent*)&xev->xkey,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case PropertyNotify:
-      call_event_handlers (ctx->event_funcs.property_notify,
-			   xev->xproperty.window,
-			   (XPropertyEvent*)&xev->xproperty);
+#if MBWM_WANT_DEBUG
+   if (mbwm_debug_flags & MBWM_DEBUG_EVENT)
+     {
+       XPropertyEvent * pev = & xev->xproperty;
+       char * prop = XGetAtomName (wm->xdpy, pev->atom);
+       printf ("    window %x, prop %s, state %d\n",
+	       pev->window,
+	       prop,
+	       pev->state);
+
+       if (prop)
+	 XFree (prop);
+     }
+#endif
+      xwin = xev->xproperty.window;
+      iter = ctx->event_funcs.property_notify;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerPropertyNotifyFunc)XE_ITER_GET_FUNC(iter)
+		  ((XPropertyEvent*)&xev->xproperty,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case ButtonPress:
-      call_event_handlers (ctx->event_funcs.button_press,
-			   xev->xany.window,
-			   (XButtonEvent*)&xev->xbutton);
+      iter = ctx->event_funcs.button_press;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerButtonPressFunc)XE_ITER_GET_FUNC(iter)
+		  ((XButtonEvent*)&xev->xbutton,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case ButtonRelease:
-      call_event_handlers (ctx->event_funcs.button_release,
-			   xev->xany.window,
-			   (XButtonEvent*)&xev->xbutton);
+      iter = ctx->event_funcs.button_release;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerButtonReleaseFunc)XE_ITER_GET_FUNC(iter)
+		  ((XButtonEvent*)&xev->xbutton,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     case MotionNotify:
-      call_event_handlers (ctx->event_funcs.motion_notify,
-			   xev->xany.window,
-			   (XMotionEvent*)&xev->xmotion);
+      iter = ctx->event_funcs.motion_notify;
+
+      while (iter)
+	{
+	  Window msg_xwin = XE_ITER_GET_XWIN(iter);
+	  MBWMList * next = iter->next;
+
+	  if (msg_xwin == None || msg_xwin == xwin)
+	    {
+	      if (!(MBWindowManagerMotionNotifyFunc)XE_ITER_GET_FUNC(iter)
+		  ((XMotionEvent*)&xev->xmotion,
+		   XE_ITER_GET_DATA(iter)))
+		break;
+	    }
+
+	  iter = next;
+	}
       break;
     }
+
+  return False;
 }
 
 static Bool

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h	2009-03-25 12:21:03 UTC (rev 17798)
@@ -143,7 +143,7 @@
 mb_wm_main_context_gloop_xevent (gpointer userdata);
 #endif
 
-void
+Bool
 mb_wm_main_context_handle_x_event (XEvent          *xev,
 				   MBWMMainContext *ctx);
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-03-25 11:32:40 UTC (rev 17797)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-03-25 12:21:03 UTC (rev 17798)
@@ -332,11 +332,59 @@
 
 /* Event Callbacks */
 
-typedef void (*MBWMXEventFunc)
+typedef Bool (*MBWMXEventFunc)
      (void              *xev,
       void              *userdata);
 
-typedef void (*MBWindowManagerTimeOutFunc)
+typedef Bool (*MBWindowManagerMapNotifyFunc)
+     (XMapEvent         *xev,
+      void              *userdata);
+
+typedef Bool (*MBWindowManagerClientMessageFunc)
+     (XClientMessageEvent *xev,
+      void                *userdata);
+
+typedef Bool (*MBWindowManagerMapRequestFunc)
+     (XMapRequestEvent  *xev,
+      void              *userdata);
+
+typedef Bool (*MBWindowManagerUnmapNotifyFunc)
+     (XUnmapEvent       *xev,
+      void              *userdata);
+
+typedef Bool (*MBWindowManagerDestroyNotifyFunc)
+     (XDestroyWindowEvent  *xev,
+      void                 *userdata);
+
+typedef Bool (*MBWindowManagerConfigureNotifyFunc)
+     (XConfigureEvent      *xev,
+      void                 *userdata);
+
+typedef Bool (*MBWindowManagerConfigureRequestFunc)
+     (XConfigureRequestEvent  *xev,
+      void                    *userdata);
+
+typedef Bool (*MBWindowManagerKeyPressFunc)
+     (XKeyEvent               *xev,
+      void                    *userdata);
+
+typedef Bool (*MBWindowManagerPropertyNotifyFunc)
+     (XPropertyEvent          *xev,
+      void                    *userdata);
+
+typedef Bool (*MBWindowManagerButtonPressFunc)
+     (XButtonEvent            *xev,
+      void                    *userdata);
+
+typedef Bool (*MBWindowManagerButtonReleaseFunc)
+     (XButtonEvent            *xev,
+      void                    *userdata);
+
+typedef Bool (*MBWindowManagerMotionNotifyFunc)
+     (XMotionEvent            *xev,
+      void                    *userdata);
+
+typedef Bool (*MBWindowManagerTimeOutFunc)
      (void                    *userdata);
 
 #if USE_GLIB_MAINLOOP


More information about the maemo-commits mailing list