From: Dana Jansens Date: Fri, 29 Jul 2011 20:59:16 +0000 (-0400) Subject: add the "all" and "target" filters X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=b8517d30606d0cd7d0d0956e638bf953c9653d5b;p=dana%2Fopenbox.git add the "all" and "target" filters --- diff --git a/Makefile.am b/Makefile.am index 2528950c..a80a98a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/openbox/filters/_all.c b/openbox/filters/_all.c index 0345df86..2d4ff360 100644 --- a/openbox/filters/_all.c +++ b/openbox/filters/_all.c @@ -20,5 +20,6 @@ void filters__all_startup(void) { - /*filter_foo_startup();*/ + filter_all_startup(); + filter_target_startup(); } diff --git a/openbox/filters/_all.h b/openbox/filters/_all.h index e75b3d62..f15fdaed 100644 --- a/openbox/filters/_all.h +++ b/openbox/filters/_all.h @@ -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 index 00000000..dd0f4d7d --- /dev/null +++ b/openbox/filters/all.c @@ -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 index 00000000..cb6b33a9 --- /dev/null +++ b/openbox/filters/target.c @@ -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); +}