qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 6/7] ui/cocoa: Subclass NSApplication so we c


From: BALATON Zoltan
Subject: Re: [Qemu-devel] [PATCH v2 6/7] ui/cocoa: Subclass NSApplication so we can implement sendEvent
Date: Thu, 14 Feb 2019 18:21:53 +0100 (CET)
User-agent: Alpine 2.21.9999 (BSF 287 2018-06-16)

On Thu, 14 Feb 2019, Peter Maydell wrote:
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>

Regards,
BALATON Zoltan

---
New patch in v2
---
ui/cocoa.m | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 5a84e1aea7..184fbd877d 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1478,6 +1478,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
@@ -1691,7 +1702,7 @@ int main (int argc, const char * argv[]) {
    ProcessSerialNumber psn = { 0, kCurrentProcess };
    TransformProcessType(&psn, kProcessTransformToForegroundApplication);

-    [NSApplication sharedApplication];
+    [QemuApplication sharedApplication];

    create_initial_menus();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]