mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
Issue: #334: Only allow markup-rows to be set on cmdline
This should avoid people setting this in XResrouces and breaking random dmenu scripts.
This commit is contained in:
parent
0a8148a95a
commit
e7b18d3a88
6 changed files with 11 additions and 15 deletions
|
@ -144,7 +144,6 @@ Settings config = {
|
||||||
.separator_style = "dash",
|
.separator_style = "dash",
|
||||||
/** Hide scrollbar */
|
/** Hide scrollbar */
|
||||||
.hide_scrollbar = FALSE,
|
.hide_scrollbar = FALSE,
|
||||||
.markup_rows = FALSE,
|
|
||||||
.fullscreen = FALSE,
|
.fullscreen = FALSE,
|
||||||
.fake_transparency = FALSE,
|
.fake_transparency = FALSE,
|
||||||
.dpi = -1,
|
.dpi = -1,
|
||||||
|
|
|
@ -140,8 +140,6 @@ typedef struct _Settings
|
||||||
char *separator_style;
|
char *separator_style;
|
||||||
/** hide scrollbar */
|
/** hide scrollbar */
|
||||||
unsigned int hide_scrollbar;
|
unsigned int hide_scrollbar;
|
||||||
/** show markup in elements. */
|
|
||||||
unsigned int markup_rows;
|
|
||||||
/** fullscreen */
|
/** fullscreen */
|
||||||
unsigned int fullscreen;
|
unsigned int fullscreen;
|
||||||
/** bg image */
|
/** bg image */
|
||||||
|
|
|
@ -64,6 +64,7 @@ typedef struct _DmenuModePrivateData
|
||||||
unsigned int num_active_list;
|
unsigned int num_active_list;
|
||||||
struct range_pair * selected_list;
|
struct range_pair * selected_list;
|
||||||
unsigned int num_selected_list;
|
unsigned int num_selected_list;
|
||||||
|
unsigned int do_markup;
|
||||||
// List with entries.
|
// List with entries.
|
||||||
char **cmd_list;
|
char **cmd_list;
|
||||||
unsigned int cmd_list_length;
|
unsigned int cmd_list_length;
|
||||||
|
@ -171,6 +172,9 @@ static char *get_display_data ( const Mode *data, unsigned int index, int *state
|
||||||
*state |= SELECTED;
|
*state |= SELECTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( pd->do_markup ) {
|
||||||
|
*state |= MARKUP;
|
||||||
|
}
|
||||||
return get_entry ? g_strdup ( retv[index] ) : NULL;
|
return get_entry ? g_strdup ( retv[index] ) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +365,9 @@ int dmenu_switcher_dialog ( void )
|
||||||
char **cmd_list = pd->cmd_list;
|
char **cmd_list = pd->cmd_list;
|
||||||
|
|
||||||
int only_selected = FALSE;
|
int only_selected = FALSE;
|
||||||
|
if ( find_arg ( "-markup-rows" ) >= 0 ) {
|
||||||
|
pd->do_markup = TRUE;
|
||||||
|
}
|
||||||
if ( find_arg ( "-only-match" ) >= 0 || find_arg ( "-no-custom" ) >= 0 ) {
|
if ( find_arg ( "-only-match" ) >= 0 || find_arg ( "-no-custom" ) >= 0 ) {
|
||||||
only_selected = TRUE;
|
only_selected = TRUE;
|
||||||
if ( cmd_list_length == 0 ) {
|
if ( cmd_list_length == 0 ) {
|
||||||
|
@ -519,4 +526,5 @@ void print_dmenu_options ( void )
|
||||||
print_help_msg ( "-no-custom", "", "Don't accept custom entry", NULL, is_term );
|
print_help_msg ( "-no-custom", "", "Don't accept custom entry", NULL, is_term );
|
||||||
print_help_msg ( "-select", "[string]", "Select the first row that matches", NULL, is_term );
|
print_help_msg ( "-select", "[string]", "Select the first row that matches", NULL, is_term );
|
||||||
print_help_msg ( "-password", "", "Do not show what the user inputs. Show '*' instead.", NULL, is_term );
|
print_help_msg ( "-password", "", "Do not show what the user inputs. Show '*' instead.", NULL, is_term );
|
||||||
|
print_help_msg ( "-markup-rows", "", "Allow and render pango markup as input data.", NULL, is_term );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1217,13 +1217,9 @@ static void menu_resize ( MenuState *state )
|
||||||
|
|
||||||
int y_offset = state->top_offset;
|
int y_offset = state->top_offset;
|
||||||
int x_offset = state->border;
|
int x_offset = state->border;
|
||||||
int rstate = 0;
|
|
||||||
if ( config.markup_rows ) {
|
|
||||||
rstate = TB_MARKUP;
|
|
||||||
}
|
|
||||||
// Add newly added boxes.
|
// Add newly added boxes.
|
||||||
for ( unsigned int i = last_length; i < state->max_elements; i++ ) {
|
for ( unsigned int i = last_length; i < state->max_elements; i++ ) {
|
||||||
state->boxes[i] = textbox_create ( rstate, x_offset, y_offset,
|
state->boxes[i] = textbox_create ( 0, x_offset, y_offset,
|
||||||
state->element_width, element_height, NORMAL, "" );
|
state->element_width, element_height, NORMAL, "" );
|
||||||
}
|
}
|
||||||
scrollbar_resize ( state->scrollbar, -1, ( state->max_rows ) * ( element_height ) - config.line_margin );
|
scrollbar_resize ( state->scrollbar, -1, ( state->max_rows ) * ( element_height ) - config.line_margin );
|
||||||
|
@ -1591,12 +1587,8 @@ MenuState *menu ( Mode *sw,
|
||||||
int y_offset = state->top_offset;
|
int y_offset = state->top_offset;
|
||||||
int x_offset = state->border;
|
int x_offset = state->border;
|
||||||
|
|
||||||
int rstate = 0;
|
|
||||||
if ( config.markup_rows ) {
|
|
||||||
rstate = TB_MARKUP;
|
|
||||||
}
|
|
||||||
for ( unsigned int i = 0; i < state->max_elements; i++ ) {
|
for ( unsigned int i = 0; i < state->max_elements; i++ ) {
|
||||||
state->boxes[i] = textbox_create ( rstate, x_offset, y_offset,
|
state->boxes[i] = textbox_create ( 0, x_offset, y_offset,
|
||||||
state->element_width, element_height, NORMAL, "" );
|
state->element_width, element_height, NORMAL, "" );
|
||||||
}
|
}
|
||||||
if ( !config.hide_scrollbar ) {
|
if ( !config.hide_scrollbar ) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ static void __textbox_update_pango_text ( textbox *tb )
|
||||||
pango_layout_set_attributes ( tb->layout, NULL );
|
pango_layout_set_attributes ( tb->layout, NULL );
|
||||||
pango_layout_set_text ( tb->layout, string, l );
|
pango_layout_set_text ( tb->layout, string, l );
|
||||||
}
|
}
|
||||||
else if ( tb->flags & TB_MARKUP || tb->tbft & MARKUP ) {
|
else if ( tb->tbft & MARKUP ) {
|
||||||
pango_layout_set_markup ( tb->layout, tb->text, -1 );
|
pango_layout_set_markup ( tb->layout, tb->text, -1 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -134,7 +134,6 @@ static XrmOption xrmOptions[] = {
|
||||||
{ xrm_String, "filter", { .str = &config.filter }, NULL, "Pre-set filter" },
|
{ xrm_String, "filter", { .str = &config.filter }, NULL, "Pre-set filter" },
|
||||||
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL, "Separator style (none, dash, solid)" },
|
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL, "Separator style (none, dash, solid)" },
|
||||||
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL, "Hide scroll-bar" },
|
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL, "Hide scroll-bar" },
|
||||||
{ xrm_Boolean, "markup-rows", { .num = &config.markup_rows }, NULL, "Show markup" },
|
|
||||||
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, "Fullscreen" },
|
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, "Fullscreen" },
|
||||||
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, "Fake transparency" },
|
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, "Fake transparency" },
|
||||||
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL, "DPI" },
|
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL, "DPI" },
|
||||||
|
|
Loading…
Reference in a new issue