* [PATCH] ui/cocoa: Override windowDidResignKey
@ 2023-02-28 7:09 Akihiko Odaki
2023-03-09 13:34 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 4+ messages in thread
From: Akihiko Odaki @ 2023-02-28 7:09 UTC (permalink / raw)
Cc: qemu-devel, Gustavo Noronha Silva, Gerd Hoffmann,
Philippe Mathieu-Daudé, Peter Maydell, Akihiko Odaki
This fixes pressed keys being stuck when the deck is clicked and the
window loses focus.
In the past, Gustavo Noronha Silva also had a patch to fix this issue
though it only ungrabs mouse and does not release keys, and depends on
another out-of-tree patch:
https://github.com/akihikodaki/qemu/pull/3/commits/e906a80147b1dc6d4f31b6a08064ef9871a2b76c
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 52e750f8a29..ac1cee09cd0 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1330,10 +1330,15 @@ - (BOOL)windowShouldClose:(id)sender
return NO;
}
-/* Called when QEMU goes into the background */
-- (void) applicationWillResignActive: (NSNotification *)aNotification
+/*
+ * Called when QEMU goes into the background. Note that
+ * [-NSWindowDelegate windowDidResignKey:] is used here instead of
+ * [-NSApplicationDelegate applicationWillResignActive:] because it cannot
+ * detect that the window loses focus when the deck is clicked on macOS 13.2.1.
+ */
+- (void) windowDidResignKey: (NSNotification *)aNotification
{
- COCOA_DEBUG("QemuCocoaAppController: applicationWillResignActive\n");
+ COCOA_DEBUG("%s\n", __func__);
[cocoaView ungrabMouse];
[cocoaView raiseAllKeys];
}
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ui/cocoa: Override windowDidResignKey
@ 2023-02-28 8:24 Akihiko Odaki
0 siblings, 0 replies; 4+ messages in thread
From: Akihiko Odaki @ 2023-02-28 8:24 UTC (permalink / raw)
Cc: qemu-devel, Gustavo Noronha Silva, Gerd Hoffmann,
Philippe Mathieu-Daudé, Peter Maydell, Akihiko Odaki
This fixes pressed keys being stuck when the deck is clicked and the
window loses focus.
In the past, Gustavo Noronha Silva also had a patch to fix this issue
though it only ungrabs mouse and does not release keys, and depends on
another out-of-tree patch:
https://github.com/akihikodaki/qemu/pull/3/commits/e906a80147b1dc6d4f31b6a08064ef9871a2b76c
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 52e750f8a29..ac1cee09cd0 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1330,10 +1330,15 @@ - (BOOL)windowShouldClose:(id)sender
return NO;
}
-/* Called when QEMU goes into the background */
-- (void) applicationWillResignActive: (NSNotification *)aNotification
+/*
+ * Called when QEMU goes into the background. Note that
+ * [-NSWindowDelegate windowDidResignKey:] is used here instead of
+ * [-NSApplicationDelegate applicationWillResignActive:] because it cannot
+ * detect that the window loses focus when the deck is clicked on macOS 13.2.1.
+ */
+- (void) windowDidResignKey: (NSNotification *)aNotification
{
- COCOA_DEBUG("QemuCocoaAppController: applicationWillResignActive\n");
+ COCOA_DEBUG("%s\n", __func__);
[cocoaView ungrabMouse];
[cocoaView raiseAllKeys];
}
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ui/cocoa: Override windowDidResignKey
@ 2023-02-28 8:31 Akihiko Odaki
0 siblings, 0 replies; 4+ messages in thread
From: Akihiko Odaki @ 2023-02-28 8:31 UTC (permalink / raw)
Cc: qemu-devel, Gustavo Noronha Silva, Gerd Hoffmann,
Philippe Mathieu-Daudé, Peter Maydell, Akihiko Odaki
This fixes pressed keys being stuck when the deck is clicked and the
window loses focus.
In the past, Gustavo Noronha Silva also had a patch to fix this issue
though it only ungrabs mouse and does not release keys, and depends on
another out-of-tree patch:
https://github.com/akihikodaki/qemu/pull/3/commits/e906a80147b1dc6d4f31b6a08064ef9871a2b76c
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 52e750f8a2..ac1cee09cd 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1330,10 +1330,15 @@ - (BOOL)windowShouldClose:(id)sender
return NO;
}
-/* Called when QEMU goes into the background */
-- (void) applicationWillResignActive: (NSNotification *)aNotification
+/*
+ * Called when QEMU goes into the background. Note that
+ * [-NSWindowDelegate windowDidResignKey:] is used here instead of
+ * [-NSApplicationDelegate applicationWillResignActive:] because it cannot
+ * detect that the window loses focus when the deck is clicked on macOS 13.2.1.
+ */
+- (void) windowDidResignKey: (NSNotification *)aNotification
{
- COCOA_DEBUG("QemuCocoaAppController: applicationWillResignActive\n");
+ COCOA_DEBUG("%s\n", __func__);
[cocoaView ungrabMouse];
[cocoaView raiseAllKeys];
}
--
2.39.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-09 13:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-28 7:09 [PATCH] ui/cocoa: Override windowDidResignKey Akihiko Odaki
2023-03-09 13:34 ` Philippe Mathieu-Daudé
-- strict thread matches above, loose matches on Subject: below --
2023-02-28 8:24 Akihiko Odaki
2023-02-28 8:31 Akihiko Odaki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).