diff --git a/luaa.c b/luaa.c index e5cd0556..332105d1 100644 --- a/luaa.c +++ b/luaa.c @@ -54,6 +54,7 @@ #include #include +#include #include /* for gethostname() */ @@ -214,6 +215,17 @@ luaA_kill(lua_State *L) return 1; } +/** Synchronize with the X11 server. This is needed in the test suite to avoid + * some race conditions. You should never need to use this function. + * @function sync + */ +static int +luaA_sync(lua_State *L) +{ + xcb_aux_sync(globalconf.connection); + return 0; +} + /** Load an image from a given path. * * @param name The file name. @@ -647,6 +659,7 @@ luaA_init(xdgHandle* xdg, string_array_t *searchpath) { "xkb_get_group_names", luaA_xkb_get_group_names}, { "xrdb_get_value", luaA_xrdb_get_value}, { "kill", luaA_kill}, + { "sync", luaA_sync}, { NULL, NULL } };