diff --git a/source/view.c b/source/view.c index 9193af3d..f5e99f0e 100644 --- a/source/view.c +++ b/source/view.c @@ -1409,7 +1409,7 @@ static void rofi_view_mainloop_iter ( RofiViewState *state, xcb_generic_event_t state->retv = MENU_OK; } } - else if ( strlen ( state->text->text ) > 0 ) { + else if ( state->text->text != NULL && strlen ( state->text->text ) > 0 ) { state->retv = MENU_CUSTOM_INPUT; } else{ diff --git a/source/x11-helper.c b/source/x11-helper.c index 4987c3c1..77c8bfa3 100644 --- a/source/x11-helper.c +++ b/source/x11-helper.c @@ -553,13 +553,10 @@ Color color_get ( const char *const name ) uint8_t g; uint8_t r; uint8_t a; - }; + } sep; uint32_t pixel; } color = { - .r = 0xff, - .g = 0xff, - .b = 0xff, - .a = 0xff, + .pixel = 0xffffffff, }; // Special format. if ( strncmp ( cname, "argb:", 5 ) == 0 ) { @@ -571,14 +568,14 @@ Color color_get ( const char *const name ) switch ( length ) { case 3: - color.a = 0xff; - color.r = 16 * ( ( val & 0xF00 ) >> 8 ); - color.g = 16 * ( ( val & 0x0F0 ) >> 4 ); - color.b = 16 * ( val & 0x00F ); + color.sep.a = 0xff; + color.sep.r = 16 * ( ( val & 0xF00 ) >> 8 ); + color.sep.g = 16 * ( ( val & 0x0F0 ) >> 4 ); + color.sep.b = 16 * ( val & 0x00F ); break; case 6: color.pixel = val; - color.a = 0xff; + color.sep.a = 0xff; break; case 8: color.pixel = val; @@ -592,20 +589,20 @@ Color color_get ( const char *const name ) map, strlen ( cname ), cname ); xcb_alloc_named_color_reply_t *r = xcb_alloc_named_color_reply ( xcb->connection, cc, NULL ); if ( r ) { - color.a = 0xFF; - color.r = r->visual_red; - color.g = r->visual_green; - color.b = r->visual_blue; + color.sep.a = 0xFF; + color.sep.r = r->visual_red; + color.sep.g = r->visual_green; + color.sep.b = r->visual_blue; free ( r ); } } g_free ( copy ); Color ret = { - .red = color.r / 255.0, - .green = color.g / 255.0, - .blue = color.b / 255.0, - .alpha = color.a / 255.0, + .red = color.sep.r / 255.0, + .green = color.sep.g / 255.0, + .blue = color.sep.b / 255.0, + .alpha = color.sep.a / 255.0, }; return ret; } diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 2ac9bcbd..07486d4e 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -63,62 +63,62 @@ typedef struct * Currently supports string, boolean and number (signed and unsigned). */ static XrmOption xrmOptions[] = { - { xrm_String, "switchers", { .str = &config.modi }, NULL, "" }, - { xrm_String, "modi", { .str = &config.modi }, NULL, "Enabled modi" }, - { xrm_Number, "opacity", { .num = &config.window_opacity }, NULL, "Window opacity" }, - { xrm_SNumber, "width", { .snum = &config.menu_width }, NULL, "Window width" }, - { xrm_Number, "lines", { .num = &config.menu_lines }, NULL, "Number of lines" }, - { xrm_Number, "columns", { .num = &config.menu_columns }, NULL, "Number of columns" }, + { xrm_String, "switchers", { .str = &config.modi }, NULL, "" }, + { xrm_String, "modi", { .str = &config.modi }, NULL, "Enabled modi" }, + { xrm_Number, "opacity", { .num = &config.window_opacity }, NULL, "Window opacity" }, + { xrm_SNumber, "width", { .snum = &config.menu_width }, NULL, "Window width" }, + { xrm_Number, "lines", { .num = &config.menu_lines }, NULL, "Number of lines" }, + { xrm_Number, "columns", { .num = &config.menu_columns }, NULL, "Number of columns" }, - { xrm_String, "font", { .str = &config.menu_font }, NULL, "Font to use" }, - { xrm_String, "color-normal", { .str = &config.color_normal }, NULL, "Color scheme for normal row" }, - { xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL, "Color scheme for urgent row" }, - { xrm_String, "color-active", { .str = &config.color_active }, NULL, "Color scheme for active row" }, - { xrm_String, "color-window", { .str = &config.color_window }, NULL, "Color scheme window" }, + { xrm_String, "font", { .str = &config.menu_font }, NULL, "Font to use" }, + { xrm_String, "color-normal", { .str = &config.color_normal }, NULL, "Color scheme for normal row" }, + { xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL, "Color scheme for urgent row" }, + { xrm_String, "color-active", { .str = &config.color_active }, NULL, "Color scheme for active row" }, + { xrm_String, "color-window", { .str = &config.color_window }, NULL, "Color scheme window" }, - { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL, "" }, - { xrm_Number, "bw", { .num = &config.menu_bw }, NULL, "Border width" }, + { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL, "" }, + { xrm_Number, "bw", { .num = &config.menu_bw }, NULL, "Border width" }, - { xrm_Number, "location", { .num = &config.location }, NULL, "Location on screen" }, + { xrm_Number, "location", { .num = &config.location }, NULL, "Location on screen" }, - { xrm_Number, "padding", { .num = &config.padding }, NULL, "Padding" }, - { xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL, "Y-offset relative to location" }, - { xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL, "X-offset relative to location" }, - { xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL, "Always show number of lines" }, + { xrm_Number, "padding", { .num = &config.padding }, NULL, "Padding" }, + { xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL, "Y-offset relative to location" }, + { xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL, "X-offset relative to location" }, + { xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL, "Always show number of lines" }, - { xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL, "Terminal to use" }, - { xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL, "Ssh client to use" }, - { xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL, "Ssh command to execute" }, - { xrm_String, "run-command", { .str = &config.run_command }, NULL, "Run command to execute" }, - { xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL, "Command to get extra run targets" }, - { xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL, "Run command to execute that runs in shell" }, + { xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL, "Terminal to use" }, + { xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL, "Ssh client to use" }, + { xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL, "Ssh command to execute" }, + { xrm_String, "run-command", { .str = &config.run_command }, NULL, "Run command to execute" }, + { xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL, "Command to get extra run targets" }, + { xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL, "Run command to execute that runs in shell" }, - { xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL, "Disable history in run/ssh" }, - { xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL, "Use levenshtein sorting" }, - { xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL, "Set case-sensitivity" }, - { xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL, "Enable sidebar-mode" }, - { xrm_SNumber, "eh", { .snum = &config.element_height }, NULL, "Row height (in chars)" }, - { xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL, "Enable auto select mode" }, - { xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL, "Parse hosts file for ssh mode" }, - { xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL, "Parse known_hosts file for ssh mode" }, - { xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL, "Set the modi to combine in combi mode" }, - { xrm_Boolean, "fuzzy", { .num = &config.fuzzy }, NULL, "Do a more fuzzy matching" }, - { xrm_Boolean, "glob", { .num = &config.glob }, NULL, "Use glob matching" }, - { xrm_Boolean, "regex", { .num = &config.regex }, NULL, "Use regex matching" }, - { xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL, "Tokenize input string" }, - { xrm_Number, "monitor", { .snum = &config.monitor }, NULL, "" }, + { xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL, "Disable history in run/ssh" }, + { xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL, "Use levenshtein sorting" }, + { xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL, "Set case-sensitivity" }, + { xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL, "Enable sidebar-mode" }, + { xrm_SNumber, "eh", { .snum = &config.element_height }, NULL, "Row height (in chars)" }, + { xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL, "Enable auto select mode" }, + { xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL, "Parse hosts file for ssh mode" }, + { xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL, "Parse known_hosts file for ssh mode" }, + { xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL, "Set the modi to combine in combi mode" }, + { xrm_Boolean, "fuzzy", { .num = &config.fuzzy }, NULL, "Do a more fuzzy matching" }, + { xrm_Boolean, "glob", { .num = &config.glob }, NULL, "Use glob matching" }, + { xrm_Boolean, "regex", { .num = &config.regex }, NULL, "Use regex matching" }, + { xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL, "Tokenize input string" }, + { xrm_Number, "monitor", { .snum = &config.monitor }, NULL, "" }, /* Alias for dmenu compatibility. */ - { xrm_SNumber, "m", { .snum = &config.monitor }, NULL, "Monitor id to show on" }, - { xrm_Number, "line-margin", { .num = &config.line_margin }, NULL, "Margin between rows" }, - { 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_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL, "Hide scroll-bar" }, - { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, "Fullscreen" }, - { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, "Fake transparency" }, - { xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL, "DPI" }, - { xrm_Number, "threads", { .num = &config.threads }, NULL, "Threads to use for string matching" }, - { xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL, "Scrollbar width" }, - { xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL, "Scrolling method. (0: Page, 1: Centered)" } + { xrm_SNumber, "m", { .snum = &config.monitor }, NULL, "Monitor id to show on" }, + { xrm_Number, "line-margin", { .num = &config.line_margin }, NULL, "Margin between rows" }, + { 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_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL, "Hide scroll-bar" }, + { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, "Fullscreen" }, + { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, "Fake transparency" }, + { xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL, "DPI" }, + { xrm_Number, "threads", { .num = &config.threads }, NULL, "Threads to use for string matching" }, + { xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL, "Scrollbar width" }, + { xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL, "Scrolling method. (0: Page, 1: Centered)" } }; // Dynamic options.