mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-03 15:34:54 -05:00
xcb: Ask for focus where possible
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
parent
94bd12e478
commit
627bd43510
3 changed files with 18 additions and 0 deletions
|
@ -84,6 +84,7 @@ void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms,
|
|||
X ( WM_WINDOW_ROLE ), \
|
||||
X ( _XROOTPMAP_ID ), \
|
||||
X ( _MOTIF_WM_HINTS ), \
|
||||
X ( WM_TAKE_FOCUS ), \
|
||||
X ( ESETROOT_PMAP_ID )
|
||||
|
||||
/** enumeration of the atoms. */
|
||||
|
|
|
@ -846,6 +846,11 @@ void __create_window ( MenuFlags menu_flags )
|
|||
window_set_atom_prop ( box_window, xcb->ewmh._NET_WM_STATE, atoms, sizeof ( atoms ) / sizeof ( xcb_atom_t ) );
|
||||
}
|
||||
|
||||
xcb_atom_t protocols[] = {
|
||||
netatoms[WM_TAKE_FOCUS]
|
||||
};
|
||||
xcb_icccm_set_wm_protocols ( xcb->connection, box_window, xcb->ewmh.WM_PROTOCOLS, G_N_ELEMENTS ( protocols ), protocols );
|
||||
|
||||
TICK_N ( "setup window fullscreen" );
|
||||
// Set the WM_NAME
|
||||
rofi_view_set_window_title ( "rofi" );
|
||||
|
|
12
source/xcb.c
12
source/xcb.c
|
@ -891,6 +891,18 @@ static void main_loop_x11_event_handler_view ( xcb_generic_event_t *event )
|
|||
|
||||
switch ( event->response_type & ~0x80 )
|
||||
{
|
||||
case XCB_CLIENT_MESSAGE:
|
||||
{
|
||||
xcb_client_message_event_t *cme = (xcb_client_message_event_t *) event;
|
||||
xcb_atom_t atom = cme->data.data32[0];
|
||||
xcb_timestamp_t time = cme->data.data32[1];
|
||||
if ( atom == netatoms[WM_TAKE_FOCUS] )
|
||||
{
|
||||
xcb_set_input_focus ( xcb->connection, XCB_INPUT_FOCUS_NONE, cme->window, time );
|
||||
xcb_flush ( xcb->connection );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XCB_EXPOSE:
|
||||
rofi_view_frame_callback ();
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue