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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Mar 24 23:20:32 EET 2009
Author: tthurman
Date: 2009-03-24 23:20:18 +0200 (Tue, 24 Mar 2009)
New Revision: 17795

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-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:
	Event handlers now return void and cannot stop processing
	of further events.
	Accoding to Kimmo:
	Fixes NB#105014.
	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c:
	* matchbox/comp-mgr/mb-wm-comp-mgr-xrender.c:
	* matchbox/comp-mgr/mb-wm-comp-mgr.h:
	* matchbox/core/mb-window-manager.c:
	* matchbox/core/mb-wm-decor.c:
	* matchbox/core/mb-wm-main-context.c:
	* matchbox/core/mb-wm-main-context.h:
	* matchbox/core/mb-wm-types.h:



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-03-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-03-24 21:20:18 UTC (rev 17795)
@@ -1,3 +1,19 @@
+2009-03-24  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	Event handlers now return void and cannot stop processing
+	of further events.
+	Accoding to Kimmo:
+	Fixes NB#105014.
+
+	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c:
+	* matchbox/comp-mgr/mb-wm-comp-mgr-xrender.c:
+	* matchbox/comp-mgr/mb-wm-comp-mgr.h:
+	* matchbox/core/mb-window-manager.c:
+	* matchbox/core/mb-wm-decor.c:
+	* matchbox/core/mb-wm-main-context.c:
+	* matchbox/core/mb-wm-main-context.h:
+	* matchbox/core/mb-wm-types.h:
+
 2009-03-24  Adam Endrodi  <adam.endrodi at blumsoft.eu>
 
 	* matchbox/core/mb-wm-client-base.c (mb_wm_client_base_realize):

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-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-03-24 21:20:18 UTC (rev 17795)
@@ -455,7 +455,7 @@
 mb_wm_comp_mgr_clutter_select_desktop (MBWMCompMgr * mgr,
 				       int desktop, int old_desktop);
 
-static Bool
+static void
 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 Bool
+static void
 mb_wm_comp_mgr_clutter_handle_damage (XDamageNotifyEvent * de,
 				      MBWMCompMgr        * mgr)
 {
@@ -756,7 +756,7 @@
 
       if (!cclient->priv->actor ||
 	  (cclient->priv->flags & MBWMCompMgrClutterClientDontUpdate))
-	return False;
+	return;
 
       MBWM_NOTE (COMPOSITOR,
 		 "Repairing window %lx, geometry %d,%d;%dx%d; more %d\n",
@@ -781,8 +781,6 @@
       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-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-xrender.c	2009-03-24 21:20:18 UTC (rev 17795)
@@ -380,7 +380,7 @@
 static void
 mb_wm_comp_mgr_xrender_render_real (MBWMCompMgr *mgr);
 
-static Bool
+static void
 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 Bool
+static void
 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-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr.h	2009-03-24 21:20:18 UTC (rev 17795)
@@ -60,7 +60,7 @@
   void   (*restack)           (MBWMCompMgr * mgr);
   void   (*map_notify)        (MBWMCompMgr * mgr, MBWindowManagerClient *c);
   void   (*unmap_notify)      (MBWMCompMgr * mgr, MBWindowManagerClient *c);
-  Bool   (*handle_damage)     (XDamageNotifyEvent * xev, MBWMCompMgr * mgr);
+  void   (*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-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-03-24 21:20:18 UTC (rev 17795)
@@ -373,7 +373,7 @@
   return wm;
 }
 
-static Bool
+static void
 mb_wm_handle_key_press (XKeyEvent       *xev,
 			void            *userdata)
 {
@@ -382,23 +382,21 @@
   mb_wm_keys_press (wm,
 		    XKeycodeToKeysym(wm->xdpy, xev->keycode, 0),
 		    xev->state);
-
-  return True;
 }
 
-static Bool
+static void
 mb_wm_handle_button_press (XButtonEvent *xev, void *userdata)
 {
   MBWindowManager *wm = (MBWindowManager*)userdata;
   MBWindowManagerClient *client = NULL;
 
   if (xev->button != 1)
-    return True;
+    return;
 
   mb_wm_is_my_window (wm, xev->window, &client);
 
   if (!client)
-    return True;
+    return;
 
   /*
    * If the client is not application, we make sure it has focus.
@@ -420,11 +418,9 @@
     }
 
   XAllowEvents (wm->xdpy, ReplayPointer, CurrentTime);
-
-  return True;
 }
 
-static Bool
+static void
 mb_wm_handle_destroy_notify (XDestroyWindowEvent  *xev,
 			     void                 *userdata)
 {
@@ -463,11 +459,9 @@
       else
 	mb_wm_unmanage_client (wm, client, True);
     }
-
-  return True;
 }
 
-static Bool
+static void
 mb_wm_handle_unmap_notify (XUnmapEvent          *xev,
 			   void                 *userdata)
 {
@@ -478,7 +472,7 @@
 
   /* Ignoring syntetic events, not even decrementing the skip_unmaps counter. */
   if (xev->send_event) 
-    return True;
+    return;
   
   /*
    * When the XCompositeRedirectWindow() is used we get an extra unmap event
@@ -486,7 +480,7 @@
    * with the xany.window set to the parent window.
    */
   if (xev->window == xev->event) 
-    return True;
+    return;
 
   client = mb_wm_managed_client_from_xwindow(wm, xev->window);
 
@@ -544,11 +538,9 @@
 	    }
 	}
     }
-
-  return True;
 }
 
-static Bool
+static void
 mb_wm_handle_property_notify (XPropertyEvent          *xev,
 			      void                    *userdata)
 {
@@ -573,20 +565,20 @@
 			      (unsigned char **)&theme_path);
 
 	  if (!type || !items)
-	    return True;
+	    return;
 
 	  mb_wm_set_theme_from_path (wm, theme_path);
 
 	  XFree (theme_path);
 	}
 
-      return True;
+      return;
     }
 
   client = mb_wm_managed_client_from_xwindow(wm, xev->window);
 
   if (!client)
-    return True;
+    return;
 
   if (xev->atom == wm->atoms[MBWM_ATOM_NET_WM_USER_TIME])
     flag = MBWM_WINDOW_PROP_NET_USER_TIME;
@@ -614,11 +606,11 @@
   if (flag)
     mb_wm_client_window_sync_properties (client->window, flag);
 
-  return True;
+  return;
 }
 
 #if ENABLE_COMPOSITE
-static  Bool
+static void
 mb_wm_handle_composite_config_notify (XConfigureEvent *xev,
 			    void            *userdata)
 {
@@ -633,7 +625,7 @@
       if (client)
 	mb_wm_comp_mgr_client_configure (client->cm_client);
     }
-  return True;
+  return;
 }
 #endif
 
@@ -641,7 +633,7 @@
  * This is called if the root window resizes itself, which happens when RANDR is
  * used to resize or rotate the display.
  */
-static  Bool
+static void
 mb_wm_handle_root_config_notify (XConfigureEvent *xev,
 			    void            *userdata)
 {
@@ -663,10 +655,9 @@
 #endif
 
   mb_wm_display_sync_queue (wm, MBWMSyncGeometry);
-  return True;
 }
 
-static  Bool
+static void
 mb_wm_handle_config_request (XConfigureRequestEvent *xev,
 			     void                   *userdata)
 {
@@ -698,7 +689,7 @@
 
       XConfigureWindow (wm->xdpy, xev->window, xev->value_mask, &xwc);
 
-      return True;
+      return;
     }
 
   value_mask = xev->value_mask;
@@ -729,8 +720,6 @@
 				     &req_geom,
 				     MBWMClientReqGeomIsViaConfigureReq);
     }
-
-  return True;
 }
 
 /*
@@ -775,7 +764,7 @@
 /*  For the compositing engine we need to track overide redirect
  *  windows so the compositor can paint them.
  */
-static Bool
+static void
 mb_wm_handle_map_notify   (XMapEvent  *xev,
 			   void       *userdata)
 {
@@ -790,12 +779,12 @@
 
   /* For the same reason as in mb_wm_handle_unmap_notify(). */
   if (xev->window == xev->event) 
-    return True;
+    return;
 
   if (!wm_class->client_new)
     {
       MBWM_DBG("### No new client hook exists ###");
-      return True;
+      return;
     }
 
   if (mb_wm_is_my_window (wm, xev->window, &client))
@@ -828,7 +817,7 @@
 	    }
 	}
 
-      return True;
+      return;
     }
 
   XGetWindowAttributes(wm->xdpy, xev->window, &attrs);
@@ -836,7 +825,7 @@
     {
       g_debug ("%s: unmap for %lx has happened after MapRequest",
                __FUNCTION__, xev->window);
-      return True;
+      return;
     }
 
   win = mb_wm_client_window_new (wm, xev->window);
@@ -844,13 +833,13 @@
   if (!win)
     {
       g_debug ("%s: mb_wm_client_window_new failed", __FUNCTION__);
-      return True;
+      return;
     }
 
   if (win->window_class == InputOnly)
     {
       mb_wm_object_unref (MB_WM_OBJECT (win));
-      return True;
+      return;
     }
 
   client = wm_class->client_new (wm, win);
@@ -858,17 +847,15 @@
   if (!client)
     {
       mb_wm_object_unref (MB_WM_OBJECT (win));
-      return True;
+      return;
     }
 
   mb_wm_manage_client (wm, client, True);
   mb_wm_comp_mgr_map_notify (wm->comp_mgr, client);
-
-  return True;
 }
 #endif
 
-static Bool
+static void
 mb_wm_handle_map_request (XMapRequestEvent  *xev,
 			  void              *userdata)
 {
@@ -887,34 +874,32 @@
       if (client)
 	mb_wm_activate_client (wm, client);
 
-      return True;
+      return;
     }
 
   if (!wm_class->client_new)
     {
       MBWM_DBG("### No new client hook exists ###");
-      return True;
+      return;
     }
 
   win = mb_wm_client_window_new (wm, xev->window);
 
   if (!win)
-    return True;
+    return;
 
   client = wm_class->client_new (wm, win);
 
   if (!client)
     {
       mb_wm_object_unref (MB_WM_OBJECT (win));
-      return True;
+      return;
     }
 
   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-decor.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c	2009-03-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c	2009-03-24 21:20:18 UTC (rev 17795)
@@ -200,7 +200,7 @@
 static Bool
 mb_wm_decor_reparent (MBWMDecor *decor);
 
-static Bool
+static void
 mb_wm_decor_release_handler (XButtonEvent    *xev,
 			     void            *userdata)
 {
@@ -213,17 +213,14 @@
   decor->release_cb_id = 0;
 
   XUngrabPointer (wm->xdpy, CurrentTime);
-
-  return False;
 }
 
-static Bool
+static void
 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)
     {
@@ -309,7 +306,7 @@
 		case ButtonRelease:
 		  {
 		    XUngrabPointer (wm->xdpy, CurrentTime);
-		    return False;
+		    return;
 		  }
 		default:
 		  ;
@@ -317,8 +314,6 @@
 	    }
 	}
     }
-
-  return retval;
 }
 
 static Bool
@@ -767,7 +762,7 @@
   return button->themedata;
 }
 
-static Bool
+static void
 mb_wm_decor_button_press_handler (XButtonEvent    *xev,
 				  void            *userdata)
 {
@@ -775,7 +770,6 @@
   MBWMDecor       *decor  = button->decor;
   MBWindowManager *wm = decor->parent_client->wmref;
   MBWMList        *transients = NULL;
-  Bool             retval = True;
 
   mb_wm_object_ref (MB_WM_OBJECT(button));
 
@@ -796,7 +790,6 @@
 	  if (MB_WM_CLIENT_CLIENT_TYPE (c) != MBWMClientTypeInput &&
 	      mb_wm_client_is_modal (c))
 	    {
-	      retval = True;
 	      goto done;
 	    }
 
@@ -813,7 +806,6 @@
 	  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,
@@ -954,7 +946,6 @@
 			    if (pev->x < xmin || pev->x > xmax ||
 				pev->y < ymin || pev->y > ymax)
 			      {
-				retval = False;
 				goto done;
 			      }
 
@@ -964,7 +955,6 @@
 			      mb_wm_decor_button_stock_button_action (button);
 
 			    mb_wm_object_unref (MB_WM_OBJECT(button));
-			    return False;
 			  }
 			}
 		    }
@@ -979,14 +969,11 @@
 		}
 	    }
 	}
-
-      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-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c	2009-03-24 21:20:18 UTC (rev 17795)
@@ -169,7 +169,24 @@
   return ctx;
 }
 
-Bool
+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
 mb_wm_main_context_handle_x_event (XEvent          *xev,
 				   MBWMMainContext *ctx)
 {
@@ -178,48 +195,76 @@
   Window           xwin = xev->xany.window;
 
 #if (MBWM_WANT_DEBUG)
-  {
-   if (mbwm_debug_flags & MBWM_DEBUG_EVENT)
-     {
-       MBWindowManagerClient *ev_client;
+  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 : ""
+	      );
 
-       ev_client = mb_wm_managed_client_from_xwindow(wm, xev->xany.window);
+      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 */
 
-       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)
     {
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.damage_notify, xev->xany.window, xev);
     }
   else
 #endif
@@ -229,294 +274,69 @@
       /* give the EWMH handler the first crack at it */
       if (!mb_wm_root_window_handle_message (wm->root_win,
 					     (XClientMessageEvent *)xev))
-	{
-	  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;
-	    }
-	}
+	call_event_handlers (ctx->event_funcs.client_message,
+			     xev->xany.window,
+			     &xev->xclient);
       break;
     case Expose:
+      /* we do nothing */
       break;
     case MapRequest:
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.map_request,
+			   xev->xany.window,
+			   (XMapRequestEvent*)&xev->xmaprequest);
       break;
     case MapNotify:
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.map_notify,
+			   xev->xany.window,
+			   (XMapEvent*)&xev->xmap);
       break;
     case UnmapNotify:
-#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;
-	}
+      call_event_handlers (ctx->event_funcs.unmap_notify,
+			   xev->xunmap.window,
+			   (XUnmapEvent*)&xev->xunmap);
       break;
     case DestroyNotify:
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.destroy_notify,
+			   xev->xany.window,
+			   (XDestroyWindowEvent*)&xev->xdestroywindow);
       break;
     case ConfigureNotify:
-#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;
-	}
+      call_event_handlers (ctx->event_funcs.configure_notify,
+			   xev->xconfigure.window,
+			   (XConfigureEvent*)&xev->xconfigure);
       break;
     case ConfigureRequest:
-#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;
-	}
+      call_event_handlers (ctx->event_funcs.configure_request,
+			   xev->xconfigurerequest.window,
+			   (XConfigureRequestEvent*)&xev->xconfigurerequest);
       break;
     case KeyPress:
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.key_press,
+			   xev->xany.window,
+			   (XKeyEvent*)&xev->xkey);
       break;
     case PropertyNotify:
-#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;
-	}
+      call_event_handlers (ctx->event_funcs.property_notify,
+			   xev->xproperty.window,
+			   (XPropertyEvent*)&xev->xproperty);
       break;
     case ButtonPress:
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.button_press,
+			   xev->xany.window,
+			   (XButtonEvent*)&xev->xbutton);
       break;
     case ButtonRelease:
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.button_release,
+			   xev->xany.window,
+			   (XButtonEvent*)&xev->xbutton);
       break;
     case MotionNotify:
-      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;
-	}
+      call_event_handlers (ctx->event_funcs.motion_notify,
+			   xev->xany.window,
+			   (XMotionEvent*)&xev->xmotion);
       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-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.h	2009-03-24 21:20:18 UTC (rev 17795)
@@ -143,7 +143,7 @@
 mb_wm_main_context_gloop_xevent (gpointer userdata);
 #endif
 
-Bool
+void
 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-24 14:38:19 UTC (rev 17794)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-types.h	2009-03-24 21:20:18 UTC (rev 17795)
@@ -332,59 +332,11 @@
 
 /* Event Callbacks */
 
-typedef Bool (*MBWMXEventFunc)
+typedef void (*MBWMXEventFunc)
      (void              *xev,
       void              *userdata);
 
-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)
+typedef void (*MBWindowManagerTimeOutFunc)
      (void                    *userdata);
 
 #if USE_GLIB_MAINLOOP


More information about the maemo-commits mailing list