summaryrefslogtreecommitdiff
path: root/cwmcc
diff options
context:
space:
mode:
Diffstat (limited to 'cwmcc')
-rw-r--r--cwmcc/prop.c4
-rw-r--r--cwmcc/root_props.c22
-rw-r--r--cwmcc/root_props.h7
3 files changed, 15 insertions, 18 deletions
diff --git a/cwmcc/prop.c b/cwmcc/prop.c
index b855c909..6e9e0812 100644
--- a/cwmcc/prop.c
+++ b/cwmcc/prop.c
@@ -84,9 +84,7 @@ static gboolean get_all(Window win, Atom prop, Atom type, int size,
&ret_items, &bytes_left, &xdata);
if (res == Success) {
if (ret_size == size && ret_items > 0) {
- *data = g_malloc(ret_items * (size / 8) + sizeof(guchar*));
- g_memmove(*data, xdata, ret_items * (size / 8));
- data[ret_items * (size / 8)] = NULL;
+ *data = g_memdup(xdata, ret_items * (size / 8));
*num = ret_items;
ret = TRUE;
}
diff --git a/cwmcc/root_props.c b/cwmcc/root_props.c
index 52b2b531..3ba243c8 100644
--- a/cwmcc/root_props.c
+++ b/cwmcc/root_props.c
@@ -5,36 +5,34 @@
#include <string.h>
-void cwmcc_root_get_supported(Window win, Atom **atoms)
+void cwmcc_root_get_supported(Window win, Atom **atoms, gulong *num)
{
- gulong num;
-
if (!cwmcc_prop_get_array32(win, CWMCC_ATOM(root, net_supported),
- CWMCC_ATOM(type, atom), atoms, &num)) {
+ CWMCC_ATOM(type, atom), atoms, num)) {
g_warning("Failed to read NET_SUPPORTED from 0x%lx", win);
*atoms = NULL;
+ *num = 0;
}
}
-void cwmcc_root_get_client_list(Window win, Window **windows)
+void cwmcc_root_get_client_list(Window win, Window **windows, gulong *num)
{
- gulong num;
-
if (!cwmcc_prop_get_array32(win, CWMCC_ATOM(root, net_client_list),
- CWMCC_ATOM(type, window), windows, &num)) {
+ CWMCC_ATOM(type, window), windows, num)) {
g_warning("Failed to read NET_CLIENT_LIST from 0x%lx", win);
*windows = NULL;
+ *num = 0;
}
}
-void cwmcc_root_get_client_list_stacking(Window win, Window **windows)
+void cwmcc_root_get_client_list_stacking(Window win, Window **windows,
+ gulong *num)
{
- gulong num;
-
if (!cwmcc_prop_get_array32(win,CWMCC_ATOM(root, net_client_list_stacking),
- CWMCC_ATOM(type, window), windows, &num)) {
+ CWMCC_ATOM(type, window), windows, num)) {
g_warning("Failed to read NET_CLIENT_LIST_STACKING from 0x%lx", win);
*windows = NULL;
+ *num = 0;
}
}
diff --git a/cwmcc/root_props.h b/cwmcc/root_props.h
index 13b06010..7690287b 100644
--- a/cwmcc/root_props.h
+++ b/cwmcc/root_props.h
@@ -4,11 +4,12 @@
#include <X11/Xlib.h>
#include <glib.h>
-void cwmcc_root_get_supported(Window win, Atom **atoms);
+void cwmcc_root_get_supported(Window win, Atom **atoms, gulong *num);
-void cwmcc_root_get_client_list(Window win, Window **windows);
+void cwmcc_root_get_client_list(Window win, Window **windows, gulong *num);
-void cwmcc_root_get_client_list_stacking(Window win, Window **windows);
+void cwmcc_root_get_client_list_stacking(Window win, Window **windows,
+ gulong *num);
void cwmcc_root_get_number_of_desktops(Window win, gulong *desktops);