diff options
Diffstat (limited to 'source/widgets')
-rw-r--r-- | source/widgets/box.c | 1 | ||||
-rw-r--r-- | source/widgets/container.c | 1 | ||||
-rw-r--r-- | source/widgets/listview.c | 1 | ||||
-rw-r--r-- | source/widgets/scrollbar.c | 2 | ||||
-rw-r--r-- | source/widgets/textbox.c | 47 | ||||
-rw-r--r-- | source/widgets/widget.c | 3 |
6 files changed, 29 insertions, 26 deletions
diff --git a/source/widgets/box.c b/source/widgets/box.c index bd1e1cc8..f2c8b92f 100644 --- a/source/widgets/box.c +++ b/source/widgets/box.c @@ -337,7 +337,6 @@ box * box_create ( const char *name, RofiOrientation type ) b->widget.find_mouse_target = box_find_mouse_target; b->widget.get_desired_height = box_get_desired_height; b->widget.get_desired_width = box_get_desired_width; - b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE ); b->type = rofi_theme_get_orientation ( WIDGET ( b ), "orientation", b->type ); diff --git a/source/widgets/container.c b/source/widgets/container.c index 6807ce15..4ceaa694 100644 --- a/source/widgets/container.c +++ b/source/widgets/container.c @@ -111,7 +111,6 @@ container * container_create ( const char *name ) b->widget.update = container_update; b->widget.find_mouse_target = container_find_mouse_target; b->widget.get_desired_height = container_get_desired_height; - b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE ); return b; } diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 415ccd5a..5d1fd01a 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -524,7 +524,6 @@ listview *listview_create ( const char *name, listview_update_callback cb, void lv->widget.find_mouse_target = listview_find_mouse_target; lv->widget.trigger_action = listview_trigger_action; lv->widget.get_desired_height = listview_get_desired_height; - lv->widget.enabled = rofi_theme_get_boolean ( WIDGET ( lv ), "enabled", TRUE ); lv->eh = eh; char *n = g_strjoin ( ".", lv->listview_name, "scrollbar", NULL ); diff --git a/source/widgets/scrollbar.c b/source/widgets/scrollbar.c index 04dd0e40..7149cc44 100644 --- a/source/widgets/scrollbar.c +++ b/source/widgets/scrollbar.c @@ -119,8 +119,6 @@ scrollbar *scrollbar_create ( const char *name ) sb->pos = 0; sb->pos_length = 4; - // Enabled by default - sb->widget.enabled = rofi_theme_get_boolean ( WIDGET ( sb ), "enabled", TRUE ); return sb; } diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 57856b1c..2df91c7f 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -130,26 +130,8 @@ static WidgetTriggerActionResult textbox_editable_trigger_action ( widget *wid, return WIDGET_TRIGGER_ACTION_RESULT_IGNORED; } -textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign ) +static void textbox_initialize_font ( textbox *tb ) { - textbox *tb = g_slice_new0 ( textbox ); - - widget_init ( WIDGET ( tb ), type, name ); - - tb->widget.draw = textbox_draw; - tb->widget.free = textbox_free; - tb->widget.resize = textbox_resize; - tb->widget.get_width = textbox_get_width; - tb->widget.get_height = _textbox_get_height; - tb->widget.get_desired_height = textbox_get_desired_height; - tb->widget.get_desired_width = textbox_get_desired_width; - tb->flags = flags; - - tb->changed = FALSE; - - tb->layout = pango_layout_new ( p_context ); - textbox_font ( tb, tbft ); - tb->metrics = p_metrics; const char * font = rofi_theme_get_string ( WIDGET ( tb ), "font", NULL ); tb->left_offset = textbox_get_estimated_char_height (); @@ -178,6 +160,31 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, tb->left_offset = ( tbfc->height ) / (double) PANGO_SCALE; } } +} + +textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign ) +{ + textbox *tb = g_slice_new0 ( textbox ); + + widget_init ( WIDGET ( tb ), type, name ); + + tb->widget.draw = textbox_draw; + tb->widget.free = textbox_free; + tb->widget.resize = textbox_resize; + tb->widget.get_width = textbox_get_width; + tb->widget.get_height = _textbox_get_height; + tb->widget.get_desired_height = textbox_get_desired_height; + tb->widget.get_desired_width = textbox_get_desired_width; + tb->flags = flags; + + tb->changed = FALSE; + + tb->layout = pango_layout_new ( p_context ); + textbox_font ( tb, tbft ); + + + textbox_initialize_font ( tb ); + if ( ( tb->flags & TB_ICON ) != TB_ICON ) { tb->left_offset = 0; } @@ -204,8 +211,6 @@ textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, tb->yalign = MAX ( 0, MIN ( 1.0, tb->yalign ) ); tb->xalign = rofi_theme_get_double ( WIDGET ( tb ), "horizontal-align", yalign ); tb->xalign = MAX ( 0, MIN ( 1.0, tb->xalign ) ); - // Enabled by default - tb->widget.enabled = rofi_theme_get_boolean ( WIDGET ( tb ), "enabled", TRUE ); return tb; } diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 50c143e6..7e951aad 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -47,6 +47,9 @@ void widget_init ( widget *widget, WidgetType type, const char *name ) widget->border = rofi_theme_get_padding ( widget, "border", widget->def_border ); widget->border_radius = rofi_theme_get_padding ( widget, "border-radius", widget->def_border_radius ); widget->margin = rofi_theme_get_padding ( widget, "margin", widget->def_margin ); + + // Enabled by default + widget->enabled = rofi_theme_get_boolean ( widget, "enabled", TRUE ); } void widget_set_state ( widget *widget, const char *state ) |