diff --git a/awesome.c b/awesome.c index d8ca0993..c3192958 100644 --- a/awesome.c +++ b/awesome.c @@ -30,13 +30,12 @@ #include #include "client.h" -#include "titlebar.h" #include "event.h" #include "window.h" #include "ewmh.h" #include "dbus.h" -#include "statusbar.h" #include "systray.h" +#include "event.h" #include "common/version.h" #include "common/atoms.h" #include "config.h" @@ -171,11 +170,7 @@ a_xcb_check_cb(EV_P_ ev_check *w, int revents) } while((ev = xcb_poll_for_event(globalconf.connection))); - layout_refresh(); - statusbar_refresh(); - titlebar_refresh(); - - xcb_aux_sync(globalconf.connection); + awesome_refresh(globalconf.connection); } } @@ -387,7 +382,7 @@ main(int argc, char **argv) } /* Need to xcb_flush to validate error handler */ - xcb_aux_sync(globalconf.connection); + xcb_flush(globalconf.connection); /* Process all errors in the queue if any */ xcb_poll_for_event_loop(globalconf.evenths); @@ -479,15 +474,13 @@ main(int argc, char **argv) systray_init(screen_nbr); } - xcb_aux_sync(globalconf.connection); + xcb_flush(globalconf.connection); luaA_cs_init(); a_dbus_init(); /* refresh everything before waiting events */ - layout_refresh(); - statusbar_refresh(); - titlebar_refresh(); + awesome_refresh(globalconf.connection); /* main event loop */ ev_loop(globalconf.loop, 0); @@ -504,7 +497,7 @@ main(int argc, char **argv) for(c = globalconf.clients; c; c = c->next) client_unban(c); - xcb_aux_sync(globalconf.connection); + xcb_flush(globalconf.connection); xcb_disconnect(globalconf.connection); diff --git a/client.c b/client.c index 652c1ad6..00c858e1 100644 --- a/client.c +++ b/client.c @@ -695,7 +695,7 @@ client_unmanage(client_t *c) XCB_BUTTON_MASK_ANY); window_state_set(c->win, XCB_WM_WITHDRAWN_STATE); - xcb_aux_sync(globalconf.connection); + xcb_flush(c); xcb_ungrab_server(globalconf.connection); /* remove client everywhere */ diff --git a/common/draw.c b/common/draw.c index a35717e2..3c9e8378 100644 --- a/common/draw.c +++ b/common/draw.c @@ -30,7 +30,6 @@ #endif #include -#include #include #include diff --git a/common/swindow.c b/common/swindow.c index d96cc2e8..bcd40050 100644 --- a/common/swindow.c +++ b/common/swindow.c @@ -20,7 +20,6 @@ */ #include -#include #include "common/swindow.h" #include "common/xutil.h" diff --git a/common/xscreen.c b/common/xscreen.c index de332204..48a38ec2 100644 --- a/common/xscreen.c +++ b/common/xscreen.c @@ -20,7 +20,6 @@ */ #include -#include #include #include "common/xscreen.h" diff --git a/event.h b/event.h index 676e10c7..dcf1aeef 100644 --- a/event.h +++ b/event.h @@ -22,6 +22,21 @@ #ifndef AWESOME_EVENT_H #define AWESOME_EVENT_H +#include + +#include "statusbar.h" +#include "titlebar.h" +#include "layout.h" + +static inline int +awesome_refresh(xcb_connection_t *c) +{ + layout_refresh(); + statusbar_refresh(); + titlebar_refresh(); + return xcb_flush(c); +} + void a_xcb_set_event_handlers(void); #endif diff --git a/ewmh.c b/ewmh.c index 9dfbcee2..68672de2 100644 --- a/ewmh.c +++ b/ewmh.c @@ -583,7 +583,7 @@ ewmh_restart(void) for(c = globalconf.clients; c; c = c->next) client_unban(c); - xcb_aux_sync(globalconf.connection); + xcb_flush(globalconf.connection); xcb_disconnect(globalconf.connection); a_exec(globalconf.argv); diff --git a/lua.c b/lua.c index c4532e87..9b668c9d 100644 --- a/lua.c +++ b/lua.c @@ -34,7 +34,6 @@ #include #include -#include #include "awesome-version-internal.h" #include "ewmh.h" @@ -42,9 +41,8 @@ #include "lua.h" #include "tag.h" #include "client.h" -#include "statusbar.h" -#include "titlebar.h" #include "screen.h" +#include "event.h" #include "layouts/tile.h" #include "common/socket.h" @@ -114,7 +112,7 @@ luaA_exec(lua_State *L) for(c = globalconf.clients; c; c = c->next) client_unban(c); - xcb_aux_sync(globalconf.connection); + xcb_flush(globalconf.connection); xcb_disconnect(globalconf.connection); a_exec(cmd); @@ -759,9 +757,7 @@ luaA_cb(EV_P_ ev_io *w, int revents) buf[r] = '\0'; luaA_docmd(buf); } - layout_refresh(); - statusbar_refresh(); - titlebar_refresh(); + awesome_refresh(globalconf.connection); } void @@ -809,9 +805,7 @@ void luaA_on_timer(EV_P_ ev_timer *w, int revents) { luaA_dofunction(globalconf.L, globalconf.hooks.timer, 0, 0); - layout_refresh(); - statusbar_refresh(); - titlebar_refresh(); + awesome_refresh(globalconf.connection); } void diff --git a/mouse.c b/mouse.c index e43702ae..210dfb12 100644 --- a/mouse.c +++ b/mouse.c @@ -259,7 +259,7 @@ mouse_infobox_draw(draw_context_t *ctx, geometry.x + ((2 * border + geometry.width) - sw->geometry.width) / 2, geometry.y + ((2 * border + geometry.height) - sw->geometry.height) / 2); simplewindow_refresh_pixmap(sw); - xcb_aux_sync(ctx->connection); + xcb_flush(globalconf.connection); } #define MOUSE_INFOBOX_STRING_DEFAULT "0000x0000+0000+0000" @@ -790,7 +790,7 @@ mouse_client_resize_tiled(client_t *c) /* set pointer to the moveable border */ mouse_warp_pointer(screen->root, mouse_x, mouse_y); - xcb_aux_sync(globalconf.connection); + xcb_flush(globalconf.connection); /* for each motion event */ while(mouse_track_mouse_drag(&mouse_x, &mouse_y)) diff --git a/screen.c b/screen.c index 094bef46..eef42e66 100644 --- a/screen.c +++ b/screen.c @@ -22,7 +22,6 @@ #include #include -#include #include "screen.h" #include "ewmh.h" diff --git a/titlebar.c b/titlebar.c index 27c41975..f8866051 100644 --- a/titlebar.c +++ b/titlebar.c @@ -20,7 +20,6 @@ */ #include -#include #include