diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-09-15 13:41:51 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-09-15 13:41:51 +0000 |
commit | ae1ca0772cea076c0098a83c15de2581e8aee3f5 (patch) | |
tree | 3df8809b28956670bca8ba3b447409c5d8bdfdd5 /tools/aewm-drakx/events.c | |
parent | 1e19a1f7ea181f9fd40e0f81ac3b7fda8563d391 (diff) | |
download | drakx-ae1ca0772cea076c0098a83c15de2581e8aee3f5.tar drakx-ae1ca0772cea076c0098a83c15de2581e8aee3f5.tar.gz drakx-ae1ca0772cea076c0098a83c15de2581e8aee3f5.tar.bz2 drakx-ae1ca0772cea076c0098a83c15de2581e8aee3f5.tar.xz drakx-ae1ca0772cea076c0098a83c15de2581e8aee3f5.zip |
- add and use aewm-drakx
- add some "skip" title on help/logo/steps windows so that aewm-drakx know they don't need keyboard focus
- add some more title to ease debugging (when aewm-drakx is in debug mode)
Diffstat (limited to 'tools/aewm-drakx/events.c')
-rw-r--r-- | tools/aewm-drakx/events.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/tools/aewm-drakx/events.c b/tools/aewm-drakx/events.c new file mode 100644 index 000000000..4a6ba53a4 --- /dev/null +++ b/tools/aewm-drakx/events.c @@ -0,0 +1,105 @@ +/* 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" + + +static void handle_configure_request(XConfigureRequestEvent *e) +{ + XWindowChanges wc; + + wc.x = e->x; + wc.y = e->y; + wc.width = e->width; + wc.height = e->height; + wc.sibling = e->above; + wc.stack_mode = e->detail; + XConfigureWindow(dpy, e->window, e->value_mask, &wc); +} + +static void handle_map_request(XMapRequestEvent *e) +{ + Client *c = find_client(e->window); + + if (c) { + XMapWindow(dpy, c->window); + set_wm_state(c, NormalState); + } else { + make_new_client(e->window); + } +} + +static void handle_destroy_event(XDestroyWindowEvent *e) +{ + Client *c = find_client(e->window); + + if (c) remove_client(c); +} + + +#ifdef DEBUG +#define SHOW_EV(name, memb) \ + case name: s = #name; w = e.memb.window; break; +#define SHOW(name) \ + case name: return #name; + +void show_event(XEvent e) +{ + char *s = 0, buf[20]; + char *dd = 0; + Window w = 0; + Client *c; + + switch (e.type) { + SHOW_EV(ButtonPress, xbutton) + SHOW_EV(ButtonRelease, xbutton) + SHOW_EV(ClientMessage, xclient) + SHOW_EV(ColormapNotify, xcolormap) + SHOW_EV(ConfigureNotify, xconfigure) + SHOW_EV(ConfigureRequest, xconfigurerequest) + SHOW_EV(CreateNotify, xcreatewindow) + SHOW_EV(DestroyNotify, xdestroywindow) + SHOW_EV(EnterNotify, xcrossing) + SHOW_EV(Expose, xexpose) + SHOW_EV(MapNotify, xmap) + SHOW_EV(MapRequest, xmaprequest) + SHOW_EV(MappingNotify, xmapping) + SHOW_EV(MotionNotify, xmotion) + SHOW_EV(PropertyNotify, xproperty) + SHOW_EV(ReparentNotify, xreparent) + SHOW_EV(ResizeRequest, xresizerequest) + SHOW_EV(UnmapNotify, xunmap) + default: + break; + } + + c = find_client(w); + + if (c) XFetchName(dpy, c->window, &dd); + + snprintf(buf, sizeof buf, dd ? dd : ""); + err("%#-10lx: %-20s: %s", w, buf, s); +} +#endif + + +void do_event_loop(void) +{ + XEvent ev; + + for (;;) { + XNextEvent(dpy, &ev); +#ifdef DEBUG + show_event(ev); +#endif + switch (ev.type) { + case ConfigureRequest: + handle_configure_request(&ev.xconfigurerequest); break; + case MapRequest: + handle_map_request(&ev.xmaprequest); break; + case DestroyNotify: + handle_destroy_event(&ev.xdestroywindow); break; + } + } +} |