diff options
author | QC <qball@gmpclient.org> | 2014-05-17 22:17:07 +0200 |
---|---|---|
committer | QC <qball@gmpclient.org> | 2014-05-17 22:17:23 +0200 |
commit | f44fd749874c4467940e491a91afe02cdfba0f8f (patch) | |
tree | 0ed483b67d776da9c8bfc5a33213f34d8a92d407 /source | |
parent | 08da28693146a66975223d0c4501d78adf4dd428 (diff) |
Add option to fix the size of rofi
Diffstat (limited to 'source')
-rw-r--r-- | source/rofi.c | 7 | ||||
-rw-r--r-- | source/xrmoptions.c | 31 |
2 files changed, 23 insertions, 15 deletions
diff --git a/source/rofi.c b/source/rofi.c index 43e9ecab..701117fa 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1031,8 +1031,14 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi ; } + unsigned int max_lines = MIN ( config.menu_lines, num_lines ); + if ( config.fixed_num_lines == 1 ) + { + max_lines = config.menu_lines; + } + // Calculate as float to stop silly, big rounding down errors. int w = config.menu_width < 101 ? ( mon.w / 100.0f ) * ( float ) config.menu_width : config.menu_width; int x = mon.x + ( mon.w - w ) / 2; @@ -1184,6 +1190,7 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi // Subtract the margin of the last row. int h = line_height * ( max_lines + 1 ) + ( config.padding ) * 2 + LINE_MARGIN; + if ( config.wmode == HORIZONTAL ) { h = line_height + ( config.padding ) * 2; diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 771feb01..a61ba38c 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -51,21 +51,22 @@ typedef struct }; } XrmOption; XrmOption xrmOptions[] = { - { xrm_Number, "opacity", { .num = &config.window_opacity } }, - { xrm_Number, "width", { .num = &config.menu_width } }, - { xrm_Number, "lines", { .num = &config.menu_lines } }, - { xrm_String, "font", { .str = &config.menu_font } }, - { xrm_String, "foreground", { .str = &config.menu_fg } }, - { xrm_String, "background", { .str = &config.menu_bg } }, - { xrm_String, "highlightfg", { .str = &config.menu_hlfg } }, - { xrm_String, "highlightbg", { .str = &config.menu_hlbg } }, - { xrm_String, "bordercolor", { .str = &config.menu_bc } }, - { xrm_Number, "padding", { .num = &config.padding } }, - { xrm_Number, "borderwidth", { .num = &config.menu_bw } }, - { xrm_String, "terminal", { .str = &config.terminal_emulator } }, - { xrm_Number, "location", { .num = &config.location } }, - { xrm_Number, "yoffset", { .num = &config.y_offset } }, - { xrm_Number, "xoffset", { .num = &config.x_offset } }, + { xrm_Number, "opacity", { .num = &config.window_opacity } }, + { xrm_Number, "width", { .num = &config.menu_width } }, + { xrm_Number, "lines", { .num = &config.menu_lines } }, + { xrm_String, "font", { .str = &config.menu_font } }, + { xrm_String, "foreground", { .str = &config.menu_fg } }, + { xrm_String, "background", { .str = &config.menu_bg } }, + { xrm_String, "highlightfg", { .str = &config.menu_hlfg } }, + { xrm_String, "highlightbg", { .str = &config.menu_hlbg } }, + { xrm_String, "bordercolor", { .str = &config.menu_bc } }, + { xrm_Number, "padding", { .num = &config.padding } }, + { xrm_Number, "borderwidth", { .num = &config.menu_bw } }, + { xrm_String, "terminal", { .str = &config.terminal_emulator } }, + { xrm_Number, "location", { .num = &config.location } }, + { xrm_Number, "yoffset", { .num = &config.y_offset } }, + { xrm_Number, "xoffset", { .num = &config.x_offset } }, + { xrm_Number, "fixed_num_lines", { .num = &config.fixed_num_lines } }, }; |