Skip to content
Myr

wayland: dmenu: prevent window from being displayed until we have loaded at least one entry

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Before this patch, an empty window were in some cases displayed, despite --no-run-if-empty being used, if stdin took too long to close (i.e. if the application/script generating the dmenu input were too slow too finish). Example: python -c "import time; time.sleep(2)" | fuzzel --dmenu --no-run-if-empty Fix by preventing the wayland backend from refreshing itself until marked as ready to display. This happens as soon as some, or all, entries have been loaded.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 830d2d2 · Browse files · 4 files+22 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Note: this only applies to '--dmenu --no-run-if-empty'

Diff stats

4 files+22 added−3 removed

  • other:+22 added−3 removed

4 files+22 added−3 removed

modified:CHANGELOG.md+1 added
84 unmodified lines
85* Too wide PNGs bleeding into the text ([#313][313]).86* Lookup of icon themes in `~/.icons` and `/usr/share/pixmans`.87* Missing shell completions for `--launch-prefix`.88* Missing shell completions for `--prompt-only`.89* Empty window being displayed despite `--no-run-if-empty` being used.9091[507]: https://codeberg.org/dnkl/fuzzel/issues/50792[551]: https://codeberg.org/dnkl/fuzzel/issues/55193[313]: https://codeberg.org/dnkl/fuzzel/issues/313
916 unmodified lines
modified:main.c+9 added-3 removed
649 unmodified lines
650 /* Update matches list, then refresh the GUI */651 matches_set_applications(matches, apps);652653 if (event == EVENT_APPS_ALL_LOADED) {654 if (ctx->conf->dmenu.exit_immediately_if_empty && apps->count == 0)654 if (conf->dmenu.exit_immediately_if_empty && apps->count == 0)655 return false;656 matches_all_applications_loaded(matches);657 wayl_ready_to_display(wayl);658 }659660 const size_t match_count = matches_get_count(matches);661 const size_t matches_per_page = matches_max_matches_per_page(matches);
16 unmodified lines
678 }679 }680 else681 matches_selected_select(matches, select);682683 if (!conf->dmenu.exit_immediately_if_empty)684 wayl_ready_to_display(wayl);685 }686 break;687 }688
1427 unmodified lines
2116 }21172118 join_app_thread = true;21192116 if (!conf.dmenu.exit_immediately_if_empty)2117 wayl_refresh(wayl);2120 if (!(conf.dmenu.exit_immediately_if_empty))2121 wayl_ready_to_display(wayl);21222123 wayl_refresh(wayl);21242125 while (true) {2126 wayl_flush(wayl);2127 if (!fdm_poll(fdm))2128 break;
65 unmodified lines
modified:wayland.c+11 added
193 unmodified lines
194 struct buffer_chain *chain;195196 bool shm_have_abgr161616;197 bool shm_have_xbgr161616;198199 bool ready_to_display;200};201202bool203repeat_start(struct repeat *repeat, uint32_t key)
1961 unmodified lines
2165{2166 if (!wayl->is_configured)2167 return;21682169 if (!wayl->ready_to_display)2170 return;21712172 if (wayl->frame_cb != NULL) {2173 wayl->need_refresh = true;2174 return;2175 }
69 unmodified lines
2245 (unsigned long long)diff.tv_usec);2246 }2247}22482249void2250wayl_ready_to_display(struct wayland *wayl)2251{2252 wayl->ready_to_display = true;2253}22542255static bool2256fdm_handler(struct fdm *fdm, int fd, int events, void *data)2257{2258 struct wayland *wayl = data;
538 unmodified lines
modified:wayland.h+1 added
78 unmodified lines
79void wayl_destroy(struct wayland *wayl);8081void wayl_refresh(struct wayland *wayl);82void wayl_flush(struct wayland *wayl);83void wayl_ready_to_display(struct wayland *wayl);8485int wayl_exit_code(const struct wayland *wayl);86bool wayl_update_cache(const struct wayland *wayl);87
4 unmodified lines