diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-04-12 02:03:28 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-04-12 02:03:28 +0000 |
| commit | 7b03041409912d38cb9f98988449fb9be641f572 (patch) | |
| tree | 196628dcce72c269999045c2d031bce64eb96632 /cwmcc/root_props.c | |
| parent | 9b63f238aea70f385e49e4582ef2e67f7fe1714f (diff) | |
add most of the root window props get functions
Diffstat (limited to 'cwmcc/root_props.c')
| -rw-r--r-- | cwmcc/root_props.c | 89 |
1 files changed, 86 insertions, 3 deletions
diff --git a/cwmcc/root_props.c b/cwmcc/root_props.c index 7339cbba..ef03e445 100644 --- a/cwmcc/root_props.c +++ b/cwmcc/root_props.c @@ -1,10 +1,8 @@ #include "cwmcc_internal.h" #include "atom.h" #include "prop.h" -#include "client_props.h" -#include "render/render.h" +#include "root_props.h" -#include <X11/Xutil.h> #ifdef HAVE_STRING_H # include <string.h> #endif @@ -114,3 +112,88 @@ void cwmcc_root_get_active_window(Window win, Window *window) } } +/*void cwmcc_root_get_workarea(Window win, Rect a) +{ +}*/ + +void cwmcc_root_get_supporting_wm_check(Window win, Window *window) +{ + if (!prop_get32(win, CWMCC_ATOM(root, net_supporting_wm_check), + CWMCC_ATOM(type, window), window)) { + g_warning("Failed to read NET_SUPPORTING_WM_CHECK from 0x%lx", win); + *window = None; + } +} + +void cwmcc_root_get_desktop_layout(Window win, + struct Cwmcc_DesktopLayout *layout) +{ + gulong *data = NULL, num; + gulong desks; + + /* need the number of desktops */ + cwmcc_root_get_number_of_desktops(win, &desks); + + layout->orientation = Cwmcc_Orientation_Horz; + layout->start_corner = Cwmcc_Corner_TopLeft; + layout->rows = 1; + layout->columns = desks; + + if (!prop_get_array32(win, CWMCC_ATOM(root, net_desktop_layout), + CWMCC_ATOM(type, cardinal), &data, &num)) { + g_warning("Failed to read NET_DESKTOP_LAYOUT from 0x%lx", win); + } else if (num != 4) { + g_warning("Read invalid NET_DESKTOP_LAYOUT from 0x%lx", win); + } else { + if (data[0] == Cwmcc_Orientation_Horz || + data[0] == Cwmcc_Orientation_Vert) + layout->orientation = data[0]; + if (data[3] == Cwmcc_Corner_TopLeft || + data[3] == Cwmcc_Corner_TopRight || + data[3] == Cwmcc_Corner_BottomLeft || + data[3] == Cwmcc_Corner_BottomRight) + layout->start_corner = data[3]; + layout->rows = data[2]; + layout->columns = data[1]; + + /* bounds checking */ + if (layout->orientation == Cwmcc_Orientation_Horz) { + if (layout->rows > desks) + layout->rows = desks; + if (layout->columns > ((desks + desks % layout->rows) / + layout->rows)) + layout->columns = ((desks + desks % layout->rows) / + layout->rows); + } else { + if (layout->columns > desks) + layout->columns = desks; + if (layout->rows > ((desks + desks % layout->columns) / + layout->columns)) + layout->rows = ((desks + desks % layout->columns) / + layout->columns); + } + } + g_free(data); +} + +void cwmcc_root_get_showing_desktop(Window win, gboolean *showing) +{ + gulong a; + + if (!prop_get32(win, CWMCC_ATOM(root, net_showing_desktop), + CWMCC_ATOM(type, cardinal), &a)) { + g_warning("Failed to read NET_SHOWING_DESKTOP from 0x%lx", win); + a = FALSE; + } + *showing = !!a; +} + +void cwmcc_root_get_openbox_pid(Window win, gulong *pid) +{ + if (!prop_get32(win, CWMCC_ATOM(root, openbox_pid), + CWMCC_ATOM(type, cardinal), pid)) { + g_warning("Failed to read OPENBOX_PID from 0x%lx", win); + *pid = 0; + } +} + |
