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>
36 #include "keybinding.h"
37 #include "keygrabber.h"
41 #include "layouts/floating.h"
42 #include "common/atoms.h"
44 extern awesome_t globalconf
;
46 /** Handle mouse button events.
47 * \param c The client on which the event happened or NULL.
48 * \param type Event type, press or release.
49 * \param button Button number.
50 * \param state Modkeys state.
51 * \param buttons Buttons array to check for.
54 event_handle_mouse_button(client_t
*c
,
58 button_array_t
*buttons
)
60 for(int i
= 0; i
< buttons
->len
; i
++)
61 if(button
== buttons
->tab
[i
]->button
62 && XUTIL_MASK_CLEAN(state
) == buttons
->tab
[i
]->mod
)
66 luaA_client_userdata_new(globalconf
.L
, c
);
67 luaA_dofunction(globalconf
.L
,
68 type
== XCB_BUTTON_PRESS
?
69 buttons
->tab
[i
]->press
: buttons
->tab
[i
]->release
,
73 luaA_dofunction(globalconf
.L
,
74 type
== XCB_BUTTON_PRESS
?
75 buttons
->tab
[i
]->press
: buttons
->tab
[i
]->release
,
80 /** Get a widget node from a wibox by coords.
81 * \param Container position.
82 * \param widgets The widget list.
83 * \param width The container width.
84 * \param height The container height.
85 * \param x X coordinate of the widget.
86 * \param y Y coordinate of the widget.
87 * \return A widget node.
89 static widget_node_t
*
90 widget_getbycoords(position_t position
, widget_node_array_t
*widgets
, int width
, int height
, int16_t *x
, int16_t *y
)
94 /* Need to transform coordinates like it was top/bottom */
111 for(int i
= 0; i
< widgets
->len
; i
++)
113 widget_node_t
*w
= &widgets
->tab
[i
];
114 if(w
->widget
->isvisible
&&
115 *x
>= w
->geometry
.x
&& *x
< w
->geometry
.x
+ w
->geometry
.width
116 && *y
>= w
->geometry
.y
&& *y
< w
->geometry
.y
+ w
->geometry
.height
)
123 /** The button press event handler.
124 * \param data The type of mouse event.
125 * \param connection The connection to the X server.
126 * \param ev The event.
129 event_handle_button(void *data
, xcb_connection_t
*connection
, xcb_button_press_event_t
*ev
)
132 const int nb_screen
= xcb_setup_roots_length(xcb_get_setup(connection
));
138 * button status (8 bits) + modifiers status (8 bits)
139 * we don't care for button status that we get, especially on release, so
143 if((wibox
= wibox_getbywin(ev
->event
))
144 || (wibox
= wibox_getbywin(ev
->child
)))
146 /* If the wibox is child, then x,y are
147 * relative to root window */
148 if(wibox
->sw
.window
== ev
->child
)
150 ev
->event_x
-= wibox
->sw
.geometry
.x
;
151 ev
->event_y
-= wibox
->sw
.geometry
.y
;
153 if((w
= widget_getbycoords(wibox
->position
, &wibox
->widgets
,
154 wibox
->sw
.geometry
.width
,
155 wibox
->sw
.geometry
.height
,
156 &ev
->event_x
, &ev
->event_y
)))
157 w
->widget
->button(w
, ev
, wibox
->screen
, wibox
);
158 /* return even if no widget match */
162 if((c
= client_getbywin(ev
->event
)))
164 event_handle_mouse_button(c
, ev
->response_type
, ev
->detail
, ev
->state
, &c
->buttons
);
165 xcb_allow_events(globalconf
.connection
,
166 XCB_ALLOW_REPLAY_POINTER
,
170 for(screen
= 0; screen
< nb_screen
; screen
++)
171 if(xutil_screen_get(connection
, screen
)->root
== ev
->event
)
173 event_handle_mouse_button(NULL
, ev
->response_type
, ev
->detail
, ev
->state
, &globalconf
.buttons
);
180 /** The configure event handler.
181 * \param data currently unused.
182 * \param connection The connection to the X server.
183 * \param ev The event.
186 event_handle_configurerequest(void *data
__attribute__ ((unused
)),
187 xcb_connection_t
*connection
, xcb_configure_request_event_t
*ev
)
192 if((c
= client_getbywin(ev
->window
)))
194 geometry
= c
->geometry
;
196 if(ev
->value_mask
& XCB_CONFIG_WINDOW_X
)
198 if(ev
->value_mask
& XCB_CONFIG_WINDOW_Y
)
200 if(ev
->value_mask
& XCB_CONFIG_WINDOW_WIDTH
)
201 geometry
.width
= ev
->width
;
202 if(ev
->value_mask
& XCB_CONFIG_WINDOW_HEIGHT
)
203 geometry
.height
= ev
->height
;
205 if(geometry
.x
!= c
->geometry
.x
|| geometry
.y
!= c
->geometry
.y
206 || geometry
.width
!= c
->geometry
.width
|| geometry
.height
!= c
->geometry
.height
)
208 if(client_isfloating(c
) || layout_get_current(c
->screen
) == layout_floating
)
210 client_resize(c
, geometry
, false);
211 if(client_hasstrut(c
))
212 /* All the wiboxes (may) need to be repositioned */
213 for(int screen
= 0; screen
< globalconf
.nscreen
; screen
++)
214 for(int i
= 0; i
< globalconf
.screens
[screen
].wiboxes
.len
; i
++)
216 wibox_t
*s
= globalconf
.screens
[screen
].wiboxes
.tab
[i
];
217 wibox_position_update(s
);
222 client_need_arrange(c
);
223 /* If we do not resize the client, at least tell it that it
224 * has its new configuration. That fixes at least
226 window_configure(c
->win
, c
->geometry
, c
->border
);
230 window_configure(c
->win
, geometry
, c
->border
);
234 uint16_t config_win_mask
= 0;
235 uint32_t config_win_vals
[7];
236 unsigned short i
= 0;
238 if(ev
->value_mask
& XCB_CONFIG_WINDOW_X
)
240 config_win_mask
|= XCB_CONFIG_WINDOW_X
;
241 config_win_vals
[i
++] = ev
->x
;
243 if(ev
->value_mask
& XCB_CONFIG_WINDOW_Y
)
245 config_win_mask
|= XCB_CONFIG_WINDOW_Y
;
246 config_win_vals
[i
++] = ev
->y
;
248 if(ev
->value_mask
& XCB_CONFIG_WINDOW_WIDTH
)
250 config_win_mask
|= XCB_CONFIG_WINDOW_WIDTH
;
251 config_win_vals
[i
++] = ev
->width
;
253 if(ev
->value_mask
& XCB_CONFIG_WINDOW_HEIGHT
)
255 config_win_mask
|= XCB_CONFIG_WINDOW_HEIGHT
;
256 config_win_vals
[i
++] = ev
->height
;
258 if(ev
->value_mask
& XCB_CONFIG_WINDOW_BORDER_WIDTH
)
260 config_win_mask
|= XCB_CONFIG_WINDOW_BORDER_WIDTH
;
261 config_win_vals
[i
++] = ev
->border_width
;
263 if(ev
->value_mask
& XCB_CONFIG_WINDOW_SIBLING
)
265 config_win_mask
|= XCB_CONFIG_WINDOW_SIBLING
;
266 config_win_vals
[i
++] = ev
->sibling
;
268 if(ev
->value_mask
& XCB_CONFIG_WINDOW_STACK_MODE
)
270 config_win_mask
|= XCB_CONFIG_WINDOW_STACK_MODE
;
271 config_win_vals
[i
++] = ev
->stack_mode
;
274 xcb_configure_window(connection
, ev
->window
, config_win_mask
, config_win_vals
);
280 /** The configure notify event handler.
281 * \param data currently unused.
282 * \param connection The connection to the X server.
283 * \param ev The event.
286 event_handle_configurenotify(void *data
__attribute__ ((unused
)),
287 xcb_connection_t
*connection
, xcb_configure_notify_event_t
*ev
)
290 const xcb_screen_t
*screen
;
292 for(screen_nbr
= 0; screen_nbr
< xcb_setup_roots_length(xcb_get_setup (connection
)); screen_nbr
++)
293 if((screen
= xutil_screen_get(connection
, screen_nbr
)) != NULL
294 && ev
->window
== screen
->root
295 && (ev
->width
!= screen
->width_in_pixels
296 || ev
->height
!= screen
->height_in_pixels
))
297 /* it's not that we panic, but restart */
303 /** The destroy notify event handler.
304 * \param data currently unused.
305 * \param connection The connection to the X server.
306 * \param ev The event.
309 event_handle_destroynotify(void *data
__attribute__ ((unused
)),
310 xcb_connection_t
*connection
__attribute__ ((unused
)),
311 xcb_destroy_notify_event_t
*ev
)
314 xembed_window_t
*emwin
;
317 if((c
= client_getbywin(ev
->window
)))
319 else if((emwin
= xembed_getbywin(globalconf
.embedded
, ev
->event
)))
321 xembed_window_list_detach(&globalconf
.embedded
, emwin
);
322 for(i
= 0; i
< globalconf
.nscreen
; i
++)
323 widget_invalidate_cache(i
, WIDGET_CACHE_EMBEDDED
);
329 /** Handle a motion notify over widgets.
330 * \param object The object.
331 * \param mouse_over The pointer to the registered mouse over widget.
332 * \param w The new widget the mouse is over.
335 event_handle_widget_motionnotify(void *object
,
336 widget_t
**mouse_over
,
339 if(w
->widget
!= *mouse_over
)
343 /* call mouse leave function on old widget */
344 luaA_wibox_userdata_new(globalconf
.L
, object
);
345 luaA_dofunction(globalconf
.L
, (*mouse_over
)->mouse_leave
, 1, 0);
349 /* call mouse enter function on new widget and register it */
350 *mouse_over
= w
->widget
;
351 luaA_wibox_userdata_new(globalconf
.L
, object
);
352 luaA_dofunction(globalconf
.L
, w
->widget
->mouse_enter
, 1, 0);
357 /** The motion notify event handler.
358 * \param data currently unused.
359 * \param connection The connection to the X server.
360 * \param ev The event.
363 event_handle_motionnotify(void *data
__attribute__ ((unused
)),
364 xcb_connection_t
*connection
,
365 xcb_motion_notify_event_t
*ev
)
367 wibox_t
*wibox
= wibox_getbywin(ev
->event
);
371 && (w
= widget_getbycoords(wibox
->position
, &wibox
->widgets
,
372 wibox
->sw
.geometry
.width
,
373 wibox
->sw
.geometry
.height
,
374 &ev
->event_x
, &ev
->event_y
)))
376 globalconf
.pointer_x
= ev
->root_x
;
377 globalconf
.pointer_y
= ev
->root_y
;
378 event_handle_widget_motionnotify(wibox
, &wibox
->mouse_over
, w
);
384 /** The leave notify event handler.
385 * \param data currently unused.
386 * \param connection The connection to the X server.
387 * \param ev The event.
390 event_handle_leavenotify(void *data
__attribute__ ((unused
)),
391 xcb_connection_t
*connection
,
392 xcb_leave_notify_event_t
*ev
)
394 wibox_t
*wibox
= wibox_getbywin(ev
->event
);
396 if(wibox
&& wibox
->mouse_over
)
398 /* call mouse leave function on widget the mouse was over */
399 luaA_wibox_userdata_new(globalconf
.L
, wibox
);
400 luaA_dofunction(globalconf
.L
, wibox
->mouse_over
->mouse_leave
, 1, 0);
401 wibox
->mouse_over
= NULL
;
407 /** The enter notify event handler.
408 * \param data currently unused.
409 * \param connection The connection to the X server.
410 * \param ev The event.
413 event_handle_enternotify(void *data
__attribute__ ((unused
)),
414 xcb_connection_t
*connection
,
415 xcb_enter_notify_event_t
*ev
)
418 xembed_window_t
*emwin
;
422 if(ev
->mode
!= XCB_NOTIFY_MODE_NORMAL
423 || (ev
->root_x
== globalconf
.pointer_x
424 && ev
->root_y
== globalconf
.pointer_y
))
428 if((wibox
= wibox_getbywin(ev
->event
))
429 && (w
= widget_getbycoords(wibox
->position
, &wibox
->widgets
,
430 wibox
->sw
.geometry
.width
,
431 wibox
->sw
.geometry
.height
,
432 &ev
->event_x
, &ev
->event_y
)))
434 globalconf
.pointer_x
= ev
->root_x
;
435 globalconf
.pointer_y
= ev
->root_y
;
436 event_handle_widget_motionnotify(wibox
, &wibox
->mouse_over
, w
);
438 else if((c
= client_getbytitlebarwin(ev
->event
))
439 || (c
= client_getbywin(ev
->event
)))
441 window_buttons_grab(c
->win
, ev
->root
, &c
->buttons
);
442 /* The idea behind saving pointer_x and pointer_y is Bob Marley powered.
443 * this will allow us top drop some EnterNotify events and thus not giving
444 * focus to windows appering under the cursor without a cursor move */
445 globalconf
.pointer_x
= ev
->root_x
;
446 globalconf
.pointer_y
= ev
->root_y
;
448 luaA_client_userdata_new(globalconf
.L
, c
);
449 luaA_dofunction(globalconf
.L
, globalconf
.hooks
.mouse_enter
, 1, 0);
451 else if((emwin
= xembed_getbywin(globalconf
.embedded
, ev
->event
)))
452 xcb_ungrab_button(globalconf
.connection
, XCB_BUTTON_INDEX_ANY
,
453 xutil_screen_get(connection
, emwin
->phys_screen
)->root
,
454 XCB_BUTTON_MASK_ANY
);
455 else if(ev
->event
== ev
->root
)
456 window_root_buttons_grab(ev
->root
);
461 /** The expose event handler.
462 * \param data currently unused.
463 * \param connection The connection to the X server.
464 * \param ev The event.
467 event_handle_expose(void *data
__attribute__ ((unused
)),
468 xcb_connection_t
*connection
__attribute__ ((unused
)),
469 xcb_expose_event_t
*ev
)
471 wibox_t
*wibox
= wibox_getbywin(ev
->window
);
474 simplewindow_refresh_pixmap_partial(&wibox
->sw
,
476 ev
->width
, ev
->height
);
481 /** The key press event handler.
482 * \param data currently unused.
483 * \param connection The connection to the X server.
484 * \param ev The event.
487 event_handle_keypress(void *data
__attribute__ ((unused
)),
488 xcb_connection_t
*connection
__attribute__ ((unused
)),
489 xcb_key_press_event_t
*ev
)
491 if(globalconf
.keygrabber
!= LUA_REFNIL
)
493 lua_rawgeti(globalconf
.L
, LUA_REGISTRYINDEX
, globalconf
.keygrabber
);
494 if(keygrabber_handlekpress(globalconf
.L
, ev
))
496 if(lua_pcall(globalconf
.L
, 2, 1, 0))
498 warn("error running function: %s", lua_tostring(globalconf
.L
, -1));
501 else if(!lua_isboolean(globalconf
.L
, -1) || !lua_toboolean(globalconf
.L
, -1))
504 lua_pop(globalconf
.L
, 1); /* pop returned value or function if not called */
508 keybinding_t
*k
= keybinding_find(ev
);
509 if (k
&& k
->fct
!= LUA_REFNIL
)
510 luaA_dofunction(globalconf
.L
, k
->fct
, 0, 0);
516 /** The map request event handler.
517 * \param data currently unused.
518 * \param connection The connection to the X server.
519 * \param ev The event.
522 event_handle_maprequest(void *data
__attribute__ ((unused
)),
523 xcb_connection_t
*connection
, xcb_map_request_event_t
*ev
)
525 int phys_screen
, screen
= 0, ret
= 0;
527 xcb_get_window_attributes_cookie_t wa_c
;
528 xcb_get_window_attributes_reply_t
*wa_r
;
529 xcb_query_pointer_cookie_t qp_c
= { 0 };
530 xcb_query_pointer_reply_t
*qp_r
= NULL
;
531 xcb_get_geometry_cookie_t geom_c
;
532 xcb_get_geometry_reply_t
*geom_r
;
534 wa_c
= xcb_get_window_attributes_unchecked(connection
, ev
->window
);
536 if(!(wa_r
= xcb_get_window_attributes_reply(connection
, wa_c
, NULL
)))
539 if(wa_r
->override_redirect
)
542 if(xembed_getbywin(globalconf
.embedded
, ev
->window
))
544 xcb_map_window(connection
, ev
->window
);
545 xembed_window_activate(connection
, ev
->window
);
547 else if((c
= client_getbywin(ev
->window
)))
549 /* Check that it may be visible, but not asked to be hidden */
550 if(client_maybevisible(c
, c
->screen
) && !c
->ishidden
)
552 client_setminimized(c
, false);
553 /* it will be raised, so just update ourself */
559 geom_c
= xcb_get_geometry_unchecked(connection
, ev
->window
);
561 if(globalconf
.xinerama_is_active
)
562 qp_c
= xcb_query_pointer_unchecked(connection
,
563 xutil_screen_get(globalconf
.connection
,
564 globalconf
.default_screen
)->root
);
566 if(!(geom_r
= xcb_get_geometry_reply(connection
, geom_c
, NULL
)))
568 if(globalconf
.xinerama_is_active
)
569 qp_r
= xcb_query_pointer_reply(connection
, qp_c
, NULL
);
575 phys_screen
= xutil_root2screen(connection
, geom_r
->root
);
577 if(globalconf
.xinerama_is_active
578 && (qp_r
= xcb_query_pointer_reply(connection
, qp_c
, NULL
)))
579 screen
= screen_getbycoord(screen
, qp_r
->root_x
, qp_r
->root_y
);
581 screen
= phys_screen
;
583 client_manage(ev
->window
, geom_r
, phys_screen
, screen
);
593 /** The unmap notify event handler.
594 * \param data currently unused.
595 * \param connection The connection to the X server.
596 * \param ev The event.
599 event_handle_unmapnotify(void *data
__attribute__ ((unused
)),
600 xcb_connection_t
*connection
, xcb_unmap_notify_event_t
*ev
)
606 if((c
= client_getbywin(ev
->window
)))
608 if(ev
->event
== xutil_screen_get(connection
, c
->phys_screen
)->root
609 && XCB_EVENT_SENT(ev
)
610 && window_state_get_reply(window_state_get_unchecked(c
->win
)) == XCB_WM_STATE_NORMAL
)
613 else if((em
= xembed_getbywin(globalconf
.embedded
, ev
->window
)))
615 xembed_window_list_detach(&globalconf
.embedded
, em
);
616 for(i
= 0; i
< globalconf
.nscreen
; i
++)
617 widget_invalidate_cache(i
, WIDGET_CACHE_EMBEDDED
);
623 /** The randr screen change notify event handler.
624 * \param data currently unused.
625 * \param connection The connection to the X server.
626 * \param ev The event.
629 event_handle_randr_screen_change_notify(void *data
__attribute__ ((unused
)),
630 xcb_connection_t
*connection
__attribute__ ((unused
)),
631 xcb_randr_screen_change_notify_event_t
*ev
)
633 if(!globalconf
.have_randr
)
636 /* Code of XRRUpdateConfiguration Xlib function ported to XCB
637 * (only the code relevant to RRScreenChangeNotify) as the latter
638 * doesn't provide this kind of function */
639 if(ev
->rotation
& (XCB_RANDR_ROTATION_ROTATE_90
| XCB_RANDR_ROTATION_ROTATE_270
))
640 xcb_randr_set_screen_size(connection
, ev
->root
, ev
->height
, ev
->width
,
641 ev
->mheight
, ev
->mwidth
);
643 xcb_randr_set_screen_size(connection
, ev
->root
, ev
->width
, ev
->height
,
644 ev
->mwidth
, ev
->mheight
);
646 /* XRRUpdateConfiguration also executes the following instruction
647 * but it's not useful because SubpixelOrder is not used at all at
650 * XRenderSetSubpixelOrder(dpy, snum, scevent->subpixel_order);
658 /** The client message event handler.
659 * \param data currently unused.
660 * \param connection The connection to the X server.
661 * \param ev The event.
664 event_handle_clientmessage(void *data
__attribute__ ((unused
)),
665 xcb_connection_t
*connection
,
666 xcb_client_message_event_t
*ev
)
670 if(ev
->type
== WM_CHANGE_STATE
)
672 if((c
= client_getbywin(ev
->window
))
674 && ev
->data
.data32
[0] == XCB_WM_STATE_ICONIC
)
675 client_setminimized(c
, true);
677 else if(ev
->type
== _XEMBED
)
678 return xembed_process_client_message(ev
);
679 else if(ev
->type
== _NET_SYSTEM_TRAY_OPCODE
)
680 return systray_process_client_message(ev
);
681 return ewmh_process_client_message(ev
);
684 /** The keymap change notify event handler.
685 * \param data Unused data.
686 * \param connection The connection to the X server.
687 * \param ev The event.
688 * \return Status code, 0 if everything's fine.
691 event_handle_mappingnotify(void *data
,
692 xcb_connection_t
*connection
,
693 xcb_mapping_notify_event_t
*ev
)
695 xcb_get_modifier_mapping_cookie_t xmapping_cookie
;
697 if(ev
->request
== XCB_MAPPING_MODIFIER
698 || ev
->request
== XCB_MAPPING_KEYBOARD
)
700 int nscreen
= xcb_setup_roots_length(xcb_get_setup(connection
));
703 /* Send the request to get the NumLock, ShiftLock and CapsLock masks */
704 xmapping_cookie
= xcb_get_modifier_mapping_unchecked(globalconf
.connection
);
706 /* Free and then allocate the key symbols */
707 xcb_key_symbols_free(globalconf
.keysyms
);
708 globalconf
.keysyms
= xcb_key_symbols_alloc(globalconf
.connection
);
710 /* Process the reply of previously sent mapping request */
711 xutil_lock_mask_get(globalconf
.connection
, xmapping_cookie
,
712 globalconf
.keysyms
, &globalconf
.numlockmask
,
713 &globalconf
.shiftlockmask
, &globalconf
.capslockmask
);
717 xcb_screen_t
*s
= xutil_screen_get(globalconf
.connection
, phys_screen
);
718 /* yes XCB_BUTTON_MASK_ANY is also for grab_key even if it's look
720 xcb_ungrab_key(connection
, XCB_GRAB_ANY
, s
->root
, XCB_BUTTON_MASK_ANY
);
722 } while(phys_screen
< nscreen
);
724 /* regrab everything */
725 keybinding_array_t
*arr
= &globalconf
.keys
.by_sym
;
726 for(int i
= 0; i
< arr
->len
; i
++)
727 window_root_grabkey(arr
->tab
[i
]);
729 arr
= &globalconf
.keys
.by_code
;
730 for(int i
= 0; i
< arr
->len
; i
++)
731 window_root_grabkey(arr
->tab
[i
]);
738 event_handle_reparentnotify(void *data
,
739 xcb_connection_t
*connection
,
740 xcb_reparent_notify_event_t
*ev
)
744 if((c
= client_getbywin(ev
->window
)))
750 void a_xcb_set_event_handlers(void)
752 const xcb_query_extension_reply_t
*randr_query
;
754 xcb_event_set_button_press_handler(&globalconf
.evenths
, event_handle_button
, NULL
);
755 xcb_event_set_button_release_handler(&globalconf
.evenths
, event_handle_button
, NULL
);
756 xcb_event_set_configure_request_handler(&globalconf
.evenths
, event_handle_configurerequest
, NULL
);
757 xcb_event_set_configure_notify_handler(&globalconf
.evenths
, event_handle_configurenotify
, NULL
);
758 xcb_event_set_destroy_notify_handler(&globalconf
.evenths
, event_handle_destroynotify
, NULL
);
759 xcb_event_set_enter_notify_handler(&globalconf
.evenths
, event_handle_enternotify
, NULL
);
760 xcb_event_set_leave_notify_handler(&globalconf
.evenths
, event_handle_leavenotify
, NULL
);
761 xcb_event_set_motion_notify_handler(&globalconf
.evenths
, event_handle_motionnotify
, NULL
);
762 xcb_event_set_expose_handler(&globalconf
.evenths
, event_handle_expose
, NULL
);
763 xcb_event_set_key_press_handler(&globalconf
.evenths
, event_handle_keypress
, NULL
);
764 xcb_event_set_map_request_handler(&globalconf
.evenths
, event_handle_maprequest
, NULL
);
765 xcb_event_set_unmap_notify_handler(&globalconf
.evenths
, event_handle_unmapnotify
, NULL
);
766 xcb_event_set_client_message_handler(&globalconf
.evenths
, event_handle_clientmessage
, NULL
);
767 xcb_event_set_mapping_notify_handler(&globalconf
.evenths
, event_handle_mappingnotify
, NULL
);
768 xcb_event_set_reparent_notify_handler(&globalconf
.evenths
, event_handle_reparentnotify
, NULL
);
770 /* check for randr extension */
771 randr_query
= xcb_get_extension_data(globalconf
.connection
, &xcb_randr_id
);
772 if((globalconf
.have_randr
= randr_query
->present
))
773 xcb_event_set_handler(&globalconf
.evenths
,
774 randr_query
->first_event
+ XCB_RANDR_SCREEN_CHANGE_NOTIFY
,
775 (xcb_generic_event_handler_t
) event_handle_randr_screen_change_notify
,
780 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80