mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Taskbar: Add support for hotkeys in menu apps
This commit is contained in:
parent
6ab315ae69
commit
420da686b8
Notes:
sideshowbarker
2024-07-17 02:21:14 +09:00
Author: https://github.com/hughdavenport Commit: https://github.com/SerenityOS/serenity/commit/420da686b8 Pull-request: https://github.com/SerenityOS/serenity/pull/22560 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 25 additions and 1 deletions
|
@ -93,6 +93,30 @@ Vector<Gfx::SystemThemeMetaData> g_themes;
|
|||
RefPtr<GUI::Menu> g_themes_menu;
|
||||
GUI::ActionGroup g_themes_group;
|
||||
|
||||
static bool less_than_ignore_hotkey(ByteString const& a, ByteString const& b)
|
||||
{
|
||||
auto a_it = a.begin(), b_it = b.begin();
|
||||
while (a_it != a.end() && b_it != b.end()) {
|
||||
if (*a_it == '&') {
|
||||
++a_it;
|
||||
continue;
|
||||
}
|
||||
if (*b_it == '&') {
|
||||
++b_it;
|
||||
continue;
|
||||
}
|
||||
if (*a_it < *b_it) {
|
||||
return true;
|
||||
}
|
||||
if (*a_it > *b_it) {
|
||||
return false;
|
||||
}
|
||||
++a_it;
|
||||
++b_it;
|
||||
}
|
||||
return a_it != a.end();
|
||||
}
|
||||
|
||||
ErrorOr<Vector<ByteString>> discover_apps_and_categories()
|
||||
{
|
||||
HashTable<ByteString> seen_app_categories;
|
||||
|
@ -110,7 +134,7 @@ ErrorOr<Vector<ByteString>> discover_apps_and_categories()
|
|||
TRY(sorted_app_categories.try_ensure_capacity(seen_app_categories.size()));
|
||||
for (auto const& category : seen_app_categories)
|
||||
sorted_app_categories.unchecked_append(category);
|
||||
quick_sort(sorted_app_categories);
|
||||
quick_sort(sorted_app_categories, less_than_ignore_hotkey);
|
||||
|
||||
return sorted_app_categories;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue