Various changes to awful.util and invaders
[awesome.git] / event.c
blob3b51797644d16f0387202e22cdf1e816b36a969c
1 /*
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.
22 #include <xcb/xcb.h>
23 #include <xcb/randr.h>
24 #include <xcb/xcb_atom.h>
25 #include <xcb/xcb_icccm.h>
26 #include <xcb/xcb_event.h>
28 #include "awesome.h"
29 #include "event.h"
30 #include "tag.h"
31 #include "window.h"
32 #include "ewmh.h"
33 #include "client.h"
34 #include "widget.h"
35 #include "titlebar.h"
36 #include "keybinding.h"
37 #include "keygrabber.h"
38 #include "luaa.h"
39 #include "systray.h"
40 #include "screen.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.
53 static void
54 event_handle_mouse_button(client_t *c,
55 uint8_t type,
56 xcb_button_t button,
57 uint16_t state,
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)
64 if(c)
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,
70 1, 0);
72 else
73 luaA_dofunction(globalconf.L,
74 type == XCB_BUTTON_PRESS ?
75 buttons->tab[i]->press : buttons->tab[i]->release,
76 0, 0);
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_t *widgets, int width, int height, int16_t *x, int16_t *y)
92 int tmp;
93 widget_node_t *w;
95 /* Need to transform coordinates like it was top/bottom */
96 switch(position)
98 case Right:
99 tmp = *y;
100 *y = width - *x;
101 *x = tmp;
102 break;
103 case Left:
104 tmp = *y;
105 *y = *x;
106 *x = height - tmp;
107 break;
108 default:
109 break;
112 for(w = widgets; w; w = w->next)
113 if(*x >= w->area.x && *x < w->area.x + w->area.width
114 && *y >= w->area.y && *y < w->area.y + w->area.height)
115 return w;
117 return NULL;
120 /** The button press event handler.
121 * \param data The type of mouse event.
122 * \param connection The connection to the X server.
123 * \param ev The event.
125 static int
126 event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_event_t *ev)
128 int screen;
129 const int nb_screen = xcb_setup_roots_length(xcb_get_setup(connection));
130 client_t *c;
131 widget_node_t *w;
132 wibox_t *wibox;
134 /* ev->state is
135 * button status (8 bits) + modifiers status (8 bits)
136 * we don't care for button status that we get, especially on release, so
137 * drop them */
138 ev->state &= 0x00ff;
140 if((wibox = wibox_getbywin(ev->event))
141 || (wibox = wibox_getbywin(ev->child)))
143 /* If the wibox is child, then x,y are
144 * relative to root window */
145 if(wibox->sw.window == ev->child)
147 ev->event_x -= wibox->sw.geometry.x;
148 ev->event_y -= wibox->sw.geometry.y;
150 if((w = widget_getbycoords(wibox->position, wibox->widgets,
151 wibox->sw.geometry.width,
152 wibox->sw.geometry.height,
153 &ev->event_x, &ev->event_y)))
154 w->widget->button(w, ev, wibox->screen, wibox);
155 /* return even if no widget match */
156 return 0;
159 if((c = client_getbywin(ev->event)))
161 event_handle_mouse_button(c, ev->response_type, ev->detail, ev->state, &c->buttons);
162 xcb_allow_events(globalconf.connection,
163 XCB_ALLOW_REPLAY_POINTER,
164 XCB_CURRENT_TIME);
166 else
167 for(screen = 0; screen < nb_screen; screen++)
168 if(xutil_screen_get(connection, screen)->root == ev->event)
170 event_handle_mouse_button(NULL, ev->response_type, ev->detail, ev->state, &globalconf.buttons);
171 return 0;
174 return 0;
177 /** The configure event handler.
178 * \param data currently unused.
179 * \param connection The connection to the X server.
180 * \param ev The event.
182 static int
183 event_handle_configurerequest(void *data __attribute__ ((unused)),
184 xcb_connection_t *connection, xcb_configure_request_event_t *ev)
186 client_t *c;
187 area_t geometry;
189 if((c = client_getbywin(ev->window)))
191 geometry = c->geometry;
193 if(ev->value_mask & XCB_CONFIG_WINDOW_X)
194 geometry.x = ev->x;
195 if(ev->value_mask & XCB_CONFIG_WINDOW_Y)
196 geometry.y = ev->y;
197 if(ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)
198 geometry.width = ev->width;
199 if(ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
200 geometry.height = ev->height;
202 if(geometry.x != c->geometry.x || geometry.y != c->geometry.y
203 || geometry.width != c->geometry.width || geometry.height != c->geometry.height)
205 if(client_isfloating(c) || layout_get_current(c->screen) == layout_floating)
207 client_resize(c, geometry, false);
208 if(client_hasstrut(c))
209 /* All the wiboxes (may) need to be repositioned */
210 for(int screen = 0; screen < globalconf.nscreen; screen++)
211 for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++)
213 wibox_t *s = globalconf.screens[screen].wiboxes.tab[i];
214 wibox_position_update(s);
217 else
219 client_need_arrange(c);
220 /* If we do not resize the client, at least tell it that it
221 * has its new configuration. That fixes at least
222 * gnome-terminal */
223 window_configure(c->win, c->geometry, c->border);
226 else
227 window_configure(c->win, geometry, c->border);
229 else
231 uint16_t config_win_mask = 0;
232 uint32_t config_win_vals[7];
233 unsigned short i = 0;
235 if(ev->value_mask & XCB_CONFIG_WINDOW_X)
237 config_win_mask |= XCB_CONFIG_WINDOW_X;
238 config_win_vals[i++] = ev->x;
240 if(ev->value_mask & XCB_CONFIG_WINDOW_Y)
242 config_win_mask |= XCB_CONFIG_WINDOW_Y;
243 config_win_vals[i++] = ev->y;
245 if(ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)
247 config_win_mask |= XCB_CONFIG_WINDOW_WIDTH;
248 config_win_vals[i++] = ev->width;
250 if(ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
252 config_win_mask |= XCB_CONFIG_WINDOW_HEIGHT;
253 config_win_vals[i++] = ev->height;
255 if(ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
257 config_win_mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;
258 config_win_vals[i++] = ev->border_width;
260 if(ev->value_mask & XCB_CONFIG_WINDOW_SIBLING)
262 config_win_mask |= XCB_CONFIG_WINDOW_SIBLING;
263 config_win_vals[i++] = ev->sibling;
265 if(ev->value_mask & XCB_CONFIG_WINDOW_STACK_MODE)
267 config_win_mask |= XCB_CONFIG_WINDOW_STACK_MODE;
268 config_win_vals[i++] = ev->stack_mode;
271 xcb_configure_window(connection, ev->window, config_win_mask, config_win_vals);
274 return 0;
277 /** The configure notify event handler.
278 * \param data currently unused.
279 * \param connection The connection to the X server.
280 * \param ev The event.
282 static int
283 event_handle_configurenotify(void *data __attribute__ ((unused)),
284 xcb_connection_t *connection, xcb_configure_notify_event_t *ev)
286 int screen_nbr;
287 const xcb_screen_t *screen;
289 for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup (connection)); screen_nbr++)
290 if((screen = xutil_screen_get(connection, screen_nbr)) != NULL
291 && ev->window == screen->root
292 && (ev->width != screen->width_in_pixels
293 || ev->height != screen->height_in_pixels))
294 /* it's not that we panic, but restart */
295 awesome_restart();
297 return 0;
300 /** The destroy notify event handler.
301 * \param data currently unused.
302 * \param connection The connection to the X server.
303 * \param ev The event.
305 static int
306 event_handle_destroynotify(void *data __attribute__ ((unused)),
307 xcb_connection_t *connection __attribute__ ((unused)),
308 xcb_destroy_notify_event_t *ev)
310 client_t *c;
311 xembed_window_t *emwin;
312 int i;
314 if((c = client_getbywin(ev->window)))
315 client_unmanage(c);
316 else if((emwin = xembed_getbywin(globalconf.embedded, ev->event)))
318 xembed_window_list_detach(&globalconf.embedded, emwin);
319 for(i = 0; i < globalconf.nscreen; i++)
320 widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED);
323 return 0;
326 /** Handle a motion notify over widgets.
327 * \param object The object.
328 * \param mouse_over The pointer to the registered mouse over widget.
329 * \param w The new widget the mouse is over.
331 static void
332 event_handle_widget_motionnotify(void *object,
333 widget_node_t **mouse_over,
334 widget_node_t *w)
336 if(w != *mouse_over)
338 if(*mouse_over)
340 /* call mouse leave function on old widget */
341 luaA_wibox_userdata_new(globalconf.L, object);
342 luaA_dofunction(globalconf.L, (*mouse_over)->widget->mouse_leave, 1, 0);
344 if(w)
346 /* call mouse enter function on new widget and register it */
347 *mouse_over = w;
348 luaA_wibox_userdata_new(globalconf.L, object);
349 luaA_dofunction(globalconf.L, w->widget->mouse_enter, 1, 0);
354 /** The motion notify event handler.
355 * \param data currently unused.
356 * \param connection The connection to the X server.
357 * \param ev The event.
359 static int
360 event_handle_motionnotify(void *data __attribute__ ((unused)),
361 xcb_connection_t *connection,
362 xcb_motion_notify_event_t *ev)
364 wibox_t *wibox = wibox_getbywin(ev->event);
365 widget_node_t *w;
367 if(wibox)
369 w = widget_getbycoords(wibox->position, wibox->widgets,
370 wibox->sw.geometry.width,
371 wibox->sw.geometry.height,
372 &ev->event_x, &ev->event_y);
373 event_handle_widget_motionnotify(wibox, &wibox->mouse_over, w);
376 return 0;
379 /** The leave notify event handler.
380 * \param data currently unused.
381 * \param connection The connection to the X server.
382 * \param ev The event.
384 static int
385 event_handle_leavenotify(void *data __attribute__ ((unused)),
386 xcb_connection_t *connection,
387 xcb_leave_notify_event_t *ev)
389 wibox_t *wibox = wibox_getbywin(ev->event);
391 if(wibox && wibox->mouse_over)
393 /* call mouse leave function on widget the mouse was over */
394 luaA_wibox_userdata_new(globalconf.L, wibox);
395 luaA_dofunction(globalconf.L, wibox->mouse_over->widget->mouse_leave, 1, 0);
398 return 0;
401 /** The enter notify event handler.
402 * \param data currently unused.
403 * \param connection The connection to the X server.
404 * \param ev The event.
406 static int
407 event_handle_enternotify(void *data __attribute__ ((unused)),
408 xcb_connection_t *connection,
409 xcb_enter_notify_event_t *ev)
411 client_t *c;
412 xembed_window_t *emwin;
414 if(ev->mode != XCB_NOTIFY_MODE_NORMAL
415 || (ev->root_x == globalconf.pointer_x
416 && ev->root_y == globalconf.pointer_y))
417 return 0;
419 if((c = client_getbytitlebarwin(ev->event))
420 || (c = client_getbywin(ev->event)))
422 window_buttons_grab(c->win, ev->root, &c->buttons);
423 /* The idea behind saving pointer_x and pointer_y is Bob Marley powered.
424 * this will allow us top drop some EnterNotify events and thus not giving
425 * focus to windows appering under the cursor without a cursor move */
426 globalconf.pointer_x = ev->root_x;
427 globalconf.pointer_y = ev->root_y;
429 luaA_client_userdata_new(globalconf.L, c);
430 luaA_dofunction(globalconf.L, globalconf.hooks.mouse_enter, 1, 0);
432 else if((emwin = xembed_getbywin(globalconf.embedded, ev->event)))
433 xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY,
434 xutil_screen_get(connection, emwin->phys_screen)->root,
435 XCB_BUTTON_MASK_ANY);
436 else if(ev->event == ev->root)
437 window_root_buttons_grab(ev->root);
439 return 0;
442 /** The expose event handler.
443 * \param data currently unused.
444 * \param connection The connection to the X server.
445 * \param ev The event.
447 static int
448 event_handle_expose(void *data __attribute__ ((unused)),
449 xcb_connection_t *connection __attribute__ ((unused)),
450 xcb_expose_event_t *ev)
452 wibox_t *wibox = wibox_getbywin(ev->window);
454 if(wibox)
455 simplewindow_refresh_pixmap_partial(&wibox->sw,
456 ev->x, ev->y,
457 ev->width, ev->height);
459 return 0;
462 /** The key press event handler.
463 * \param data currently unused.
464 * \param connection The connection to the X server.
465 * \param ev The event.
467 static int
468 event_handle_keypress(void *data __attribute__ ((unused)),
469 xcb_connection_t *connection __attribute__ ((unused)),
470 xcb_key_press_event_t *ev)
472 if(globalconf.keygrabber != LUA_REFNIL)
474 lua_rawgeti(globalconf.L, LUA_REGISTRYINDEX, globalconf.keygrabber);
475 if(keygrabber_handlekpress(globalconf.L, ev))
477 if(lua_pcall(globalconf.L, 2, 1, 0))
479 warn("error running function: %s", lua_tostring(globalconf.L, -1));
480 keygrabber_ungrab();
482 else if(!lua_isboolean(globalconf.L, -1) || !lua_toboolean(globalconf.L, -1))
483 keygrabber_ungrab();
485 lua_pop(globalconf.L, 1); /* pop returned value or function if not called */
487 else
489 keybinding_t *k = keybinding_find(ev);
490 if (k && k->fct != LUA_REFNIL)
491 luaA_dofunction(globalconf.L, k->fct, 0, 0);
494 return 0;
497 /** The map request event handler.
498 * \param data currently unused.
499 * \param connection The connection to the X server.
500 * \param ev The event.
502 static int
503 event_handle_maprequest(void *data __attribute__ ((unused)),
504 xcb_connection_t *connection, xcb_map_request_event_t *ev)
506 int phys_screen, screen = 0, ret = 0;
507 client_t *c;
508 xcb_get_window_attributes_cookie_t wa_c;
509 xcb_get_window_attributes_reply_t *wa_r;
510 xcb_query_pointer_cookie_t qp_c = { 0 };
511 xcb_query_pointer_reply_t *qp_r = NULL;
512 xcb_get_geometry_cookie_t geom_c;
513 xcb_get_geometry_reply_t *geom_r;
515 wa_c = xcb_get_window_attributes_unchecked(connection, ev->window);
517 if(!(wa_r = xcb_get_window_attributes_reply(connection, wa_c, NULL)))
518 return -1;
520 if(wa_r->override_redirect)
521 goto bailout;
523 if(xembed_getbywin(globalconf.embedded, ev->window))
525 xcb_map_window(connection, ev->window);
526 xembed_window_activate(connection, ev->window);
528 else if((c = client_getbywin(ev->window)))
530 /* Check that it may be visible, but not asked to be hidden */
531 if(client_maybevisible(c, c->screen) && !c->ishidden)
533 client_setminimized(c, false);
534 /* it will be raised, so just update ourself */
535 client_raise(c);
538 else
540 geom_c = xcb_get_geometry_unchecked(connection, ev->window);
542 if(globalconf.xinerama_is_active)
543 qp_c = xcb_query_pointer_unchecked(connection,
544 xutil_screen_get(globalconf.connection,
545 globalconf.default_screen)->root);
547 if(!(geom_r = xcb_get_geometry_reply(connection, geom_c, NULL)))
549 if(globalconf.xinerama_is_active)
550 qp_r = xcb_query_pointer_reply(connection, qp_c, NULL);
551 ret = -1;
552 goto bailout;
556 phys_screen = xutil_root2screen(connection, geom_r->root);
558 if(globalconf.xinerama_is_active
559 && (qp_r = xcb_query_pointer_reply(connection, qp_c, NULL)))
560 screen = screen_getbycoord(screen, qp_r->root_x, qp_r->root_y);
561 else
562 screen = phys_screen;
564 client_manage(ev->window, geom_r, phys_screen, screen);
565 p_delete(&geom_r);
568 bailout:
569 p_delete(&qp_r);
570 p_delete(&wa_r);
571 return ret;
574 /** The unmap notify event handler.
575 * \param data currently unused.
576 * \param connection The connection to the X server.
577 * \param ev The event.
579 static int
580 event_handle_unmapnotify(void *data __attribute__ ((unused)),
581 xcb_connection_t *connection, xcb_unmap_notify_event_t *ev)
583 client_t *c;
584 xembed_window_t *em;
585 int i;
587 if((c = client_getbywin(ev->window)))
589 if(ev->event == xutil_screen_get(connection, c->phys_screen)->root
590 && XCB_EVENT_SENT(ev)
591 && window_state_get_reply(window_state_get_unchecked(c->win)) == XCB_WM_STATE_NORMAL)
592 client_unmanage(c);
594 else if((em = xembed_getbywin(globalconf.embedded, ev->window)))
596 xembed_window_list_detach(&globalconf.embedded, em);
597 for(i = 0; i < globalconf.nscreen; i++)
598 widget_invalidate_cache(i, WIDGET_CACHE_EMBEDDED);
601 return 0;
604 /** The randr screen change notify event handler.
605 * \param data currently unused.
606 * \param connection The connection to the X server.
607 * \param ev The event.
609 static int
610 event_handle_randr_screen_change_notify(void *data __attribute__ ((unused)),
611 xcb_connection_t *connection __attribute__ ((unused)),
612 xcb_randr_screen_change_notify_event_t *ev)
614 if(!globalconf.have_randr)
615 return -1;
617 /* Code of XRRUpdateConfiguration Xlib function ported to XCB
618 * (only the code relevant to RRScreenChangeNotify) as the latter
619 * doesn't provide this kind of function */
620 if(ev->rotation & (XCB_RANDR_ROTATION_ROTATE_90 | XCB_RANDR_ROTATION_ROTATE_270))
621 xcb_randr_set_screen_size(connection, ev->root, ev->height, ev->width,
622 ev->mheight, ev->mwidth);
623 else
624 xcb_randr_set_screen_size(connection, ev->root, ev->width, ev->height,
625 ev->mwidth, ev->mheight);
627 /* XRRUpdateConfiguration also executes the following instruction
628 * but it's not useful because SubpixelOrder is not used at all at
629 * the moment
631 * XRenderSetSubpixelOrder(dpy, snum, scevent->subpixel_order);
634 awesome_restart();
636 return 0;
639 /** The client message event handler.
640 * \param data currently unused.
641 * \param connection The connection to the X server.
642 * \param ev The event.
644 static int
645 event_handle_clientmessage(void *data __attribute__ ((unused)),
646 xcb_connection_t *connection,
647 xcb_client_message_event_t *ev)
649 client_t *c;
651 if(ev->type == WM_CHANGE_STATE)
653 if((c = client_getbywin(ev->window))
654 && ev->format == 32
655 && ev->data.data32[0] == XCB_WM_STATE_ICONIC)
656 client_setminimized(c, true);
658 else if(ev->type == _XEMBED)
659 return xembed_process_client_message(ev);
660 else if(ev->type == _NET_SYSTEM_TRAY_OPCODE)
661 return systray_process_client_message(ev);
662 return ewmh_process_client_message(ev);
665 /** The keymap change notify event handler.
666 * \param data Unused data.
667 * \param connection The connection to the X server.
668 * \param ev The event.
669 * \return Status code, 0 if everything's fine.
671 static int
672 event_handle_mappingnotify(void *data,
673 xcb_connection_t *connection,
674 xcb_mapping_notify_event_t *ev)
676 xcb_get_modifier_mapping_cookie_t xmapping_cookie;
678 if(ev->request == XCB_MAPPING_MODIFIER
679 || ev->request == XCB_MAPPING_KEYBOARD)
681 /* Send the request to get the NumLock, ShiftLock and CapsLock masks */
682 xmapping_cookie = xcb_get_modifier_mapping_unchecked(globalconf.connection);
684 /* Free and then allocate the key symbols */
685 xcb_key_symbols_free(globalconf.keysyms);
686 globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection);
688 /* Process the reply of previously sent mapping request */
689 xutil_lock_mask_get(globalconf.connection, xmapping_cookie,
690 globalconf.keysyms, &globalconf.numlockmask,
691 &globalconf.shiftlockmask, &globalconf.capslockmask);
694 return 0;
697 static int
698 event_handle_reparentnotify(void *data,
699 xcb_connection_t *connection,
700 xcb_reparent_notify_event_t *ev)
702 client_t *c;
704 if((c = client_getbywin(ev->window)))
705 client_unmanage(c);
707 return 0;
710 void a_xcb_set_event_handlers(void)
712 const xcb_query_extension_reply_t *randr_query;
714 xcb_event_set_button_press_handler(&globalconf.evenths, event_handle_button, NULL);
715 xcb_event_set_button_release_handler(&globalconf.evenths, event_handle_button, NULL);
716 xcb_event_set_configure_request_handler(&globalconf.evenths, event_handle_configurerequest, NULL);
717 xcb_event_set_configure_notify_handler(&globalconf.evenths, event_handle_configurenotify, NULL);
718 xcb_event_set_destroy_notify_handler(&globalconf.evenths, event_handle_destroynotify, NULL);
719 xcb_event_set_enter_notify_handler(&globalconf.evenths, event_handle_enternotify, NULL);
720 xcb_event_set_leave_notify_handler(&globalconf.evenths, event_handle_leavenotify, NULL);
721 xcb_event_set_motion_notify_handler(&globalconf.evenths, event_handle_motionnotify, NULL);
722 xcb_event_set_expose_handler(&globalconf.evenths, event_handle_expose, NULL);
723 xcb_event_set_key_press_handler(&globalconf.evenths, event_handle_keypress, NULL);
724 xcb_event_set_map_request_handler(&globalconf.evenths, event_handle_maprequest, NULL);
725 xcb_event_set_unmap_notify_handler(&globalconf.evenths, event_handle_unmapnotify, NULL);
726 xcb_event_set_client_message_handler(&globalconf.evenths, event_handle_clientmessage, NULL);
727 xcb_event_set_mapping_notify_handler(&globalconf.evenths, event_handle_mappingnotify, NULL);
728 xcb_event_set_reparent_notify_handler(&globalconf.evenths, event_handle_reparentnotify, NULL);
730 /* check for randr extension */
731 randr_query = xcb_get_extension_data(globalconf.connection, &xcb_randr_id);
732 if((globalconf.have_randr = randr_query->present))
733 xcb_event_set_handler(&globalconf.evenths,
734 randr_query->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY,
735 (xcb_generic_event_handler_t) event_handle_randr_screen_change_notify,
736 NULL);
740 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80