add the "all" and "target" filters
authorDana Jansens <danakj@orodu.net>
Fri, 29 Jul 2011 20:59:16 +0000 (16:59 -0400)
committerDana Jansens <danakj@orodu.net>
Sun, 16 Oct 2011 22:55:15 +0000 (18:55 -0400)
Makefile.am
openbox/filters/_all.c
openbox/filters/_all.h
openbox/filters/all.c [new file with mode: 0644]
openbox/filters/target.c [new file with mode: 0644]

index 2528950c5574bb9c2173891dd33d4878deed9f24..a80a98a575c9fe7e495a4085a593ac2cd9922647 100644 (file)
@@ -236,6 +236,8 @@ openbox_openbox_SOURCES = \
        openbox/actions/unfocus.c \
        openbox/filters/_all.c \
        openbox/filters/_all.h \
+       openbox/filters/all.c \
+       openbox/filters/target.c \
        openbox/action.c \
        openbox/action.h \
        openbox/action_filter.c \
index 0345df86c4d4f6885d9a5725994dc3c7bc39f4e6..2d4ff360c52e82bfcc25a26baa2045eab14dd564 100644 (file)
@@ -20,5 +20,6 @@
 
 void filters__all_startup(void)
 {
-    /*filter_foo_startup();*/
+    filter_all_startup();
+    filter_target_startup();
 }
index e75b3d62d0ed61cc2e1a00805a388463f59b95cf..f15fdaeda702b4460e12a47736b256a59e897d7a 100644 (file)
@@ -18,4 +18,5 @@
 
 void filters__all_startup(void);
 
-/*void filter_foo_startup(void);*/
+void filter_all_startup(void);
+void filter_target_startup(void);
diff --git a/openbox/filters/all.c b/openbox/filters/all.c
new file mode 100644 (file)
index 0000000..dd0f4d7
--- /dev/null
@@ -0,0 +1,33 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   filters/all.c for the Openbox window manager
+   Copyright (c) 2011             Dana Jansens
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#include "openbox/action_filter.h"
+
+static gboolean reduce(struct _ObClient *c, gpointer data)
+{
+    return FALSE; /* remove nothing */
+}
+static gboolean expand(struct _ObClient *c, gpointer data)
+{
+    return TRUE; /* add everything */
+}
+
+void filter_all_startup(void)
+{
+    action_filter_register("all", NULL, NULL, reduce, expand);
+}
diff --git a/openbox/filters/target.c b/openbox/filters/target.c
new file mode 100644 (file)
index 0000000..cb6b33a
--- /dev/null
@@ -0,0 +1,34 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   filters/all.c for the Openbox window manager
+   Copyright (c) 2011             Dana Jansens
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#include "openbox/action_filter.h"
+#include "openbox/event.h"
+
+static gboolean reduce(struct _ObClient *c, gpointer data)
+{
+    return c != event_current_target(); /* remove anything not the target */
+}
+static gboolean expand(struct _ObClient *c, gpointer data)
+{
+    return c == event_current_target(); /* add only the target */
+}
+
+void filter_target_startup(void)
+{
+    action_filter_register("target", NULL, NULL, reduce, expand);
+}