only show normal,dialog, and utility windows
authorDana Jansens <danakj@orodu.net>
Mon, 11 Jun 2007 04:29:37 +0000 (04:29 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 11 Jun 2007 04:29:37 +0000 (04:29 +0000)
rspanel.c
rspanel.h
xprop.c
xprop.h

index 1880f84..35e2fd9 100644 (file)
--- a/rspanel.c
+++ b/rspanel.c
@@ -65,8 +65,27 @@ static int is_shaded(Window win)
     return find_state(win, _NET_WM_STATE_SHADED);
 }
 
-static char* get_openbox_theme()
+static xprop_t get_window_type(Window win)
 {
+    Atom *types;
+    int i, j, ntypes;
+    xprop_t known_types[] = { _NET_WM_WINDOW_TYPE_NORMAL,
+                              _NET_WM_WINDOW_TYPE_DIALOG,
+                              _NET_WM_WINDOW_TYPE_MENU,
+                              _NET_WM_WINDOW_TYPE_TOOLBAR,
+                              _NET_WM_WINDOW_TYPE_UTILITY,
+                              _NET_WM_WINDOW_TYPE_SPLASH,
+                              _NET_WM_WINDOW_TYPE_DOCK,
+                              _NET_WM_WINDOW_TYPE_DESKTOP, 0 };
+        
+    types = xprop_get_data(&sc, win, _NET_WM_WINDOW_TYPE, XA_ATOM, &ntypes);
+    for (i = 0; i < ntypes; ++i)
+        for (j = 0; known_types[j]; ++j)
+            if (types[i] == sc.atoms[known_types[j]])
+                return known_types[j];
+
+    /* default to normal */
+    return _NET_WM_WINDOW_TYPE_NORMAL;
 }
 
 static int get_current_desktop(void)
@@ -100,7 +119,10 @@ static void task_update_icons(task *tk)
 
 int task_shown(task *tk)
 {
-    return tk->focused || !tk->hidden;
+    return (tk->focused || !tk->hidden) &&
+        (tk->type == _NET_WM_WINDOW_TYPE_NORMAL ||
+         tk->type == _NET_WM_WINDOW_TYPE_DIALOG ||
+         tk->type == _NET_WM_WINDOW_TYPE_UTILITY);
 }
 
 static void add_task(Window win, int focus)
@@ -128,6 +150,7 @@ static void add_task(Window win, int focus)
     tk->iconified = is_iconified(win);
     tk->shaded = is_shaded(win);
     tk->hidden = is_hidden(win);
+    tk->type = get_window_type(win);
     task_update_icons(tk);
 
     /* now append it to our linked list */
index 3ebe242..3452f0e 100644 (file)
--- a/rspanel.h
+++ b/rspanel.h
@@ -32,6 +32,7 @@ typedef struct task
        int pos_x;
        unsigned int width;
        unsigned int nicons;
+       xprop_t type;
        struct icon *icons;
        unsigned int focused:1;
        unsigned int iconified:1;
diff --git a/xprop.c b/xprop.c
index 3b1408c..8be7e62 100644 (file)
--- a/xprop.c
+++ b/xprop.c
@@ -14,21 +14,14 @@ char *xprop_names[] = {
     "_NET_WM_STATE_HIDDEN",
     "_NET_WM_DESKTOP",
     "_NET_WM_WINDOW_TYPE",
-/* XXX only show some of these */
-"_NET_WM_WINDOW_TYPE_DESKTOP",
-"_NET_WM_WINDOW_TYPE_DOCK",
-"_NET_WM_WINDOW_TYPE_TOOLBAR",
-"_NET_WM_WINDOW_TYPE_MENU",
-"_NET_WM_WINDOW_TYPE_UTILITY",
-"_NET_WM_WINDOW_TYPE_SPLASH",
-"_NET_WM_WINDOW_TYPE_DIALOG",
-"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
-"_NET_WM_WINDOW_TYPE_POPUP_MENU",
-"_NET_WM_WINDOW_TYPE_TOOLTIP",
-"_NET_WM_WINDOW_TYPE_NOTIFICATION",
-"_NET_WM_WINDOW_TYPE_COMBO",
-"_NET_WM_WINDOW_TYPE_DND",
-"_NET_WM_WINDOW_TYPE_NORMAL",
+    "_NET_WM_WINDOW_TYPE_DESKTOP",
+    "_NET_WM_WINDOW_TYPE_DOCK",
+    "_NET_WM_WINDOW_TYPE_TOOLBAR",
+    "_NET_WM_WINDOW_TYPE_MENU",
+    "_NET_WM_WINDOW_TYPE_UTILITY",
+    "_NET_WM_WINDOW_TYPE_SPLASH",
+    "_NET_WM_WINDOW_TYPE_DIALOG",
+    "_NET_WM_WINDOW_TYPE_NORMAL",
     "_NET_WM_STRUT",
     "_NET_WM_ICON_GEOMETRY",
     "_NET_WM_ICON",
diff --git a/xprop.h b/xprop.h
index 0963ae9..97e9387 100644 (file)
--- a/xprop.h
+++ b/xprop.h
@@ -21,20 +21,14 @@ typedef enum {
     _NET_WM_STATE_HIDDEN,
     _NET_WM_DESKTOP,
     _NET_WM_WINDOW_TYPE,
-_NET_WM_WINDOW_TYPE_DESKTOP,
-_NET_WM_WINDOW_TYPE_DOCK,
-_NET_WM_WINDOW_TYPE_TOOLBAR,
-_NET_WM_WINDOW_TYPE_MENU,
-_NET_WM_WINDOW_TYPE_UTILITY,
-_NET_WM_WINDOW_TYPE_SPLASH,
-_NET_WM_WINDOW_TYPE_DIALOG,
-_NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
-_NET_WM_WINDOW_TYPE_POPUP_MENU,
-_NET_WM_WINDOW_TYPE_TOOLTIP,
-_NET_WM_WINDOW_TYPE_NOTIFICATION,
-_NET_WM_WINDOW_TYPE_COMBO,
-_NET_WM_WINDOW_TYPE_DND,
-_NET_WM_WINDOW_TYPE_NORMAL,
+    _NET_WM_WINDOW_TYPE_DESKTOP,
+    _NET_WM_WINDOW_TYPE_DOCK,
+    _NET_WM_WINDOW_TYPE_TOOLBAR,
+    _NET_WM_WINDOW_TYPE_MENU,
+    _NET_WM_WINDOW_TYPE_UTILITY,
+    _NET_WM_WINDOW_TYPE_SPLASH,
+    _NET_WM_WINDOW_TYPE_DIALOG,
+    _NET_WM_WINDOW_TYPE_NORMAL,
     _NET_WM_STRUT,
     _NET_WM_ICON_GEOMETRY,
     _NET_WM_ICON,