From: Dana Jansens Date: Sat, 12 Apr 2003 02:24:03 +0000 (+0000) Subject: complete the root property get functions X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=949946a9b4054ebb46e2eca8bd7685dc9bb5765c;p=chaz%2Fopenbox complete the root property get functions --- diff --git a/cwmcc/root_props.c b/cwmcc/root_props.c index ef03e445..bc963c83 100644 --- a/cwmcc/root_props.c +++ b/cwmcc/root_props.c @@ -112,9 +112,32 @@ void cwmcc_root_get_active_window(Window win, Window *window) } } -/*void cwmcc_root_get_workarea(Window win, Rect a) +void cwmcc_root_get_workarea(Window win, int **x, int **y, int **w, int **h) { -}*/ + gulong *data = NULL, num; + gulong desks, i; + + /* need the number of desktops */ + cwmcc_root_get_number_of_desktops(win, &desks); + + if (!prop_get_array32(win, CWMCC_ATOM(root, net_workarea), + CWMCC_ATOM(type, cardinal), &data, &num)) { + g_warning("Failed to read NET_DESKTOP_LAYOUT from 0x%lx", win); + } else if (num != 4 * desks) { + g_warning("Read invalid NET_DESKTOP_LAYOUT from 0x%lx", win); + } else { + *x = g_new(int, desks); + *y = g_new(int, desks); + *w = g_new(int, desks); + *h = g_new(int, desks); + for (i = 0; i < desks; ++i) { + (*x)[i] = data[i * 4]; + (*y)[i] = data[i * 4 + 1]; + (*w)[i] = data[i * 4 + 2]; + (*h)[i] = data[i * 4 + 3]; + } + } +} void cwmcc_root_get_supporting_wm_check(Window win, Window *window) { diff --git a/cwmcc/root_props.h b/cwmcc/root_props.h index ca43f136..13b06010 100644 --- a/cwmcc/root_props.h +++ b/cwmcc/root_props.h @@ -22,7 +22,7 @@ void cwmcc_root_get_desktop_names(Window win, char ***names); void cwmcc_root_get_active_window(Window win, Window *window); -/*void cwmcc_root_get_workarea(Window win, Rect a)*/ +void cwmcc_root_get_workarea(Window win, int **x, int **y, int **w, int **h); void cwmcc_root_get_supporting_wm_check(Window win, Window *window);