Message ID | 20220215080307.69550-12-f4bug@amsat.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | host: Support macOS 12 | expand |
On Tue, Feb 15, 2022 at 3:04 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > From: Akihiko Odaki <akihiko.odaki@gmail.com> > > Services menu functionality of Cocoa is described at: > > https://developer.apple.com/design/human-interface-guidelines/macos/extensions/services/ > > Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> > Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > Message-Id: <20220214091320.51750-1-akihiko.odaki@gmail.com> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > ui/cocoa.m | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/ui/cocoa.m b/ui/cocoa.m > index 7a1ddd4075..becca58cb7 100644 > --- a/ui/cocoa.m > +++ b/ui/cocoa.m > @@ -1591,11 +1591,15 @@ static void create_initial_menus(void) > NSMenuItem *menuItem; > > [NSApp setMainMenu:[[NSMenu alloc] init]]; > + [NSApp setServicesMenu:[[NSMenu alloc] initWithTitle:@"Services"]]; > > // Application menu > menu = [[NSMenu alloc] initWithTitle:@""]; > [menu addItemWithTitle:@"About QEMU" action:@selector(do_about_menu_item:) > keyEquivalent:@""]; // About QEMU > [menu addItem:[NSMenuItem separatorItem]]; //Separator > + menuItem = [menu addItemWithTitle:@"Services" action:nil > keyEquivalent:@""]; > + [menuItem setSubmenu:[NSApp servicesMenu]]; > + [menu addItem:[NSMenuItem separatorItem]]; > [menu addItemWithTitle:@"Hide QEMU" action:@selector(hide:) > keyEquivalent:@"h"]; //Hide QEMU > menuItem = (NSMenuItem *)[menu addItemWithTitle:@"Hide Others" > action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; // Hide > Others > [menuItem > setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)]; > -- > 2.34.1 > Reviewed-by: Will Cohen <wwcohen@gmail.com> Tested-by: Will Cohen <wwcohen@gmail.com>
On Tue, 15 Feb 2022 at 08:26, Philippe Mathieu-Daudé via <qemu-devel@nongnu.org> wrote: > > From: Akihiko Odaki <akihiko.odaki@gmail.com> > > Services menu functionality of Cocoa is described at: > https://developer.apple.com/design/human-interface-guidelines/macos/extensions/services/ > I tested this, and while it does create a Services menu, none of the items in it seem very relevant to QEMU (on my machine, there's Activity Monitor, Time Profile Active Application, and some other software-development related things). In fact, every app I looked at exposed the same list of things in the Services menu. So I'm not sure why this is even an application-specific menu that needs specific code to support, rather than something system-wide that Apple automatically adds to the UI where it wants it. -- PMM
On Sat, Feb 19, 2022 at 2:33 AM Peter Maydell <peter.maydell@linaro.org> wrote: > > On Tue, 15 Feb 2022 at 08:26, Philippe Mathieu-Daudé via > <qemu-devel@nongnu.org> wrote: > > > > From: Akihiko Odaki <akihiko.odaki@gmail.com> > > > > Services menu functionality of Cocoa is described at: > > https://developer.apple.com/design/human-interface-guidelines/macos/extensions/services/ > > > > I tested this, and while it does create a Services menu, none of > the items in it seem very relevant to QEMU (on my machine, there's > Activity Monitor, Time Profile Active Application, and some other > software-development related things). In fact, every app I looked > at exposed the same list of things in the Services menu. So I'm > not sure why this is even an application-specific menu that needs > specific code to support, rather than something system-wide that > Apple automatically adds to the UI where it wants it. > > -- PMM Actually I wanted to use those services from Xcode to debug QEMU. I have no idea why Apple decided to do it this way, but an application template from Xcode does the same although it uses an interface file instead of Objective-C code. Regards, Akihiko Odaki
On Freitag, 18. Februar 2022 18:49:55 CET Akihiko Odaki wrote: > On Sat, Feb 19, 2022 at 2:33 AM Peter Maydell <peter.maydell@linaro.org> wrote: > > On Tue, 15 Feb 2022 at 08:26, Philippe Mathieu-Daudé via > > > > <qemu-devel@nongnu.org> wrote: > > > From: Akihiko Odaki <akihiko.odaki@gmail.com> > > > > > > Services menu functionality of Cocoa is described at: > > > https://developer.apple.com/design/human-interface-guidelines/macos/exte > > > nsions/services/> > > I tested this, and while it does create a Services menu, none of > > the items in it seem very relevant to QEMU (on my machine, there's > > Activity Monitor, Time Profile Active Application, and some other > > software-development related things). In fact, every app I looked > > at exposed the same list of things in the Services menu. So I'm > > not sure why this is even an application-specific menu that needs > > specific code to support, rather than something system-wide that > > Apple automatically adds to the UI where it wants it. > > > > -- PMM > > Actually I wanted to use those services from Xcode to debug QEMU. I > have no idea why Apple decided to do it this way, but an application > template from Xcode does the same although it uses an interface file > instead of Objective-C code. > > Regards, > Akihiko Odaki Yes, that appearance of the "Services" menu is normal. I think the idea was to leave it completely to app developers how their app menus looks like exactly, instead of Apple injecting something there without being asked. There are much bigger oddities in macOS's menu design than that IMO. Best regards, Christian Schoenebeck
diff --git a/ui/cocoa.m b/ui/cocoa.m index 7a1ddd4075..becca58cb7 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1591,11 +1591,15 @@ static void create_initial_menus(void) NSMenuItem *menuItem; [NSApp setMainMenu:[[NSMenu alloc] init]]; + [NSApp setServicesMenu:[[NSMenu alloc] initWithTitle:@"Services"]]; // Application menu menu = [[NSMenu alloc] initWithTitle:@""]; [menu addItemWithTitle:@"About QEMU" action:@selector(do_about_menu_item:) keyEquivalent:@""]; // About QEMU [menu addItem:[NSMenuItem separatorItem]]; //Separator + menuItem = [menu addItemWithTitle:@"Services" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:[NSApp servicesMenu]]; + [menu addItem:[NSMenuItem separatorItem]]; [menu addItemWithTitle:@"Hide QEMU" action:@selector(hide:) keyEquivalent:@"h"]; //Hide QEMU menuItem = (NSMenuItem *)[menu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; // Hide Others [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)];