diff --git a/SDL/CocoaBarItems.mm b/SDL/CocoaBarItems.mm index 237ce3157c..25587097a4 100644 --- a/SDL/CocoaBarItems.mm +++ b/SDL/CocoaBarItems.mm @@ -41,7 +41,7 @@ variableName.state = [self controlStateForBool: ConfigurationValueName]; @interface BarItemsManager : NSObject +(instancetype)sharedInstance; -(void)setupAppBarItems; -@property (assign) NSMenu *openMenu; +@property (assign) NSMenu *fileMenu; @property (assign) std::shared_ptr mainSettingsLocalization; @property (assign) std::shared_ptr graphicsLocalization; @end @@ -65,10 +65,10 @@ void initializeOSXExtras() { -(void)setupAppBarItems { - NSMenuItem *openMenuItem = [[NSMenuItem alloc] init]; - openMenuItem.submenu = [self makeOpenSubmenu]; - openMenuItem.submenu.delegate = self; - + NSMenuItem *fileMenuItem = [[NSMenuItem alloc] init]; + fileMenuItem.submenu = [self makeFileSubmenu]; + fileMenuItem.submenu.delegate = self; + NSMenuItem *graphicsMenuItem = [[NSMenuItem alloc] init]; graphicsMenuItem.submenu = [self makeGraphicsMenu]; graphicsMenuItem.submenu.delegate = self; @@ -80,7 +80,7 @@ void initializeOSXExtras() { NSMenuItem *helpMenuItem = [[NSMenuItem alloc] init]; helpMenuItem.submenu = [self makeHelpMenu]; - [NSApplication.sharedApplication.menu addItem:openMenuItem]; + [NSApplication.sharedApplication.menu addItem:fileMenuItem]; [NSApplication.sharedApplication.menu addItem:graphicsMenuItem]; [NSApplication.sharedApplication.menu addItem:debugMenuItem]; [NSApplication.sharedApplication.menu addItem:helpMenuItem]; @@ -97,7 +97,7 @@ void initializeOSXExtras() { break; } } - + NSArray *firstSubmenu = NSApp.menu.itemArray.firstObject.submenu.itemArray; for (NSMenuItem *item in firstSubmenu) { // about item, set action @@ -206,16 +206,23 @@ void initializeOSXExtras() { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://discord.gg/5NJB6dD"]]; } --(NSMenu *)makeOpenSubmenu { +-(NSMenu *)makeFileSubmenu { NSMenu *menu = [[NSMenu alloc] initWithTitle:@"File"]; NSMenuItem *openWithSystemFolderBrowserItem = [[NSMenuItem alloc] initWithTitle:@"Open..." action:@selector(openSystemFileBrowser) keyEquivalent:@"o"]; openWithSystemFolderBrowserItem.keyEquivalentModifierMask = NSEventModifierFlagCommand; openWithSystemFolderBrowserItem.enabled = YES; openWithSystemFolderBrowserItem.target = self; [menu addItem:openWithSystemFolderBrowserItem]; - self.openMenu = menu; - + self.fileMenu = menu; [self addOpenRecentlyItem]; + + [self.fileMenu addItem:[NSMenuItem separatorItem]]; + + NSMenuItem *openMemstickFolderItem = [[NSMenuItem alloc] initWithTitle:@"Open Memory Stick" action:@selector(openMemstickFolder) keyEquivalent:@""]; + openMemstickFolderItem.enabled = YES; + openMemstickFolderItem.target = self; + [self.fileMenu addItem:openMemstickFolderItem]; + return menu; } @@ -504,7 +511,7 @@ TOGGLE_METHOD(ShowDebugStats, g_Config.bShowDebugStats, NativeMessageReceived("c } openRecent.submenu = recentsMenu; - [self.openMenu addItem:openRecent]; + [self.fileMenu addItem:openRecent]; } -(void)openRecentItem: (NSMenuItem *)item { @@ -522,6 +529,12 @@ TOGGLE_METHOD(ShowDebugStats, g_Config.bShowDebugStats, NativeMessageReceived("c services.presentDirectoryPanel(callback, /* allowFiles = */ true, /* allowDirectorites = */ true); } +-(void)openMemstickFolder { + NSString *script = [NSString stringWithFormat:@"tell application \"Finder\"\nactivate\nopen folder (\"%s\" as POSIX file)\nend tell\n", g_Config.memStickDirectory.c_str()]; + NSAppleScript *openScript = [[NSAppleScript alloc] initWithSource: script]; + [openScript executeAndReturnError:nil]; +} + - (void)dealloc { [NSNotificationCenter.defaultCenter removeObserver:self]; } diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 9a46aba81b..f451f3a7c9 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -1183,6 +1183,7 @@ int main(int argc, char *argv[]) { NativeKey(key); break; } + // TODO: Should we even keep the "non-precise" events? if (event.wheel.y > 0) { key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP; mouseWheelMovedUpFrames = 5; diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 48fde122d8..bb7b1dcf82 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -454,7 +454,7 @@ namespace MainWindow { break; case ID_FILE_MEMSTICK: - ShellExecute(NULL, L"open", g_Config.memStickDirectory.ToWString().c_str(), 0, 0, SW_SHOW); + ShellExecute(NULL, L"open", g_Config.memStickDirectory.ToWString().c_str(), 0, 0, SW_SHOWNORMAL); break; case ID_TOGGLE_BREAK: