From c20e88fdced470feb3eab8be4dc80d9ac20e919c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 7 Aug 2010 13:28:44 +0200 Subject: [PATCH] Avoid some round-trips on startup This makes awesome prefetch some of the data it needs during startup to avoid some useless round-trips to the server. Signed-off-by: Uli Schlachter --- awesome.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/awesome.c b/awesome.c index 6baa023d..6c848db8 100644 --- a/awesome.c +++ b/awesome.c @@ -26,8 +26,12 @@ #include #include -#include +#include +#include +#include #include +#include +#include #include "awesome.h" #include "spawn.h" @@ -427,10 +431,12 @@ main(int argc, char **argv) if(xcb_connection_has_error(globalconf.connection)) fatal("cannot open display"); - /* check for xtest extension */ - const xcb_query_extension_reply_t *xtest_query; - xtest_query = xcb_get_extension_data(globalconf.connection, &xcb_test_id); - globalconf.have_xtest = xtest_query->present; + /* Prefetch all the extensions we might need */ + xcb_prefetch_extension_data(globalconf.connection, &xcb_big_requests_id); + xcb_prefetch_extension_data(globalconf.connection, &xcb_test_id); + xcb_prefetch_extension_data(globalconf.connection, &xcb_randr_id); + xcb_prefetch_extension_data(globalconf.connection, &xcb_xinerama_id); + xcb_prefetch_extension_data(globalconf.connection, &xcb_shape_id); /* initialize dbus */ a_dbus_init(); @@ -475,6 +481,14 @@ main(int argc, char **argv) /* Set the default xerror handler */ xutil_error_handler_catch_all_set(&globalconf.evenths, xerror, NULL); + /* Prefetch the maximum request length */ + xcb_prefetch_maximum_request_length(globalconf.connection); + + /* check for xtest extension */ + const xcb_query_extension_reply_t *xtest_query; + xtest_query = xcb_get_extension_data(globalconf.connection, &xcb_test_id); + globalconf.have_xtest = xtest_query->present; + /* Allocate the key symbols */ globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection); xcb_get_modifier_mapping_cookie_t xmapping_cookie =