From cbf9bbd66a1dfc55a1147b7c999b1eae3554168b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 30 Sep 2010 13:03:28 +0200 Subject: [PATCH] screen_default_visual(): Move to awesome.c Signed-off-by: Uli Schlachter --- awesome.c | 16 ++++++++++++++++ screen.c | 17 ----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/awesome.c b/awesome.c index a74cdb3b..b87e1c6e 100644 --- a/awesome.c +++ b/awesome.c @@ -156,6 +156,21 @@ scan(void) p_delete(&tree_r); } +static xcb_visualtype_t * +screen_default_visual(xcb_screen_t *s) +{ + xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s); + + if(depth_iter.data) + for(; depth_iter.rem; xcb_depth_next (&depth_iter)) + for(xcb_visualtype_iterator_t visual_iter = xcb_depth_visuals_iterator(depth_iter.data); + visual_iter.rem; xcb_visualtype_next (&visual_iter)) + if(s->root_visual == visual_iter.data->visual_id) + return visual_iter.data; + + return NULL; +} + static void a_refresh_cb(EV_P_ ev_prepare *w, int revents) { @@ -359,6 +374,7 @@ main(int argc, char **argv) fatal("cannot open display"); globalconf.screen = xcb_aux_get_screen(globalconf.connection, globalconf.default_screen); + globalconf.visual = screen_default_visual(globalconf.screen); globalconf.default_depth = globalconf.screen->root_depth; globalconf.default_cmap = globalconf.screen->default_colormap; diff --git a/screen.c b/screen.c index 09203953..a3527f9e 100644 --- a/screen.c +++ b/screen.c @@ -57,21 +57,6 @@ screen_xsitoarea(xcb_xinerama_screen_info_t si) return a; } -static xcb_visualtype_t * -screen_default_visual(xcb_screen_t *s) -{ - xcb_depth_iterator_t depth_iter = xcb_screen_allowed_depths_iterator(s); - - if(depth_iter.data) - for(; depth_iter.rem; xcb_depth_next (&depth_iter)) - for(xcb_visualtype_iterator_t visual_iter = xcb_depth_visuals_iterator(depth_iter.data); - visual_iter.rem; xcb_visualtype_next (&visual_iter)) - if(s->root_visual == visual_iter.data->visual_id) - return visual_iter.data; - - return NULL; -} - static void screen_add(screen_t new_screen) { @@ -244,8 +229,6 @@ screen_scan(void) { if(!screen_scan_randr() && !screen_scan_xinerama()) screen_scan_x11(); - - globalconf.visual = screen_default_visual(globalconf.screen); } /** Return the Xinerama screen number where the coordinates belongs to.