1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

[View] Move overlay into the theme system instead of weird addon.

It is now a child in the inputbar.

Fixes: #950
This commit is contained in:
Dave Davenport 2019-04-16 12:52:53 +02:00
parent 29c83b3623
commit 5b96be66ae
3 changed files with 8 additions and 17 deletions

View file

@ -119,7 +119,7 @@ inputbar {
spacing: 0px ;
text-color: var(normal-foreground);
padding: 1px ;
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
children: [ prompt,textbox-prompt-colon,entry,overlay,case-indicator ];
}
case-indicator {
spacing: 0;

View file

@ -119,7 +119,7 @@ inputbar {
spacing: 0px ;
text-color: var(normal-foreground);
padding: 1px ;
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
children: [ prompt,textbox-prompt-colon,entry,overlay,case-indicator ];
}
case-indicator {
spacing: 0;

View file

@ -497,7 +497,6 @@ void rofi_view_free ( RofiViewState *state )
// Do this here?
// Wait for final release?
widget_free ( WIDGET ( state->main_window ) );
widget_free ( WIDGET ( state->overlay ) );
g_free ( state->line_map );
g_free ( state->distance );
@ -1005,10 +1004,6 @@ void rofi_view_update ( RofiViewState *state, gboolean qr )
cairo_set_operator ( d, CAIRO_OPERATOR_OVER );
widget_draw ( WIDGET ( state->main_window ), d );
if ( state->overlay ) {
widget_draw ( WIDGET ( state->overlay ), d );
}
TICK_N ( "widgets" );
cairo_surface_flush ( CacheState.edit_surf );
if ( qr ) {
@ -1566,7 +1561,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
*/
else if ( strcmp ( name, "inputbar" ) == 0 ) {
wid = (widget *) box_create ( parent_widget, name, ROFI_ORIENTATION_HORIZONTAL );
defaults = "prompt,entry,case-indicator";
defaults = "prompt,entry,overlay,case-indicator";
box_add ( (box *) parent_widget, WIDGET ( wid ), FALSE );
}
/**
@ -1663,6 +1658,11 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
widget_set_trigger_action_handler ( WIDGET ( state->modi[j] ), textbox_sidebar_modi_trigger_action, state );
}
}
else if ( g_ascii_strcasecmp ( name, "overlay" ) == 0 ) {
state->overlay = textbox_create ( WIDGET ( parent_widget ), WIDGET_TYPE_TEXTBOX_TEXT, "overlay", TB_AUTOWIDTH | TB_AUTOHEIGHT, URGENT, "blaat", 0.5, 0 );
box_add ( (box *) parent_widget, WIDGET ( state->overlay), FALSE );
widget_disable ( WIDGET ( state->overlay ) );
}
else if ( g_ascii_strncasecmp ( name, "textbox", 7 ) == 0 ) {
textbox *t = textbox_create ( parent_widget, WIDGET_TYPE_TEXTBOX_TEXT, name, TB_AUTOHEIGHT | TB_WRAP, NORMAL, "", 0, 0 );
box_add ( (box *) parent_widget, WIDGET ( t ), TRUE );
@ -1725,8 +1725,6 @@ RofiViewState *rofi_view_create ( Mode *sw,
textbox_cursor_end ( state->text );
}
state->overlay = textbox_create ( WIDGET ( state->main_window ), WIDGET_TYPE_TEXTBOX_TEXT, "overlay", TB_AUTOWIDTH | TB_AUTOHEIGHT, URGENT, "blaat", 0.5, 0 );
widget_disable ( WIDGET ( state->overlay ) );
// filtered list
state->line_map = g_malloc0_n ( state->num_lines, sizeof ( unsigned int ) );
@ -1896,13 +1894,6 @@ void rofi_view_set_overlay ( RofiViewState *state, const char *text )
}
widget_enable ( WIDGET ( state->overlay ) );
textbox_text ( state->overlay, text );
int x_offset = widget_get_width ( WIDGET ( state->list_view ) );
// Within padding of window.
x_offset += widget_get_absolute_xpos ( WIDGET ( state->list_view ) );
x_offset -= widget_get_width ( WIDGET ( state->overlay ) );
// Within the border of widget.
int top_offset = widget_get_absolute_ypos ( WIDGET ( state->list_view ) );
widget_move ( WIDGET ( state->overlay ), x_offset, top_offset );
// We want to queue a repaint.
rofi_view_queue_redraw ( );
}