[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 6/7] ui/cocoa: Subclass NSApplication so we can i
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH v3 6/7] ui/cocoa: Subclass NSApplication so we can implement sendEvent |
Date: |
Mon, 25 Feb 2019 10:24:32 +0000 |
When we switch away from our custom event handling, we still want to
be able to have first go at any events our application receives,
because in full-screen mode we want to send key events to the guest,
even if they would be menu item activation events. There are several
ways we could do that, but one simple approach is to subclass
NSApplication so we can implement a custom sendEvent method.
Do that, but for the moment have our sendEvent just invoke the
superclass method.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Reviewed-by: Roman Bolshakov <address@hidden>
Tested-by: Roman Bolshakov <address@hidden>
Message-id: address@hidden
---
ui/cocoa.m | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 1b54d42aba..00e3db69c9 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1482,6 +1482,17 @@ - (void)adjustSpeed:(id)sender
@end
address@hidden QemuApplication : NSApplication
address@hidden
+
address@hidden QemuApplication
+- (void)sendEvent:(NSEvent *)event
+{
+ COCOA_DEBUG("QemuApplication: sendEvent\n");
+ [super sendEvent: event];
+}
address@hidden
+
static void create_initial_menus(void)
{
// Add menus
@@ -1695,7 +1706,7 @@ int main (int argc, const char * argv[]) {
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
- [NSApplication sharedApplication];
+ [QemuApplication sharedApplication];
create_initial_menus();
--
2.17.2 (Apple Git-113)
- [Qemu-devel] [PATCH v3 0/7] ui/cocoa: Use OSX's main loop, Peter Maydell, 2019/02/25
- [Qemu-devel] [PATCH v3 3/7] ui/cocoa: Factor out initial menu creation, Peter Maydell, 2019/02/25
- [Qemu-devel] [PATCH v3 1/7] ui/cocoa: Ensure we have the iothread lock when calling into QEMU, Peter Maydell, 2019/02/25
- [Qemu-devel] [PATCH v3 2/7] ui/cocoa: Use the pixman image directly in switchSurface, Peter Maydell, 2019/02/25
- [Qemu-devel] [PATCH v3 4/7] ui/cocoa: Move console/device menu creation code up in file, Peter Maydell, 2019/02/25
- [Qemu-devel] [PATCH v3 7/7] ui/cocoa: Perform UI operations only on the main thread, Peter Maydell, 2019/02/25
- [Qemu-devel] [PATCH v3 6/7] ui/cocoa: Subclass NSApplication so we can implement sendEvent,
Peter Maydell <=
- [Qemu-devel] [PATCH v3 5/7] ui/cocoa: Don't call NSApp sendEvent directly from handleEvent, Peter Maydell, 2019/02/25
- Re: [Qemu-devel] [PATCH v3 0/7] ui/cocoa: Use OSX's main loop, Peter Maydell, 2019/02/25