summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2019-04-16 12:52:53 +0200
committerDave Davenport <qball@gmpclient.org>2019-04-16 12:52:53 +0200
commit5b96be66ae5bfbb88020c208df62c4fb783ba8fc (patch)
treebb121fbdc16038b74c7205e9dc5bac0dfc908590
parent29c83b362304a1165ee31733026a44f40f6b19c5 (diff)
[View] Move overlay into the theme system instead of weird addon.
It is now a child in the inputbar. Fixes: #950
-rw-r--r--doc/default_theme.rasi2
-rw-r--r--doc/old-theme-convert-output.rasi2
-rw-r--r--source/view.c21
3 files changed, 8 insertions, 17 deletions
diff --git a/doc/default_theme.rasi b/doc/default_theme.rasi
index d7e3b305..4a1a382c 100644
--- a/doc/default_theme.rasi
+++ b/doc/default_theme.rasi
@@ -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;
diff --git a/doc/old-theme-convert-output.rasi b/doc/old-theme-convert-output.rasi
index 26736af9..169f07e4 100644
--- a/doc/old-theme-convert-output.rasi
+++ b/doc/old-theme-convert-output.rasi
@@ -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;
diff --git a/source/view.c b/source/view.c
index c6ef6068..e35035fd 100644
--- a/source/view.c
+++ b/source/view.c
@@ -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 ( );
}