use xcb_flush; move refresh stuff in common function

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-26 19:35:37 +02:00
parent b3f86152df
commit 87a89b6aa1
11 changed files with 29 additions and 32 deletions

View File

@ -30,13 +30,12 @@
#include <ev.h> #include <ev.h>
#include "client.h" #include "client.h"
#include "titlebar.h"
#include "event.h" #include "event.h"
#include "window.h" #include "window.h"
#include "ewmh.h" #include "ewmh.h"
#include "dbus.h" #include "dbus.h"
#include "statusbar.h"
#include "systray.h" #include "systray.h"
#include "event.h"
#include "common/version.h" #include "common/version.h"
#include "common/atoms.h" #include "common/atoms.h"
#include "config.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))); while((ev = xcb_poll_for_event(globalconf.connection)));
layout_refresh(); awesome_refresh(globalconf.connection);
statusbar_refresh();
titlebar_refresh();
xcb_aux_sync(globalconf.connection);
} }
} }
@ -387,7 +382,7 @@ main(int argc, char **argv)
} }
/* Need to xcb_flush to validate error handler */ /* 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 */ /* Process all errors in the queue if any */
xcb_poll_for_event_loop(globalconf.evenths); xcb_poll_for_event_loop(globalconf.evenths);
@ -479,15 +474,13 @@ main(int argc, char **argv)
systray_init(screen_nbr); systray_init(screen_nbr);
} }
xcb_aux_sync(globalconf.connection); xcb_flush(globalconf.connection);
luaA_cs_init(); luaA_cs_init();
a_dbus_init(); a_dbus_init();
/* refresh everything before waiting events */ /* refresh everything before waiting events */
layout_refresh(); awesome_refresh(globalconf.connection);
statusbar_refresh();
titlebar_refresh();
/* main event loop */ /* main event loop */
ev_loop(globalconf.loop, 0); ev_loop(globalconf.loop, 0);
@ -504,7 +497,7 @@ main(int argc, char **argv)
for(c = globalconf.clients; c; c = c->next) for(c = globalconf.clients; c; c = c->next)
client_unban(c); client_unban(c);
xcb_aux_sync(globalconf.connection); xcb_flush(globalconf.connection);
xcb_disconnect(globalconf.connection); xcb_disconnect(globalconf.connection);

View File

@ -695,7 +695,7 @@ client_unmanage(client_t *c)
XCB_BUTTON_MASK_ANY); XCB_BUTTON_MASK_ANY);
window_state_set(c->win, XCB_WM_WITHDRAWN_STATE); window_state_set(c->win, XCB_WM_WITHDRAWN_STATE);
xcb_aux_sync(globalconf.connection); xcb_flush(c);
xcb_ungrab_server(globalconf.connection); xcb_ungrab_server(globalconf.connection);
/* remove client everywhere */ /* remove client everywhere */

View File

@ -30,7 +30,6 @@
#endif #endif
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <langinfo.h> #include <langinfo.h>
#include <iconv.h> #include <iconv.h>

View File

@ -20,7 +20,6 @@
*/ */
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "common/swindow.h" #include "common/swindow.h"
#include "common/xutil.h" #include "common/xutil.h"

View File

@ -20,7 +20,6 @@
*/ */
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xinerama.h> #include <xcb/xinerama.h>
#include "common/xscreen.h" #include "common/xscreen.h"

15
event.h
View File

@ -22,6 +22,21 @@
#ifndef AWESOME_EVENT_H #ifndef AWESOME_EVENT_H
#define AWESOME_EVENT_H #define AWESOME_EVENT_H
#include <xcb/xcb.h>
#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); void a_xcb_set_event_handlers(void);
#endif #endif

2
ewmh.c
View File

@ -583,7 +583,7 @@ ewmh_restart(void)
for(c = globalconf.clients; c; c = c->next) for(c = globalconf.clients; c; c = c->next)
client_unban(c); client_unban(c);
xcb_aux_sync(globalconf.connection); xcb_flush(globalconf.connection);
xcb_disconnect(globalconf.connection); xcb_disconnect(globalconf.connection);
a_exec(globalconf.argv); a_exec(globalconf.argv);

14
lua.c
View File

@ -34,7 +34,6 @@
#include <lualib.h> #include <lualib.h>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "awesome-version-internal.h" #include "awesome-version-internal.h"
#include "ewmh.h" #include "ewmh.h"
@ -42,9 +41,8 @@
#include "lua.h" #include "lua.h"
#include "tag.h" #include "tag.h"
#include "client.h" #include "client.h"
#include "statusbar.h"
#include "titlebar.h"
#include "screen.h" #include "screen.h"
#include "event.h"
#include "layouts/tile.h" #include "layouts/tile.h"
#include "common/socket.h" #include "common/socket.h"
@ -114,7 +112,7 @@ luaA_exec(lua_State *L)
for(c = globalconf.clients; c; c = c->next) for(c = globalconf.clients; c; c = c->next)
client_unban(c); client_unban(c);
xcb_aux_sync(globalconf.connection); xcb_flush(globalconf.connection);
xcb_disconnect(globalconf.connection); xcb_disconnect(globalconf.connection);
a_exec(cmd); a_exec(cmd);
@ -759,9 +757,7 @@ luaA_cb(EV_P_ ev_io *w, int revents)
buf[r] = '\0'; buf[r] = '\0';
luaA_docmd(buf); luaA_docmd(buf);
} }
layout_refresh(); awesome_refresh(globalconf.connection);
statusbar_refresh();
titlebar_refresh();
} }
void void
@ -809,9 +805,7 @@ void
luaA_on_timer(EV_P_ ev_timer *w, int revents) luaA_on_timer(EV_P_ ev_timer *w, int revents)
{ {
luaA_dofunction(globalconf.L, globalconf.hooks.timer, 0, 0); luaA_dofunction(globalconf.L, globalconf.hooks.timer, 0, 0);
layout_refresh(); awesome_refresh(globalconf.connection);
statusbar_refresh();
titlebar_refresh();
} }
void void

View File

@ -259,7 +259,7 @@ mouse_infobox_draw(draw_context_t *ctx,
geometry.x + ((2 * border + geometry.width) - sw->geometry.width) / 2, geometry.x + ((2 * border + geometry.width) - sw->geometry.width) / 2,
geometry.y + ((2 * border + geometry.height) - sw->geometry.height) / 2); geometry.y + ((2 * border + geometry.height) - sw->geometry.height) / 2);
simplewindow_refresh_pixmap(sw); simplewindow_refresh_pixmap(sw);
xcb_aux_sync(ctx->connection); xcb_flush(globalconf.connection);
} }
#define MOUSE_INFOBOX_STRING_DEFAULT "0000x0000+0000+0000" #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 */ /* set pointer to the moveable border */
mouse_warp_pointer(screen->root, mouse_x, mouse_y); mouse_warp_pointer(screen->root, mouse_x, mouse_y);
xcb_aux_sync(globalconf.connection); xcb_flush(globalconf.connection);
/* for each motion event */ /* for each motion event */
while(mouse_track_mouse_drag(&mouse_x, &mouse_y)) while(mouse_track_mouse_drag(&mouse_x, &mouse_y))

View File

@ -22,7 +22,6 @@
#include <stdio.h> #include <stdio.h>
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include "screen.h" #include "screen.h"
#include "ewmh.h" #include "ewmh.h"

View File

@ -20,7 +20,6 @@
*/ */
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <math.h> #include <math.h>