summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-03-29 20:18:41 +0200
committerDave Davenport <qball@gmpclient.org>2017-03-29 20:18:41 +0200
commiteeee200d8f5778cd65cd1f7cef985df3526772c4 (patch)
tree1eac7634b138b09e1033d671e92e0552dfef8c24 /source
parent28f74e3a5aaacc896345236f8dfa2dfafa63a409 (diff)
Remove old theme support. (part 1)
Diffstat (limited to 'source')
-rw-r--r--source/rofi.c9
-rw-r--r--source/theme.c301
-rw-r--r--source/view.c3
-rw-r--r--source/widgets/listview.c2
-rw-r--r--source/xrmoptions.c29
5 files changed, 9 insertions, 335 deletions
diff --git a/source/rofi.c b/source/rofi.c
index f67b337f..df8bae5f 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -69,6 +69,8 @@
#include "timings.h"
+#include "default-theme.h"
+
// Plugin abi version.
// TODO: move this check to mode.c
#include "mode-private.h"
@@ -1083,7 +1085,12 @@ int main ( int argc, char *argv[] )
g_free ( theme_str );
}
if ( rofi_theme_is_empty ( ) ) {
- rofi_theme_convert_old_theme ( );
+ if ( rofi_theme_parse_string ( default_theme ) ){
+ fprintf(stderr, "Failed to parse default theme. Giving up..\n");
+ rofi_theme = NULL;
+ cleanup ();
+ return EXIT_FAILURE;
+ }
}
if ( find_arg ( "-dump-theme" ) >= 0 ) {
diff --git a/source/theme.c b/source/theme.c
index ab660315..d6ced01e 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -574,304 +574,3 @@ gboolean rofi_theme_is_empty ( void )
return FALSE;
}
-#ifdef THEME_CONVERTER
-
-static Property* rofi_theme_convert_get_color ( const char *color, const char *name )
-{
- Color c = color_get ( color );
- Property *p = rofi_theme_property_create ( P_COLOR );
- p->name = g_strdup ( name );
- p->value.color.alpha = c.alpha;
- p->value.color.red = c.red;
- p->value.color.green = c.green;
- p->value.color.blue = c.blue;
-
- return p;
-}
-static void rofi_theme_convert_create_property_ht ( ThemeWidget *widget )
-{
- if ( widget->properties == NULL ) {
- widget->properties = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) rofi_theme_property_free );
- }
-}
-
-void rofi_theme_convert_old_theme ( void )
-{
- if ( rofi_theme != NULL ) {
- rofi_theme_free ( rofi_theme );
- }
- rofi_theme = (ThemeWidget *) g_slice_new0 ( ThemeWidget );
- rofi_theme->name = g_strdup ( "Root" );
- rofi_theme_convert_create_property_ht ( rofi_theme );
- ThemeWidget *window_widget = rofi_theme_find_or_create_name ( rofi_theme, "window" );
- rofi_theme_convert_create_property_ht ( window_widget );
- 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" );
- 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" );
- p->value.i = 0;
- g_hash_table_replace ( mainbox_widget->properties, p->name, p );
-
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "padding" );
- p->value.i = config.padding;
- g_hash_table_replace ( window_widget->properties, p->name, p );
-
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "padding" );
- p->value.i = 0;
- g_hash_table_replace ( mainbox_widget->properties, p->name, p );
- // Spacing
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "spacing" );
- p->value.i = config.line_margin;
- g_hash_table_replace ( rofi_theme->properties, p->name, p );
- }
- {
- // Background
- Property *p = rofi_theme_property_create ( P_COLOR );
- p->name = g_strdup ( "background" );
- p->value.color.alpha = 0;
- p->value.color.red = 0;
- p->value.color.green = 0;
- p->value.color.blue = 0;
- g_hash_table_replace ( rofi_theme->properties, p->name, p );
-
- ThemeWidget *inputbar_widget = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
- rofi_theme_convert_create_property_ht ( inputbar_widget );
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "spacing" );
- p->value.i = 0;
- g_hash_table_replace ( inputbar_widget->properties, p->name, p );
-
- LineStyle style = ( g_strcmp0 ( config.separator_style, "dash" ) == 0 ) ? DASH : SOLID;
- int place_end = ( config.location == WL_SOUTH_EAST || config.location == WL_SOUTH || config.location == WL_SOUTH_WEST );
- p = rofi_theme_property_create ( P_PADDING );
- p->name = g_strdup ( "border" );
- Distance d = (Distance){ config.menu_bw, PW_PX, style };
- if ( place_end ) {
- p->value.padding.bottom = d;
- }
- else {
- p->value.padding.top = d;
- }
- 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 };
- if ( place_end ) {
- p->value.padding.bottom = d;
- }
- else {
- p->value.padding.top = d;
- }
- 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 };
- if ( place_end ) {
- p->value.padding.bottom = d;
- }
- else {
- p->value.padding.top = d;
- }
- g_hash_table_replace ( listview_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 };
- if ( place_end ) {
- p->value.padding.bottom = d;
- }
- else {
- p->value.padding.top = d;
- }
- g_hash_table_replace ( message_box->properties, p->name, p );
- }
- {
- Property *p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "columns" );
- p->value.i = config.menu_columns;
- g_hash_table_replace ( listview_widget->properties, p->name, p );
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "fixed-height" );
- p->value.i = !( config.fixed_num_lines );
- g_hash_table_replace ( listview_widget->properties, p->name, p );
- }
- {
- // Border width.
- rofi_theme_convert_create_property_ht ( window_widget );
- // Padding
- Property *p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "padding" );
- p->value.i = config.padding;
- g_hash_table_replace ( window_widget->properties, p->name, p );
-
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "border" );
- p->value.i = config.menu_bw;
- g_hash_table_replace ( window_widget->properties, p->name, p );
- }
- {
- gchar **vals = g_strsplit ( config.color_window, ",", 3 );
- if ( vals != NULL ) {
- if ( vals[0] != NULL ) {
- Property *p = rofi_theme_convert_get_color ( vals[0], "background" );
- g_hash_table_replace ( window_widget->properties, p->name, p );
-
- if ( vals[1] != NULL ) {
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( window_widget->properties, p->name, p );
-
- ThemeWidget *inputbar = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
- ThemeWidget *widget = rofi_theme_find_or_create_name ( inputbar, "box" );
- rofi_theme_convert_create_property_ht ( widget );
- if ( vals[2] != NULL ) {
- p = rofi_theme_convert_get_color ( vals[2], "foreground" );
- g_hash_table_replace ( window_widget->properties, p->name, p );
- }
- else {
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( window_widget->properties, p->name, p );
- }
- }
- }
- }
- g_strfreev ( vals );
- {
- ThemeWidget *widget = rofi_theme_find_or_create_name ( listview_widget, "element" );
- ThemeWidget *scrollbar = rofi_theme_find_or_create_name ( listview_widget, "scrollbar" );
-
- ThemeWidget *wnormal = rofi_theme_find_or_create_name ( widget, "normal" );
- ThemeWidget *wselected = rofi_theme_find_or_create_name ( widget, "selected" );
- ThemeWidget *walternate = rofi_theme_find_or_create_name ( widget, "alternate" );
-
- rofi_theme_convert_create_property_ht ( widget );
- Property *p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "border" );
- p->value.i = 0;
- g_hash_table_replace ( widget->properties, p->name, p );
-
- rofi_theme_convert_create_property_ht ( scrollbar );
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "border" );
- p->value.i = 0;
- g_hash_table_replace ( scrollbar->properties, p->name, p );
- p = rofi_theme_property_create ( P_INTEGER );
- p->name = g_strdup ( "padding" );
- p->value.i = 0;
- g_hash_table_replace ( scrollbar->properties, p->name, p );
-
- gchar **vals = g_strsplit ( config.color_normal, ",", 5 );
- if ( g_strv_length ( vals ) == 5 ) {
- ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "normal" );
- rofi_theme_convert_create_property_ht ( wnn );
- p = rofi_theme_convert_get_color ( vals[0], "background" );
- g_hash_table_replace ( wnn->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wnn->properties, p->name, p );
-
- ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "normal" );
- rofi_theme_convert_create_property_ht ( wsl );
- p = rofi_theme_convert_get_color ( vals[3], "background" );
- g_hash_table_replace ( wsl->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[4], "foreground" );
- g_hash_table_replace ( wsl->properties, p->name, p );
-
- ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "normal" );
- rofi_theme_convert_create_property_ht ( wal );
- p = rofi_theme_convert_get_color ( vals[2], "background" );
- g_hash_table_replace ( wal->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wal->properties, p->name, p );
-
- ThemeWidget *inputbar = rofi_theme_find_or_create_name ( mainbox_widget, "inputbar" );
- wnn = rofi_theme_find_or_create_name ( inputbar, "normal" );
- rofi_theme_convert_create_property_ht ( wnn );
- p = rofi_theme_convert_get_color ( vals[0], "background" );
- g_hash_table_replace ( wnn->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wnn->properties, p->name, p );
-
- wnn = rofi_theme_find_or_create_name ( message, "normal" );
- rofi_theme_convert_create_property_ht ( wnn );
- p = rofi_theme_convert_get_color ( vals[0], "background" );
- g_hash_table_replace ( wnn->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wnn->properties, p->name, p );
- }
- g_strfreev ( vals );
-
- vals = g_strsplit ( config.color_urgent, ",", 5 );
- if ( g_strv_length ( vals ) == 5 ) {
- ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "urgent" );
- rofi_theme_convert_create_property_ht ( wnn );
- p = rofi_theme_convert_get_color ( vals[0], "background" );
- g_hash_table_replace ( wnn->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wnn->properties, p->name, p );
-
- ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "urgent" );
- rofi_theme_convert_create_property_ht ( wsl );
- p = rofi_theme_convert_get_color ( vals[3], "background" );
- g_hash_table_replace ( wsl->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[4], "foreground" );
- g_hash_table_replace ( wsl->properties, p->name, p );
-
- ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "urgent" );
- rofi_theme_convert_create_property_ht ( wal );
- p = rofi_theme_convert_get_color ( vals[2], "background" );
- g_hash_table_replace ( wal->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wal->properties, p->name, p );
- }
- g_strfreev ( vals );
-
- vals = g_strsplit ( config.color_active, ",", 5 );
- if ( g_strv_length ( vals ) == 5 ) {
- ThemeWidget *wnn = rofi_theme_find_or_create_name ( wnormal, "active" );
- rofi_theme_convert_create_property_ht ( wnn );
- p = rofi_theme_convert_get_color ( vals[0], "background" );
- g_hash_table_replace ( wnn->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wnn->properties, p->name, p );
-
- ThemeWidget *wsl = rofi_theme_find_or_create_name ( wselected, "active" );
- rofi_theme_convert_create_property_ht ( wsl );
- p = rofi_theme_convert_get_color ( vals[3], "background" );
- g_hash_table_replace ( wsl->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[4], "foreground" );
- g_hash_table_replace ( wsl->properties, p->name, p );
-
- ThemeWidget *wal = rofi_theme_find_or_create_name ( walternate, "active" );
- rofi_theme_convert_create_property_ht ( wal );
- p = rofi_theme_convert_get_color ( vals[2], "background" );
- g_hash_table_replace ( wal->properties, p->name, p );
- p = rofi_theme_convert_get_color ( vals[1], "foreground" );
- g_hash_table_replace ( wal->properties, p->name, p );
- }
- g_strfreev ( vals );
- }
- }
-}
-#endif
diff --git a/source/view.c b/source/view.c
index 5ea660e3..bb801e6c 100644
--- a/source/view.c
+++ b/source/view.c
@@ -759,9 +759,6 @@ void __create_window ( MenuFlags menu_flags )
TICK_N ( "setup window name and class" );
char *transparency = rofi_theme_get_string ( WIDGET ( win ), "transparency", NULL );
- if ( transparency == NULL && config.fake_transparency ) {
- transparency = config.fake_background;
- }
if ( transparency ) {
rofi_view_setup_fake_transparency ( transparency );
}
diff --git a/source/widgets/listview.c b/source/widgets/listview.c
index b9815290..6dc092a8 100644
--- a/source/widgets/listview.c
+++ b/source/widgets/listview.c
@@ -394,7 +394,7 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
lv->fixed_num_lines = rofi_theme_get_boolean ( WIDGET ( lv ), "fixed-height", config.fixed_num_lines );
lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE );
lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse );
- listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", !config.hide_scrollbar ) );
+ listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( WIDGET ( lv ), "scrollbar", FALSE ) );
lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle );
return lv;
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index 04126acd..0512ec41 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -96,25 +96,10 @@ static XrmOption xrmOptions[] = {
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
"Font to use", CONFIG_DEFAULT },
- { xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
- "Color scheme for normal row", CONFIG_DEFAULT },
- { xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
- "Color scheme for urgent row", CONFIG_DEFAULT },
- { xrm_String, "color-active", { .str = &config.color_active }, NULL,
- "Color scheme for active row", CONFIG_DEFAULT },
- { xrm_String, "color-window", { .str = &config.color_window }, NULL,
- "Color scheme window", CONFIG_DEFAULT },
-
- { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
- "", CONFIG_DEFAULT },
- { xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
- "Border width", CONFIG_DEFAULT },
{ xrm_Number, "location", { .num = &config.location }, NULL,
"Location on screen", CONFIG_DEFAULT },
- { xrm_Number, "padding", { .num = &config.padding }, NULL,
- "Padding", CONFIG_DEFAULT },
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
"Y-offset relative to location", CONFIG_DEFAULT },
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
@@ -168,30 +153,16 @@ static XrmOption xrmOptions[] = {
/* Alias for dmenu compatibility. */
{ xrm_String, "m", { .str = &config.monitor }, NULL,
"Monitor id to show on", CONFIG_DEFAULT },
- { xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
- "Margin between rows", CONFIG_DEFAULT },
- { xrm_Number, "line-padding", { .num = &config.line_padding }, NULL,
- "Padding within rows", CONFIG_DEFAULT },
{ xrm_String, "filter", { .str = &config.filter }, NULL,
"Pre-set filter", CONFIG_DEFAULT },
- { xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
- "Separator style (none, dash, solid)", CONFIG_DEFAULT },
- { xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
- "Hide scroll-bar", CONFIG_DEFAULT },
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
"Fullscreen", CONFIG_DEFAULT },
- { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
- "Fake transparency", CONFIG_DEFAULT },
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
"DPI", CONFIG_DEFAULT },
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
"Threads to use for string matching", CONFIG_DEFAULT },
- { xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
- "Scrollbar width", CONFIG_DEFAULT },
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
- { xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
- "Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT },
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
{ xrm_Boolean, "click-to-exit", { .snum = &config.click_to_exit }, NULL,