diff options
author | Mystery Man <unknown@mandriva.org> | 2003-03-07 17:32:04 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2003-03-07 17:32:04 +0000 |
commit | af51a7a94a9548765a97f7b7ae198c849b07b050 (patch) | |
tree | 66a71d3292243d805566337973e015e5fa131a78 /tools/aewm-drakx/client.c | |
parent | 653c799da0aa230257f3487228be1a132993db36 (diff) | |
download | drakx-backup-do-not-use-9_1_18mdk.tar drakx-backup-do-not-use-9_1_18mdk.tar.gz drakx-backup-do-not-use-9_1_18mdk.tar.bz2 drakx-backup-do-not-use-9_1_18mdk.tar.xz drakx-backup-do-not-use-9_1_18mdk.zip |
This commit was manufactured by cvs2svn to create tag 'V9_1_18mdk'.V9_1_18mdk
Diffstat (limited to 'tools/aewm-drakx/client.c')
-rw-r--r-- | tools/aewm-drakx/client.c | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/tools/aewm-drakx/client.c b/tools/aewm-drakx/client.c deleted file mode 100644 index 8db6b2151..000000000 --- a/tools/aewm-drakx/client.c +++ /dev/null @@ -1,122 +0,0 @@ -/* aewm - a minimalistic X11 window manager. ------- vim:sw=4:et - * Copyright (c) 1998-2001 Decklin Foster <decklin@red-bean.com> - * Free software! Please see README for details and license. */ - -#include "aewm.h" -#include <X11/Xmd.h> - - -Client *head_client = NULL; - -Client *find_client(Window w) -{ - Client *c; - - for (c = head_client; c; c = c->next) - if (c->window == w) return c; - - return NULL; -} - -void set_focus_on(Window w) -{ - char *name; - XFetchName(dpy, w, &name); - if (name && strcmp(name, "skip")) { - XSetInputFocus(dpy, w, RevertToPointerRoot, CurrentTime); -#ifdef DEBUG - printf("aewm-drakx: adding %lx %s\n", w, name); -#endif - } -} - -/* Attempt to follow the ICCCM by explicity specifying 32 bits for - * this property. Does this goof up on 64 bit systems? */ -void set_wm_state(Client *c, int state) -{ - CARD32 data[2]; - - data[0] = state; - data[1] = None; /* Icon? We don't need no steenking icon. */ - - XChangeProperty(dpy, c->window, wm_state, wm_state, - 32, PropModeReplace, (unsigned char *)data, 2); -} - -/* If we can't find a WM_STATE we're going to have to assume - * Withdrawn. This is not exactly optimal, since we can't really - * distinguish between the case where no WM has run yet and when the - * state was explicitly removed (Clients are allowed to either set the - * atom to Withdrawn or just remove it... yuck.) */ -long get_wm_state(Client *c) -{ - Atom real_type; int real_format; - unsigned long items_read, items_left; - long *data, state = WithdrawnState; - - if (XGetWindowProperty(dpy, c->window, wm_state, 0L, 2L, False, - wm_state, &real_type, &real_format, &items_read, &items_left, - (unsigned char **) &data) == Success && items_read) { - state = *data; - XFree(data); - } - return state; -} - -void remove_client(Client *c) -{ - int ignore_xerror(Display *dpy, XErrorEvent *e) { return 0; } - - Client *p; - - XGrabServer(dpy); - XSetErrorHandler(ignore_xerror); - - set_wm_state(c, WithdrawnState); - - if (head_client == c) head_client = c->next; - else for (p = head_client; p && p->next; p = p->next) - if (p->next == c) p->next = c->next; - - free(c); - - if (head_client) set_focus_on(head_client->window); - - XSync(dpy, False); - XSetErrorHandler(handle_xerror); - XUngrabServer(dpy); -} - -void make_new_client(Window w) -{ - Client *c; - XWindowAttributes attr; - - c = malloc(sizeof *c); - c->next = head_client; - c->window = w; - head_client = c; - - XGrabServer(dpy); - XGetWindowAttributes(dpy, w, &attr); - - - if (attr.map_state != IsViewable) { - XWMHints *hints; - set_wm_state(c, NormalState); - if ((hints = XGetWMHints(dpy, w))) { - if (hints->flags & StateHint) set_wm_state(c, hints->initial_state); - XFree(hints); - } - } - if (attr.map_state == IsViewable) { - XMapWindow(dpy, c->window); - set_wm_state(c, NormalState); - } else if (get_wm_state(c) == NormalState) { - XMapWindow(dpy, c->window); - } - set_focus_on(w); - - XSync(dpy, False); - XUngrabServer(dpy); -} |