qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 7/7] ui/cocoa: Perform UI operations only on


From: BALATON Zoltan
Subject: Re: [Qemu-devel] [PATCH v2 7/7] ui/cocoa: Perform UI operations only on the main thread
Date: Sat, 16 Feb 2019 02:15:28 +0100 (CET)
User-agent: Alpine 2.21.9999 (BSF 287 2018-06-16)

On Fri, 15 Feb 2019, Peter Maydell wrote:
On Fri, 15 Feb 2019 at 01:28, BALATON Zoltan <address@hidden> wrote:

On Thu, 14 Feb 2019, Peter Maydell wrote:
- (void)sendEvent:(NSEvent *)event
{
    COCOA_DEBUG("QemuApplication: sendEvent\n");
-    [super sendEvent: event];
+    if (!cocoaView || ![cocoaView handleEvent:event]) {
+        [super sendEvent: event];
+    }

I think the menu problem may be because now all mouse events go to our
handleEvent method and it may swallow those that should operate the menus
somehow while previously [super sendEvent] took care of those events and
only left the remaining mouse events in queue? Maybe we should test in
handleEvent if the mouse event is within our window and forward everything
else to super? But I'm not sure and could be wrong, only guessing.

Menus definitely did work for me (both mouse interaction and
keyboard shortcuts), so I'm not sure why you're seeing something
different.

My understanding is that the new code should eat exactly the
same set of events that the old code did:
* in the old code, only our custom "pull events off the queue"
  code took events from OSX, and it passed them to handleEvent;
  only events handleEvent called [NSApp sendEvent] on would
  ever get to the OSX menu/etc handling
* in the new code, OSX's run loop takes events off the queue:
  they go to our NSApplication sendEvent method, which passes
  them to handleEvent. Only events that handleEvent returns false
  for will ever get to the OSX menu/etc handling
and (absent bugs) handleEvent should now return false for exactly
the set of events that it previously called sendEvent on.

I know menu handling in OSX is a bit odd because the menu
drag stuff uses a 'private event loop' to handle events
while the menu is down. Maybe something is interacting
badly with that.

Sorry, looks like my proposed patch [ui/cocoa: Make sure app is not starting in the background] is the one which breaks this. After some recompiling menus work here as well with your series so forget about this patch and sorry for the false alarm. (The habit of macOS to open apps started from Terminal in the background is quite annoying but looks like it's normal and can't be fixed that easily.)

Regards,
BALATON Zoltan



reply via email to

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