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

Remove some deprecated options.

* lines
 * columns
 * width
This commit is contained in:
Dave Davenport 2021-06-08 22:33:23 +02:00
parent b478de3d7d
commit 1a9dac80a9
11 changed files with 30 additions and 163 deletions

View file

@ -40,12 +40,6 @@ Settings config = {
#else #else
.modi = "run,ssh", .modi = "run,ssh",
#endif #endif
/** The width of the switcher. (0100 in % > 100 in pixels) */
.menu_width = 50,
/** Maximum number of options to show. */
.menu_lines = 15,
/** Number of columns */
.menu_columns = 1,
/** Font */ /** Font */
.menu_font = "mono 12", .menu_font = "mono 12",

View file

@ -566,87 +566,6 @@ Default: '\-'
Most of the following options are \fBdeprecated\fP and should not be used. Please use the new theme format to customize Most of the following options are \fBdeprecated\fP and should not be used. Please use the new theme format to customize
\fBrofi\fP\&. More information about the new format can be found in the \fBrofi\-theme(5)\fP manpage. \fBrofi\fP\&. More information about the new format can be found in the \fBrofi\-theme(5)\fP manpage.
.PP
\fB\fC\-lines\fR
.PP
Maximum number of lines to show before scrolling.
.PP
.RS
.nf
rofi \-lines 25
.fi
.RE
.PP
Default: \fI15\fP
.PP
\fB\fC\-columns\fR
.PP
Number of columns to show before scrolling.
.PP
.RS
.nf
rofi \-columns 2
.fi
.RE
.PP
Default: \fI1\fP
.PP
\fB\fC\-width\fR [value]
.PP
Set width of menu. \fB\fC[value]\fR is specified in percentage.
.PP
.RS
.nf
rofi \-width 60
.fi
.RE
.PP
If \fB\fC[value]\fR is larger then 100, size is set in pixels. Example to span a full\-HD monitor:
.PP
.RS
.nf
rofi \-width 1920
.fi
.RE
.PP
If \fB\fC[value]\fR is negative, it tries to estimates a character width. To show 30 characters in a row:
.PP
.RS
.nf
rofi \-width \-30
.fi
.RE
.PP
Character width is a rough estimate, and might not be correct, but should work for most monospaced fonts.
.PP
Default: \fI50\fP
.PP .PP
\fB\fC\-location\fR \fB\fC\-location\fR

View file

@ -325,40 +325,6 @@ Set to '\x0' to disable.
Most of the following options are **deprecated** and should not be used. Please use the new theme format to customize Most of the following options are **deprecated** and should not be used. Please use the new theme format to customize
**rofi**. More information about the new format can be found in the **rofi-theme(5)** manpage. **rofi**. More information about the new format can be found in the **rofi-theme(5)** manpage.
`-lines`
Maximum number of lines to show before scrolling.
rofi -lines 25
Default: *15*
`-columns`
Number of columns to show before scrolling.
rofi -columns 2
Default: *1*
`-width` [value]
Set width of menu. `[value]` is specified in percentage.
rofi -width 60
If `[value]` is larger then 100, size is set in pixels. Example to span a full-HD monitor:
rofi -width 1920
If `[value]` is negative, it tries to estimates a character width. To show 30 characters in a row:
rofi -width -30
Character width is a rough estimate, and might not be correct, but should work for most monospaced fonts.
Default: *50*
`-location` `-location`
Specify where the window should be located. The numbers map to the following locations on screen: Specify where the window should be located. The numbers map to the following locations on screen:

View file

@ -61,12 +61,6 @@ typedef struct
{ {
/** List of enabled modi */ /** List of enabled modi */
char *modi; char *modi;
/** Width (0-100 in %, > 100 in pixels, < 0 in char width.) */
int menu_width;
/** # lines */
unsigned int menu_lines;
/** # Columns */
unsigned int menu_columns;
/** Font string (pango format) */ /** Font string (pango format) */
char * menu_font; char * menu_font;
@ -206,6 +200,11 @@ typedef struct
/** fallback icon */ /** fallback icon */
char *application_fallback_icon; char *application_fallback_icon;
} Settings; } Settings;
#define DEFAULT_MENU_LINES 15
#define DEFAULT_MENU_COLUMNS 1
#define DEFAULT_MENU_WIDTH 50.0f
/** Global Settings structure. */ /** Global Settings structure. */
extern Settings config; extern Settings config;
#endif // ROFI_SETTINGS_H #endif // ROFI_SETTINGS_H

View file

@ -388,7 +388,19 @@ static int dmenu_mode_init ( Mode *sw )
} }
// DMENU COMPATIBILITY // DMENU COMPATIBILITY
find_arg_uint ( "-l", &( config.menu_lines ) ); unsigned int lines = DEFAULT_MENU_LINES;
find_arg_uint ( "-l", &( lines ) );
if ( lines != DEFAULT_MENU_LINES ) {
Property *p = rofi_theme_property_create ( P_INTEGER );
p->name = g_strdup("lines");
p->value.i = lines;
ThemeWidget *widget = rofi_theme_find_or_create_name ( rofi_theme, "listview" );
GHashTable *table = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) rofi_theme_property_free );
g_hash_table_replace ( table, p->name, p );
rofi_theme_widget_add_properties ( widget, table );
g_hash_table_destroy ( table );
}
str = NULL; str = NULL;
find_arg_str ( "-window-title", &str ); find_arg_str ( "-window-title", &str );

View file

@ -109,7 +109,7 @@ typedef struct
long hint_flags; long hint_flags;
uint32_t wmdesktop; uint32_t wmdesktop;
char *wmdesktopstr; char *wmdesktopstr;
int wmdesktopstr_len; unsigned int wmdesktopstr_len;
cairo_surface_t *icon; cairo_surface_t *icon;
gboolean icon_checked; gboolean icon_checked;
uint32_t icon_fetch_uid; uint32_t icon_fetch_uid;
@ -790,9 +790,6 @@ static gboolean helper_eval_cb ( const GMatchInfo *info, GString *str, gpointer
int l = 0; int l = 0;
if ( match[2] == ':' ) { if ( match[2] == ':' ) {
l = (int) g_ascii_strtoll ( &match[3], NULL, 10 ); l = (int) g_ascii_strtoll ( &match[3], NULL, 10 );
if ( l < 0 && config.menu_width < 0 ) {
l = -config.menu_width + l;
}
if ( l < 0 ) { if ( l < 0 ) {
l = 0; l = 0;
} }

View file

@ -661,17 +661,6 @@ int config_sanity_check ( void )
config.element_height = 1; config.element_height = 1;
found_error = TRUE; found_error = TRUE;
} }
if ( config.menu_columns == 0 ) {
g_string_append_printf ( msg, "\t<b>config.menu_columns</b>=%d is invalid. You need at least one visible column.\n",
config.menu_columns );
config.menu_columns = 1;
found_error = TRUE;
}
if ( config.menu_width == 0 ) {
g_string_append_printf ( msg, "<b>config.menu_width</b>=0 is invalid. You cannot have a window with no width." );
config.menu_columns = 50;
found_error = TRUE;
}
if ( !( config.location >= 0 && config.location <= 8 ) ) { if ( !( config.location >= 0 && config.location <= 8 ) ) {
g_string_append_printf ( msg, "\t<b>config.location</b>=%d is invalid. Value should be between %d and %d.\n", g_string_append_printf ( msg, "\t<b>config.location</b>=%d is invalid. Value should be between %d and %d.\n",
config.location, 0, 8 ); config.location, 0, 8 );

View file

@ -140,6 +140,11 @@ void rofi_icon_fetcher_init ( void )
g_slist_free ( l ); g_slist_free ( l );
} }
static void free_wrapper ( gpointer data, G_GNUC_UNUSED gpointer user_data )
{
g_free ( data ) ;
}
void rofi_icon_fetcher_destroy ( void ) void rofi_icon_fetcher_destroy ( void )
{ {
if ( rofi_icon_fetcher_data == NULL ) { if ( rofi_icon_fetcher_data == NULL ) {
@ -151,7 +156,7 @@ void rofi_icon_fetcher_destroy ( void )
g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache_uid ); g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache_uid );
g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache ); g_hash_table_unref ( rofi_icon_fetcher_data->icon_cache );
g_list_foreach ( rofi_icon_fetcher_data->supported_extensions, (GFunc) g_free, NULL ); g_list_foreach ( rofi_icon_fetcher_data->supported_extensions, free_wrapper, NULL );
g_list_free ( rofi_icon_fetcher_data->supported_extensions ); g_list_free ( rofi_icon_fetcher_data->supported_extensions );
g_free ( rofi_icon_fetcher_data ); g_free ( rofi_icon_fetcher_data );
} }

View file

@ -918,15 +918,8 @@ static void rofi_view_calculate_window_width ( RofiViewState *state )
state->width = CacheState.mon.w; state->width = CacheState.mon.w;
return; return;
} }
if ( config.menu_width < 0 ) {
double fw = textbox_get_estimated_char_width ( );
state->width = -( fw * config.menu_width );
state->width += widget_padding_get_padding_width ( WIDGET ( state->main_window ) );
}
else{
// Calculate as float to stop silly, big rounding down errors. // Calculate as float to stop silly, big rounding down errors.
state->width = config.menu_width < 101 ? ( CacheState.mon.w / 100.0f ) * ( float ) config.menu_width : config.menu_width; state->width = ( CacheState.mon.w / 100.0f ) * DEFAULT_MENU_WIDTH;
}
// Use theme configured width, if set. // Use theme configured width, if set.
RofiDistance width = rofi_theme_get_distance ( WIDGET ( state->main_window ), "width", state->width ); RofiDistance width = rofi_theme_get_distance ( WIDGET ( state->main_window ), "width", state->width );
state->width = distance_get_pixel ( width, ROFI_ORIENTATION_HORIZONTAL ); state->width = distance_get_pixel ( width, ROFI_ORIENTATION_HORIZONTAL );
@ -1853,7 +1846,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
listview_set_scroll_type ( state->list_view, config.scroll_method ); listview_set_scroll_type ( state->list_view, config.scroll_method );
listview_set_mouse_activated_cb ( state->list_view, rofi_view_listview_mouse_activated_cb, state ); listview_set_mouse_activated_cb ( state->list_view, rofi_view_listview_mouse_activated_cb, state );
int lines = rofi_theme_get_integer ( WIDGET ( state->list_view ), "lines", config.menu_lines ); int lines = rofi_theme_get_integer ( WIDGET ( state->list_view ), "lines", DEFAULT_MENU_LINES );
listview_set_num_lines ( state->list_view, lines ); listview_set_num_lines ( state->list_view, lines );
listview_set_max_lines ( state->list_view, state->num_lines ); listview_set_max_lines ( state->list_view, state->num_lines );
} }

View file

@ -521,7 +521,7 @@ void listview_set_num_elements ( listview *lv, unsigned int rows )
if ( lv == NULL ) { if ( lv == NULL ) {
return; return;
} }
TICK_N ( __FUNCTION__ ); TICK_N ( "listview_set_num_elements" );
lv->req_elements = rows; lv->req_elements = rows;
listview_set_selected ( lv, lv->selected ); listview_set_selected ( lv, lv->selected );
TICK_N ( "Set selected" ); TICK_N ( "Set selected" );
@ -696,7 +696,7 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca
// Some settings. // Some settings.
lv->spacing = rofi_theme_get_distance ( WIDGET ( lv ), "spacing", DEFAULT_SPACING ); lv->spacing = rofi_theme_get_distance ( WIDGET ( lv ), "spacing", DEFAULT_SPACING );
lv->menu_columns = rofi_theme_get_integer ( WIDGET ( lv ), "columns", config.menu_columns ); lv->menu_columns = rofi_theme_get_integer ( WIDGET ( lv ), "columns", DEFAULT_MENU_COLUMNS);
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", config.fixed_num_lines );
lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE ); lv->dynamic = rofi_theme_get_boolean ( WIDGET ( lv ), "dynamic", TRUE );
lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse ); lv->reverse = rofi_theme_get_boolean ( WIDGET ( lv ), "reverse", reverse );

View file

@ -86,13 +86,6 @@ static XrmOption xrmOptions[] = {
"", CONFIG_DEFAULT }, "", CONFIG_DEFAULT },
{ xrm_String, "modi", { .str = &config.modi }, NULL, { xrm_String, "modi", { .str = &config.modi }, NULL,
"Enabled modi", CONFIG_DEFAULT }, "Enabled modi", CONFIG_DEFAULT },
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
"Window width", CONFIG_DEFAULT },
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
"Number of lines", CONFIG_DEFAULT },
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
"Number of columns", CONFIG_DEFAULT },
{ xrm_String, "font", { .str = &config.menu_font }, NULL, { xrm_String, "font", { .str = &config.menu_font }, NULL,
"Font to use", CONFIG_DEFAULT }, "Font to use", CONFIG_DEFAULT },
{ xrm_Number, "location", { .num = &config.location }, NULL, { xrm_Number, "location", { .num = &config.location }, NULL,