2 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
3 * Copyright (C) 2004-2009 Kim Woelders
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies of the Software, its documentation and marketing & publicity
14 * materials, and acknowledgment shall be given in the documentation, materials
15 * and software packages that this Software was used.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 #include <X11/Xutil.h>
33 #include <X11/extensions/shape.h>
35 #include <X11/extensions/sync.h>
38 #include <X11/extensions/scrnsaver.h>
41 #include <X11/extensions/Xrandr.h>
44 #include <X11/extensions/Xcomposite.h>
45 #include <X11/extensions/Xdamage.h>
46 #include <X11/extensions/Xfixes.h>
47 #include <X11/extensions/Xrender.h>
53 #if ENABLE_DEBUG_EVENTS
54 static const char *EventName(unsigned int type);
58 * Server extension handling
62 int event_base, error_base;
69 int (*query_ext) (Display * dpy, int *event, int *error);
70 int (*query_ver) (Display * dpy, int *major, int *minor);
71 void (*init) (int avaliable);
74 static EServerExtData ExtData[8];
76 #define event_base_shape ExtData[XEXT_SHAPE].event_base
77 #define event_base_randr ExtData[XEXT_RANDR].event_base
78 #define event_base_damage ExtData[XEXT_DAMAGE].event_base
79 #define event_base_saver ExtData[XEXT_SCRSAVER].event_base
82 ExtInitShape(int available)
87 AlertX(_("X server setup error"), _("OK"), NULL, NULL,
88 _("FATAL ERROR:\n" "\n"
89 "This Xserver does not support the Shape extension.\n"
90 "This is required for Enlightenment to run.\n" "\n"
91 "Your Xserver probably is too old or mis-configured.\n" "\n"
98 ExtInitSync(int available)
101 XSyncSystemCounter *xssc;
106 xssc = XSyncListSystemCounters(disp, &num);
107 for (i = 0; i < num; i++)
109 if (!strcmp(xssc[i].name, "SERVERTIME"))
110 Mode.display.server_time = xssc[i].counter;
111 if (EDebug(EDBUG_TYPE_SYNC))
112 Eprintf(" Sync counter %2d: %10s %#lx %#x:%#x\n", i,
113 xssc[i].name, xssc[i].counter,
114 XSyncValueHigh32(xssc[i].resolution),
115 XSyncValueLow32(xssc[i].resolution));
117 XSyncFreeSystemCounterList(xssc);
119 if (Mode.display.server_time == None)
120 Conf.movres.enable_sync_request = 0;
126 ExtInitSS(int available)
131 if (EDebug(EDBUG_TYPE_VERBOSE))
133 XScreenSaverInfo *xssi = XScreenSaverAllocInfo();
135 XScreenSaverQueryInfo(disp, WinGetXwin(VROOT), xssi);
136 Eprintf(" Screen saver window=%#lx\n", xssi->window);
139 XScreenSaverSelectInput(disp, WinGetXwin(VROOT),
140 ScreenSaverNotifyMask | ScreenSaverCycleMask);
146 ExtInitRR(int available)
151 /* Listen for RandR events */
152 XRRSelectInput(disp, WinGetXwin(VROOT), RRScreenChangeNotifyMask);
156 static const EServerExt Extensions[] = {
157 {"Shape", XEXT_SHAPE, XShapeQueryExtension, XShapeQueryVersion,
160 {"Sync", XEXT_SYNC, XSyncQueryExtension, XSyncInitialize, ExtInitSync},
163 {"ScrSaver", XEXT_SCRSAVER, XScreenSaverQueryExtension,
164 XScreenSaverQueryVersion, ExtInitSS},
167 {"RandR", XEXT_RANDR, XRRQueryExtension, XRRQueryVersion, ExtInitRR},
170 {"Composite", XEXT_COMPOSITE, XCompositeQueryExtension,
171 XCompositeQueryVersion, NULL},
172 {"Damage", XEXT_DAMAGE, XDamageQueryExtension, XDamageQueryVersion, NULL},
173 {"Fixes", XEXT_FIXES, XFixesQueryExtension, XFixesQueryVersion, NULL},
174 {"Render", XEXT_RENDER, XRenderQueryExtension, XRenderQueryVersion, NULL},
177 {"GLX", XEXT_GLX, glXQueryExtension, glXQueryVersion, NULL},
182 ExtQuery(const EServerExt * ext)
185 EServerExtData *exd = ExtData + ext->ix;
187 available = ext->query_ext(disp, &(exd->event_base), &(exd->error_base));
191 Mode.server.extensions |= 1 << ext->ix;
193 ext->query_ver(disp, &(exd->major), &(exd->minor));
195 if (EDebug(EDBUG_TYPE_VERBOSE))
196 Eprintf("Found extension %-10s version %d.%d -"
197 " Event/error base = %d/%d\n", ext->name,
198 exd->major, exd->minor, exd->event_base, exd->error_base);
202 ext->init(available);
206 * File descriptor handling
209 struct _EventFdDesc {
212 void (*handler) (void);
216 static EventFdDesc *pfds = NULL;
219 EventFdRegister(int fd, EventFdHandler * handler)
222 pfds = EREALLOC(EventFdDesc, pfds, nfds);
223 pfds[nfds - 1].fd = fd;
224 pfds[nfds - 1].handler = handler;
226 return pfds + (nfds - 1);
230 EventFdUnregister(EventFdDesc * efd)
239 #define DOUBLE_CLICK_TIME 250 /* Milliseconds */
246 memset(ExtData, 0, sizeof(ExtData));
248 for (i = 0; i < sizeof(Extensions) / sizeof(EServerExt); i++)
249 ExtQuery(Extensions + i);
252 #define XEXT_MASK_CM_ALL ((1 << XEXT_COMPOSITE) | (1 << XEXT_DAMAGE) | \
253 (1 << XEXT_FIXES) | (1 << XEXT_RENDER))
254 if (((Mode.server.extensions & XEXT_MASK_CM_ALL) == XEXT_MASK_CM_ALL) &&
255 (ExtData[XEXT_COMPOSITE].major > 0 ||
256 ExtData[XEXT_COMPOSITE].minor >= 2))
257 Mode.server.extensions |= 1 << XEXT_CM_ALL;
260 EventFdRegister(ConnectionNumber(disp), NULL);
264 EventsGetXY(int *px, int *py)
268 ss = EQueryPointer(NULL, px, py, NULL, NULL);
269 Mode.events.cx = *px;
270 Mode.events.cy = *py;
276 ModeGetXY(Window rwin, int rx, int ry)
282 XTranslateCoordinates(disp, rwin, WinGetXwin(VROOT), rx, ry,
283 &Mode.events.cx, &Mode.events.cy, &child);
293 HandleEvent(XEvent * ev)
297 #if ENABLE_DEBUG_EVENTS
298 if (EDebug(ev->type))
302 win = ELookupXwin(ev->xany.window);
307 Mode.events.last_keycode = ev->xkey.keycode;
308 Mode.events.last_keystate = ev->xkey.state;
310 Mode.events.time = ev->xkey.time;
311 ModeGetXY(ev->xbutton.root, ev->xkey.x_root, ev->xkey.y_root);
312 #if 0 /* FIXME - Why? */
313 if (ev->xkey.root != WinGetXwin(VROOT))
315 XSetInputFocus(disp, ev->xkey.root, RevertToPointerRoot,
318 ev->xkey.time = CurrentTime;
319 EXSendEvent(ev->xkey.root, 0, ev);
323 Mode.events.on_screen = ev->xkey.same_screen;
328 Mode.events.time = ev->xbutton.time;
329 ModeGetXY(ev->xbutton.root, ev->xbutton.x_root, ev->xbutton.y_root);
330 Mode.events.on_screen = ev->xbutton.same_screen;
335 Mode.events.time = ev->xmotion.time;
336 Mode.events.px = Mode.events.mx;
337 Mode.events.py = Mode.events.my;
338 ModeGetXY(ev->xmotion.root, ev->xmotion.x_root, ev->xmotion.y_root);
339 Mode.events.mx = Mode.events.cx;
340 Mode.events.my = Mode.events.cy;
341 Mode.events.on_screen = ev->xmotion.same_screen;
345 Mode.context_win = win;
346 Mode.events.time = ev->xcrossing.time;
347 Mode.events.on_screen = ev->xcrossing.same_screen;
348 if (ev->xcrossing.mode == NotifyGrab &&
349 ev->xcrossing.detail == NotifyInferior)
351 Mode.grabs.pointer_grab_window = ev->xany.window;
352 if (!Mode.grabs.pointer_grab_active)
353 Mode.grabs.pointer_grab_active = 2;
355 ModeGetXY(ev->xcrossing.root, ev->xcrossing.x_root,
356 ev->xcrossing.y_root);
361 Mode.events.time = ev->xcrossing.time;
362 Mode.events.on_screen = ev->xcrossing.same_screen;
363 if (ev->xcrossing.mode == NotifyGrab &&
364 ev->xcrossing.detail == NotifyInferior)
366 Mode.grabs.pointer_grab_window = None;
367 Mode.grabs.pointer_grab_active = 0;
369 ModeGetXY(ev->xcrossing.root, ev->xcrossing.x_root,
370 ev->xcrossing.y_root);
375 Mode.events.time = ev->xproperty.time;
379 if (ev->xany.window == WinGetXwin(VROOT))
380 ActionclassesGlobalEvent(ev);
386 case KeyPress: /* 2 */
387 case KeyRelease: /* 3 */
388 /* Unfreeze keyboard in case we got here by keygrab */
389 XAllowEvents(disp, AsyncKeyboard, CurrentTime);
392 case ButtonPress: /* 4 */
393 SoundPlay(SOUND_BUTTON_CLICK);
395 Mode.events.double_click =
396 ((ev->xbutton.time - Mode.events.last_btime < DOUBLE_CLICK_TIME) &&
397 ev->xbutton.button == Mode.events.last_button &&
398 ev->xbutton.window == Mode.events.last_bpress2);
400 Mode.events.last_bpress = ev->xbutton.window;
401 Mode.events.last_bpress2 = ev->xbutton.window;
402 Mode.events.last_btime = ev->xbutton.time;
403 Mode.events.last_button = ev->xbutton.button;
405 case ButtonRelease: /* 5 */
406 SoundPlay(SOUND_BUTTON_RAISE);
410 /* The new event dispatcher */
411 EventCallbacksProcess(win, ev);
413 /* Post-event stuff TBD */
416 case ButtonRelease: /* 5 */
417 Mode.events.last_bpress = 0;
418 Mode.action_inhibit = 0;
421 #if 1 /* Do this here? */
423 EUnregisterXwin(ev->xdestroywindow.window);
428 XRefreshKeyboardMapping(&ev->xmapping);
429 if (Conf.testing.bindings_reload)
430 ActionclassesReload();
436 EventsCompress(XEvent * evq, int count)
443 #if ENABLE_DEBUG_EVENTS
444 /* Debug - should be taken out */
445 if (EDebug(EDBUG_TYPE_COMPRESSION))
446 for (i = 0; i < count; i++)
448 Eprintf("EventsCompress-1 %3d %s w=%#lx\n", i,
449 EventName(evq[i].type), evq[i].xany.window);
452 /* Loop through event list, starting with latest */
453 for (i = count - 1; i >= 0; i--)
461 /* Already thrown away */
466 /* Discard all but last motion event */
472 if (ev2->type == type)
478 #if ENABLE_DEBUG_EVENTS
479 if (n && EDebug(EDBUG_TYPE_COMPRESSION))
480 Eprintf("EventsCompress n=%4d %s %#lx x,y = %d,%d\n",
481 n, EventName(type), ev->xmotion.window,
482 ev->xmotion.x, ev->xmotion.y);
487 for (j = i - 1; j >= 0; j--)
490 if (ev2->type == EnterNotify)
492 if (ev2->xcrossing.window == ev->xcrossing.window)
493 goto do_enter_leave_nuked;
497 do_enter_leave_nuked:
498 ev2->type = ev->type = 0;
499 for (n = i - 1; n > j; n--)
502 if (ev2->type == MotionNotify)
504 if (ev2->xmotion.window != ev->xmotion.window)
509 #if ENABLE_DEBUG_EVENTS
510 if (EDebug(EDBUG_TYPE_COMPRESSION))
511 Eprintf("EventsCompress n=%4d %s %#lx\n",
512 1, EventName(type), ev->xcrossing.window);
517 for (j = i - 1; j >= 0; j--)
523 if (ev2->xcreatewindow.window !=
524 ev->xdestroywindow.window)
526 ev2->type = EX_EVENT_CREATE_GONE;
527 j = -1; /* Break for() */
532 if (ev2->xunmap.window != ev->xdestroywindow.window)
534 ev2->type = EX_EVENT_UNMAP_GONE;
537 if (ev2->xmap.window != ev->xdestroywindow.window)
539 ev2->type = EX_EVENT_MAP_GONE;
542 if (ev2->xmaprequest.window != ev->xdestroywindow.window)
544 ev2->type = EX_EVENT_MAPREQUEST_GONE;
547 if (ev2->xreparent.window != ev->xdestroywindow.window)
549 ev2->type = EX_EVENT_REPARENT_GONE;
551 case ConfigureRequest:
552 if (ev2->xconfigurerequest.window !=
553 ev->xdestroywindow.window)
558 /* Nuke all other events on a destroyed window */
559 if (ev2->xany.window != ev->xdestroywindow.window)
570 xb = xa + ev->xexpose.width;
572 yb = ya + ev->xexpose.height;
573 for (j = i - 1; j >= 0; j--)
576 if (ev2->type == type &&
577 ev2->xexpose.window == ev->xexpose.window)
581 if (xa > ev2->xexpose.x)
583 if (xb < ev2->xexpose.x + ev2->xexpose.width)
584 xb = ev2->xexpose.x + ev2->xexpose.width;
585 if (ya > ev2->xexpose.y)
587 if (yb < ev2->xexpose.y + ev2->xexpose.height)
588 yb = ev2->xexpose.y + ev2->xexpose.height;
594 ev->xexpose.width = xb - xa;
596 ev->xexpose.height = yb - ya;
598 #if ENABLE_DEBUG_EVENTS
599 if (EDebug(EDBUG_TYPE_COMPRESSION))
600 Eprintf("EventsCompress n=%4d %s %#lx x=%4d-%4d y=%4d-%4d\n",
601 n, EventName(type), ev->xexpose.window, xa, xb, ya, yb);
605 case EX_EVENT_SHAPE_NOTIFY:
607 for (j = i - 1; j >= 0; j--)
610 if (ev2->type == type && ev2->xany.window == ev->xany.window)
616 #if ENABLE_DEBUG_EVENTS
617 if (n && EDebug(EDBUG_TYPE_COMPRESSION))
618 Eprintf("EventsCompress n=%4d %s %#lx\n",
619 n, EventName(type), ev->xmotion.window);
625 /* Not using these */
631 #if ENABLE_DEBUG_EVENTS
632 /* Debug - should be taken out */
633 if (EDebug(EDBUG_TYPE_COMPRESSION))
634 for (i = 0; i < count; i++)
636 Eprintf("EventsCompress-2 %3d %s w=%#lx\n", i,
637 EventName(evq[i].type), evq[i].xany.window);
642 EventsFetch(XEvent ** evq_p, int *evq_n)
645 XEvent *evq = *evq_p, *ev;
648 /* Fetch the entire event queue */
649 for (i = count = 0; (n = XPending(disp)) > 0;)
655 evq = EREALLOC(XEvent, evq, qsz);
658 for (; i < count; i++, ev++)
660 XNextEvent(disp, ev);
662 /* Map some event types to E internals */
663 if (ev->type == event_base_shape + ShapeNotify)
664 ev->type = EX_EVENT_SHAPE_NOTIFY;
666 else if (ev->type == event_base_randr + RRScreenChangeNotify)
667 ev->type = EX_EVENT_SCREEN_CHANGE_NOTIFY;
670 else if (ev->type == event_base_damage + XDamageNotify)
671 ev->type = EX_EVENT_DAMAGE_NOTIFY;
674 else if (ev->type == event_base_saver + ScreenSaverNotify)
675 ev->type = EX_EVENT_SAVER_NOTIFY;
680 EventsCompress(evq, count);
689 EventsProcess(XEvent ** evq_p, int *evq_n, int *evq_f)
694 /* Fetch the entire event queue */
695 n = EventsFetch(evq_p, evq_n);
698 if (EDebug(EDBUG_TYPE_EVENTS))
699 Eprintf("EventsProcess-B %d\n", n);
701 for (i = count = 0; i < n; i++)
703 if (evq[i].type == 0)
706 if (EDebug(EDBUG_TYPE_EVENTS) > 1)
710 HandleEvent(evq + i);
714 if (EDebug(EDBUG_TYPE_EVENTS))
715 Eprintf("EventsProcess-E %d/%d\n", count, n);
724 * This is the primary event loop. Everything that is going to happen in the
725 * window manager has to start here at some point. This is where all the
726 * events from the X server are interpreted, timer events are inserted, etc
731 static int evq_alloc = 0;
732 static int evq_fetch = 0;
733 static XEvent *evq_ptr = NULL;
736 double time1, time2, dt;
745 count = EventsProcess(&evq_ptr, &evq_alloc, &pfetch);
750 (pfetch > evq_fetch) ? pfetch : (3 * evq_fetch + pfetch) / 4;
751 if (EDebug(EDBUG_TYPE_EVENTS))
752 Eprintf("EventsMain - Alloc/fetch/pfetch/peak=%d/%d/%d/%d)\n",
753 evq_alloc, evq_fetch, pfetch, count);
754 if ((evq_ptr) && ((evq_alloc - evq_fetch) > 64))
765 /* time2 = current time */
769 /* dt = time spent since we last were here */
771 /* Run all expired timers, get time to first non-expired (0. means none) */
772 time2 = TimersRun(time2);
774 if (Mode.wm.exit_mode)
782 for (i = 0; i < nfds; i++)
795 tval.tv_sec = (long)time2;
796 tval.tv_usec = (long)((time2 - ((double)tval.tv_sec)) * 1000000);
797 count = select(fdsize, &fdset, NULL, NULL, &tval);
801 count = select(fdsize, &fdset, NULL, NULL, NULL);
804 if (EDebug(EDBUG_TYPE_EVENTS))
806 ("EventsMain - count=%d xfd=%d:%d dt=%lf time2=%lf\n",
807 count, pfds[0].fd, FD_ISSET(pfds[0].fd, &fdset), dt, time2);
811 /* We can only get here by timeout in select */
817 for (i = 1; i < nfds; i++)
820 if ((fd >= 0) && (FD_ISSET(fd, &fdset)))
822 if (EDebug(EDBUG_TYPE_EVENTS))
823 Eprintf("Event fd %d\n", i);
831 #if ENABLE_DEBUG_EVENTS
836 static const char *const TxtEventNames[] = {
837 "Error", "Reply", "KeyPress", "KeyRelease", "ButtonPress",
838 "ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn",
839 "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose",
840 "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify",
842 "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest",
844 "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify",
846 "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage",
849 #define N_EVENT_NAMES (sizeof(TxtEventNames)/sizeof(char*))
852 EventName(unsigned int type)
856 if (type < N_EVENT_NAMES)
857 return TxtEventNames[type];
861 case EX_EVENT_CREATE_GONE:
862 return "Create-Gone";
863 case EX_EVENT_UNMAP_GONE:
865 case EX_EVENT_MAP_GONE:
867 case EX_EVENT_MAPREQUEST_GONE:
868 return "MapRequest-Gone";
869 case EX_EVENT_REPARENT_GONE:
870 return "Reparent-Gone";
871 case EX_EVENT_SHAPE_NOTIFY:
872 return "ShapeNotify";
874 case EX_EVENT_SAVER_NOTIFY:
875 return "ScreenSaverNotify";
878 case EX_EVENT_SCREEN_CHANGE_NOTIFY:
879 return "ScreenChangeNotify";
882 case EX_EVENT_DAMAGE_NOTIFY:
883 return "DamageNotify";
887 sprintf(buf, "%d", type);
891 static const char *const TxtEventNotifyModeNames[] = {
892 "NotifyNormal", "NotifyGrab", "NotifyUngrab", "NotifyWhileGrabbed"
894 #define N_EVENT_NOTIFY_MODE_NAMES (sizeof(TxtEventNotifyModeNames)/sizeof(char*))
897 EventNotifyModeName(unsigned int mode)
899 if (mode < N_EVENT_NOTIFY_MODE_NAMES)
900 return TxtEventNotifyModeNames[mode];
905 static const char *const TxtEventNotifyDetailNames[] = {
906 "NotifyAncestor", "NotifyVirtual", "NotifyInferior", "NotifyNonlinear",
907 "NotifyNonlinearVirtual", "NotifyPointer", "NotifyPointerRoot",
910 #define N_EVENT_NOTIFY_DETAIL_NAMES (sizeof(TxtEventNotifyDetailNames)/sizeof(char*))
913 EventNotifyDetailName(unsigned int detail)
915 if (detail < N_EVENT_NOTIFY_DETAIL_NAMES)
916 return TxtEventNotifyDetailNames[detail];
922 EventShow(const XEvent * ev)
926 Esnprintf(buf, sizeof(buf), "%#08lx %cEV-%s ev=%#lx",
927 ev->xany.serial, (ev->xany.send_event) ? '*' : ' ',
928 EventName(ev->type), ev->xany.window);
934 Eprintf("%s sub=%#lx x,y=%d,%d state=%#x keycode=%#x ss=%d\n", buf,
935 ev->xkey.subwindow, ev->xkey.x, ev->xkey.y,
936 ev->xkey.state, ev->xkey.keycode, ev->xkey.same_screen);
940 Eprintf("%s sub=%#lx x,y=%d,%d state=%#x button=%#x ss=%d\n", buf,
941 ev->xbutton.subwindow, ev->xbutton.x, ev->xbutton.y,
942 ev->xbutton.state, ev->xbutton.button, ev->xbutton.same_screen);
945 Eprintf("%s sub=%#lx x,y=%d,%d rx,ry=%d,%d ss=%d\n", buf,
946 ev->xmotion.subwindow, ev->xmotion.x, ev->xmotion.y,
947 ev->xmotion.x_root, ev->xmotion.y_root,
948 ev->xmotion.same_screen);
952 Eprintf("%s sub=%#lx x,y=%d,%d m=%s d=%s ss=%d focus=%d\n", buf,
953 ev->xcrossing.subwindow, ev->xcrossing.x, ev->xcrossing.y,
954 EventNotifyModeName(ev->xcrossing.mode),
955 EventNotifyDetailName(ev->xcrossing.detail),
956 ev->xcrossing.same_screen, ev->xcrossing.focus);
960 Eprintf("%s m=%s d=%s\n", buf, EventNotifyModeName(ev->xfocus.mode),
961 EventNotifyDetailName(ev->xfocus.detail));
966 Eprintf("%sx %d+%d %dx%d\n", buf,
967 ev->xexpose.x, ev->xexpose.y,
968 ev->xexpose.width, ev->xexpose.height);
970 case VisibilityNotify:
971 Eprintf("%s state=%d\n", buf, ev->xvisibility.state);
977 case EX_EVENT_CREATE_GONE:
978 case EX_EVENT_UNMAP_GONE:
979 case EX_EVENT_MAPREQUEST_GONE:
980 Eprintf("%s win=%#lx\n", buf, ev->xcreatewindow.window);
983 case EX_EVENT_MAP_GONE:
984 Eprintf("%s win=%#lx or=%d\n", buf, ev->xmap.window,
985 ev->xmap.override_redirect);
988 case EX_EVENT_REPARENT_GONE:
989 Eprintf("%s win=%#lx parent=%#lx %d+%d\n", buf,
990 ev->xreparent.window, ev->xreparent.parent,
991 ev->xreparent.x, ev->xreparent.y);
993 case ConfigureNotify:
994 Eprintf("%s win=%#lx %d+%d %dx%d bw=%d above=%#lx\n", buf,
995 ev->xconfigure.window, ev->xconfigure.x,
996 ev->xconfigure.y, ev->xconfigure.width, ev->xconfigure.height,
997 ev->xconfigure.border_width, ev->xconfigure.above);
999 case ConfigureRequest:
1000 Eprintf("%s win=%#lx m=%#lx %d+%d %dx%d bw=%d above=%#lx stk=%d\n",
1001 buf, ev->xconfigurerequest.window,
1002 ev->xconfigurerequest.value_mask, ev->xconfigurerequest.x,
1003 ev->xconfigurerequest.y, ev->xconfigurerequest.width,
1004 ev->xconfigurerequest.height,
1005 ev->xconfigurerequest.border_width, ev->xconfigurerequest.above,
1006 ev->xconfigurerequest.detail);
1011 Eprintf("%s %dx%d\n", buf,
1012 ev->xresizerequest.width, ev->xresizerequest.height);
1014 case CirculateNotify:
1015 case CirculateRequest:
1017 case PropertyNotify:
1018 txt = XGetAtomName(disp, ev->xproperty.atom);
1019 Eprintf("%s Atom=%s(%ld)\n", buf, txt, ev->xproperty.atom);
1022 case SelectionClear:
1023 case SelectionRequest:
1024 case SelectionNotify:
1025 case ColormapNotify:
1028 txt = XGetAtomName(disp, ev->xclient.message_type);
1029 Eprintf("%s ev_type=%s(%ld) data: %08lx %08lx %08lx %08lx %08lx\n",
1030 buf, txt, ev->xclient.message_type,
1031 ev->xclient.data.l[0], ev->xclient.data.l[1],
1032 ev->xclient.data.l[2], ev->xclient.data.l[3],
1033 ev->xclient.data.l[4]);
1037 Eprintf("%s req=%d first=%d count=%d\n",
1038 buf, ev->xmapping.request,
1039 ev->xmapping.first_keycode, ev->xmapping.count);
1042 case EX_EVENT_SHAPE_NOTIFY:
1043 #define se ((XShapeEvent *)ev)
1044 Eprintf("%s kind=%d shaped=%d %d,%d %dx%d\n", buf,
1045 se->kind, se->shaped, se->x, se->y, se->width, se->height);
1048 #if USE_XSCREENSAVER
1049 case EX_EVENT_SAVER_NOTIFY:
1050 #define se ((XScreenSaverNotifyEvent *)ev)
1051 Eprintf("%s state=%d kind=%d\n", buf, se->state, se->kind);
1056 case EX_EVENT_SCREEN_CHANGE_NOTIFY:
1057 Eprintf("%s\n", buf);
1061 #define de ((XDamageNotifyEvent *)ev)
1062 case EX_EVENT_DAMAGE_NOTIFY:
1063 Eprintf("%s level=%d more=%x %d+%d %dx%d\n", buf,
1064 de->level, de->more,
1065 de->area.x, de->area.y, de->area.width, de->area.height);
1071 Eprintf("%s\n", buf);
1075 #endif /* ENABLE_DEBUG_EVENTS */