From: Dana Jansens Date: Mon, 24 Oct 2011 23:40:11 +0000 (-0400) Subject: Add "visible" filter for windows on current desktop. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=93c8eff9baa22d63f8c128e483c24c097af9a2c8;p=dana%2Fopenbox.git Add "visible" filter for windows on current desktop. --- diff --git a/Makefile.am b/Makefile.am index b7c86544..47cbd9a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -239,6 +239,7 @@ openbox_openbox_SOURCES = \ openbox/filters/_all.h \ openbox/filters/all.c \ openbox/filters/target.c \ + openbox/filters/visible.c \ openbox/action.c \ openbox/action.h \ openbox/action_filter.c \ diff --git a/openbox/filters/_all.c b/openbox/filters/_all.c index 2d4ff360..07621cdd 100644 --- a/openbox/filters/_all.c +++ b/openbox/filters/_all.c @@ -18,8 +18,13 @@ #include "_all.h" +void filter_all_startup(void); +void filter_target_startup(void); +void filter_visible_startup(void); + void filters__all_startup(void) { filter_all_startup(); filter_target_startup(); + filter_visible_startup(); } diff --git a/openbox/filters/_all.h b/openbox/filters/_all.h index f15fdaed..28522fb8 100644 --- a/openbox/filters/_all.h +++ b/openbox/filters/_all.h @@ -17,6 +17,3 @@ */ void filters__all_startup(void); - -void filter_all_startup(void); -void filter_target_startup(void); diff --git a/openbox/filters/visible.c b/openbox/filters/visible.c new file mode 100644 index 00000000..39c80789 --- /dev/null +++ b/openbox/filters/visible.c @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + filters/visible.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/action_list_run.h" +#include "openbox/client.h" +#include "openbox/client_set.h" +#include "openbox/screen.h" + +static gboolean test_visible(ObClient *c, gpointer data) +{ + return screen_compare_desktops(c->desktop, screen_desktop); +} + +static ObClientSet* filter(gboolean invert, const ObActionListRun *data, + gpointer setup_data) +{ + return client_set_expand(client_set_empty(), test_visible, NULL); +} + +/*! The "visible" filter matches all clients that are visible currently + (including iconic windows). In the classic paradigm this is all windows + visible on the current desktop. +*/ +void filter_visible_startup(void) +{ + action_filter_register("visible", NULL, NULL, filter); +}