=> 37fefc85a9a23be7c3bc6dcddb8a30047459f534
[1mdiff --git a/src/macos.m b/src/macos.m[m [1mindex 4e214923..9d46d84b 100644[m [1m--- a/src/macos.m[m [1m+++ b/src/macos.m[m [36m@@ -241,10 +241,20 @@[m [mstatic void appearanceChanged_MacOS_(NSString *name) {[m [m - (void)showPreferences {[m postCommand_App("preferences");[m [32m+[m[32m ignoreImmediateKeyDownEvents_();[m [32m+[m[32m}[m [32m+[m [32m+[m[32mstatic void ignoreImmediateKeyDownEvents_(void) {[m [32m+[m[32m /* SDL ignores menu key equivalents so the keydown events will be posted regardless.[m [32m+[m[32m However, we shouldn't double-activate menu items when a shortcut key is used in our[m [32m+[m[32m widgets. Quite a kludge: take advantage of Window's focus-acquisition threshold to[m [32m+[m[32m ignore the immediately following key down events. */[m [32m+[m[32m get_Window()->focusGainedAt = SDL_GetTicks();[m }[m [m - (void)closeTab {[m postCommand_App("tabs.close");[m [32m+[m[32m ignoreImmediateKeyDownEvents_();[m }[m [m - (NSString *)commandForItem:(NSMenuItem *)menuItem {[m [36m@@ -255,11 +265,7 @@[m [mstatic void appearanceChanged_MacOS_(NSString *name) {[m NSString *command = [menuCommands objectForKey:[(NSMenuItem *)sender title]];[m if (command) {[m postCommand_App([command cStringUsingEncoding:NSUTF8StringEncoding]);[m [31m- /* Shouldn't double-activate menu items in case the same key is used in our widgets.[m [31m- SDL ignores menu key equivalents so the keydown events will be posted regardless.[m [31m- This is quite a kludge, but we can achieve this by taking advantage of Window's[m [31m- focus-acquisition threshold for ignoring key events. */[m [31m- get_Window()->focusGainedAt = SDL_GetTicks();[m [32m+[m[32m ignoreImmediateKeyDownEvents_();[m }[m }[m [m [36m@@ -501,11 +507,17 @@[m [mvoid handleCommand_MacOS(const char *cmd) {[m NSApplication *app = [NSApplication sharedApplication];[m MyDelegate *myDel = (MyDelegate *) app.delegate;[m NSMenu *appMenu = [app mainMenu];[m [32m+[m[32m int mainIndex = 0;[m for (NSMenuItem *mainMenuItem in appMenu.itemArray) {[m NSMenu *menu = mainMenuItem.submenu;[m if (menu) {[m [31m- for (NSMenuItem *menuItem in menu.itemArray) {[m [32m+[m[32m int itemIndex = 0;[m [32m+[m[32m for (NSMenuItem *menuItem in menu.itemArray) {[m[41m [m NSString *command = [myDel commandForItem:menuItem];[m [32m+[m[32m if (!command && mainIndex == 6 && itemIndex == 0) {[m [32m+[m[32m /* Window > Close */[m [32m+[m[32m command = @"tabs.close";[m [32m+[m[32m }[m if (command) {[m const iBinding *bind = findCommand_Keys([m [command cStringUsingEncoding:NSUTF8StringEncoding]);[m [36m@@ -513,8 +525,10 @@[m [mvoid handleCommand_MacOS(const char *cmd) {[m setShortcut_NSMenuItem_(menuItem, bind->key, bind->mods);[m }[m }[m [32m+[m[32m itemIndex++;[m }[m }[m [32m+[m[32m mainIndex++;[m }[m }[m }[m [1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex c725a8f6..68f3c966 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -253,7 +253,7 @@[m [mvoid init_DocumentWidget(iDocumentWidget *d) {[m resizeToParentWidth_WidgetFlag | resizeToParentHeight_WidgetFlag);[m #if !defined (iPlatformApple) /* in system menu */[m addAction_Widget(w, reload_KeyShortcut, "navigate.reload");[m [31m- addAction_Widget(w, SDLK_w, KMOD_PRIMARY, "tabs.close");[m [32m+[m[32m addAction_Widget(w, closeTab_KeyShortcut, "tabs.close");[m addAction_Widget(w, SDLK_d, KMOD_PRIMARY, "bookmark.add");[m addAction_Widget(w, subscribeToPage_KeyModifier, "feeds.subscribe");[m #endif[m [1mdiff --git a/src/ui/keys.c b/src/ui/keys.c[m [1mindex 5cf071fb..656a52ac 100644[m [1m--- a/src/ui/keys.c[m [1m+++ b/src/ui/keys.c[m [36m@@ -80,12 +80,14 @@[m [mstatic const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] =[m { 45, { "Open link in new tab via home row keys", 'f', KMOD_SHIFT, "document.linkkeys arg:1 newtab:1" }, 0 },[m { 46, { "Hover on link via home row keys", 'h', 0, "document.linkkeys arg:1 hover:1" }, 0 },[m { 47, { "Next set of home row key links", '.', 0, "document.linkkeys more:1" }, 0 },[m [32m+[m[32m { 50, { "Add bookmark", 'd', KMOD_PRIMARY, "bookmark.add" }, 0 },[m { 70, { "Zoom in", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, 0 },[m { 71, { "Zoom out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, 0 },[m { 72, { "Reset zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, 0 },[m [32m+[m[32m { 76, { "New tab", newTab_KeyShortcut, "tabs.new" }, 0 },[m [32m+[m[32m { 77, { "Close tab", closeTab_KeyShortcut, "tabs.close" }, 0 },[m { 80, { "Previous tab", prevTab_KeyShortcut, "tabs.prev" }, 0 },[m { 81, { "Next tab", nextTab_KeyShortcut, "tabs.next" }, 0 },[m [31m- { 82, { "Close tab", 'c', 0, "tabs.close" }, 0 },[m { 100,{ "Toggle show URL on hover", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 },[m /* The following cannot currently be changed (built-in duplicates). */[m { 1000, { NULL, SDLK_SPACE, KMOD_SHIFT, "scroll.page arg:-1" }, argRepeat_BindFlag },[m [1mdiff --git a/src/ui/keys.h b/src/ui/keys.h[m [1mindex 8bcd4f53..f6f0b465 100644[m [1m--- a/src/ui/keys.h[m [1m+++ b/src/ui/keys.h[m [36m@@ -28,6 +28,8 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m [m #if defined (iPlatformApple)[m # define reload_KeyShortcut SDLK_r, KMOD_PRIMARY[m [32m+[m[32m# define newTab_KeyShortcut SDLK_t, KMOD_PRIMARY[m [32m+[m[32m# define closeTab_KeyShortcut SDLK_w, KMOD_PRIMARY[m # define prevTab_KeyShortcut SDLK_LEFTBRACKET, KMOD_SHIFT | KMOD_PRIMARY[m # define nextTab_KeyShortcut SDLK_RIGHTBRACKET, KMOD_SHIFT | KMOD_PRIMARY[m # define navigateBack_KeyShortcut SDLK_LEFT, KMOD_PRIMARY[m [36m@@ -40,6 +42,8 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m # define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY[m #else[m # define reload_KeyShortcut SDLK_r, KMOD_PRIMARY[m [32m+[m[32m# define newTab_KeyShortcut SDLK_t, KMOD_PRIMARY[m [32m+[m[32m# define closeTab_KeyShortcut SDLK_w, KMOD_PRIMARY[m # define prevTab_KeyShortcut SDLK_PAGEUP, KMOD_PRIMARY[m # define nextTab_KeyShortcut SDLK_PAGEDOWN, KMOD_PRIMARY[m # define navigateBack_KeyShortcut SDLK_LEFT, KMOD_ALT[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).