merge r6529-6531 from trunk
authorDana Jansens <danakj@orodu.net>
Mon, 14 May 2007 13:47:25 +0000 (13:47 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 14 May 2007 13:47:25 +0000 (13:47 +0000)
openbox/action.c
openbox/action.h
openbox/client.c
openbox/event.c
openbox/focus.c

index 20bf686f2e69701f31580d9c0a350d2c2ee4fe18..aa9465b8eb7fe366541db0b9ac9904e6aadd2e03 100644 (file)
@@ -95,6 +95,8 @@ void action_unref(ObAction *a)
     /* deal with pointers */
     if (a->func == action_execute || a->func == action_restart)
         g_free(a->data.execute.path);
+    else if (a->func == action_debug)
+        g_free(a->data.debug.string);
     else if (a->func == action_showmenu)
         g_free(a->data.showmenu.name);
 
@@ -110,6 +112,8 @@ ObAction* action_copy(const ObAction *src)
     /* deal with pointers */
     if (a->func == action_execute || a->func == action_restart)
         a->data.execute.path = g_strdup(a->data.execute.path);
+    else if (a->func == action_debug)
+        a->data.debug.string = g_strdup(a->data.debug.string);
     else if (a->func == action_showmenu)
         a->data.showmenu.name = g_strdup(a->data.showmenu.name);
 
@@ -471,9 +475,14 @@ void setup_client_action(ObAction **a, ObUserAction uact)
 
 ActionString actionstrings[] =
 {
+    {
+        "debug", 
+        action_debug,
+        NULL
+    },
     {
         "execute", 
-        action_execute, 
+        action_execute,
         NULL
     },
     {
@@ -974,6 +983,9 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
                     if ((m = parse_find_node("icon", n->xmlChildrenNode)))
                         act->data.execute.icon_name = parse_string(doc, m);
                 }
+            } else if (act->func == action_debug) {
+                if ((n = parse_find_node("string", node->xmlChildrenNode)))
+                    act->data.debug.string = parse_string(doc, n);
             } else if (act->func == action_showmenu) {
                 if ((n = parse_find_node("menu", node->xmlChildrenNode)))
                     act->data.showmenu.name = parse_string(doc, n);
@@ -1183,6 +1195,12 @@ void action_run_string(const gchar *name, struct _ObClient *c, Time time)
     action_run(l, c, 0, time);
 }
 
+void action_debug(union ActionData *data)
+{
+    if (data->debug.string)
+        g_print("%s\n", data->debug.string);
+}
+
 void action_execute(union ActionData *data)
 {
     GError *e = NULL;
index 8a1726bc5e33e63b2722cd614cd877e668b5219b..7c48f37b30bb6adeb4e95a16396384aeaf56eaaf 100644 (file)
@@ -71,6 +71,10 @@ struct DirectionalAction{
     gboolean hang;
 };
 
+struct Debug {
+    gchar *string;
+};
+
 struct Execute {
     struct AnyAction any;
     gchar *path;
@@ -157,6 +161,7 @@ union ActionData {
     struct InteractiveAction inter;
     struct InterDirectionalAction interdiraction;
     struct DirectionalAction diraction;
+    struct Debug debug;
     struct Execute execute;
     struct ClientAction client;
     struct Activate activate;
@@ -185,6 +190,7 @@ struct _ObAction {
 /* Creates a new Action from the name of the action
    A few action types need data set after making this call still. Check if
    the returned action's "func" is one of these.
+   action_debug - the string to print should be set
    action_execute - the path needs to be set
    action_restart - the path can optionally be set
    action_desktop - the destination desktop needs to be set
@@ -234,6 +240,8 @@ void action_run_list(GSList *acts, struct _ObClient *c, ObFrameContext context,
 
 void action_run_string(const gchar *name, struct _ObClient *c, Time time);
 
+/* Debug */
+void action_debug(union ActionData *data);
 /* Execute */
 void action_execute(union ActionData *data);
 /* ActivateAction */
index 10626633e64846917c5bf0c20cefdebe52bd16f9..c1df47865c547d987d4f35e2beedc87317bf155f 100644 (file)
@@ -3343,24 +3343,6 @@ gboolean client_can_focus(ObClient *self)
     if (!(self->can_focus || self->focus_notify))
         return FALSE;
 
-    /* do a check to see if the window has already been unmapped or destroyed
-       do this intelligently while watching out for unmaps we've generated
-       (ignore_unmaps > 0) */
-    if (XCheckTypedWindowEvent(ob_display, self->window,
-                               DestroyNotify, &ev)) {
-        XPutBackEvent(ob_display, &ev);
-        return FALSE;
-    }
-    while (XCheckTypedWindowEvent(ob_display, self->window,
-                                  UnmapNotify, &ev)) {
-        if (self->ignore_unmaps) {
-            self->ignore_unmaps--;
-        } else {
-            XPutBackEvent(ob_display, &ev);
-            return FALSE;
-        }
-    }
-
     return TRUE;
 }
 
index 0e731b083779291028bc0a49c75c5c180e77ced8..a2571f0e112dac34c82fca7e537b48b07d003b6b 100644 (file)
@@ -394,6 +394,9 @@ static void print_focusevent(XEvent *e)
     case NotifyDetailNone:  detailstr="NotifyDetailNone";  break;
     }
 
+    if (mode == NotifyGrab || mode == NotifyUngrab)
+        return;
+
     g_assert(modestr);
     g_assert(detailstr);
     ob_debug_type(OB_DEBUG_FOCUS, "Focus%s 0x%x mode=%s detail=%s\n",
index 0c32df6cc2517f750b71555c977cbe52c0db956c..88ef01047160472775c7ac1ad58284cc776fcda7 100644 (file)
@@ -201,6 +201,7 @@ void focus_set_client(ObClient *client)
 
 
     focus_tried = NULL; /* focus isn't "trying" to go anywhere now */
+    ob_debug_type(OB_DEBUG_FOCUS, "focus tried = NULL\n");
 }
 
 static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
@@ -290,6 +291,8 @@ ObClient* focus_fallback(gboolean allow_refocus)
         client_focus(new);
         /* remember that we tried to send focus here */
         focus_tried = new;
+
+        ob_debug_type(OB_DEBUG_FOCUS, "focus tried = %s\n", new->title);
     }
 
     return new;
@@ -311,6 +314,7 @@ void focus_nothing()
     */
 
     focus_tried = NULL; /* focus isn't "trying" to go anywhere now */
+    ob_debug_type(OB_DEBUG_FOCUS, "focus tried = NULL\n");
 
     /* if there is a grab going on, then we need to cancel it. if we move
        focus during the grab, applications will get NotifyWhileGrabbed events
@@ -964,6 +968,9 @@ static void focus_tried_hide_notify(ObClient *client, gpointer data)
 {
     XEvent ce;
 
+    ob_debug_type(OB_DEBUG_FOCUS, "checking focus tried (%s) against %s\n",
+                  (focus_tried?focus_tried->title:"(null)"), client->title);
+
     if (client == focus_tried) {
         /* we were trying to focus this window but it's gone */