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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed May 13 21:15:53 EEST 2009
Author: tthurman
Date: 2009-05-13 21:15:48 +0300 (Wed, 13 May 2009)
New Revision: 18360

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.h
Log:
	* matchbox/core/mb-wm-client-base.c: use mb_wm_client_deliver_message()
	instead of attempting to do the identical work ourselves.
	* matchbox/core/mb-wm-client.c (mb_wm_client_deliver_message): returns
	a gboolean to indicate success.
	* matchbox/core/mb-wm-client.c (mb_wm_client_get_next_focused_client):
	removed loop, rewrote as equivalent single line.
	* matchbox/core/mb-wm-client.h:
	* matchbox/core/mb-wm-props.[ch]: remove mb_wm_props_send_x_message()
	which is redundant (does exactly the same as
	mb_wm_client_deliver_message()) and is never used.
	* matchbox/core/mb-wm-props.h:



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-05-13 16:02:30 UTC (rev 18359)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-05-13 18:15:48 UTC (rev 18360)
@@ -1,3 +1,17 @@
+2009-05-13  Thomas Thurman  <thomas.thurman at collabora.co.uk>
+
+	* matchbox/core/mb-wm-client-base.c: use mb_wm_client_deliver_message()
+	instead of attempting to do the identical work ourselves.
+	* matchbox/core/mb-wm-client.c (mb_wm_client_deliver_message): returns
+	a gboolean to indicate success.
+	* matchbox/core/mb-wm-client.c (mb_wm_client_get_next_focused_client):
+	removed loop, rewrote as equivalent single line.
+	* matchbox/core/mb-wm-client.h:
+	* matchbox/core/mb-wm-props.[ch]: remove mb_wm_props_send_x_message()
+	which is redundant (does exactly the same as
+	mb_wm_client_deliver_message()) and is never used.
+	* matchbox/core/mb-wm-props.h:
+
 2009-05-13  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	* matchbox/core/mb-wm-client.c

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c	2009-05-13 16:02:30 UTC (rev 18359)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-base.c	2009-05-13 18:15:48 UTC (rev 18360)
@@ -802,8 +802,9 @@
 mb_wm_client_base_focus (MBWindowManagerClient *client)
 {
   static Window     last_focused = None;
+  Window xwin = client->window->xwindow;
   MBWindowManager  *wm = client->wmref;
-  Window            xwin = client->window->xwindow;
+  gboolean success = True;
 
   if (!mb_wm_client_want_focus (client))
     return False;
@@ -811,24 +812,21 @@
   if (xwin == last_focused)
     return False;
 
-  mb_wm_util_trap_x_errors ();
-
   if (client->window->protos & MBWMClientWindowProtosFocus)
     {
-      XClientMessageEvent ev;
-
-      ev.type = ClientMessage;
-      ev.window = xwin;           /* our window! */
-
-      ev.message_type = wm->atoms[MBWM_ATOM_WM_PROTOCOLS];
-
-      ev.format = 32;
-      ev.data.l[0] = wm->atoms[MBWM_ATOM_WM_TAKE_FOCUS];
-      ev.data.l[1] = CurrentTime;
-
       MBWM_NOTE (CLIENT, "sending XEvent WM_TAKE_FOCUS to %x", xwin);
 
-      XSendEvent(wm->xdpy, xwin, False, 0L, (XEvent *)&ev);
+      success = mb_wm_client_deliver_message
+	(client,
+	 wm->atoms[MBWM_ATOM_WM_PROTOCOLS],
+	 wm->atoms[MBWM_ATOM_WM_TAKE_FOCUS],
+	 /* FIXME: The spec explicitly says not to use CurrentTime in l[1].
+	  * It works, but we shouldn't do it.
+	  * (This will involve storing a per-display event timestamp, or a
+	  * round trip to get the time.)
+	  */
+	 CurrentTime,
+	 0, 0, 0);
     }
   else
     {
@@ -842,7 +840,7 @@
 		  XA_WINDOW, 32, PropModeReplace,
 		  (unsigned char *)&xwin, 1);
 
-  if (mb_wm_util_untrap_x_errors())
+  if (!success)
     return False;
 
   last_focused = xwin;

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-05-13 16:02:30 UTC (rev 18359)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-05-13 18:15:48 UTC (rev 18360)
@@ -598,21 +598,7 @@
 MBWindowManagerClient*
 mb_wm_client_get_next_focused_client (MBWindowManagerClient *client)
 {
-  MBWindowManagerClient *c;
-  gboolean get_this_one = FALSE;
-
-  /* enumerate goes from bottom to top, as opposed to enumerate_reverse
-   * which goes from top to bottom.
-   */
-  mb_wm_stack_enumerate (client->wmref, c)
-    {
-      if (get_this_one)
-        return c;
-      else if (c == client)
-        get_this_one = TRUE;
-    }
-
-  return NULL; /* oops, fell off the end. */
+  return client->stacked_above;
 }
 
 /**
@@ -697,7 +683,7 @@
   return client->window->name;
 }
 
-void
+gboolean
 mb_wm_client_deliver_message (MBWindowManagerClient   *client,
 			      Atom          delivery_atom,
 			      unsigned long data0,
@@ -725,7 +711,7 @@
   mb_wm_util_trap_x_errors();
   XSendEvent(wm->xdpy, xwin, False, NoEventMask, &ev);
   XSync(wm->xdpy, False);
-  mb_wm_util_untrap_x_errors();
+  return mb_wm_util_untrap_x_errors()==0;
 }
 
 void

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-05-13 16:02:30 UTC (rev 18359)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.h	2009-05-13 18:15:48 UTC (rev 18360)
@@ -339,7 +339,7 @@
 void
 mb_wm_client_deliver_delete (MBWindowManagerClient *client);
 
-void
+gboolean
 mb_wm_client_deliver_message (MBWindowManagerClient   *client,
 			      Atom          delivery_atom,
 			      unsigned long data0,

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.c	2009-05-13 16:02:30 UTC (rev 18359)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.c	2009-05-13 18:15:48 UTC (rev 18360)
@@ -146,44 +146,7 @@
 				 x_error_code);
 }
 
-
 void
-mb_wm_props_send_x_message (MBWindowManager *wm,
-			    Window           xwin_src,
-			    Window           xwin_dest,
-			    Atom             delivery_atom,
-			    unsigned long    data0,
-			    unsigned long    data1,
-			    unsigned long    data2,
-			    unsigned long    data3,
-			    unsigned long    data4,
-			    unsigned long    mask)
-{
-  XEvent ev;
-
-  memset(&ev, 0, sizeof(ev));
-
-  ev.xclient.type = ClientMessage;
-  ev.xclient.window = xwin_src;
-  ev.xclient.message_type = delivery_atom;
-  ev.xclient.format = 32;
-  ev.xclient.data.l[0] = data0;
-  ev.xclient.data.l[1] = data1;
-  ev.xclient.data.l[2] = data2;
-  ev.xclient.data.l[3] = data3;
-  ev.xclient.data.l[4] = data4;
-
-  if (!mask)
-    mask = NoEventMask;
-
-  /* FIXME: traps */
-
-  XSendEvent(wm->xdpy, xwin_dest, False, mask, &ev);
-  XSync(wm->xdpy, False);
-
-}
-
-void
 mb_wm_props_sync_root_props (MBWindowManager *wm)
 {
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.h	2009-05-13 16:02:30 UTC (rev 18359)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-props.h	2009-05-13 18:15:48 UTC (rev 18360)
@@ -74,18 +74,6 @@
 			       unsigned int      *depth_return,
 			       int               *x_error_code);
 
-void
-mb_wm_props_send_x_message (MBWindowManager *wm,
-			    Window           xwin_src,
-			    Window           xwin_dest,
-			    Atom             delivery_atom,
-			    unsigned long    data0,
-			    unsigned long    data1,
-			    unsigned long    data2,
-			    unsigned long    data3,
-			    unsigned long    data4,
-			    unsigned long    mask);
-
 /* Utils */
 
 #define mb_wm_property_cardinal_req(wm, win, prop)                   \


More information about the maemo-commits mailing list