mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
xcb: Hide release details
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
parent
2b6c084f32
commit
4792a16593
4 changed files with 16 additions and 39 deletions
|
@ -156,35 +156,6 @@ typedef struct _workarea
|
|||
*/
|
||||
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
|
||||
*
|
||||
|
@ -212,6 +183,8 @@ extern xcb_colormap_t map;
|
|||
|
||||
gboolean x11_late_setup ( void );
|
||||
|
||||
void x11_early_cleanup ( void );
|
||||
|
||||
/**
|
||||
* Gets a surface containing the background image of the desktop.
|
||||
*
|
||||
|
|
|
@ -146,9 +146,7 @@ static void teardown ( int pfd )
|
|||
// Cleanup font setup.
|
||||
textbox_cleanup ( );
|
||||
|
||||
// Release the window.
|
||||
release_keyboard ( );
|
||||
release_pointer ( );
|
||||
x11_early_cleanup ();
|
||||
|
||||
// Cleanup view
|
||||
rofi_view_cleanup ();
|
||||
|
|
|
@ -1722,9 +1722,7 @@ void rofi_view_hide ( void )
|
|||
{
|
||||
if ( CacheState.main_window != XCB_WINDOW_NONE ) {
|
||||
xcb_unmap_window ( xcb->connection, CacheState.main_window );
|
||||
release_keyboard ( );
|
||||
release_pointer ( );
|
||||
xcb_flush ( xcb->connection );
|
||||
x11_early_cleanup ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
source/xcb.c
16
source/xcb.c
|
@ -628,7 +628,7 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
|
|||
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;
|
||||
while ( TRUE ) {
|
||||
|
@ -653,7 +653,8 @@ int take_pointer ( xcb_window_t w, int iters )
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
int take_keyboard ( xcb_window_t w, int iters )
|
||||
|
||||
static int take_keyboard ( xcb_window_t w, int iters )
|
||||
{
|
||||
int i = 0;
|
||||
while ( TRUE ) {
|
||||
|
@ -680,11 +681,11 @@ int take_keyboard ( xcb_window_t w, int iters )
|
|||
return 0;
|
||||
}
|
||||
|
||||
void release_keyboard ( void )
|
||||
static void release_keyboard ( void )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
@ -960,6 +961,13 @@ xcb_window_t xcb_stuff_get_root_window ( void )
|
|||
return xcb->screen->root;
|
||||
}
|
||||
|
||||
void x11_early_cleanup ( void )
|
||||
{
|
||||
release_keyboard ( );
|
||||
release_pointer ( );
|
||||
xcb_flush ( xcb->connection );
|
||||
}
|
||||
|
||||
void xcb_stuff_wipe ( void )
|
||||
{
|
||||
if ( xcb->connection == NULL ) {
|
||||
|
|
Loading…
Reference in a new issue