From 2e21c2b63eb1b837b9f33598263302592df7e30e Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Wed, 2 Dec 2020 21:14:31 +0100 Subject: Remove more old config options that are now part of theme. --- config/config.c | 34 ------------------------------ doc/rofi.1 | 13 ------------ doc/rofi.1.markdown | 9 -------- include/settings.h | 27 ------------------------ source/dialogs/dmenu.c | 8 ------- source/dialogs/drun.c | 7 +------ source/helper.c | 25 ---------------------- source/rofi.c | 1 - source/theme.c | 53 ----------------------------------------------- source/view.c | 33 +++++------------------------ source/widgets/listview.c | 8 +++---- source/xrmoptions.c | 30 --------------------------- 12 files changed, 9 insertions(+), 239 deletions(-) diff --git a/config/config.c b/config/config.c index 9e97f2b7..45a975f3 100644 --- a/config/config.c +++ b/config/config.c @@ -40,11 +40,6 @@ Settings config = { #else .modi = "run,ssh", #endif - /** Font */ - .menu_font = "mono 12", - - /** Whether to load and show icons */ - .show_icons = FALSE, /** Terminal to use. (for ssh and open in terminal) */ .terminal_emulator = "rofi-sensible-terminal", @@ -61,24 +56,6 @@ Settings config = { .window_command = "wmctrl -i -R {window}", /** No default icon theme, we search Adwaita and gnome as fallback */ .icon_theme = NULL, - /** - * Location of the window. - * Enumeration indicating location or gravity of window. - * - * WL_NORTH_WEST WL_NORTH WL_NORTH_EAST - * - * WL_EAST WL_CENTER WL_EAST - * - * WL_SOUTH_WEST WL_SOUTH WL_SOUTH_EAST - * - */ - .location = WL_CENTER, - /** Y offset */ - .y_offset = 0, - /** X offset */ - .x_offset = 0, - /** Always show config.menu_lines lines, even if less lines are available */ - .fixed_num_lines = TRUE, /** Do not use history */ .disable_history = FALSE, /** Programs ignored for history */ @@ -122,22 +99,11 @@ Settings config = { .window_match_fields = "all", /** Monitor */ .monitor = "-5", - /** set line margin */ - .line_margin = 2, - .line_padding = 1, /** Set filter */ .filter = NULL, - /** Separator style: dash/solid */ - .separator_style = "dash", - /** Hide scrollbar */ - .hide_scrollbar = FALSE, - .fullscreen = FALSE, - .fake_transparency = FALSE, .dpi = -1, .threads = 0, .scroll_method = 0, - .scrollbar_width = 8, - .fake_background = "screenshot", .window_format = "{w} {c} {t}", .click_to_exit = TRUE, .show_match = TRUE, diff --git a/doc/rofi.1 b/doc/rofi.1 index c36b160b..1cc3f806 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -1159,19 +1159,6 @@ If \fB\fCdrun\-use\-desktop\-cache\fR is enabled, rebuild a cache with the conte .PP Make \fBrofi\fP create a pid file and check this on startup. The pid file prevents multiple \fBrofi\fP instances from running simultaneously. This is useful when running \fBrofi\fP from a key\-binding daemon. -.PP -\fB\fC\-fake\-transparency\fR - -.PP -Enable fake transparency. This only works with transparent background color in the theme. - -.PP -\fB\fC\-fake\-background\fR - -.PP -Select what to use as background for fake transparency. This can be 'background', 'screenshot' or a path to an image -file (currently only supports png). - .PP \fB\fC\-display\-{mode}\fR \fIstring\fP diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index d661ae4f..7f55d266 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -699,15 +699,6 @@ If `drun-use-desktop-cache` is enabled, rebuild a cache with the content of desk Make **rofi** create a pid file and check this on startup. The pid file prevents multiple **rofi** instances from running simultaneously. This is useful when running **rofi** from a key-binding daemon. -`-fake-transparency` - -Enable fake transparency. This only works with transparent background color in the theme. - -`-fake-background` - -Select what to use as background for fake transparency. This can be 'background', 'screenshot' or a path to an image -file (currently only supports png). - `-display-{mode}` *string* Set the name to use for mode. This is used as prompt and in combi-browser. diff --git a/include/settings.h b/include/settings.h index 94f1ab5d..e665da55 100644 --- a/include/settings.h +++ b/include/settings.h @@ -60,11 +60,6 @@ typedef struct { /** List of enabled modi */ char *modi; - /** Font string (pango format) */ - char * menu_font; - - /** Whether to load and show icons */ - gboolean show_icons; /** Terminal to use */ char * terminal_emulator; @@ -85,14 +80,6 @@ typedef struct /** Theme for icons */ char * icon_theme; - /** Windows location/gravity */ - WindowLocation location; - /** Y offset */ - int y_offset; - /** X offset */ - int x_offset; - /** Always should config.menu_lines lines, even if less lines are available */ - unsigned int fixed_num_lines; /** Do not use history */ unsigned int disable_history; /** Programs ignored for history */ @@ -138,27 +125,13 @@ typedef struct unsigned int tokenize; /** Monitors */ char *monitor; - /** Line margin */ - unsigned int line_margin; - unsigned int line_padding; /** filter */ char *filter; - /** style */ - char *separator_style; - /** hide scrollbar */ - unsigned int hide_scrollbar; - /** fullscreen */ - unsigned int fullscreen; - /** bg image */ - unsigned int fake_transparency; /** dpi */ int dpi; /** Number threads (1 to disable) */ unsigned int threads; unsigned int scroll_method; - unsigned int scrollbar_width; - /** Background type */ - char *fake_background; char *window_format; /** Click outside the window to exit */ diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index 64985b4f..f0d97896 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -392,14 +392,6 @@ static int dmenu_mode_init ( Mode *sw ) if ( str ) { dmenu_mode.display_name = str; } - - /** - * Dmenu compatibility. - * `-b` put on bottom. - */ - if ( find_arg ( "-b" ) >= 0 ) { - config.location = 6; - } /* -i case insensitive */ config.case_sensitive = TRUE; if ( find_arg ( "-i" ) >= 0 ) { diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 969fe35f..c800d05e 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -577,12 +577,7 @@ static void read_desktop_file ( DRunModePrivateData *pd, const char *root, const else { pd->entry_list[pd->cmd_list_length].comment = NULL; } - if ( config.show_icons ) { - pd->entry_list[pd->cmd_list_length].icon_name = g_key_file_get_locale_string ( kf, DRUN_GROUP_NAME, "Icon", NULL, NULL ); - } - else{ - pd->entry_list[pd->cmd_list_length].icon_name = NULL; - } + pd->entry_list[pd->cmd_list_length].icon_name = g_key_file_get_locale_string ( kf, DRUN_GROUP_NAME, "Icon", NULL, NULL ); pd->entry_list[pd->cmd_list_length].icon = NULL; // Keep keyfile around. diff --git a/source/helper.c b/source/helper.c index 78140b2c..0d4e202d 100644 --- a/source/helper.c +++ b/source/helper.c @@ -645,12 +645,6 @@ int config_sanity_check ( void ) config.element_height = 1; found_error = TRUE; } - if ( !( config.location >= 0 && config.location <= 8 ) ) { - g_string_append_printf ( msg, "\tconfig.location=%d is invalid. Value should be between %d and %d.\n", - config.location, 0, 8 ); - config.location = WL_CENTER; - found_error = 1; - } // Check size { @@ -668,25 +662,6 @@ int config_sanity_check ( void ) } } - if ( config.menu_font ) { - PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font ); - const char *fam = pango_font_description_get_family ( pfd ); - int size = pango_font_description_get_size ( pfd ); - if ( fam == NULL || size == 0 ) { - g_string_append_printf ( msg, "Pango failed to parse font: '%s'\n", config.menu_font ); - g_string_append_printf ( msg, "Got font family: %s at size %d\n", fam ? fam : "{unknown}", size ); - config.menu_font = NULL; - found_error = TRUE; - } - pango_font_description_free ( pfd ); - } - - if ( g_strcmp0 ( config.monitor, "-3" ) == 0 ) { - // On -3, set to location 1. - config.location = 1; - config.fullscreen = 0; - } - if ( found_error ) { g_string_append ( msg, "Please update your configuration." ); rofi_add_error_message ( msg ); diff --git a/source/rofi.c b/source/rofi.c index 281435e1..b50a69ef 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1024,7 +1024,6 @@ int main ( int argc, char *argv[] ) } g_bytes_unref ( theme_data ); } - rofi_theme_convert_old (); } /** diff --git a/source/theme.c b/source/theme.c index 4bf005ea..89244010 100644 --- a/source/theme.c +++ b/source/theme.c @@ -1060,59 +1060,6 @@ gboolean rofi_theme_is_empty ( void ) return FALSE; } -#ifdef THEME_CONVERTER - -void rofi_theme_convert_old ( void ) -{ - if ( config.separator_style != NULL ) { - if ( g_strcmp0 ( config.separator_style, "none" ) == 0 ) { - const char *const str = "#listview { border: 0px; }"; - rofi_theme_parse_string ( str ); - const char *const str2 = "#mode-switcher { border: 0px; }"; - rofi_theme_parse_string ( str2 ); - const char *const str3 = "#message { border: 0px; }"; - rofi_theme_parse_string ( str3 ); - } - else if ( g_strcmp0 ( config.separator_style, "solid" ) == 0 ) { - const char *const str = "#listview { border: 2px solid 0px 0px 0px; }"; - rofi_theme_parse_string ( str ); - const char *const str2 = "#mode-switcher { border: 2px solid 0px 0px 0px; }"; - rofi_theme_parse_string ( str2 ); - const char *const str3 = "#message { border: 2px solid 0px 0px 0px; }"; - rofi_theme_parse_string ( str3 ); - } /* dash is default */ - } - /* Line Margin */ - { - char *str = g_strdup_printf ( "#listview { spacing: %dpx;}", config.line_margin ); - rofi_theme_parse_string ( str ); - g_free ( str ); - } - /* Line Padding */ - { - char *str = g_strdup_printf ( "#element, inputbar, message { padding: %dpx;}", config.line_padding ); - rofi_theme_parse_string ( str ); - g_free ( str ); - } - if ( config.hide_scrollbar ) { - const char *str = "#listview { scrollbar: false; }"; - rofi_theme_parse_string ( str ); - } - else { - const char *str = "#listview { scrollbar: true; }"; - rofi_theme_parse_string ( str ); - char *str2 = g_strdup_printf ( "#scrollbar { handle-width: %dpx; }", config.scrollbar_width ); - rofi_theme_parse_string ( str2 ); - g_free ( str2 ); - } - if ( config.fake_transparency ) { - char *str = g_strdup_printf ( "#window { transparency: \"%s\"; }", config.fake_background ); - rofi_theme_parse_string ( str ); - g_free ( str ); - } -} -#endif // THEME_CONVERTER - char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file ) { char *filename = rofi_expand_path ( file ); diff --git a/source/view.c b/source/view.c index 51abc159..78625675 100644 --- a/source/view.c +++ b/source/view.c @@ -293,29 +293,9 @@ static void rofi_view_update_prompt ( RofiViewState *state ) /** * Calculates the window position */ -/** Convert the old location to the new location type. - * 123 - * 804 - * 765 - * - * nw n ne - * w c e - * sw s se - */ -static const int loc_transtable[9] = { - WL_CENTER, - WL_NORTH | WL_WEST, - WL_NORTH, - WL_NORTH | WL_EAST, - WL_EAST, - WL_SOUTH | WL_EAST, - WL_SOUTH, - WL_SOUTH | WL_WEST, - WL_WEST -}; static void rofi_view_calculate_window_position ( RofiViewState *state ) { - int location = rofi_theme_get_position ( WIDGET ( state->main_window ), "location", loc_transtable[config.location] ); + int location = rofi_theme_get_position ( WIDGET ( state->main_window ), "location", WL_CENTER ); int anchor = location; if ( !listview_get_fixed_num_lines ( state->list_view ) ) { anchor = location; @@ -407,8 +387,8 @@ static void rofi_view_calculate_window_position ( RofiViewState *state ) break; } // Apply offset. - RofiDistance x = rofi_theme_get_distance ( WIDGET ( state->main_window ), "x-offset", config.x_offset ); - RofiDistance y = rofi_theme_get_distance ( WIDGET ( state->main_window ), "y-offset", config.y_offset ); + RofiDistance x = rofi_theme_get_distance ( WIDGET ( state->main_window ), "x-offset", 0 ); + RofiDistance y = rofi_theme_get_distance ( WIDGET ( state->main_window ), "y-offset", 0 ); state->x += distance_get_pixel ( x, ROFI_ORIENTATION_HORIZONTAL ); state->y += distance_get_pixel ( y, ROFI_ORIENTATION_VERTICAL ); } @@ -806,7 +786,7 @@ void __create_window ( MenuFlags menu_flags ) // Setup font. // Dummy widget. box *win = box_create ( NULL, "window", ROFI_ORIENTATION_HORIZONTAL ); - const char *font = rofi_theme_get_string ( WIDGET ( win ), "font", config.menu_font ); + const char *font = rofi_theme_get_string ( WIDGET ( win ), "font", "mono 12" ); if ( font ) { PangoFontDescription *pfd = pango_font_description_from_string ( font ); if ( helper_validate_font ( pfd, font ) ) { @@ -837,7 +817,7 @@ void __create_window ( MenuFlags menu_flags ) } TICK_N ( "setup window attributes" ); - CacheState.fullscreen = rofi_theme_get_boolean ( WIDGET ( win ), "fullscreen", config.fullscreen ); + CacheState.fullscreen = rofi_theme_get_boolean ( WIDGET ( win ), "fullscreen", FALSE ); if ( CacheState.fullscreen ) { xcb_atom_t atoms[] = { xcb->ewmh._NET_WM_STATE_FULLSCREEN, @@ -862,9 +842,6 @@ void __create_window ( MenuFlags menu_flags ) if ( transparency ) { rofi_view_setup_fake_transparency ( transparency ); } - else if ( config.fake_transparency && config.fake_background ) { - rofi_view_setup_fake_transparency ( config.fake_background ); - } if ( xcb->sncontext != NULL ) { sn_launchee_context_setup_window ( xcb->sncontext, CacheState.main_window ); } diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 5a6d1bab..b784ab92 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -169,10 +169,8 @@ static void listview_add_widget ( listview *lv, _listview_row *row, widget *wid, { TextboxFlags flags = ( lv->multi_select ) ? TB_INDICATOR : 0; if ( strcasecmp ( label, "element-icon" ) == 0 ) { - if ( config.show_icons ) { - row->icon = icon_create ( WIDGET ( wid ), "element-icon" ); - box_add ( (box *) wid, WIDGET ( row->icon ), FALSE ); - } + row->icon = icon_create ( WIDGET ( wid ), "element-icon" ); + box_add ( (box *) wid, WIDGET ( row->icon ), FALSE ); } else if ( strcasecmp ( label, "element-text" ) == 0 ) { row->textbox = textbox_create ( WIDGET ( wid ), WIDGET_TYPE_TEXTBOX_TEXT, "element-text", TB_AUTOHEIGHT | flags, NORMAL, "DDD", 0, 0 ); @@ -678,7 +676,7 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca // Some settings. lv->spacing = rofi_theme_get_distance ( WIDGET ( lv ), "spacing", DEFAULT_SPACING ); lv->menu_columns = rofi_theme_get_integer ( WIDGET ( lv ), "columns", 1 ); - lv->fixed_num_lines = rofi_theme_get_boolean ( WIDGET ( lv ), "fixed-height", config.fixed_num_lines ); + lv->fixed_num_lines = rofi_theme_get_boolean ( WIDGET ( lv ), "fixed-height", FALSE ); lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE ); lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse ); lv->cycle = rofi_theme_get_boolean ( WIDGET ( lv ), "cycle", config.cycle ); diff --git a/source/xrmoptions.c b/source/xrmoptions.c index f410bc83..95127e4e 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -85,20 +85,6 @@ static XrmOption xrmOptions[] = { "", CONFIG_DEFAULT }, { xrm_String, "modi", { .str = &config.modi }, NULL, "Enabled modi", CONFIG_DEFAULT }, - { xrm_String, "font", { .str = &config.menu_font }, NULL, - "Font to use", CONFIG_DEFAULT }, - { xrm_Number, "location", { .num = &config.location }, NULL, - "Location on screen", 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, - "X-offset relative to location", CONFIG_DEFAULT }, - { xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL, - "Always show number of lines", CONFIG_DEFAULT }, - - { xrm_Boolean, "show-icons", { .snum = &config.show_icons }, NULL, - "Whether to load and show icons", CONFIG_DEFAULT }, - { xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL, "Terminal to use", CONFIG_DEFAULT }, { xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL, @@ -162,30 +148,14 @@ 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 *DEPRECATED*", CONFIG_DEFAULT }, - { xrm_Number, "line-padding", { .num = &config.line_padding }, NULL, - "Padding within rows *DEPRECATED*", 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) *DEPRECATED*", CONFIG_DEFAULT }, - { xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL, - "Hide scroll-bar *DEPRECATED*", CONFIG_DEFAULT }, - { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, - "Fullscreen", CONFIG_DEFAULT }, - { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, - "Fake transparency *DEPRECATED*", 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 *DEPRECATED*", 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) *DEPRECATED*", 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, -- cgit v1.2.3