1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-07-31 21:59:25 -04:00

xcb: Hide some internal details

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2017-06-01 11:50:44 +02:00
parent 93cf26414e
commit f042851add
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7
3 changed files with 17 additions and 26 deletions

View file

@ -210,11 +210,7 @@ extern xcb_visualtype_t *visual;
*/ */
extern xcb_colormap_t map; extern xcb_colormap_t map;
/** void x11_late_setup ( void );
* This function tries to create a 32bit TrueColor colormap.
* If this fails, it falls back to the default for the connected display.
*/
void x11_create_visual_and_colormap ( void );
/** /**
* Gets a surface containing the background image of the desktop. * Gets a surface containing the background image of the desktop.

View file

@ -137,21 +137,6 @@ static int switcher_get ( const char *name )
return -1; return -1;
} }
/**
* 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. * Teardown the gui.
*/ */
@ -956,17 +941,22 @@ int main ( int argc, char *argv[] )
rofi_view_workers_initialize (); 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. // Setup signal handling sources.
// SIGINT // SIGINT
g_unix_signal_add ( SIGINT, main_loop_signal_handler_int, NULL ); g_unix_signal_add ( SIGINT, main_loop_signal_handler_int, NULL );
g_idle_add ( startup, NULL ); g_idle_add ( startup, NULL );
// Pidfile + visuals
int pfd = setup ();
if ( pfd < 0 ) {
return EXIT_FAILURE;
}
// Start mainloop. // Start mainloop.
g_main_loop_run ( main_loop ); g_main_loop_run ( main_loop );
teardown ( pfd ); teardown ( pfd );

View file

@ -850,7 +850,7 @@ gboolean x11_setup ( GMainLoop *main_loop )
return TRUE; 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_t *root_depth = NULL;
xcb_depth_iterator_t depth_iter; 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 ) xcb_window_t xcb_stuff_get_root_window ( void )
{ {
return xcb->screen->root; return xcb->screen->root;