From: Dana Jansens Date: Fri, 11 Apr 2003 03:35:14 +0000 (+0000) Subject: add set functions for all the client props that need em X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=d976fc6bb1baebfb805c2f46e56306656fef5922;p=chaz%2Fopenbox add set functions for all the client props that need em --- diff --git a/cwmcc/client_props.c b/cwmcc/client_props.c index 43641324..126677cf 100644 --- a/cwmcc/client_props.c +++ b/cwmcc/client_props.c @@ -16,16 +16,31 @@ void cwmcc_client_get_protocols(Window win, Atom **protocols) } } -int cwmcc_client_get_wm_state(Window win) +void cwmcc_client_set_protocols(Window win, Atom *protocols) { - gulong s; + gulong n; + Atom *a; + for (a = protocols, n = 0; *a; ++a, ++n); + XChangeProperty(cwmcc_display, win, CWMCC_ATOM(client, wm_state), + CWMCC_ATOM(type, atom), 32, PropModeReplace, + (guchar*)protocols, n); +} + +void cwmcc_client_get_wm_state(Window win, gulong *state) +{ if (!prop_get32(win, CWMCC_ATOM(client, wm_state), - CWMCC_ATOM(client, wm_state), &s)) { + CWMCC_ATOM(client, wm_state), state)) { g_warning("Failed to read WM_STATE from 0x%lx", win); - s = NormalState; + *state = NormalState; } - return s; +} + +void cwmcc_client_set_wm_state(Window win, gulong state) +{ + XChangeProperty(cwmcc_display, win, CWMCC_ATOM(client, wm_state), + CWMCC_ATOM(client, wm_state), 32, PropModeReplace, + (guchar*)&state, 1); } void cwmcc_client_get_name(Window win, char **name) @@ -109,6 +124,13 @@ void cwmcc_client_get_desktop(Window win, gulong *desk) } } +void cwmcc_client_set_desktop(Window win, gulong desk) +{ + XChangeProperty(cwmcc_display, win, CWMCC_ATOM(client, net_wm_desktop), + CWMCC_ATOM(type, cardinal), 32, PropModeReplace, + (guchar*)&desk, 1); +} + void cwmcc_client_get_type(Window win, gulong **types) { gulong num; @@ -122,6 +144,17 @@ void cwmcc_client_get_type(Window win, gulong **types) } } +void cwmcc_client_set_type(Window win, gulong *types) +{ + gulong n; + gulong *t; + + for (t = types, n = 0; *t; ++t, ++n); + XChangeProperty(cwmcc_display, win, CWMCC_ATOM(client, wm_state), + CWMCC_ATOM(type, atom), 32, PropModeReplace, + (guchar*)types, n); +} + void cwmcc_client_get_state(Window win, gulong **states) { gulong num; @@ -134,6 +167,17 @@ void cwmcc_client_get_state(Window win, gulong **states) } } +void cwmcc_client_set_state(Window win, gulong *states) +{ + gulong n; + gulong *s; + + for (s = states, n = 0; *s; ++s, ++n); + XChangeProperty(cwmcc_display, win, CWMCC_ATOM(client, wm_state), + CWMCC_ATOM(type, atom), 32, PropModeReplace, + (guchar*)states, n); +} + void cwmcc_client_get_strut(Window win, int *l, int *t, int *r, int *b) { gulong *data = NULL, num; diff --git a/cwmcc/client_props.h b/cwmcc/client_props.h index d73344b4..3f0153f7 100644 --- a/cwmcc/client_props.h +++ b/cwmcc/client_props.h @@ -3,7 +3,8 @@ void cwmcc_client_get_protocols(Window win, Atom **protocols); -int cwmcc_client_get_wm_state(Window win); +void cwmcc_client_get_wm_state(Window win, gulong *state); +void cwmcc_client_set_wm_state(Window win, gulong state); void cwmcc_client_get_name(Window win, char **name); @@ -55,10 +56,13 @@ struct Cwmcc_MwmHints { void cwmcc_client_get_mwmhints(Window win, struct Cwmcc_MwmHints *hints); void cwmcc_client_get_desktop(Window win, gulong *desk); +void cwmcc_client_set_desktop(Window win, gulong desk); void cwmcc_client_get_type(Window win, gulong **types); +void cwmcc_client_set_type(Window win, gulong *types); void cwmcc_client_get_state(Window win, gulong **states); +void cwmcc_client_set_state(Window win, gulong *states); void cwmcc_client_get_strut(Window win, int *l, int *t, int *r, int *b);