clean up a few xu_* functions to just accept what they need (Window).

ok oga@
This commit is contained in:
okan 2010-04-11 16:51:26 +00:00
parent 46c9b5cbae
commit b12e6fc5cd
4 changed files with 12 additions and 13 deletions

View File

@ -399,9 +399,8 @@ void xu_ptr_setpos(Window, int, int);
void xu_ptr_getpos(Window, int *, int *); void xu_ptr_getpos(Window, int *, int *);
void xu_key_grab(Window, int, int); void xu_key_grab(Window, int, int);
void xu_key_ungrab(Window, int, int); void xu_key_ungrab(Window, int, int);
void xu_sendmsg(struct client_ctx *, Atom, long); void xu_sendmsg(Window, Atom, long);
int xu_getprop(struct client_ctx *, Atom, Atom, long, int xu_getprop(Window, Atom, Atom, long, u_char **);
u_char **);
char *xu_getstrprop(struct client_ctx *, Atom atm); char *xu_getstrprop(struct client_ctx *, Atom atm);
void xu_setstate(struct client_ctx *, int); void xu_setstate(struct client_ctx *, int);
int xu_getstate(struct client_ctx *, int *); int xu_getstate(struct client_ctx *, int *);

View File

@ -495,7 +495,7 @@ client_update(struct client_ctx *cc)
int i; int i;
long n; long n;
if ((n = xu_getprop(cc, WM_PROTOCOLS, if ((n = xu_getprop(cc->win, WM_PROTOCOLS,
XA_ATOM, 20L, (u_char **)&p)) <= 0) XA_ATOM, 20L, (u_char **)&p)) <= 0)
return; return;
@ -512,7 +512,7 @@ void
client_send_delete(struct client_ctx *cc) client_send_delete(struct client_ctx *cc)
{ {
if (cc->xproto & CLIENT_PROTO_DELETE) if (cc->xproto & CLIENT_PROTO_DELETE)
xu_sendmsg(cc, WM_PROTOCOLS, WM_DELETE_WINDOW); xu_sendmsg(cc->win, WM_PROTOCOLS, WM_DELETE_WINDOW);
else else
XKillClient(X_Dpy, cc->win); XKillClient(X_Dpy, cc->win);
} }
@ -814,7 +814,7 @@ client_gethints(struct client_ctx *cc)
cc->app_class = xch.res_class; cc->app_class = xch.res_class;
} }
if (xu_getprop(cc, _MOTIF_WM_HINTS, _MOTIF_WM_HINTS, if (xu_getprop(cc->win, _MOTIF_WM_HINTS, _MOTIF_WM_HINTS,
PROP_MWM_HINTS_ELEMENTS, (u_char **)&mwmh) == MWM_NUMHINTS) PROP_MWM_HINTS_ELEMENTS, (u_char **)&mwmh) == MWM_NUMHINTS)
if (mwmh->flags & MWM_HINTS_DECORATIONS && if (mwmh->flags & MWM_HINTS_DECORATIONS &&
!(mwmh->decorations & MWM_DECOR_ALL) && !(mwmh->decorations & MWM_DECOR_ALL) &&

View File

@ -426,7 +426,7 @@ group_autogroup(struct client_ctx *cc)
if (cc->app_class == NULL || cc->app_name == NULL) if (cc->app_class == NULL || cc->app_name == NULL)
return; return;
if (xu_getprop(cc, _NET_WM_DESKTOP, XA_CARDINAL, if (xu_getprop(cc->win, _NET_WM_DESKTOP, XA_CARDINAL,
1, (unsigned char **)&grpno) > 0) { 1, (unsigned char **)&grpno) > 0) {
if (*grpno == 0xffffffff) if (*grpno == 0xffffffff)
no = 0; no = 0;

12
xutil.c
View File

@ -119,29 +119,29 @@ xu_key_ungrab(Window win, int mask, int keysym)
} }
void void
xu_sendmsg(struct client_ctx *cc, Atom atm, long val) xu_sendmsg(Window win, Atom atm, long val)
{ {
XEvent e; XEvent e;
memset(&e, 0, sizeof(e)); memset(&e, 0, sizeof(e));
e.xclient.type = ClientMessage; e.xclient.type = ClientMessage;
e.xclient.window = cc->win; e.xclient.window = win;
e.xclient.message_type = atm; e.xclient.message_type = atm;
e.xclient.format = 32; e.xclient.format = 32;
e.xclient.data.l[0] = val; e.xclient.data.l[0] = val;
e.xclient.data.l[1] = CurrentTime; e.xclient.data.l[1] = CurrentTime;
XSendEvent(X_Dpy, cc->win, False, 0, &e); XSendEvent(X_Dpy, win, False, 0, &e);
} }
int int
xu_getprop(struct client_ctx *cc, Atom atm, Atom type, long len, u_char **p) xu_getprop(Window win, Atom atm, Atom type, long len, u_char **p)
{ {
Atom realtype; Atom realtype;
u_long n, extra; u_long n, extra;
int format; int format;
if (XGetWindowProperty(X_Dpy, cc->win, atm, 0L, len, False, type, if (XGetWindowProperty(X_Dpy, win, atm, 0L, len, False, type,
&realtype, &format, &n, &extra, p) != Success || *p == NULL) &realtype, &format, &n, &extra, p) != Success || *p == NULL)
return (-1); return (-1);
@ -156,7 +156,7 @@ xu_getstate(struct client_ctx *cc, int *state)
{ {
long *p = NULL; long *p = NULL;
if (xu_getprop(cc, WM_STATE, WM_STATE, 2L, (u_char **)&p) <= 0) if (xu_getprop(cc->win, WM_STATE, WM_STATE, 2L, (u_char **)&p) <= 0)
return (-1); return (-1);
*state = (int)*p; *state = (int)*p;