mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Add -normal-window mode for testing.
This commit is contained in:
parent
79b1bdf2db
commit
93d10cc7c8
1 changed files with 35 additions and 4 deletions
|
@ -200,7 +200,7 @@ static Window create_window ( Display *display )
|
||||||
Window box = XCreateWindow ( display, DefaultRootWindow ( display ),
|
Window box = XCreateWindow ( display, DefaultRootWindow ( display ),
|
||||||
0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput,
|
0, 0, 200, 100, config.menu_bw, vinfo.depth, InputOutput,
|
||||||
vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr );
|
vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr );
|
||||||
XSelectInput ( display, box, ExposureMask | ButtonPressMask );
|
XSelectInput ( display, box, ExposureMask | ButtonPressMask | StructureNotifyMask );
|
||||||
|
|
||||||
gc = XCreateGC ( display, box, 0, 0 );
|
gc = XCreateGC ( display, box, 0, 0 );
|
||||||
int line_style = LineOnOffDash;
|
int line_style = LineOnOffDash;
|
||||||
|
@ -213,9 +213,11 @@ static Window create_window ( Display *display )
|
||||||
XSetLineAttributes ( display, gc, 2, line_style, CapButt, JoinMiter );
|
XSetLineAttributes ( display, gc, 2, line_style, CapButt, JoinMiter );
|
||||||
XSetForeground ( display, gc, color_separator ( display ) );
|
XSetForeground ( display, gc, color_separator ( display ) );
|
||||||
// make it an unmanaged window
|
// make it an unmanaged window
|
||||||
|
if ( find_arg ( "-normal-window" ) < 0 ) {
|
||||||
window_set_atom_prop ( display, box, netatoms[_NET_WM_STATE], &netatoms[_NET_WM_STATE_ABOVE], 1 );
|
window_set_atom_prop ( display, box, netatoms[_NET_WM_STATE], &netatoms[_NET_WM_STATE_ABOVE], 1 );
|
||||||
XSetWindowAttributes sattr = { .override_redirect = True };
|
XSetWindowAttributes sattr = { .override_redirect = True };
|
||||||
XChangeWindowAttributes ( display, box, CWOverrideRedirect, &sattr );
|
XChangeWindowAttributes ( display, box, CWOverrideRedirect, &sattr );
|
||||||
|
}
|
||||||
|
|
||||||
// Set the WM_NAME
|
// Set the WM_NAME
|
||||||
XStoreName ( display, box, "rofi" );
|
XStoreName ( display, box, "rofi" );
|
||||||
|
@ -900,6 +902,26 @@ static void menu_paste ( MenuState *state, XSelectionEvent *xse )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void menu_resize ( MenuState *state )
|
||||||
|
{
|
||||||
|
if ( state->scrollbar ) {
|
||||||
|
unsigned int sbw = config.line_margin + 8;
|
||||||
|
XMoveWindow ( display, state->scrollbar->window, state->w - config.padding - sbw, state->top_offset );
|
||||||
|
}
|
||||||
|
if ( config.sidebar_mode == TRUE ) {
|
||||||
|
int width = ( state->w - ( 2 * ( config.padding ) +
|
||||||
|
( num_switchers - 1 ) * config.line_margin ) ) / num_switchers;
|
||||||
|
for ( unsigned int j = 0; j < num_switchers; j++ ) {
|
||||||
|
textbox_moveresize ( switchers[j].tb,
|
||||||
|
config.padding + j * ( width + config.line_margin ),
|
||||||
|
state->h - state->line_height - config.padding,
|
||||||
|
width, state->line_height );
|
||||||
|
textbox_show ( switchers[j].tb );
|
||||||
|
textbox_draw ( switchers[j].tb );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MenuReturn menu ( Switcher *sw, char **input, char *prompt,
|
MenuReturn menu ( Switcher *sw, char **input, char *prompt,
|
||||||
unsigned int *selected_line,
|
unsigned int *selected_line,
|
||||||
unsigned int *next_pos, const char *message )
|
unsigned int *next_pos, const char *message )
|
||||||
|
@ -1131,6 +1153,15 @@ MenuReturn menu ( Switcher *sw, char **input, char *prompt,
|
||||||
if ( ev.type == KeymapNotify ) {
|
if ( ev.type == KeymapNotify ) {
|
||||||
XRefreshKeyboardMapping ( &ev.xmapping );
|
XRefreshKeyboardMapping ( &ev.xmapping );
|
||||||
}
|
}
|
||||||
|
else if ( ev.type == ConfigureNotify ) {
|
||||||
|
XConfigureEvent xce = ev.xconfigure;
|
||||||
|
if ( xce.window == main_window ) {
|
||||||
|
if ( state.w != (unsigned int) xce.width ) {
|
||||||
|
state.w = xce.width;
|
||||||
|
menu_resize ( &state );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Handle event.
|
// Handle event.
|
||||||
else if ( ev.type == Expose ) {
|
else if ( ev.type == Expose ) {
|
||||||
while ( XCheckTypedEvent ( display, Expose, &ev ) ) {
|
while ( XCheckTypedEvent ( display, Expose, &ev ) ) {
|
||||||
|
|
Loading…
Reference in a new issue