summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-04-11 21:27:03 +0000
committerDana Jansens <danakj@orodu.net>2003-04-11 21:27:03 +0000
commit6b95bf33363f73d198da2f515f2f9f6bef2278c8 (patch)
treecba1c63dfa36730842f5c745fad973792f66902e
parent6011fe9c952b91a7f6f8b341e9a2897805bf3725 (diff)
add getting of some root properties
-rw-r--r--build/Makefile.cwmcc2
-rw-r--r--cwmcc/.cvsignore1
-rw-r--r--cwmcc/client_props.c3
-rw-r--r--cwmcc/root_props.c116
-rw-r--r--cwmcc/root_props.h6
5 files changed, 126 insertions, 2 deletions
diff --git a/build/Makefile.cwmcc b/build/Makefile.cwmcc
index 43601725..7ad79615 100644
--- a/build/Makefile.cwmcc
+++ b/build/Makefile.cwmcc
@@ -6,7 +6,7 @@ CPPFLAGS += $(GLIB_CFLAGS) $(XFT_CFLAGS) -DG_LOG_DOMAIN=\"CWMCC\"
LIBS += $(GLIB_LIBS)
target = libcwmcc.la
-sources = cwmcc.c atom.c prop.c client_props.c
+sources = cwmcc.c atom.c prop.c client_props.c root_props.c
srcdir := $(srcdir)/$(dir)
target := $(addprefix $(dir)/, $(target))
diff --git a/cwmcc/.cvsignore b/cwmcc/.cvsignore
index 60f9361f..df68fa02 100644
--- a/cwmcc/.cvsignore
+++ b/cwmcc/.cvsignore
@@ -4,3 +4,4 @@ libcwmcc.la
atom.lo
prop.lo
client_props.lo
+root_props.lo
diff --git a/cwmcc/client_props.c b/cwmcc/client_props.c
index e0b39419..34ae4ecd 100644
--- a/cwmcc/client_props.c
+++ b/cwmcc/client_props.c
@@ -15,6 +15,7 @@ void cwmcc_client_get_protocols(Window win, Atom **protocols)
if (!prop_get_array32(win, CWMCC_ATOM(client, wm_protocols),
CWMCC_ATOM(type, atom), protocols, &num)) {
+ g_warning("Failed to read WM_PROTOCOLS from 0x%lx", win);
*protocols = NULL;
}
}
@@ -212,7 +213,7 @@ void cwmcc_client_get_strut(Window win, int *l, int *t, int *r, int *b)
*t = data[2];
*b = data[3];
}
- g_free(l);
+ g_free(data);
}
static void convert_pixmap_to_icon(Pixmap pix, Pixmap mask,
diff --git a/cwmcc/root_props.c b/cwmcc/root_props.c
new file mode 100644
index 00000000..7339cbba
--- /dev/null
+++ b/cwmcc/root_props.c
@@ -0,0 +1,116 @@
+#include "cwmcc_internal.h"
+#include "atom.h"
+#include "prop.h"
+#include "client_props.h"
+#include "render/render.h"
+
+#include <X11/Xutil.h>
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+
+void cwmcc_root_get_supported(Window win, Atom **atoms)
+{
+ gulong num;
+
+ if (!prop_get_array32(win, CWMCC_ATOM(root, net_supported),
+ CWMCC_ATOM(type, atom), atoms, &num)) {
+ g_warning("Failed to read NET_SUPPORTED from 0x%lx", win);
+ *atoms = NULL;
+ }
+}
+
+void cwmcc_root_get_client_list(Window win, Window **windows)
+{
+ gulong num;
+
+ if (!prop_get_array32(win, CWMCC_ATOM(root, net_client_list),
+ CWMCC_ATOM(type, window), windows, &num)) {
+ g_warning("Failed to read NET_CLIENT_LIST from 0x%lx", win);
+ *windows = NULL;
+ }
+}
+
+void cwmcc_root_get_client_list_stacking(Window win, Window **windows)
+{
+ gulong num;
+
+ if (!prop_get_array32(win, CWMCC_ATOM(root, net_client_list_stacking),
+ CWMCC_ATOM(type, window), windows, &num)) {
+ g_warning("Failed to read NET_CLIENT_LIST_STACKING from 0x%lx", win);
+ *windows = NULL;
+ }
+}
+
+void cwmcc_root_get_number_of_desktops(Window win, gulong *desktops)
+{
+ if (!prop_get32(win, CWMCC_ATOM(root, net_number_of_desktops),
+ CWMCC_ATOM(type, cardinal), desktops)) {
+ g_warning("Failed to read NET_NUMBER_OF_DESKTOPS from 0x%lx", win);
+ *desktops = 1;
+ }
+}
+
+void cwmcc_root_get_desktop_geometry(Window win, gulong *w, gulong *h)
+{
+ gulong *data = NULL, num;
+
+ if (!prop_get_array32(win, CWMCC_ATOM(root, net_desktop_geometry),
+ CWMCC_ATOM(type, cardinal), &data, &num)) {
+ g_warning("Failed to read NET_DESKTOP_GEOMETRY from 0x%lx", win);
+ *w = *h = 0;
+ } else if (num != 2) {
+ g_warning("Read invalid NET_DESKTOP_GEOMETRY from 0x%lx", win);
+ *w = *h = 0;
+ } else {
+ *w = data[0];
+ *h = data[1];
+ }
+ g_free(data);
+}
+
+void cwmcc_root_get_desktop_viewport(Window win, gulong *x, gulong *y)
+{
+ gulong *data = NULL, num;
+
+ if (!prop_get_array32(win, CWMCC_ATOM(root, net_desktop_viewport),
+ CWMCC_ATOM(type, cardinal), &data, &num)) {
+ g_warning("Failed to read NET_DESKTOP_VIEWPORT from 0x%lx", win);
+ *x = *y = 0;
+ } else if (num != 2) {
+ g_warning("Read invalid NET_DESKTOP_VIEWPORT from 0x%lx", win);
+ *x = *y = 0;
+ } else {
+ *x = data[0];
+ *y = data[1];
+ }
+ g_free(data);
+}
+
+void cwmcc_root_get_current_desktop(Window win, gulong *desktop)
+{
+ if (!prop_get32(win, CWMCC_ATOM(root, net_current_desktop),
+ CWMCC_ATOM(type, cardinal), desktop)) {
+ g_warning("Failed to read NET_CURRENT_DESKTOP from 0x%lx", win);
+ *desktop = 0;
+ }
+}
+
+void cwmcc_root_get_desktop_names(Window win, char ***names)
+{
+ if (!prop_get_strings_utf8(win,
+ CWMCC_ATOM(root, net_desktop_names), names)) {
+ g_warning("Failed to read NET_DESKTOP_NAMES from 0x%lx", win);
+ *names = NULL;
+ }
+}
+
+void cwmcc_root_get_active_window(Window win, Window *window)
+{
+ if (!prop_get32(win, CWMCC_ATOM(root, net_active_window),
+ CWMCC_ATOM(type, window), window)) {
+ g_warning("Failed to read NET_ACTIVE_WINDOW from 0x%lx", win);
+ *window = None;
+ }
+}
+
diff --git a/cwmcc/root_props.h b/cwmcc/root_props.h
new file mode 100644
index 00000000..0bc5fef7
--- /dev/null
+++ b/cwmcc/root_props.h
@@ -0,0 +1,6 @@
+#ifndef __cwmcc_root_props_h
+#define __cwmcc_root_props_h
+
+void cwmcc_root_get_supported(Window win, Atom **atoms);
+
+#endif