1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-10 15:44:41 -05:00

xcb: Hide release details

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2017-06-01 12:47:52 +02:00
parent 2b6c084f32
commit 4792a16593
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7
4 changed files with 16 additions and 39 deletions

View file

@ -156,35 +156,6 @@ typedef struct _workarea
*/ */
int monitor_active ( workarea *mon ); int monitor_active ( workarea *mon );
/**
* Release keyboard grab on root window.
*/
void release_keyboard ( void );
/**
* Release pointer grab on root window.
*/
void release_pointer ( void );
/**
* @param w xcb_window_t we want to grab keyboard on.
* @param iters Number of retries.
*
* Grab keyboard.
*
* @return 1 when keyboard is grabbed, 0 not.
*/
int take_keyboard ( xcb_window_t w, int iters );
/**
* @param w xcb_window_t we want to grab mouse on.
* @param iters Number of retries.
*
* Grab mouse.
*
* @return 1 when mouse is grabbed, 0 not.
*/
int take_pointer ( xcb_window_t w, int iters );
/** /**
* @param main_loop The GMainLoop * @param main_loop The GMainLoop
* *
@ -212,6 +183,8 @@ extern xcb_colormap_t map;
gboolean x11_late_setup ( void ); gboolean x11_late_setup ( void );
void x11_early_cleanup ( void );
/** /**
* Gets a surface containing the background image of the desktop. * Gets a surface containing the background image of the desktop.
* *

View file

@ -146,9 +146,7 @@ static void teardown ( int pfd )
// Cleanup font setup. // Cleanup font setup.
textbox_cleanup ( ); textbox_cleanup ( );
// Release the window. x11_early_cleanup ();
release_keyboard ( );
release_pointer ( );
// Cleanup view // Cleanup view
rofi_view_cleanup (); rofi_view_cleanup ();

View file

@ -1722,9 +1722,7 @@ void rofi_view_hide ( void )
{ {
if ( CacheState.main_window != XCB_WINDOW_NONE ) { if ( CacheState.main_window != XCB_WINDOW_NONE ) {
xcb_unmap_window ( xcb->connection, CacheState.main_window ); xcb_unmap_window ( xcb->connection, CacheState.main_window );
release_keyboard ( ); x11_early_cleanup ();
release_pointer ( );
xcb_flush ( xcb->connection );
} }
} }

View file

@ -628,7 +628,7 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
} }
int take_pointer ( xcb_window_t w, int iters ) static int take_pointer ( xcb_window_t w, int iters )
{ {
int i = 0; int i = 0;
while ( TRUE ) { while ( TRUE ) {
@ -653,7 +653,8 @@ int take_pointer ( xcb_window_t w, int iters )
} }
return 0; return 0;
} }
int take_keyboard ( xcb_window_t w, int iters )
static int take_keyboard ( xcb_window_t w, int iters )
{ {
int i = 0; int i = 0;
while ( TRUE ) { while ( TRUE ) {
@ -680,11 +681,11 @@ int take_keyboard ( xcb_window_t w, int iters )
return 0; return 0;
} }
void release_keyboard ( void ) static void release_keyboard ( void )
{ {
xcb_ungrab_keyboard ( xcb->connection, XCB_CURRENT_TIME ); xcb_ungrab_keyboard ( xcb->connection, XCB_CURRENT_TIME );
} }
void release_pointer ( void ) static void release_pointer ( void )
{ {
xcb_ungrab_pointer ( xcb->connection, XCB_CURRENT_TIME ); xcb_ungrab_pointer ( xcb->connection, XCB_CURRENT_TIME );
} }
@ -960,6 +961,13 @@ xcb_window_t xcb_stuff_get_root_window ( void )
return xcb->screen->root; return xcb->screen->root;
} }
void x11_early_cleanup ( void )
{
release_keyboard ( );
release_pointer ( );
xcb_flush ( xcb->connection );
}
void xcb_stuff_wipe ( void ) void xcb_stuff_wipe ( void )
{ {
if ( xcb->connection == NULL ) { if ( xcb->connection == NULL ) {