2 * event.c - event handlers
4 * Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <xcb/randr.h>
24 #include <xcb/xcb_atom.h>
25 #include <xcb/xcb_icccm.h>
26 #include <xcb/xcb_event.h>
31 #include "objects/tag.h"
32 #include "objects/drawin.h"
35 #include "objects/client.h"
36 #include "keyresolv.h"
37 #include "keygrabber.h"
38 #include "mousegrabber.h"
42 #include "common/atoms.h"
43 #include "common/xutil.h"
45 #define DO_EVENT_HOOK_CALLBACK(type, xcbtype, xcbeventprefix, arraytype, match) \
47 event_##xcbtype##_callback(xcb_##xcbtype##_press_event_t *ev, \
53 int abs_oud = oud < 0 ? ((lua_gettop(globalconf.L) + 1) + oud) : oud; \
54 int item_matching = 0; \
56 if(match(ev, *item, data)) \
59 luaA_object_push_item(globalconf.L, abs_oud, *item); \
61 luaA_object_push(globalconf.L, *item); \
64 for(; item_matching > 0; item_matching--) \
66 switch(ev->response_type) \
68 case xcbeventprefix##_PRESS: \
69 for(int i = 0; i < nargs; i++) \
70 lua_pushvalue(globalconf.L, - nargs - item_matching); \
71 luaA_object_emit_signal(globalconf.L, - nargs - 1, "press", nargs); \
73 case xcbeventprefix##_RELEASE: \
74 for(int i = 0; i < nargs; i++) \
75 lua_pushvalue(globalconf.L, - nargs - item_matching); \
76 luaA_object_emit_signal(globalconf.L, - nargs - 1, "release", nargs); \
79 lua_pop(globalconf.L, 1); \
81 lua_pop(globalconf.L, nargs); \
85 event_key_match(xcb_key_press_event_t
*ev
, keyb_t
*k
, void *data
)
88 xcb_keysym_t keysym
= *(xcb_keysym_t
*) data
;
89 return (((k
->keycode
&& ev
->detail
== k
->keycode
)
90 || (k
->keysym
&& keysym
== k
->keysym
))
91 && (k
->modifiers
== XCB_BUTTON_MASK_ANY
|| k
->modifiers
== ev
->state
));
95 event_button_match(xcb_button_press_event_t
*ev
, button_t
*b
, void *data
)
97 return ((!b
->button
|| ev
->detail
== b
->button
)
98 && (b
->modifiers
== XCB_BUTTON_MASK_ANY
|| b
->modifiers
== ev
->state
));
101 DO_EVENT_HOOK_CALLBACK(button_t
, button
, XCB_BUTTON
, button_array_t
, event_button_match
)
102 DO_EVENT_HOOK_CALLBACK(keyb_t
, key
, XCB_KEY
, key_array_t
, event_key_match
)
104 /** Handle an event with mouse grabber if needed
105 * \param x The x coordinate.
106 * \param y The y coordinate.
107 * \param mask The mask buttons.
108 * \return True if the event was handled.
111 event_handle_mousegrabber(int x
, int y
, uint16_t mask
)
113 if(globalconf
.mousegrabber
!= LUA_REFNIL
)
115 lua_rawgeti(globalconf
.L
, LUA_REGISTRYINDEX
, globalconf
.mousegrabber
);
116 mousegrabber_handleevent(globalconf
.L
, x
, y
, mask
);
117 if(lua_pcall(globalconf
.L
, 1, 1, 0))
119 warn("error running function: %s", lua_tostring(globalconf
.L
, -1));
120 luaA_mousegrabber_stop(globalconf
.L
);
122 else if(!lua_isboolean(globalconf
.L
, -1) || !lua_toboolean(globalconf
.L
, -1))
123 luaA_mousegrabber_stop(globalconf
.L
);
124 lua_pop(globalconf
.L
, 1); /* pop returned value */
130 /** Emit a button signal.
131 * The top of the lua stack has to be the object on which to emit the event.
132 * \param ev The event to handle.
135 event_emit_button(xcb_button_press_event_t
*ev
)
138 switch(ev
->response_type
)
140 case XCB_BUTTON_PRESS
:
141 name
= "button::press";
143 case XCB_BUTTON_RELEASE
:
144 name
= "button::release";
147 fatal("Invalid event type");
150 /* Push the event's info */
151 lua_pushnumber(globalconf
.L
, ev
->event_x
);
152 lua_pushnumber(globalconf
.L
, ev
->event_y
);
153 lua_pushnumber(globalconf
.L
, ev
->detail
);
154 luaA_pushmodifiers(globalconf
.L
, ev
->state
);
155 /* And emit the signal */
156 luaA_object_emit_signal(globalconf
.L
, -5, name
, 4);
159 /** The button press event handler.
160 * \param ev The event.
163 event_handle_button(xcb_button_press_event_t
*ev
)
168 globalconf
.timestamp
= ev
->time
;
170 if(event_handle_mousegrabber(ev
->root_x
, ev
->root_y
, 1 << (ev
->detail
- 1 + 8)))
174 * button status (8 bits) + modifiers status (8 bits)
175 * we don't care for button status that we get, especially on release, so
179 if((drawin
= drawin_getbywin(ev
->event
))
180 || (drawin
= drawin_getbywin(ev
->child
)))
182 /* If the drawin is child, then x,y are
183 * relative to root window */
184 if(drawin
->window
== ev
->child
)
186 ev
->event_x
-= drawin
->geometry
.x
;
187 ev
->event_y
-= drawin
->geometry
.y
;
190 /* Push the drawin */
191 luaA_object_push(globalconf
.L
, drawin
);
192 /* and handle the button raw button event */
193 event_emit_button(ev
);
194 /* check if any button object matches */
195 event_button_callback(ev
, &drawin
->buttons
, -1, 1, NULL
);
197 else if((c
= client_getbyframewin(ev
->event
)))
199 luaA_object_push(globalconf
.L
, c
);
200 /* And handle the button raw button event */
201 event_emit_button(ev
);
202 /* then check if any button objects match */
203 event_button_callback(ev
, &c
->buttons
, -1, 1, NULL
);
204 xcb_allow_events(globalconf
.connection
,
205 XCB_ALLOW_REPLAY_POINTER
,
208 else if(ev
->child
== XCB_NONE
)
209 if(globalconf
.screen
->root
== ev
->event
)
211 event_button_callback(ev
, &globalconf
.buttons
, 0, 0, NULL
);
217 event_handle_configurerequest_configure_window(xcb_configure_request_event_t
*ev
)
219 uint16_t config_win_mask
= 0;
220 uint32_t config_win_vals
[7];
221 unsigned short i
= 0;
223 if(ev
->value_mask
& XCB_CONFIG_WINDOW_X
)
225 config_win_mask
|= XCB_CONFIG_WINDOW_X
;
226 config_win_vals
[i
++] = ev
->x
;
228 if(ev
->value_mask
& XCB_CONFIG_WINDOW_Y
)
230 config_win_mask
|= XCB_CONFIG_WINDOW_Y
;
231 config_win_vals
[i
++] = ev
->y
;
233 if(ev
->value_mask
& XCB_CONFIG_WINDOW_WIDTH
)
235 config_win_mask
|= XCB_CONFIG_WINDOW_WIDTH
;
236 config_win_vals
[i
++] = ev
->width
;
238 if(ev
->value_mask
& XCB_CONFIG_WINDOW_HEIGHT
)
240 config_win_mask
|= XCB_CONFIG_WINDOW_HEIGHT
;
241 config_win_vals
[i
++] = ev
->height
;
243 if(ev
->value_mask
& XCB_CONFIG_WINDOW_BORDER_WIDTH
)
245 config_win_mask
|= XCB_CONFIG_WINDOW_BORDER_WIDTH
;
246 config_win_vals
[i
++] = ev
->border_width
;
248 if(ev
->value_mask
& XCB_CONFIG_WINDOW_SIBLING
)
250 config_win_mask
|= XCB_CONFIG_WINDOW_SIBLING
;
251 config_win_vals
[i
++] = ev
->sibling
;
253 if(ev
->value_mask
& XCB_CONFIG_WINDOW_STACK_MODE
)
255 config_win_mask
|= XCB_CONFIG_WINDOW_STACK_MODE
;
256 config_win_vals
[i
++] = ev
->stack_mode
;
259 xcb_configure_window(globalconf
.connection
, ev
->window
, config_win_mask
, config_win_vals
);
262 /** The configure event handler.
263 * \param ev The event.
266 event_handle_configurerequest(xcb_configure_request_event_t
*ev
)
270 if((c
= client_getbywin(ev
->window
)))
272 area_t geometry
= c
->geometry
;
274 if(ev
->value_mask
& XCB_CONFIG_WINDOW_X
)
276 if(ev
->value_mask
& XCB_CONFIG_WINDOW_Y
)
278 if(ev
->value_mask
& XCB_CONFIG_WINDOW_WIDTH
)
279 geometry
.width
= ev
->width
;
280 if(ev
->value_mask
& XCB_CONFIG_WINDOW_HEIGHT
)
281 geometry
.height
= ev
->height
;
283 if(ev
->value_mask
& XCB_CONFIG_WINDOW_BORDER_WIDTH
)
285 luaA_object_push(globalconf
.L
, c
);
286 window_set_border_width(globalconf
.L
, -1, ev
->border_width
);
287 lua_pop(globalconf
.L
, 1);
290 if(!client_resize(c
, geometry
, false))
291 /* ICCCM 4.1.5 / 4.2.3, if nothing was changed, send an event saying so */
292 xwindow_configure(c
->window
, geometry
, c
->border_width
);
295 event_handle_configurerequest_configure_window(ev
);
298 /** The configure notify event handler.
299 * \param ev The event.
302 event_handle_configurenotify(xcb_configure_notify_event_t
*ev
)
304 const xcb_screen_t
*screen
= globalconf
.screen
;
306 if(ev
->window
== screen
->root
307 && (ev
->width
!= screen
->width_in_pixels
308 || ev
->height
!= screen
->height_in_pixels
))
309 /* it's not that we panic, but restart */
313 /** The destroy notify event handler.
314 * \param ev The event.
317 event_handle_destroynotify(xcb_destroy_notify_event_t
*ev
)
321 if((c
= client_getbywin(ev
->window
)))
322 client_unmanage(c
, false);
324 for(int i
= 0; i
< globalconf
.embedded
.len
; i
++)
325 if(globalconf
.embedded
.tab
[i
].win
== ev
->window
)
327 xembed_window_array_take(&globalconf
.embedded
, i
);
328 luaA_systray_invalidate();
332 /** The motion notify event handler.
333 * \param ev The event.
336 event_handle_motionnotify(xcb_motion_notify_event_t
*ev
)
341 globalconf
.timestamp
= ev
->time
;
343 if(event_handle_mousegrabber(ev
->root_x
, ev
->root_y
, ev
->state
))
346 if((c
= client_getbyframewin(ev
->event
)))
348 luaA_object_push(globalconf
.L
, c
);
349 lua_pushnumber(globalconf
.L
, ev
->event_x
);
350 lua_pushnumber(globalconf
.L
, ev
->event_y
);
351 luaA_object_emit_signal(globalconf
.L
, -3, "mouse::move", 2);
352 lua_pop(globalconf
.L
, 1);
355 if((w
= drawin_getbywin(ev
->event
)))
357 luaA_object_push(globalconf
.L
, w
);
358 lua_pushnumber(globalconf
.L
, ev
->event_x
);
359 lua_pushnumber(globalconf
.L
, ev
->event_y
);
360 luaA_object_emit_signal(globalconf
.L
, -3, "mouse::move", 2);
361 lua_pop(globalconf
.L
, 1);
365 /** The leave notify event handler.
366 * \param ev The event.
369 event_handle_leavenotify(xcb_leave_notify_event_t
*ev
)
374 globalconf
.timestamp
= ev
->time
;
376 if(ev
->mode
!= XCB_NOTIFY_MODE_NORMAL
)
379 if((c
= client_getbyframewin(ev
->event
)))
381 luaA_object_push(globalconf
.L
, c
);
382 luaA_object_emit_signal(globalconf
.L
, -1, "mouse::leave", 0);
383 lua_pop(globalconf
.L
, 1);
386 if((drawin
= drawin_getbywin(ev
->event
)))
388 luaA_object_push(globalconf
.L
, drawin
);
389 luaA_object_emit_signal(globalconf
.L
, -1, "mouse::leave", 0);
390 lua_pop(globalconf
.L
, 1);
394 /** The enter notify event handler.
395 * \param ev The event.
398 event_handle_enternotify(xcb_enter_notify_event_t
*ev
)
403 globalconf
.timestamp
= ev
->time
;
405 if(ev
->mode
!= XCB_NOTIFY_MODE_NORMAL
)
408 if((drawin
= drawin_getbywin(ev
->event
)))
410 luaA_object_push(globalconf
.L
, drawin
);
411 luaA_object_emit_signal(globalconf
.L
, -1, "mouse::enter", 0);
412 lua_pop(globalconf
.L
, 1);
415 if((c
= client_getbyframewin(ev
->event
)))
417 luaA_object_push(globalconf
.L
, c
);
418 luaA_object_emit_signal(globalconf
.L
, -1, "mouse::enter", 0);
419 lua_pop(globalconf
.L
, 1);
423 /** The focus in event handler.
424 * \param ev The event.
427 event_handle_focusin(xcb_focus_in_event_t
*ev
)
429 /* Events that we are interested in: */
432 /* These are events that jump between root windows.
434 case XCB_NOTIFY_DETAIL_ANCESTOR
:
435 case XCB_NOTIFY_DETAIL_INFERIOR
:
437 /* These are events that jump between clients.
438 * Virtual events ensure we always get an event on our top-level window.
440 case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL
:
441 case XCB_NOTIFY_DETAIL_NONLINEAR
:
445 if((c
= client_getbywin(ev
->event
)))
446 client_focus_update(c
);
448 /* all other events are ignored */
454 /** The expose event handler.
455 * \param ev The event.
458 event_handle_expose(xcb_expose_event_t
*ev
)
462 if((drawin
= drawin_getbywin(ev
->window
)))
463 drawin_refresh_pixmap_partial(drawin
,
465 ev
->width
, ev
->height
);
468 /** The key press event handler.
469 * \param ev The event.
472 event_handle_key(xcb_key_press_event_t
*ev
)
474 globalconf
.timestamp
= ev
->time
;
476 if(globalconf
.keygrabber
!= LUA_REFNIL
)
478 lua_rawgeti(globalconf
.L
, LUA_REGISTRYINDEX
, globalconf
.keygrabber
);
479 if(keygrabber_handlekpress(globalconf
.L
, ev
))
481 if(lua_pcall(globalconf
.L
, 3, 1, 0))
483 warn("error running function: %s", lua_tostring(globalconf
.L
, -1));
484 luaA_keygrabber_stop(globalconf
.L
);
486 else if(!lua_isboolean(globalconf
.L
, -1) || !lua_toboolean(globalconf
.L
, -1))
487 luaA_keygrabber_stop(globalconf
.L
);
489 lua_pop(globalconf
.L
, 1); /* pop returned value or function if not called */
493 /* get keysym ignoring all modifiers */
494 xcb_keysym_t keysym
= keyresolv_get_keysym(ev
->detail
, 0);
496 if((c
= client_getbyframewin(ev
->event
)))
498 luaA_object_push(globalconf
.L
, c
);
499 event_key_callback(ev
, &c
->keys
, -1, 1, &keysym
);
502 event_key_callback(ev
, &globalconf
.keys
, 0, 0, &keysym
);
506 /** The map request event handler.
507 * \param ev The event.
510 event_handle_maprequest(xcb_map_request_event_t
*ev
)
513 xcb_get_window_attributes_cookie_t wa_c
;
514 xcb_get_window_attributes_reply_t
*wa_r
;
515 xcb_get_geometry_cookie_t geom_c
;
516 xcb_get_geometry_reply_t
*geom_r
;
518 wa_c
= xcb_get_window_attributes_unchecked(globalconf
.connection
, ev
->window
);
520 if(!(wa_r
= xcb_get_window_attributes_reply(globalconf
.connection
, wa_c
, NULL
)))
523 if(wa_r
->override_redirect
)
526 if(xembed_getbywin(&globalconf
.embedded
, ev
->window
))
528 xcb_map_window(globalconf
.connection
, ev
->window
);
529 xembed_window_activate(globalconf
.connection
, ev
->window
);
531 else if((c
= client_getbywin(ev
->window
)))
533 /* Check that it may be visible, but not asked to be hidden */
534 if(client_maybevisible(c
, c
->screen
) && !c
->hidden
)
536 luaA_object_push(globalconf
.L
, c
);
537 client_set_minimized(globalconf
.L
, -1, false);
538 lua_pop(globalconf
.L
, 1);
539 /* it will be raised, so just update ourself */
545 geom_c
= xcb_get_geometry_unchecked(globalconf
.connection
, ev
->window
);
547 if(!(geom_r
= xcb_get_geometry_reply(globalconf
.connection
, geom_c
, NULL
)))
552 client_manage(ev
->window
, geom_r
, false);
561 /** The unmap notify event handler.
562 * \param ev The event.
565 event_handle_unmapnotify(xcb_unmap_notify_event_t
*ev
)
569 if((c
= client_getbywin(ev
->window
)))
570 client_unmanage(c
, true);
572 for(int i
= 0; i
< globalconf
.embedded
.len
; i
++)
573 if(globalconf
.embedded
.tab
[i
].win
== ev
->window
)
575 xembed_window_array_take(&globalconf
.embedded
, i
);
576 xcb_change_save_set(globalconf
.connection
, XCB_SET_MODE_DELETE
, ev
->window
);
577 luaA_systray_invalidate();
581 /** The randr screen change notify event handler.
582 * \param ev The event.
585 event_handle_randr_screen_change_notify(xcb_randr_screen_change_notify_event_t
*ev
)
587 /* Code of XRRUpdateConfiguration Xlib function ported to XCB
588 * (only the code relevant to RRScreenChangeNotify) as the latter
589 * doesn't provide this kind of function */
590 if(ev
->rotation
& (XCB_RANDR_ROTATION_ROTATE_90
| XCB_RANDR_ROTATION_ROTATE_270
))
591 xcb_randr_set_screen_size(globalconf
.connection
, ev
->root
, ev
->height
, ev
->width
,
592 ev
->mheight
, ev
->mwidth
);
594 xcb_randr_set_screen_size(globalconf
.connection
, ev
->root
, ev
->width
, ev
->height
,
595 ev
->mwidth
, ev
->mheight
);
597 /* XRRUpdateConfiguration also executes the following instruction
598 * but it's not useful because SubpixelOrder is not used at all at
601 * XRenderSetSubpixelOrder(dpy, snum, scevent->subpixel_order);
607 /** The client message event handler.
608 * \param ev The event.
611 event_handle_clientmessage(xcb_client_message_event_t
*ev
)
613 /* check for startup notification messages */
614 if(sn_xcb_display_process_event(globalconf
.sndisplay
, (xcb_generic_event_t
*) ev
))
617 if(ev
->type
== WM_CHANGE_STATE
)
620 if((c
= client_getbywin(ev
->window
))
622 && ev
->data
.data32
[0] == XCB_WM_STATE_ICONIC
)
624 luaA_object_push(globalconf
.L
, c
);
625 client_set_minimized(globalconf
.L
, -1, true);
626 lua_pop(globalconf
.L
, 1);
629 else if(ev
->type
== _XEMBED
)
630 xembed_process_client_message(ev
);
631 else if(ev
->type
== _NET_SYSTEM_TRAY_OPCODE
)
632 systray_process_client_message(ev
);
634 ewmh_process_client_message(ev
);
637 /** The keymap change notify event handler.
638 * \param ev The event.
641 event_handle_mappingnotify(xcb_mapping_notify_event_t
*ev
)
643 if(ev
->request
== XCB_MAPPING_MODIFIER
644 || ev
->request
== XCB_MAPPING_KEYBOARD
)
646 xcb_get_modifier_mapping_cookie_t xmapping_cookie
=
647 xcb_get_modifier_mapping_unchecked(globalconf
.connection
);
649 /* Free and then allocate the key symbols */
650 xcb_key_symbols_free(globalconf
.keysyms
);
651 globalconf
.keysyms
= xcb_key_symbols_alloc(globalconf
.connection
);
653 xutil_lock_mask_get(globalconf
.connection
, xmapping_cookie
,
654 globalconf
.keysyms
, &globalconf
.numlockmask
,
655 &globalconf
.shiftlockmask
, &globalconf
.capslockmask
,
656 &globalconf
.modeswitchmask
);
658 /* regrab everything */
659 xcb_screen_t
*s
= globalconf
.screen
;
660 /* yes XCB_BUTTON_MASK_ANY is also for grab_key even if it's look weird */
661 xcb_ungrab_key(globalconf
.connection
, XCB_GRAB_ANY
, s
->root
, XCB_BUTTON_MASK_ANY
);
662 xwindow_grabkeys(s
->root
, &globalconf
.keys
);
664 foreach(_c
, globalconf
.clients
)
667 xcb_ungrab_key(globalconf
.connection
, XCB_GRAB_ANY
, c
->frame_window
, XCB_BUTTON_MASK_ANY
);
668 xwindow_grabkeys(c
->frame_window
, &c
->keys
);
674 event_handle_reparentnotify(xcb_reparent_notify_event_t
*ev
)
678 if((c
= client_getbywin(ev
->window
)) && c
->frame_window
!= ev
->parent
)
680 /* Ignore reparents to the root window, they *might* be caused by
681 * ourselves if a client quickly unmaps and maps itself again. */
682 if (ev
->parent
!= globalconf
.screen
->root
)
683 client_unmanage(c
, true);
687 /** \brief awesome xerror function.
688 * There's no way to check accesses to destroyed windows, thus those cases are
689 * ignored (especially on UnmapNotify's).
690 * \param e The error event.
693 xerror(xcb_generic_error_t
*e
)
696 if(e
->error_code
== XCB_WINDOW
697 || (e
->error_code
== XCB_MATCH
698 && e
->major_code
== XCB_SET_INPUT_FOCUS
)
699 || (e
->error_code
== XCB_VALUE
700 && e
->major_code
== XCB_KILL_CLIENT
)
701 || (e
->error_code
== XCB_MATCH
702 && e
->major_code
== XCB_CONFIGURE_WINDOW
))
705 warn("X error: request=%s, error=%s",
706 xcb_event_get_request_label(e
->major_code
),
707 xcb_event_get_error_label(e
->error_code
));
712 void event_handle(xcb_generic_event_t
*event
)
714 uint8_t response_type
= XCB_EVENT_RESPONSE_TYPE(event
);
716 if(response_type
== 0)
718 /* This is an error, not a event */
719 xerror((xcb_generic_error_t
*) event
);
723 switch(response_type
)
725 #define EVENT(type, callback) case type: callback((void *) event); return
726 EVENT(XCB_BUTTON_PRESS
, event_handle_button
);
727 EVENT(XCB_BUTTON_RELEASE
, event_handle_button
);
728 EVENT(XCB_CONFIGURE_REQUEST
, event_handle_configurerequest
);
729 EVENT(XCB_CONFIGURE_NOTIFY
, event_handle_configurenotify
);
730 EVENT(XCB_DESTROY_NOTIFY
, event_handle_destroynotify
);
731 EVENT(XCB_ENTER_NOTIFY
, event_handle_enternotify
);
732 EVENT(XCB_CLIENT_MESSAGE
, event_handle_clientmessage
);
733 EVENT(XCB_EXPOSE
, event_handle_expose
);
734 EVENT(XCB_FOCUS_IN
, event_handle_focusin
);
735 EVENT(XCB_KEY_PRESS
, event_handle_key
);
736 EVENT(XCB_KEY_RELEASE
, event_handle_key
);
737 EVENT(XCB_LEAVE_NOTIFY
, event_handle_leavenotify
);
738 EVENT(XCB_MAPPING_NOTIFY
, event_handle_mappingnotify
);
739 EVENT(XCB_MAP_REQUEST
, event_handle_maprequest
);
740 EVENT(XCB_MOTION_NOTIFY
, event_handle_motionnotify
);
741 EVENT(XCB_PROPERTY_NOTIFY
, property_handle_propertynotify
);
742 EVENT(XCB_REPARENT_NOTIFY
, event_handle_reparentnotify
);
743 EVENT(XCB_UNMAP_NOTIFY
, event_handle_unmapnotify
);
747 static uint8_t randr_screen_change_notify
= 0;
749 if(randr_screen_change_notify
== 0)
751 /* check for randr extension */
752 const xcb_query_extension_reply_t
*randr_query
;
753 randr_query
= xcb_get_extension_data(globalconf
.connection
, &xcb_randr_id
);
754 if(randr_query
->present
)
755 randr_screen_change_notify
= randr_query
->first_event
+ XCB_RANDR_SCREEN_CHANGE_NOTIFY
;
758 if (response_type
== randr_screen_change_notify
)
759 event_handle_randr_screen_change_notify((void *) event
);
762 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80