diff --git a/include/widgets/box.h b/include/widgets/box.h index 21724b1a..0bc34f8c 100644 --- a/include/widgets/box.h +++ b/include/widgets/box.h @@ -53,7 +53,7 @@ typedef struct _box box; * * @returns a newly created box, free with #widget_free */ -box * box_create ( const char *name, RofiOrientation type ); +box * box_create ( widget *parent, const char *name, RofiOrientation type ); /** * @param box Handle to the box widget. diff --git a/include/widgets/container.h b/include/widgets/container.h index 60c0b258..e0233562 100644 --- a/include/widgets/container.h +++ b/include/widgets/container.h @@ -44,11 +44,12 @@ typedef struct _window container; /** + * @parem parent The widget's parent * @param name The name of the widget. * * @returns a newly created container, free with #widget_free */ -container * container_create ( const char *name ); +container * container_create ( widget *parent, const char *name ); /** * @param container Handle to the container widget. diff --git a/include/widgets/listview.h b/include/widgets/listview.h index 81d705b1..2eda9d43 100644 --- a/include/widgets/listview.h +++ b/include/widgets/listview.h @@ -77,7 +77,7 @@ typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * ); * * @returns a new listview */ -listview *listview_create ( const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse ); +listview *listview_create ( widget *parent, const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse ); /** * @param lv The listview handle diff --git a/include/widgets/scrollbar.h b/include/widgets/scrollbar.h index 6c7af7c8..0339abf2 100644 --- a/include/widgets/scrollbar.h +++ b/include/widgets/scrollbar.h @@ -50,13 +50,14 @@ typedef struct _scrollbar } scrollbar; /** + * @parem parent The parent widget. * @param name The name of the widget. * * Create a new scrollbar * * @returns the scrollbar object. */ -scrollbar *scrollbar_create ( const char *name ); +scrollbar *scrollbar_create ( widget *parent, const char *name ); /** * @param sb scrollbar object diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h index 3ea8074b..c238fb5e 100644 --- a/include/widgets/textbox.h +++ b/include/widgets/textbox.h @@ -127,7 +127,7 @@ typedef enum * free with #widget_free * @returns a new #textbox */ -textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, +textbox* textbox_create ( widget *parent, WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign ); /** * @param tb Handle to the textbox diff --git a/include/widgets/widget-internal.h b/include/widgets/widget-internal.h index 8ae1f823..e32c8766 100644 --- a/include/widgets/widget-internal.h +++ b/include/widgets/widget-internal.h @@ -97,14 +97,15 @@ struct _widget }; /** - * @param widget The widget to initialize. + * @param wid The widget to initialize. + * @param parent The widget's parent. * @param type The type of the widget. * @param name The name of the widget. * * Initializes the widget structure. * */ -void widget_init ( widget *widget, WidgetType type, const char *name ); +void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name ); /** * @param widget The widget handle. diff --git a/source/view.c b/source/view.c index 73e3bd43..bf90ca6c 100644 --- a/source/view.c +++ b/source/view.c @@ -735,7 +735,7 @@ void __create_window ( MenuFlags menu_flags ) } // Setup font. // Dummy widget. - box *win = box_create ( "window", ROFI_ORIENTATION_HORIZONTAL ); + box *win = box_create ( NULL, "window", ROFI_ORIENTATION_HORIZONTAL ); const char *font = rofi_theme_get_string ( WIDGET ( win ), "font", config.menu_font ); if ( font ) { PangoFontDescription *pfd = pango_font_description_from_string ( font ); @@ -1525,7 +1525,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, * MAINBOX */ if ( strcmp ( name, "mainbox" ) == 0 ) { - wid = (widget *) box_create ( name, ROFI_ORIENTATION_VERTICAL ); + wid = (widget *) box_create ( parent_widget, name, ROFI_ORIENTATION_VERTICAL ); box_add ( (box *) parent_widget, WIDGET ( wid ), TRUE ); defaults = "inputbar,message,listview,sidebar"; } @@ -1533,7 +1533,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, * INPUTBAR */ else if ( strcmp ( name, "inputbar" ) == 0 ) { - wid = (widget *) box_create ( name, ROFI_ORIENTATION_HORIZONTAL ); + wid = (widget *) box_create ( parent_widget, name, ROFI_ORIENTATION_HORIZONTAL ); defaults = "prompt,entry,case-indicator"; box_add ( (box *) parent_widget, WIDGET ( wid ), FALSE ); } @@ -1546,7 +1546,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, return; } // Prompt box. - state->prompt = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, name, TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "", 0, 0 ); + state->prompt = textbox_create ( parent_widget, WIDGET_TYPE_TEXTBOX_TEXT, name, TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "", 0, 0 ); rofi_view_update_prompt ( state ); box_add ( (box *) parent_widget, WIDGET ( state->prompt ), FALSE ); defaults = NULL; @@ -1559,7 +1559,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, g_error ( "Case indicator widget can only be added once to the layout." ); return; } - state->case_indicator = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, name, TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "*", 0, 0 ); + state->case_indicator = textbox_create ( parent_widget, WIDGET_TYPE_TEXTBOX_TEXT, name, TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "*", 0, 0 ); // Add small separator between case indicator and text box. box_add ( (box *) parent_widget, WIDGET ( state->case_indicator ), FALSE ); textbox_text ( state->case_indicator, get_matching_state () ); @@ -1575,7 +1575,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, // Entry box TextboxFlags tfl = TB_EDITABLE; tfl |= ( ( state->menu_flags & MENU_PASSWORD ) == MENU_PASSWORD ) ? TB_PASSWORD : 0; - state->text = textbox_create ( WIDGET_TYPE_EDITBOX, name, tfl | TB_AUTOHEIGHT, NORMAL, NULL, 0, 0 ); + state->text = textbox_create ( parent_widget, WIDGET_TYPE_EDITBOX, name, tfl | TB_AUTOHEIGHT, NORMAL, NULL, 0, 0 ); box_add ( (box *) parent_widget, WIDGET ( state->text ), TRUE ); } /** @@ -1586,8 +1586,8 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, g_error ( "Message widget can only be added once to the layout." ); return; } - state->mesg_box = container_create ( name ); - state->mesg_tb = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, "textbox", TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, NORMAL, NULL, 0, 0 ); + state->mesg_box = container_create ( parent_widget, name ); + state->mesg_tb = textbox_create ( state->mesg_box, WIDGET_TYPE_TEXTBOX_TEXT, "textbox", TB_AUTOHEIGHT | TB_MARKUP | TB_WRAP, NORMAL, NULL, 0, 0 ); container_add ( state->mesg_box, WIDGET ( state->mesg_tb ) ); rofi_view_reload_message_bar ( state ); box_add ( (box *) parent_widget, WIDGET ( state->mesg_box ), FALSE ); @@ -1600,7 +1600,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, g_error ( "Listview widget can only be added once to the layout." ); return; } - state->list_view = listview_create ( name, update_callback, state, config.element_height, 0 ); + state->list_view = listview_create ( parent_widget, name, update_callback, state, config.element_height, 0 ); box_add ( (box *) parent_widget, WIDGET ( state->list_view ), TRUE ); // Set configuration listview_set_multi_select ( state->list_view, ( state->menu_flags & MENU_INDICATOR ) == MENU_INDICATOR ); @@ -1620,13 +1620,13 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, return; } if ( config.sidebar_mode ) { - state->sidebar_bar = box_create ( name,ROFI_ORIENTATION_HORIZONTAL ); + state->sidebar_bar = box_create ( parent_widget, name,ROFI_ORIENTATION_HORIZONTAL ); box_add ( (box *) parent_widget, WIDGET ( state->sidebar_bar ), FALSE ); state->num_modi = rofi_get_num_enabled_modi (); state->modi = g_malloc0 ( state->num_modi * sizeof ( textbox * ) ); for ( unsigned int j = 0; j < state->num_modi; j++ ) { const Mode * mode = rofi_get_mode ( j ); - state->modi[j] = textbox_create ( WIDGET_TYPE_SIDEBAR_MODI, "button", TB_AUTOHEIGHT, ( mode == state->sw ) ? HIGHLIGHT : NORMAL, + state->modi[j] = textbox_create ( WIDGET ( state->sidebar_bar ), WIDGET_TYPE_SIDEBAR_MODI, "button", TB_AUTOHEIGHT, ( mode == state->sw ) ? HIGHLIGHT : NORMAL, mode_get_display_name ( mode ), 0.5, 0.5 ); box_add ( state->sidebar_bar, WIDGET ( state->modi[j] ), TRUE ); widget_set_trigger_action_handler ( WIDGET ( state->modi[j] ), textbox_sidebar_modi_trigger_action, state ); @@ -1634,11 +1634,11 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget, } } else if ( g_ascii_strncasecmp ( name, "textbox", 7 ) == 0 ) { - textbox *t = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, name, TB_WRAP, NORMAL, "", 0, 0 ); + textbox *t = textbox_create ( parent_widget, WIDGET_TYPE_TEXTBOX_TEXT, name, TB_WRAP, NORMAL, "", 0, 0 ); box_add ( (box *) parent_widget, WIDGET ( t ), TRUE ); } else { - wid = (widget *) box_create ( name, ROFI_ORIENTATION_VERTICAL ); + wid = (widget *) box_create ( parent_widget, name, ROFI_ORIENTATION_VERTICAL ); box_add ( (box *) parent_widget, WIDGET ( wid ), TRUE ); //g_error("The widget %s does not exists. Invalid layout.", name); } @@ -1678,7 +1678,7 @@ RofiViewState *rofi_view_create ( Mode *sw, // Get active monitor size. TICK_N ( "Get active monitor" ); - state->main_window = box_create ( "window", ROFI_ORIENTATION_VERTICAL ); + state->main_window = box_create ( NULL, "window", ROFI_ORIENTATION_VERTICAL ); // Get children. GList *list = rofi_theme_get_list ( WIDGET ( state->main_window ), "children", "mainbox" ); for ( const GList *iter = list; iter != NULL; iter = g_list_next ( iter ) ) { @@ -1691,8 +1691,7 @@ RofiViewState *rofi_view_create ( Mode *sw, textbox_cursor_end ( state->text ); } - state->overlay = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, "overlay", TB_AUTOWIDTH | TB_AUTOHEIGHT, URGENT, "blaat", 0.5, 0 ); - state->overlay->widget.parent = WIDGET ( state->main_window ); + 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 @@ -1729,10 +1728,10 @@ int rofi_view_error_dialog ( const char *msg, int markup ) state->menu_flags = MENU_ERROR_DIALOG; state->finalize = process_result; - state->main_window = box_create ( "window", ROFI_ORIENTATION_VERTICAL ); - box *box = box_create ( "message", ROFI_ORIENTATION_VERTICAL ); + state->main_window = box_create ( NULL, "window", ROFI_ORIENTATION_VERTICAL ); + box *box = box_create ( WIDGET ( state->main_window ), "message", ROFI_ORIENTATION_VERTICAL ); box_add ( state->main_window, WIDGET ( box ), TRUE ); - state->text = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, "textbox", ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ), + state->text = textbox_create ( WIDGET ( box ), WIDGET_TYPE_TEXTBOX_TEXT, "textbox", ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ), NORMAL, ( msg != NULL ) ? msg : "", 0, 0 ); box_add ( box, WIDGET ( state->text ), TRUE ); diff --git a/source/widgets/box.c b/source/widgets/box.c index f2c8b92f..8ebd9257 100644 --- a/source/widgets/box.c +++ b/source/widgets/box.c @@ -289,7 +289,7 @@ void box_add ( box *box, widget *child, gboolean expand ) box->widget.h = height; } child->expand = rofi_theme_get_boolean ( child, "expand", expand ); - child->parent = WIDGET ( box ); + g_assert ( child->parent == WIDGET ( box ) ); box->children = g_list_append ( box->children, (void *) child ); widget_update ( WIDGET ( box ) ); } @@ -324,11 +324,11 @@ static widget *box_find_mouse_target ( widget *wid, WidgetType type, gint x, gin return NULL; } -box * box_create ( const char *name, RofiOrientation type ) +box * box_create ( widget *parent, const char *name, RofiOrientation type ) { box *b = g_malloc0 ( sizeof ( box ) ); // Initialize widget. - widget_init ( WIDGET ( b ), WIDGET_TYPE_UNKNOWN, name ); + widget_init ( WIDGET ( b ), parent, WIDGET_TYPE_UNKNOWN, name ); b->type = type; b->widget.draw = box_draw; b->widget.free = box_free; diff --git a/source/widgets/container.c b/source/widgets/container.c index 4ceaa694..9791dd21 100644 --- a/source/widgets/container.c +++ b/source/widgets/container.c @@ -74,7 +74,7 @@ void container_add ( container *container, widget *child ) return; } container->child = child; - child->parent = WIDGET ( container ); + g_assert ( child->parent == WIDGET ( container )); widget_update ( WIDGET ( container ) ); } @@ -100,11 +100,11 @@ static widget *container_find_mouse_target ( widget *wid, WidgetType type, gint return widget_find_mouse_target ( b->child, type, x, y ); } -container * container_create ( const char *name ) +container * container_create ( widget *parent, const char *name ) { container *b = g_malloc0 ( sizeof ( container ) ); // Initialize widget. - widget_init ( WIDGET ( b ), WIDGET_TYPE_UNKNOWN, name ); + widget_init ( WIDGET ( b ), parent, WIDGET_TYPE_UNKNOWN, name ); b->widget.draw = container_draw; b->widget.free = container_free; b->widget.resize = container_resize; diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 5d1fd01a..40537af4 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -371,7 +371,7 @@ static void listview_recompute_elements ( listview *lv ) for ( unsigned int i = lv->cur_elements; i < newne; i++ ) { TextboxFlags flags = ( lv->multi_select ) ? TB_INDICATOR : 0; flags |= ( ( config.show_icons ) ? TB_ICON : 0 ); - lv->boxes[i] = textbox_create ( WIDGET_TYPE_LISTVIEW_ELEMENT, "element", flags, NORMAL, "", 0, 0 ); + lv->boxes[i] = textbox_create ( WIDGET (lv), WIDGET_TYPE_LISTVIEW_ELEMENT, "element", flags, NORMAL, "", 0, 0 ); widget_set_trigger_action_handler ( WIDGET ( lv->boxes[i] ), listview_element_trigger_action, lv ); } } @@ -511,12 +511,10 @@ static WidgetTriggerActionResult listview_element_trigger_action ( widget *wid, return WIDGET_TRIGGER_ACTION_RESULT_HANDLED; } -listview *listview_create ( const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse ) +listview *listview_create ( widget *parent, const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse ) { listview *lv = g_malloc0 ( sizeof ( listview ) ); - gchar *box = g_strjoin ( ".", name, "box", NULL ); - widget_init ( WIDGET ( lv ), WIDGET_TYPE_LISTVIEW, box ); - g_free ( box ); + widget_init ( WIDGET ( lv ), parent, WIDGET_TYPE_LISTVIEW, name ); lv->listview_name = g_strdup ( name ); lv->widget.free = listview_free; lv->widget.resize = listview_resize; @@ -526,13 +524,10 @@ listview *listview_create ( const char *name, listview_update_callback cb, void lv->widget.get_desired_height = listview_get_desired_height; lv->eh = eh; - char *n = g_strjoin ( ".", lv->listview_name, "scrollbar", NULL ); - lv->scrollbar = scrollbar_create ( n ); - g_free ( n ); - lv->scrollbar->widget.parent = WIDGET ( lv ); + lv->scrollbar = scrollbar_create ( WIDGET ( lv ) , "scrollbar" ); // Calculate height of an element. // - textbox *tb = textbox_create ( WIDGET_TYPE_LISTVIEW_ELEMENT, "element", 0, NORMAL, "", 0, 0 ); + textbox *tb = textbox_create ( WIDGET (lv), WIDGET_TYPE_LISTVIEW_ELEMENT, "element", 0, NORMAL, "", 0, 0 ); lv->element_height = textbox_get_estimated_height ( tb, lv->eh ); widget_free ( WIDGET ( tb ) ); diff --git a/source/widgets/scrollbar.c b/source/widgets/scrollbar.c index 7149cc44..32f92716 100644 --- a/source/widgets/scrollbar.c +++ b/source/widgets/scrollbar.c @@ -98,10 +98,10 @@ static gboolean scrollbar_motion_notify ( widget *wid, G_GNUC_UNUSED gint x, gin return TRUE; } -scrollbar *scrollbar_create ( const char *name ) +scrollbar *scrollbar_create ( widget *parent, const char *name ) { scrollbar *sb = g_malloc0 ( sizeof ( scrollbar ) ); - widget_init ( WIDGET ( sb ), WIDGET_TYPE_SCROLLBAR, name ); + widget_init ( WIDGET ( sb ), parent, WIDGET_TYPE_SCROLLBAR, name ); sb->widget.x = 0; sb->widget.y = 0; sb->width = rofi_theme_get_distance ( WIDGET ( sb ), "handle-width", DEFAULT_SCROLLBAR_WIDTH ); diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 2df91c7f..0fed9d38 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -162,11 +162,11 @@ static void textbox_initialize_font ( textbox *tb ) } } -textbox* textbox_create ( WidgetType type, const char *name, TextboxFlags flags, TextBoxFontType tbft, const char *text, double xalign, double yalign ) +textbox* textbox_create ( widget *parent, 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 ); + widget_init ( WIDGET ( tb ), parent, type, name ); tb->widget.draw = textbox_draw; tb->widget.free = textbox_free; diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 7e951aad..774ab502 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -34,22 +34,23 @@ /** Default padding. */ #define WIDGET_DEFAULT_PADDING 0 -void widget_init ( widget *widget, WidgetType type, const char *name ) +void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name ) { - widget->type = type; - widget->name = g_strdup ( name ); - widget->def_padding = (RofiPadding){ { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID } }; - widget->def_border = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; - widget->def_border_radius = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; - widget->def_margin = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; + wid->type = type; + wid->parent = parent; + wid->name = g_strdup ( name ); + wid->def_padding = (RofiPadding){ { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID } }; + wid->def_border = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; + wid->def_border_radius = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; + wid->def_margin = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } }; - widget->padding = rofi_theme_get_padding ( widget, "padding", widget->def_padding ); - 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 ); + wid->padding = rofi_theme_get_padding ( wid, "padding", wid->def_padding ); + wid->border = rofi_theme_get_padding ( wid, "border", wid->def_border ); + wid->border_radius = rofi_theme_get_padding ( wid, "border-radius", wid->def_border_radius ); + wid->margin = rofi_theme_get_padding ( wid, "margin", wid->def_margin ); - // Enabled by default - widget->enabled = rofi_theme_get_boolean ( widget, "enabled", TRUE ); + // bled by default + wid->enabled = rofi_theme_get_boolean ( wid, "enabled", TRUE ); } void widget_set_state ( widget *widget, const char *state ) diff --git a/test/box-test.c b/test/box-test.c index 0d276d63..134ed521 100644 --- a/test/box-test.c +++ b/test/box-test.c @@ -98,7 +98,7 @@ void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) { { - box *b = box_create ( "box", ROFI_ORIENTATION_HORIZONTAL ); + box *b = box_create ( NULL, "box", ROFI_ORIENTATION_HORIZONTAL ); //box_set_padding ( b, 5 ); widget_resize ( WIDGET (b), 100, 20); @@ -160,7 +160,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) widget_free ( WIDGET ( b ) ); } { - box *b = box_create ( "box", ROFI_ORIENTATION_VERTICAL ); + box *b = box_create ( NULL, "box", ROFI_ORIENTATION_VERTICAL ); widget_resize ( WIDGET (b), 20, 100); //box_set_padding ( b, 5 ); @@ -221,7 +221,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) widget_free ( WIDGET ( b ) ); } { - box *b = box_create ( "box", ROFI_ORIENTATION_VERTICAL ); + box *b = box_create ( NULL, "box", ROFI_ORIENTATION_VERTICAL ); widget_resize ( WIDGET (b), 20, 90); //box_set_padding ( b, 5 ); widget *wid1 = g_malloc0(sizeof(widget)); diff --git a/test/scrollbar-test.c b/test/scrollbar-test.c index 0fb98019..d9896d01 100644 --- a/test/scrollbar-test.c +++ b/test/scrollbar-test.c @@ -90,7 +90,7 @@ void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) { - scrollbar * sb = scrollbar_create ( "scrollbar" ); + scrollbar * sb = scrollbar_create ( NULL, "scrollbar" ); widget_resize ( WIDGET (sb), 10, 100); scrollbar_set_handle ( NULL, 10213); diff --git a/test/textbox-test.c b/test/textbox-test.c index 94703a85..ad5049e8 100644 --- a/test/textbox-test.c +++ b/test/textbox-test.c @@ -93,7 +93,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv ) textbox_set_pango_context ( "default", p ); - textbox *box = textbox_create ( WIDGET_TYPE_TEXTBOX_TEXT, "textbox", TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "test",0,0 ); + textbox *box = textbox_create ( NULL, WIDGET_TYPE_TEXTBOX_TEXT, "textbox", TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "test",0,0 ); TASSERT ( box != NULL ); textbox_keybinding ( box, MOVE_END );