summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2017-06-01 11:50:44 +0200
committerQuentin Glidic <sardemff7+git@sardemff7.net>2017-06-01 11:57:17 +0200
commitf042851add70c9af0adc2b3017dedbb563c9ca3a (patch)
tree10cf6a2d2fd9323602714afd81a6588465f4ac51 /source
parent93cf26414e379c721d0ce5a938ea3ca111dadbba (diff)
xcb: Hide some internal details
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'source')
-rw-r--r--source/rofi.c30
-rw-r--r--source/xcb.c7
2 files changed, 16 insertions, 21 deletions
diff --git a/source/rofi.c b/source/rofi.c
index bab587bb..b22e3e25 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -138,21 +138,6 @@ static int switcher_get ( const char *name )
}
/**
- * Do needed steps to start showing the gui
- */
-static int setup ()
-{
- // Create pid file
- int pfd = create_pid_file ( pidfile );
- if ( pfd >= 0 ) {
- // Request truecolor visual.
- x11_create_visual_and_colormap ( );
- textbox_setup ();
- }
- return pfd;
-}
-
-/**
* Teardown the gui.
*/
static void teardown ( int pfd )
@@ -956,17 +941,22 @@ int main ( int argc, char *argv[] )
rofi_view_workers_initialize ();
+ // Create pid file
+ int pfd = create_pid_file ( pidfile );
+ if ( pfd < 0 ) {
+ cleanup ();
+ return EXIT_FAILURE;
+ }
+ textbox_setup ();
+
+ x11_late_setup ();
+
// Setup signal handling sources.
// SIGINT
g_unix_signal_add ( SIGINT, main_loop_signal_handler_int, NULL );
g_idle_add ( startup, NULL );
- // Pidfile + visuals
- int pfd = setup ();
- if ( pfd < 0 ) {
- return EXIT_FAILURE;
- }
// Start mainloop.
g_main_loop_run ( main_loop );
teardown ( pfd );
diff --git a/source/xcb.c b/source/xcb.c
index 52de39e9..5284be6c 100644
--- a/source/xcb.c
+++ b/source/xcb.c
@@ -850,7 +850,7 @@ gboolean x11_setup ( GMainLoop *main_loop )
return TRUE;
}
-void x11_create_visual_and_colormap ( void )
+static void x11_create_visual_and_colormap ( void )
{
xcb_depth_t *root_depth = NULL;
xcb_depth_iterator_t depth_iter;
@@ -890,6 +890,11 @@ void x11_create_visual_and_colormap ( void )
}
}
+void x11_late_setup ( void )
+{
+ x11_create_visual_and_colormap ();
+}
+
xcb_window_t xcb_stuff_get_root_window ( void )
{
return xcb->screen->root;