diff --git a/awesome.c b/awesome.c index 9708c57c..a5a39528 100644 --- a/awesome.c +++ b/awesome.c @@ -29,9 +29,10 @@ #include +#include + #include "awesome.h" #include "client.h" -#include "event.h" #include "window.h" #include "ewmh.h" #include "dbus.h" @@ -184,14 +185,7 @@ scan(void) static void a_xcb_check_cb(EV_P_ ev_check *w, int revents) { - xcb_generic_event_t *ev; - - while((ev = xcb_poll_for_event(globalconf.connection))) - { - xcb_handle_event(globalconf.evenths, ev); - p_delete(&ev); - } - + xcb_event_poll_for_event_loop(&globalconf.evenths); awesome_refresh(globalconf.connection); } @@ -397,8 +391,8 @@ main(int argc, char **argv) ev_unref(globalconf.loop); /* Allocate a handler which will holds all errors and events */ - globalconf.evenths = xcb_alloc_event_handlers(globalconf.connection); - xutil_error_handler_catch_all_set(globalconf.evenths, xerrorstart, NULL); + xcb_event_handlers_init(globalconf.connection, &globalconf.evenths); + xutil_error_handler_catch_all_set(&globalconf.evenths, xerrorstart, NULL); for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection)); @@ -416,10 +410,10 @@ main(int argc, char **argv) xcb_aux_sync(globalconf.connection); /* Process all errors in the queue if any */ - xcb_poll_for_event_loop(globalconf.evenths); + xcb_event_poll_for_event_loop(&globalconf.evenths); /* Set the default xerror handler */ - xutil_error_handler_catch_all_set(globalconf.evenths, xerror, NULL); + xutil_error_handler_catch_all_set(&globalconf.evenths, xerror, NULL); /* Allocate the key symbols */ globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection); @@ -480,7 +474,7 @@ main(int argc, char **argv) scan(); /* process all errors in the queue if any */ - xcb_poll_for_event_loop(globalconf.evenths); + xcb_event_poll_for_event_loop(&globalconf.evenths); a_xcb_set_event_handlers(); /* do this only for real screen */ diff --git a/common/xutil.c b/common/xutil.c index 0f0e1a6f..2e818aa6 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -140,7 +140,7 @@ xutil_error_handler_catch_all_set(xcb_event_handlers_t *evenths, { int err_num; for(err_num = 0; err_num < ERRORS_NBR; err_num++) - xcb_set_error_handler(evenths, err_num, handler, data); + xcb_event_set_error_handler(evenths, err_num, handler, data); } const char * diff --git a/event.c b/event.c index 3574e315..27c44fa8 100644 --- a/event.c +++ b/event.c @@ -20,9 +20,10 @@ */ #include -#include #include +#include #include +#include #include "awesome.h" #include "event.h" @@ -568,15 +569,10 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)), xembed_window_t *em; int i; - /* event->send_event (Xlib) is quivalent to (ev->response_type & - * 0x80) in XCB because the SendEvent bit is available in the - * response_type field */ - bool send_event = ((ev->response_type & 0x80) >> 7); - if((c = client_getbywin(ev->window))) { if(ev->event == xutil_screen_get(connection, c->phys_screen)->root - && send_event + && XCB_EVENT_SENT(ev) && window_state_get_reply(window_state_get_unchecked(c->win)) == XCB_WM_STATE_NORMAL) client_unmanage(c); } @@ -690,24 +686,24 @@ void a_xcb_set_event_handlers(void) { const xcb_query_extension_reply_t *randr_query; - set_button_press_event_handler(globalconf.evenths, event_handle_buttonpress, NULL); - set_configure_request_event_handler(globalconf.evenths, event_handle_configurerequest, NULL); - set_configure_notify_event_handler(globalconf.evenths, event_handle_configurenotify, NULL); - set_destroy_notify_event_handler(globalconf.evenths, event_handle_destroynotify, NULL); - set_enter_notify_event_handler(globalconf.evenths, event_handle_enternotify, NULL); - set_expose_event_handler(globalconf.evenths, event_handle_expose, NULL); - set_key_press_event_handler(globalconf.evenths, event_handle_keypress, NULL); - set_map_request_event_handler(globalconf.evenths, event_handle_maprequest, NULL); - set_property_notify_event_handler(globalconf.evenths, event_handle_propertynotify, NULL); - set_unmap_notify_event_handler(globalconf.evenths, event_handle_unmapnotify, NULL); - set_client_message_event_handler(globalconf.evenths, event_handle_clientmessage, NULL); - set_mapping_notify_event_handler(globalconf.evenths, event_handle_mappingnotify, NULL); + xcb_event_set_button_press_handler(&globalconf.evenths, event_handle_buttonpress, NULL); + xcb_event_set_configure_request_handler(&globalconf.evenths, event_handle_configurerequest, NULL); + xcb_event_set_configure_notify_handler(&globalconf.evenths, event_handle_configurenotify, NULL); + xcb_event_set_destroy_notify_handler(&globalconf.evenths, event_handle_destroynotify, NULL); + xcb_event_set_enter_notify_handler(&globalconf.evenths, event_handle_enternotify, NULL); + xcb_event_set_expose_handler(&globalconf.evenths, event_handle_expose, NULL); + xcb_event_set_key_press_handler(&globalconf.evenths, event_handle_keypress, NULL); + xcb_event_set_map_request_handler(&globalconf.evenths, event_handle_maprequest, NULL); + xcb_event_set_property_notify_handler(&globalconf.evenths, event_handle_propertynotify, NULL); + xcb_event_set_unmap_notify_handler(&globalconf.evenths, event_handle_unmapnotify, NULL); + xcb_event_set_client_message_handler(&globalconf.evenths, event_handle_clientmessage, NULL); + xcb_event_set_mapping_notify_handler(&globalconf.evenths, event_handle_mappingnotify, NULL); /* check for randr extension */ randr_query = xcb_get_extension_data(globalconf.connection, &xcb_randr_id); if((globalconf.have_randr = randr_query->present)) - xcb_set_event_handler(globalconf.evenths, - (randr_query->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY), + xcb_event_set_handler(&globalconf.evenths, + randr_query->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY, (xcb_generic_event_handler_t) event_handle_randr_screen_change_notify, NULL); diff --git a/mouse.c b/mouse.c index 210dfb12..8915675e 100644 --- a/mouse.c +++ b/mouse.c @@ -445,7 +445,7 @@ mouse_track_mouse_drag(int *x, int *y) return false; default: - xcb_handle_event(globalconf.evenths, ev); + xcb_event_handle(&globalconf.evenths, ev); p_delete(&ev); break; } diff --git a/structs.h b/structs.h index 5c76911a..82829c27 100644 --- a/structs.h +++ b/structs.h @@ -397,7 +397,7 @@ struct awesome_t /** Connection ref */ xcb_connection_t *connection; /** Event and error handlers */ - xcb_event_handlers_t *evenths; + xcb_event_handlers_t evenths; /** Default screen number */ int default_screen; /** Keys symbol table */