Save target window across restarts for sendkeyevent.
authorMikael Magnusson <mikachu@comhem.se>
Wed, 27 Feb 2008 15:27:07 +0000 (16:27 +0100)
committerMikael Magnusson <mikachu@comhem.se>
Thu, 28 Feb 2008 03:33:49 +0000 (04:33 +0100)
obt/prop.c
obt/prop.h
openbox/actions/sendkeyevent.c

index 1e324b9..ffd8afd 100644 (file)
@@ -189,6 +189,7 @@ void obt_prop_startup(void)
     CREATE_(OB_WM_ACTION_UNDECORATE);
     CREATE_(OB_WM_STATE_UNDECORATED);
     CREATE_(OB_CONTROL);
+    CREATE_(OB_TARGET_WINDOW);
 }
 
 Atom obt_prop_atom(ObtPropAtom a)
index 22a1ab4..924db52 100644 (file)
@@ -210,6 +210,7 @@ typedef enum {
     OBT_PROP_OB_THEME,
     OBT_PROP_OB_CONFIG_FILE,
     OBT_PROP_OB_CONTROL,
+    OBT_PROP_OB_TARGET_WINDOW,
 
     OBT_PROP_NUM_ATOMS
 } ObtPropAtom;
index 2817882..129eb50 100644 (file)
@@ -2,6 +2,8 @@
 #include "openbox/client.h"
 #include "openbox/window.h"
 #include "obt/display.h"
+#include "obt/prop.h"
+#include "openbox/openbox.h"
 #include "gettext.h"
 
 typedef struct {
@@ -25,6 +27,7 @@ void action_sendkeyevent_startup(void)
                      NULL, NULL,
                      settarget,
                      NULL, NULL);
+    OBT_PROP_GET32(obt_root(ob_screen), OB_TARGET_WINDOW, WINDOW, (guint32 *)&target);
 }
 
 static KeyCode parse_key(gchar *s)
@@ -82,8 +85,10 @@ static gboolean sendkey(ObActionsData *data, gpointer options)
 /* Always return FALSE because its not interactive */
 static gboolean settarget(ObActionsData *data, gpointer options)
 {
-    if (data->client)
+    if (data->client) {
       target = data->client->window;
+      OBT_PROP_SET32(obt_root(ob_screen), OB_TARGET_WINDOW, WINDOW, target);
+    }
 
     return FALSE;
 }