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

Fix theme converter and check.

This commit is contained in:
Dave Davenport 2017-01-06 16:53:21 +01:00
parent af8a6541a2
commit 9aaf21cd85
3 changed files with 33 additions and 18 deletions

View file

@ -506,9 +506,13 @@ void rofi_theme_convert_old_theme ( void )
ThemeWidget *mainbox_widget = rofi_theme_find_or_create_name ( window_widget, "mainbox" );
rofi_theme_convert_create_property_ht ( mainbox_widget );
ThemeWidget *message = rofi_theme_find_or_create_name ( mainbox_widget, "message" );
rofi_theme_convert_create_property_ht ( message );
ThemeWidget *message_box = rofi_theme_find_or_create_name ( message, "box" );
rofi_theme_convert_create_property_ht ( message_box );
ThemeWidget *listview_widget = rofi_theme_find_or_create_name ( mainbox_widget, "listview" );
rofi_theme_convert_create_property_ht ( listview_widget );
ThemeWidget *sidebar_widget = rofi_theme_find_or_create_name ( mainbox_widget, "sidebar" );
ThemeWidget *sidebarbox_widget = rofi_theme_find_or_create_name ( sidebar_widget, "box" );
rofi_theme_convert_create_property_ht ( sidebarbox_widget );
{
Property *p = rofi_theme_property_create ( P_INTEGER );
p->name = g_strdup ("border");
@ -560,6 +564,7 @@ void rofi_theme_convert_old_theme ( void )
}
g_hash_table_replace ( listview_widget->properties, p->name, p );
p = rofi_theme_property_create ( P_PADDING );
p->name = g_strdup("border");
d = (Distance){config.menu_bw, PW_PX, style};
@ -568,7 +573,17 @@ void rofi_theme_convert_old_theme ( void )
} else {
p->value.padding.top= d;
}
g_hash_table_replace ( message->properties, p->name, p );
g_hash_table_replace ( message_box->properties, p->name, p );
/**
* Sidebar top
*/
p = rofi_theme_property_create ( P_PADDING );
p->name = g_strdup("border");
d = (Distance){config.menu_bw, PW_PX, style};
p->value.padding.top= d;
g_hash_table_replace ( sidebarbox_widget->properties, p->name, p );
p = rofi_theme_property_create ( P_PADDING );
p->name = g_strdup("padding");
d = (Distance){config.line_margin, PW_PX, SOLID};
@ -587,7 +602,7 @@ void rofi_theme_convert_old_theme ( void )
} else {
p->value.padding.top= d;
}
g_hash_table_replace ( message->properties, p->name, p );
g_hash_table_replace ( message_box->properties, p->name, p );
}
{

View file

@ -46,7 +46,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget_resize ( WIDGET (b), 100, 20);
widget *wid1 = g_malloc0(sizeof(widget));
box_add ( b , WIDGET( wid1 ), TRUE, FALSE );
box_add ( b , WIDGET( wid1 ), TRUE, 0 );
// Widget not enabled. no width allocated.
TASSERTE ( wid1->h, 0);
TASSERTE ( wid1->w, 0 );
@ -57,7 +57,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERTE ( wid1->w, 100 );
widget *wid2 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid2 ) );
box_add ( b , WIDGET( wid2 ), TRUE, FALSE );
box_add ( b , WIDGET( wid2 ), TRUE, 1 );
TASSERTE ( wid1->h, 20);
TASSERTE ( wid1->w, 49);
TASSERTE ( wid2->h, 20);
@ -65,7 +65,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget *wid3 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid3 ) );
box_add ( b , WIDGET( wid3 ), FALSE, FALSE );
box_add ( b , WIDGET( wid3 ), FALSE, 2 );
TASSERTE ( wid1->h, 20);
TASSERTE ( wid1->w, 48);
TASSERTE ( wid2->h, 20);
@ -93,13 +93,13 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget *wid4 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid4 ) );
widget_resize ( WIDGET ( wid4 ), 20, 20 );
box_add ( b , WIDGET( wid4 ), FALSE, TRUE );
box_add ( b , WIDGET( wid4 ), FALSE, 5 );
TASSERTE ( wid4->x, 200-20);
widget *wid5 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid5 ) );
widget_resize ( WIDGET ( wid5 ), 20, 20 );
box_add ( b , WIDGET( wid5 ), TRUE, TRUE );
TASSERTE ( wid5->x, 127);
box_add ( b , WIDGET( wid5 ), TRUE, 6 );
TASSERTE ( wid5->x, 149);
widget_free ( WIDGET ( b ) );
}
{
@ -108,7 +108,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
//box_set_padding ( b, 5 );
widget *wid1 = g_malloc0(sizeof(widget));
box_add ( b , WIDGET( wid1 ), TRUE, FALSE );
box_add ( b , WIDGET( wid1 ), TRUE, 0 );
// Widget not enabled. no width allocated.
TASSERTE ( wid1->h, 0);
TASSERTE ( wid1->w, 0 );
@ -119,7 +119,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERTE ( wid1->w, 20 );
widget *wid2 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid2 ) );
box_add ( b , WIDGET( wid2 ), TRUE, FALSE );
box_add ( b , WIDGET( wid2 ), TRUE, 1 );
TASSERTE ( wid1->w, 20);
TASSERTE ( wid1->h, 49);
TASSERTE ( wid2->w, 20);
@ -127,7 +127,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget *wid3 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid3 ) );
box_add ( b , WIDGET( wid3 ), FALSE, FALSE );
box_add ( b , WIDGET( wid3 ), FALSE, 2 );
TASSERTE ( wid1->w, 20);
TASSERTE ( wid1->h, 48);
TASSERTE ( wid2->w, 20);
@ -155,13 +155,13 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget *wid4 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid4 ) );
widget_resize ( WIDGET ( wid4 ), 20, 20 );
box_add ( b , WIDGET( wid4 ), FALSE, TRUE );
box_add ( b , WIDGET( wid4 ), FALSE, 5 );
TASSERTE ( wid4->y, 200);
widget *wid5 = g_malloc0(sizeof(widget));
widget_enable ( WIDGET ( wid5 ) );
widget_resize ( WIDGET ( wid5 ), 20, 20 );
box_add ( b , WIDGET( wid5 ), TRUE, TRUE );
TASSERTE ( wid5->y, 134);
box_add ( b , WIDGET( wid5 ), TRUE, 6 );
TASSERTE ( wid5->y, 136);
widget_free ( WIDGET ( b ) );
}
{
@ -171,10 +171,10 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget *wid1 = g_malloc0(sizeof(widget));
widget_enable(wid1);
wid1->clicked = test_widget_clicked;
box_add ( b , WIDGET( wid1 ), TRUE, FALSE );
box_add ( b , WIDGET( wid1 ), TRUE, 0 );
widget *wid2 = g_malloc0(sizeof(widget));
widget_enable(wid2);
box_add ( b , WIDGET( wid2 ), TRUE, FALSE );
box_add ( b , WIDGET( wid2 ), TRUE, 1 );
xcb_button_press_event_t xce;
xce.event_x = 10;

View file

@ -40,7 +40,7 @@ void rofi_view_get_current_monitor ( int *width, int *height )
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
scrollbar * sb = scrollbar_create ( "scrollbar", 3);
scrollbar * sb = scrollbar_create ( "scrollbar" );
widget_resize ( WIDGET (sb), 10, 100);
scrollbar_set_handle ( NULL, 10213);