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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-08-07 13:28:44 +02:00
parent fae5dfcd08
commit c20e88fdce
1 changed files with 19 additions and 5 deletions

View File

@ -26,8 +26,12 @@
#include <unistd.h>
#include <signal.h>
#include <xcb/xtest.h>
#include <xcb/bigreq.h>
#include <xcb/randr.h>
#include <xcb/shape.h>
#include <xcb/xcb_event.h>
#include <xcb/xinerama.h>
#include <xcb/xtest.h>
#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 =