1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Ask window manager to hide decoration in normal-window mode.

Issue #485
This commit is contained in:
Dave Davenport 2016-09-08 08:53:14 +02:00
parent abc190fd7c
commit e3fb17a843
7 changed files with 78 additions and 43 deletions

View file

@ -39,6 +39,7 @@ void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms,
X ( STRING ), \
X ( WM_WINDOW_ROLE ), \
X ( _XROOTPMAP_ID ), \
X ( _MOTIF_WM_HINTS ), \
X ( ESETROOT_PMAP_ID )
enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS };
@ -168,5 +169,13 @@ cairo_surface_t * x11_helper_get_bg_surface ( void );
void x11_build_monitor_layout ( void );
void x11_dump_monitor_layout ( void );
int x11_modifier_active ( unsigned int mask, int key );
/**
* @param window The X11 window to modify
*
* Set the right hints to disable the window decoration.
* (Set MOTIF_WM_HINTS, decoration field)
*/
void x11_disable_decoration ( xcb_window_t window );
/*@}*/
#endif

View file

@ -75,7 +75,7 @@ struct xkb_stuff xkb = {
.compose = {
.table = NULL,
.state = NULL
}
}
};
char *config_path = NULL;
// Array of modi.

View file

@ -611,6 +611,7 @@ void __create_window ( MenuFlags menu_flags )
}
else{
window_set_atom_prop ( box, xcb->ewmh._NET_WM_WINDOW_TYPE, &( xcb->ewmh._NET_WM_WINDOW_TYPE_NORMAL ), 1 );
x11_disable_decoration ( box );
}
if ( config.fullscreen ) {
xcb_atom_t atoms[] = {
@ -1199,7 +1200,7 @@ static void rofi_view_mouse_navigation ( RofiViewState *state, xcb_button_press_
}
for ( unsigned int i = 0; i < state->max_elements; i++ ) {
if ( widget_intersect ( &( state->boxes[i]->widget ), xbe->event_x, xbe->event_y ) ) {
int control = x11_modifier_active ( xbe->state, X11MOD_CONTROL);
int control = x11_modifier_active ( xbe->state, X11MOD_CONTROL );
// Only allow items that are visible to be selected.
if ( ( state->last_offset + i ) >= state->filtered_lines ) {
break;

View file

@ -68,7 +68,6 @@ struct _xcb_stuff xcb_int = {
};
xcb_stuff *xcb = &xcb_int;
xcb_depth_t *depth = NULL;
xcb_visualtype_t *visual = NULL;
xcb_colormap_t map = XCB_COLORMAP_NONE;
@ -589,7 +588,7 @@ static void x11_figure_out_masks ( xkb_stuff *xkb )
int x11_modifier_active ( unsigned int mask, int key )
{
return (x11_mod_masks[key]&mask) != 0;
return ( x11_mod_masks[key] & mask ) != 0;
}
unsigned int x11_canonalize_mask ( unsigned int mask )
@ -949,3 +948,29 @@ void xcb_stuff_wipe ( xcb_stuff *xcb )
xcb->screen_nbr = 0;
}
}
void x11_disable_decoration ( xcb_window_t window )
{
#define MWM_HINTS_FUNCTIONS ( 1 << 0 )
#define MWM_HINTS_DECORATIONS ( 1 << 1 )
struct MotifWMHints
{
uint32_t flags;
uint32_t functions;
uint32_t decorations;
int32_t inputMode;
uint32_t state;
};
struct MotifWMHints hints;
hints.flags = /*MWM_HINTS_FUNCTIONS |*/ MWM_HINTS_DECORATIONS;
hints.decorations = 0;
hints.functions = 0;
hints.inputMode = 0;
hints.state = 0;
xcb_atom_t ha = netatoms[_MOTIF_WM_HINTS];
xcb_change_property ( xcb->connection, XCB_PROP_MODE_REPLACE, window, ha, ha, 32, 5, &hints );
#undef MWM_HINTS_DECORATIONS
#undef MWM_HINTS_FUNCTIONS
}