* [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize
@ 2024-02-24 12:43 Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:] Akihiko Odaki
` (10 more replies)
0 siblings, 11 replies; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
V5 -> V6:
Rebased.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
Changes in v12:
- Extracted patches "ui/cocoa: Split [-QemuCocoaView handleEventLocked:]",
"ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]" from
"ui/cocoa: Release specific mouse buttons". (Peter Maydell)
- Changed the message of patch "ui/cocoa: Call console_select() with the BQL" to
refer to [-QemuCocoaView displayConsole:]. (Peter Maydell)
- Added patch "ui/cocoa: Fix pause label coordinates".
- Added patch "ui/cocoa: Remove normalWindow".
- Removed [-QemuCocoaView fixZoomedFullScreenSize:], which turned out
unnecessary.
- Simplified references to NSWindow.styleMask.
- Link to v11: https://lore.kernel.org/r/20240217-cocoa-v11-0-0a17a7e534d4@daynix.com
Changes in v11:
- Ensured to reflect screen size changes to bounds
- Link to v10: https://lore.kernel.org/r/20240214-cocoa-v10-0-c7ffe5d9f08a@daynix.com
Changes in v10:
- Removed relative mouse input scaling.
- Link to v9: https://lore.kernel.org/r/20240213-cocoa-v9-0-d5a5e1bf0490@daynix.com
Changes in v9:
- Split patch "ui/cocoa: Use NSWindow's ability to resize" into patches
"ui/cocoa: Let the platform toggle fullscreen", "ui/cocoa: Make window
resizable", "ui/cocoa: Call console_select() with the BQL".
- Added patch "ui/cocoa: Scale with NSView instead of Core Graphics".
- Rebased.
- Dropped Tested-by: from patch "ui/cocoa: Use NSWindow's ability to
resize".
- Link to v8: https://lore.kernel.org/r/20231218-cocoa-v8-0-d7fad80c7ef6@daynix.com
Changes in v8:
- Split into three patches. (BALATON Zoltan)
- Removed negative full-screen conditions. (BALATON Zoltan)
- Converted a C++-style comment to C style.
- Link to v7: https://lore.kernel.org/r/20231217-cocoa-v7-1-6af21ef75680@daynix.com
Changes in v7:
- Fixed zoom-to-fit option. (Marek Glogowski)
- Link to v6: https://lore.kernel.org/r/20231211-cocoa-v6-1-49f3be0191f2@daynix.com
---
Akihiko Odaki (10):
ui/cocoa: Split [-QemuCocoaView handleEventLocked:]
ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]
ui/cocoa: Release specific mouse buttons
ui/cocoa: Scale with NSView instead of Core Graphics
ui/cocoa: Fix pause label coordinates
ui/cocoa: Let the platform toggle fullscreen
ui/cocoa: Remove normalWindow
ui/cocoa: Make window resizable
ui/cocoa: Call console_select() with the BQL
ui/cocoa: Remove stretch_video flag
ui/cocoa.m | 552 +++++++++++++++++++++++++++----------------------------------
1 file changed, 242 insertions(+), 310 deletions(-)
---
base-commit: 5005aed8a7e728d028efb40e243ecfc2b4f3df3a
change-id: 20231211-cocoa-576b8639e9bd
Best regards,
--
Akihiko Odaki <akihiko.odaki@daynix.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:]
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-26 16:58 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 02/10] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:] Akihiko Odaki
` (9 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
Currently [-QemuCocoaView handleEventLocked:] parses the passed event,
stores operations to be done to variables, and perform them according
to the variables. This construct will be cluttered with variables and
hard to read when we need more different operations for different
events.
Split the methods so that we can call appropriate methods depending on
events instead of relying on variables.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 82 +++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 49 insertions(+), 33 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index eb99064beeb4..32d61e226507 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1094,42 +1094,58 @@ - (bool) handleEventLocked:(NSEvent *)event
}
if (mouse_event) {
- /* Don't send button events to the guest unless we've got a
- * mouse grab or window focus. If we have neither then this event
- * is the user clicking on the background window to activate and
- * bring us to the front, which will be done by the sendEvent
- * call below. We definitely don't want to pass that click through
- * to the guest.
+ return [self handleMouseEvent:event buttons:buttons];
+ }
+ return true;
+}
+
+- (bool) handleMouseEvent:(NSEvent *)event buttons:(uint32_t)buttons
+{
+ /* Don't send button events to the guest unless we've got a
+ * mouse grab or window focus. If we have neither then this event
+ * is the user clicking on the background window to activate and
+ * bring us to the front, which will be done by the sendEvent
+ * call below. We definitely don't want to pass that click through
+ * to the guest.
+ */
+ if ((isMouseGrabbed || [[self window] isKeyWindow]) &&
+ (last_buttons != buttons)) {
+ static uint32_t bmap[INPUT_BUTTON__MAX] = {
+ [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
+ [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
+ [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON
+ };
+ qemu_input_update_buttons(dcl.con, bmap, last_buttons, buttons);
+ last_buttons = buttons;
+ }
+
+ return [self handleMouseEvent:event];
+}
+
+- (bool) handleMouseEvent:(NSEvent *)event
+{
+ if (!isMouseGrabbed) {
+ return false;
+ }
+
+ if (isAbsoluteEnabled) {
+ NSPoint p = [self screenLocationOfEvent:event];
+
+ /* Note that the origin for Cocoa mouse coords is bottom left, not top left.
+ * The check on screenContainsPoint is to avoid sending out of range values for
+ * clicks in the titlebar.
*/
- if ((isMouseGrabbed || [[self window] isKeyWindow]) &&
- (last_buttons != buttons)) {
- static uint32_t bmap[INPUT_BUTTON__MAX] = {
- [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
- [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
- [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON
- };
- qemu_input_update_buttons(dcl.con, bmap, last_buttons, buttons);
- last_buttons = buttons;
+ if ([self screenContainsPoint:p]) {
+ qemu_input_queue_abs(dcl.con, INPUT_AXIS_X, p.x, 0, screen.width);
+ qemu_input_queue_abs(dcl.con, INPUT_AXIS_Y, screen.height - p.y, 0, screen.height);
}
- if (isMouseGrabbed) {
- if (isAbsoluteEnabled) {
- /* Note that the origin for Cocoa mouse coords is bottom left, not top left.
- * The check on screenContainsPoint is to avoid sending out of range values for
- * clicks in the titlebar.
- */
- if ([self screenContainsPoint:p]) {
- qemu_input_queue_abs(dcl.con, INPUT_AXIS_X, p.x, 0, screen.width);
- qemu_input_queue_abs(dcl.con, INPUT_AXIS_Y, screen.height - p.y, 0, screen.height);
- }
- } else {
- qemu_input_queue_rel(dcl.con, INPUT_AXIS_X, (int)[event deltaX]);
- qemu_input_queue_rel(dcl.con, INPUT_AXIS_Y, (int)[event deltaY]);
- }
- } else {
- return false;
- }
- qemu_input_event_sync();
+ } else {
+ qemu_input_queue_rel(dcl.con, INPUT_AXIS_X, (int)[event deltaX]);
+ qemu_input_queue_rel(dcl.con, INPUT_AXIS_Y, (int)[event deltaY]);
}
+
+ qemu_input_event_sync();
+
return true;
}
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 02/10] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:] Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-26 16:59 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 03/10] ui/cocoa: Release specific mouse buttons Akihiko Odaki
` (8 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
Instead of using mouse_event variable to tell to handle a mouse event
later, immediately call [-QemuCocoaView handleMouseEvent:buttons:].
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 87 ++++++++++++++++++++++----------------------------------------
1 file changed, 30 insertions(+), 57 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 32d61e226507..06bd5737636b 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -799,9 +799,8 @@ - (bool) handleEventLocked:(NSEvent *)event
{
/* Return true if we handled the event, false if it should be given to OSX */
COCOA_DEBUG("QemuCocoaView: handleEvent\n");
- int buttons = 0;
+ InputButton button;
int keycode = 0;
- bool mouse_event = false;
// Location of event in virtual screen coordinates
NSPoint p = [self screenLocationOfEvent:event];
NSUInteger modifiers = [event modifierFlags];
@@ -947,7 +946,7 @@ - (bool) handleEventLocked:(NSEvent *)event
}
break;
}
- break;
+ return true;
case NSEventTypeKeyDown:
keycode = cocoa_keycode_to_qemu([event keyCode]);
@@ -983,7 +982,7 @@ - (bool) handleEventLocked:(NSEvent *)event
} else {
[self handleMonitorInput: event];
}
- break;
+ return true;
case NSEventTypeKeyUp:
keycode = cocoa_keycode_to_qemu([event keyCode]);
@@ -996,7 +995,7 @@ - (bool) handleEventLocked:(NSEvent *)event
if (qemu_console_is_graphic(NULL)) {
qkbd_state_key_event(kbd, keycode, false);
}
- break;
+ return true;
case NSEventTypeMouseMoved:
if (isAbsoluteEnabled) {
// Cursor re-entered into a window might generate events bound to screen coordinates
@@ -1012,34 +1011,20 @@ - (bool) handleEventLocked:(NSEvent *)event
}
}
}
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:0];
case NSEventTypeLeftMouseDown:
- buttons |= MOUSE_EVENT_LBUTTON;
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:MOUSE_EVENT_LBUTTON];
case NSEventTypeRightMouseDown:
- buttons |= MOUSE_EVENT_RBUTTON;
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:MOUSE_EVENT_RBUTTON];
case NSEventTypeOtherMouseDown:
- buttons |= MOUSE_EVENT_MBUTTON;
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:MOUSE_EVENT_MBUTTON];
case NSEventTypeLeftMouseDragged:
- buttons |= MOUSE_EVENT_LBUTTON;
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:MOUSE_EVENT_LBUTTON];
case NSEventTypeRightMouseDragged:
- buttons |= MOUSE_EVENT_RBUTTON;
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:MOUSE_EVENT_RBUTTON];
case NSEventTypeOtherMouseDragged:
- buttons |= MOUSE_EVENT_MBUTTON;
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:MOUSE_EVENT_MBUTTON];
case NSEventTypeLeftMouseUp:
- mouse_event = true;
if (!isMouseGrabbed && [self screenContainsPoint:p]) {
/*
* In fullscreen mode, the window of cocoaView may not be the
@@ -1050,53 +1035,41 @@ - (bool) handleEventLocked:(NSEvent *)event
[self grabMouse];
}
}
- break;
+ return [self handleMouseEvent:event buttons:0];
case NSEventTypeRightMouseUp:
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:0];
case NSEventTypeOtherMouseUp:
- mouse_event = true;
- break;
+ return [self handleMouseEvent:event buttons:0];
case NSEventTypeScrollWheel:
/*
* Send wheel events to the guest regardless of window focus.
* This is in-line with standard Mac OS X UI behaviour.
*/
- /*
- * We shouldn't have got a scroll event when deltaY and delta Y
- * are zero, hence no harm in dropping the event
- */
- if ([event deltaY] != 0 || [event deltaX] != 0) {
/* Determine if this is a scroll up or scroll down event */
- if ([event deltaY] != 0) {
- buttons = ([event deltaY] > 0) ?
+ if ([event deltaY] != 0) {
+ button = ([event deltaY] > 0) ?
INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN;
- } else if ([event deltaX] != 0) {
- buttons = ([event deltaX] > 0) ?
+ } else if ([event deltaX] != 0) {
+ button = ([event deltaX] > 0) ?
INPUT_BUTTON_WHEEL_LEFT : INPUT_BUTTON_WHEEL_RIGHT;
- }
-
- qemu_input_queue_btn(dcl.con, buttons, true);
- qemu_input_event_sync();
- qemu_input_queue_btn(dcl.con, buttons, false);
- qemu_input_event_sync();
+ } else {
+ /*
+ * We shouldn't have got a scroll event when deltaY and delta Y
+ * are zero, hence no harm in dropping the event
+ */
+ return true;
}
- /*
- * Since deltaX/deltaY also report scroll wheel events we prevent mouse
- * movement code from executing.
- */
- mouse_event = false;
- break;
+ qemu_input_queue_btn(dcl.con, button, true);
+ qemu_input_event_sync();
+ qemu_input_queue_btn(dcl.con, button, false);
+ qemu_input_event_sync();
+
+ return true;
default:
return false;
}
-
- if (mouse_event) {
- return [self handleMouseEvent:event buttons:buttons];
- }
- return true;
}
- (bool) handleMouseEvent:(NSEvent *)event buttons:(uint32_t)buttons
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 03/10] ui/cocoa: Release specific mouse buttons
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:] Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 02/10] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:] Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-26 17:00 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 04/10] ui/cocoa: Scale with NSView instead of Core Graphics Akihiko Odaki
` (7 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
ui/cocoa used to release all mouse buttons when it sees
NSEventTypeLeftMouseUp, NSEventTypeRightMouseUp, or
NSEventTypeOtherMouseUp, but it can instead release specific one
according to the delivered event.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 06bd5737636b..c73ef8884454 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -99,7 +99,6 @@ static void cocoa_switch(DisplayChangeListener *dcl,
static DisplayChangeListener dcl = {
.ops = &dcl_ops,
};
-static int last_buttons;
static int cursor_hide = 1;
static int left_command_key_enabled = 1;
static bool swap_opt_cmd;
@@ -1011,19 +1010,19 @@ - (bool) handleEventLocked:(NSEvent *)event
}
}
}
- return [self handleMouseEvent:event buttons:0];
+ return [self handleMouseEvent:event];
case NSEventTypeLeftMouseDown:
- return [self handleMouseEvent:event buttons:MOUSE_EVENT_LBUTTON];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:true];
case NSEventTypeRightMouseDown:
- return [self handleMouseEvent:event buttons:MOUSE_EVENT_RBUTTON];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:true];
case NSEventTypeOtherMouseDown:
- return [self handleMouseEvent:event buttons:MOUSE_EVENT_MBUTTON];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:true];
case NSEventTypeLeftMouseDragged:
- return [self handleMouseEvent:event buttons:MOUSE_EVENT_LBUTTON];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:true];
case NSEventTypeRightMouseDragged:
- return [self handleMouseEvent:event buttons:MOUSE_EVENT_RBUTTON];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:true];
case NSEventTypeOtherMouseDragged:
- return [self handleMouseEvent:event buttons:MOUSE_EVENT_MBUTTON];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:true];
case NSEventTypeLeftMouseUp:
if (!isMouseGrabbed && [self screenContainsPoint:p]) {
/*
@@ -1035,11 +1034,11 @@ - (bool) handleEventLocked:(NSEvent *)event
[self grabMouse];
}
}
- return [self handleMouseEvent:event buttons:0];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:false];
case NSEventTypeRightMouseUp:
- return [self handleMouseEvent:event buttons:0];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:false];
case NSEventTypeOtherMouseUp:
- return [self handleMouseEvent:event buttons:0];
+ return [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:false];
case NSEventTypeScrollWheel:
/*
* Send wheel events to the guest regardless of window focus.
@@ -1072,7 +1071,7 @@ - (bool) handleEventLocked:(NSEvent *)event
}
}
-- (bool) handleMouseEvent:(NSEvent *)event buttons:(uint32_t)buttons
+- (bool) handleMouseEvent:(NSEvent *)event button:(InputButton)button down:(bool)down
{
/* Don't send button events to the guest unless we've got a
* mouse grab or window focus. If we have neither then this event
@@ -1081,17 +1080,12 @@ - (bool) handleMouseEvent:(NSEvent *)event buttons:(uint32_t)buttons
* call below. We definitely don't want to pass that click through
* to the guest.
*/
- if ((isMouseGrabbed || [[self window] isKeyWindow]) &&
- (last_buttons != buttons)) {
- static uint32_t bmap[INPUT_BUTTON__MAX] = {
- [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,
- [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
- [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON
- };
- qemu_input_update_buttons(dcl.con, bmap, last_buttons, buttons);
- last_buttons = buttons;
+ if (!isMouseGrabbed && ![[self window] isKeyWindow]) {
+ return false;
}
+ qemu_input_queue_btn(dcl.con, button, down);
+
return [self handleMouseEvent:event];
}
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 04/10] ui/cocoa: Scale with NSView instead of Core Graphics
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (2 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 03/10] ui/cocoa: Release specific mouse buttons Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 05/10] ui/cocoa: Fix pause label coordinates Akihiko Odaki
` (6 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
Core Graphics is not accelerated and slow.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
ui/cocoa.m | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index c73ef8884454..644fd32eaa4d 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -496,10 +496,8 @@ - (void) drawRect:(NSRect) rect
[self getRectsBeingDrawn:&rectList count:&rectCount];
for (i = 0; i < rectCount; i++) {
- clipRect.origin.x = rectList[i].origin.x / cdx;
- clipRect.origin.y = (float)h - (rectList[i].origin.y + rectList[i].size.height) / cdy;
- clipRect.size.width = rectList[i].size.width / cdx;
- clipRect.size.height = rectList[i].size.height / cdy;
+ clipRect = rectList[i];
+ clipRect.origin.y = (float)h - (clipRect.origin.y + clipRect.size.height);
clipImageRef = CGImageCreateWithImageInRect(
imageRef,
clipRect
@@ -545,6 +543,11 @@ - (void) setContentDimensions
}
}
+- (void) updateBounds
+{
+ [self setBoundsSize:NSMakeSize(screen.width, screen.height)];
+}
+
- (void) updateUIInfoLocked
{
/* Must be called with the BQL, i.e. via updateUIInfo */
@@ -634,6 +637,7 @@ - (void) switchSurface:(pixman_image_t *)image
screen.height = h;
[self setContentDimensions];
[self setFrame:NSMakeRect(cx, cy, cw, ch)];
+ [self updateBounds];
}
// update screenBuffer
@@ -1297,6 +1301,7 @@ - (void)windowDidChangeScreen:(NSNotification *)notification
- (void)windowDidResize:(NSNotification *)notification
{
+ [cocoaView updateBounds];
[cocoaView updateUIInfo];
}
@@ -1945,16 +1950,7 @@ static void cocoa_update(DisplayChangeListener *dcl,
COCOA_DEBUG("qemu_cocoa: cocoa_update\n");
dispatch_async(dispatch_get_main_queue(), ^{
- NSRect rect;
- if ([cocoaView cdx] == 1.0) {
- rect = NSMakeRect(x, [cocoaView gscreen].height - y - h, w, h);
- } else {
- rect = NSMakeRect(
- x * [cocoaView cdx],
- ([cocoaView gscreen].height - y - h) * [cocoaView cdy],
- w * [cocoaView cdx],
- h * [cocoaView cdy]);
- }
+ NSRect rect = NSMakeRect(x, [cocoaView gscreen].height - y - h, w, h);
[cocoaView setNeedsDisplayInRect:rect];
});
}
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 05/10] ui/cocoa: Fix pause label coordinates
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (3 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 04/10] ui/cocoa: Scale with NSView instead of Core Graphics Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-26 17:01 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 06/10] ui/cocoa: Let the platform toggle fullscreen Akihiko Odaki
` (5 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
A subview is positioned in the superview so the superview's frame
should be used instead of one of the window to determine the
coordinates.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 644fd32eaa4d..df8072479c82 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1432,8 +1432,8 @@ - (void)displayPause
{
/* Coordinates have to be calculated each time because the window can change its size */
int xCoord, yCoord, width, height;
- xCoord = ([normalWindow frame].size.width - [pauseLabel frame].size.width)/2;
- yCoord = [normalWindow frame].size.height - [pauseLabel frame].size.height - ([pauseLabel frame].size.height * .5);
+ xCoord = ([cocoaView frame].size.width - [pauseLabel frame].size.width)/2;
+ yCoord = [cocoaView frame].size.height - [pauseLabel frame].size.height - ([pauseLabel frame].size.height * .5);
width = [pauseLabel frame].size.width;
height = [pauseLabel frame].size.height;
[pauseLabel setFrame: NSMakeRect(xCoord, yCoord, width, height)];
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 06/10] ui/cocoa: Let the platform toggle fullscreen
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (4 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 05/10] ui/cocoa: Fix pause label coordinates Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-26 17:14 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 07/10] ui/cocoa: Remove normalWindow Akihiko Odaki
` (4 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
It allows making the window full screen by clicking full screen button
provided by the platform (the left-top green button) and save some code.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 408 +++++++++++++++++++++++++++----------------------------------
1 file changed, 181 insertions(+), 227 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index df8072479c82..88684af6f38b 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -303,20 +303,17 @@ static void handleAnyDeviceErrors(Error * err)
*/
@interface QemuCocoaView : NSView
{
+ NSTrackingArea *trackingArea;
QEMUScreen screen;
- NSWindow *fullScreenWindow;
- float cx,cy,cw,ch,cdx,cdy;
pixman_image_t *pixman_image;
QKbdState *kbd;
BOOL isMouseGrabbed;
- BOOL isFullscreen;
BOOL isAbsoluteEnabled;
CFMachPortRef eventsTap;
}
- (void) switchSurface:(pixman_image_t *)image;
- (void) grabMouse;
- (void) ungrabMouse;
-- (void) toggleFullScreen:(id)sender;
- (void) setFullGrab:(id)sender;
- (void) handleMonitorInput:(NSEvent *)event;
- (bool) handleEvent:(NSEvent *)event;
@@ -332,8 +329,6 @@ - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled;
*/
- (BOOL) isMouseGrabbed;
- (BOOL) isAbsoluteEnabled;
-- (float) cdx;
-- (float) cdy;
- (QEMUScreen) gscreen;
- (void) raiseAllKeys;
@end
@@ -391,46 +386,43 @@ - (BOOL) isOpaque
return YES;
}
-- (BOOL) screenContainsPoint:(NSPoint) p
+- (void) removeTrackingRect
{
- return (p.x > -1 && p.x < screen.width && p.y > -1 && p.y < screen.height);
+ if (trackingArea) {
+ [self removeTrackingArea:trackingArea];
+ [trackingArea release];
+ trackingArea = nil;
+ }
}
-/* Get location of event and convert to virtual screen coordinate */
-- (CGPoint) screenLocationOfEvent:(NSEvent *)ev
+- (void) frameUpdated
{
- NSWindow *eventWindow = [ev window];
- // XXX: Use CGRect and -convertRectFromScreen: to support macOS 10.10
- CGRect r = CGRectZero;
- r.origin = [ev locationInWindow];
- if (!eventWindow) {
- if (!isFullscreen) {
- return [[self window] convertRectFromScreen:r].origin;
- } else {
- CGPoint locationInSelfWindow = [[self window] convertRectFromScreen:r].origin;
- CGPoint loc = [self convertPoint:locationInSelfWindow fromView:nil];
- if (stretch_video) {
- loc.x /= cdx;
- loc.y /= cdy;
- }
- return loc;
- }
- } else if ([[self window] isEqual:eventWindow]) {
- if (!isFullscreen) {
- return r.origin;
- } else {
- CGPoint loc = [self convertPoint:r.origin fromView:nil];
- if (stretch_video) {
- loc.x /= cdx;
- loc.y /= cdy;
- }
- return loc;
- }
- } else {
- return [[self window] convertRectFromScreen:[eventWindow convertRectToScreen:r]].origin;
+ [self removeTrackingRect];
+
+ if ([self window]) {
+ NSTrackingAreaOptions options = NSTrackingActiveInKeyWindow |
+ NSTrackingMouseEnteredAndExited |
+ NSTrackingMouseMoved;
+ trackingArea = [[NSTrackingArea alloc] initWithRect:[self frame]
+ options:options
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea:trackingArea];
+ [self updateUIInfo];
}
}
+- (void) viewDidMoveToWindow
+{
+ [self resizeWindow];
+ [self frameUpdated];
+}
+
+- (void) viewWillMoveToWindow:(NSWindow *)newWindow
+{
+ [self removeTrackingRect];
+}
+
- (void) hideCursor
{
if (!cursor_hide) {
@@ -510,36 +502,25 @@ - (void) drawRect:(NSRect) rect
}
}
-- (void) setContentDimensions
+- (NSSize) screenSafeAreaSize
{
- COCOA_DEBUG("QemuCocoaView: setContentDimensions\n");
+ NSSize size = [[[self window] screen] frame].size;
+ NSEdgeInsets insets = [[[self window] screen] safeAreaInsets];
+ size.width -= insets.left + insets.right;
+ size.height -= insets.top + insets.bottom;
+ return size;
+}
- if (isFullscreen) {
- cdx = [[NSScreen mainScreen] frame].size.width / (float)screen.width;
- cdy = [[NSScreen mainScreen] frame].size.height / (float)screen.height;
+- (void) resizeWindow
+{
+ [[self window] setContentAspectRatio:NSMakeSize(screen.width, screen.height)];
- /* stretches video, but keeps same aspect ratio */
- if (stretch_video == true) {
- /* use smallest stretch value - prevents clipping on sides */
- if (MIN(cdx, cdy) == cdx) {
- cdy = cdx;
- } else {
- cdx = cdy;
- }
- } else { /* No stretching */
- cdx = cdy = 1;
- }
- cw = screen.width * cdx;
- ch = screen.height * cdy;
- cx = ([[NSScreen mainScreen] frame].size.width - cw) / 2.0;
- cy = ([[NSScreen mainScreen] frame].size.height - ch) / 2.0;
- } else {
- cx = 0;
- cy = 0;
- cw = screen.width;
- ch = screen.height;
- cdx = 1.0;
- cdy = 1.0;
+ if (!stretch_video) {
+ [[self window] setContentSize:NSMakeSize(screen.width, screen.height)];
+ [[self window] center];
+ } else if ([[self window] styleMask] & NSWindowStyleMaskFullScreen) {
+ [[self window] setContentSize:[self screenSafeAreaSize]];
+ [[self window] center];
}
}
@@ -563,9 +544,10 @@ - (void) updateUIInfoLocked
CGDirectDisplayID display = [[description objectForKey:@"NSScreenNumber"] unsignedIntValue];
NSSize screenSize = [[[self window] screen] frame].size;
CGSize screenPhysicalSize = CGDisplayScreenSize(display);
+ bool isFullscreen = ([[self window] styleMask] & NSWindowStyleMaskFullScreen) != 0;
CVDisplayLinkRef displayLink;
- frameSize = isFullscreen ? screenSize : [self frame].size;
+ frameSize = isFullscreen ? [self screenSafeAreaSize] : [self frame].size;
if (!CVDisplayLinkCreateWithCGDisplay(display, &displayLink)) {
CVTime period = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(displayLink);
@@ -612,31 +594,19 @@ - (void) updateUIInfo
});
}
-- (void)viewDidMoveToWindow
-{
- [self updateUIInfo];
-}
-
- (void) switchSurface:(pixman_image_t *)image
{
COCOA_DEBUG("QemuCocoaView: switchSurface\n");
int w = pixman_image_get_width(image);
int h = pixman_image_get_height(image);
- /* cdx == 0 means this is our very first surface, in which case we need
- * to recalculate the content dimensions even if it happens to be the size
- * of the initial empty window.
- */
- bool isResize = (w != screen.width || h != screen.height || cdx == 0.0);
- int oldh = screen.height;
- if (isResize) {
+ if (w != screen.width || h != screen.height) {
// Resize before we trigger the redraw, or we'll redraw at the wrong size
COCOA_DEBUG("switchSurface: new size %d x %d\n", w, h);
screen.width = w;
screen.height = h;
- [self setContentDimensions];
- [self setFrame:NSMakeRect(cx, cy, cw, ch)];
+ [self resizeWindow];
[self updateBounds];
}
@@ -646,51 +616,6 @@ - (void) switchSurface:(pixman_image_t *)image
}
pixman_image = image;
-
- // update windows
- if (isFullscreen) {
- [[fullScreenWindow contentView] setFrame:[[NSScreen mainScreen] frame]];
- [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + oldh, w, h + [normalWindow frame].size.height - oldh) display:NO animate:NO];
- } else {
- if (qemu_name)
- [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
- [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + oldh, w, h + [normalWindow frame].size.height - oldh) display:YES animate:NO];
- }
-
- if (isResize) {
- [normalWindow center];
- }
-}
-
-- (void) toggleFullScreen:(id)sender
-{
- COCOA_DEBUG("QemuCocoaView: toggleFullScreen\n");
-
- if (isFullscreen) { // switch from fullscreen to desktop
- isFullscreen = FALSE;
- [self ungrabMouse];
- [self setContentDimensions];
- [fullScreenWindow close];
- [normalWindow setContentView: self];
- [normalWindow makeKeyAndOrderFront: self];
- [NSMenu setMenuBarVisible:YES];
- } else { // switch from desktop to fullscreen
- isFullscreen = TRUE;
- [normalWindow orderOut: nil]; /* Hide the window */
- [self grabMouse];
- [self setContentDimensions];
- [NSMenu setMenuBarVisible:NO];
- fullScreenWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame]
- styleMask:NSWindowStyleMaskBorderless
- backing:NSBackingStoreBuffered
- defer:NO];
- [fullScreenWindow setAcceptsMouseMovedEvents: YES];
- [fullScreenWindow setHasShadow:NO];
- [fullScreenWindow setBackgroundColor: [NSColor blackColor]];
- [self setFrame:NSMakeRect(cx, cy, cw, ch)];
- [[fullScreenWindow contentView] addSubview: self];
- [fullScreenWindow makeKeyAndOrderFront:self];
- }
}
- (void) setFullGrab:(id)sender
@@ -804,8 +729,6 @@ - (bool) handleEventLocked:(NSEvent *)event
COCOA_DEBUG("QemuCocoaView: handleEvent\n");
InputButton button;
int keycode = 0;
- // Location of event in virtual screen coordinates
- NSPoint p = [self screenLocationOfEvent:event];
NSUInteger modifiers = [event modifierFlags];
/*
@@ -999,50 +922,6 @@ - (bool) handleEventLocked:(NSEvent *)event
qkbd_state_key_event(kbd, keycode, false);
}
return true;
- case NSEventTypeMouseMoved:
- if (isAbsoluteEnabled) {
- // Cursor re-entered into a window might generate events bound to screen coordinates
- // and `nil` window property, and in full screen mode, current window might not be
- // key window, where event location alone should suffice.
- if (![self screenContainsPoint:p] || !([[self window] isKeyWindow] || isFullscreen)) {
- if (isMouseGrabbed) {
- [self ungrabMouse];
- }
- } else {
- if (!isMouseGrabbed) {
- [self grabMouse];
- }
- }
- }
- return [self handleMouseEvent:event];
- case NSEventTypeLeftMouseDown:
- return [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:true];
- case NSEventTypeRightMouseDown:
- return [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:true];
- case NSEventTypeOtherMouseDown:
- return [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:true];
- case NSEventTypeLeftMouseDragged:
- return [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:true];
- case NSEventTypeRightMouseDragged:
- return [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:true];
- case NSEventTypeOtherMouseDragged:
- return [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:true];
- case NSEventTypeLeftMouseUp:
- if (!isMouseGrabbed && [self screenContainsPoint:p]) {
- /*
- * In fullscreen mode, the window of cocoaView may not be the
- * key window, therefore the position relative to the virtual
- * screen alone will be sufficient.
- */
- if(isFullscreen || [[self window] isKeyWindow]) {
- [self grabMouse];
- }
- }
- return [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:false];
- case NSEventTypeRightMouseUp:
- return [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:false];
- case NSEventTypeOtherMouseUp:
- return [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:false];
case NSEventTypeScrollWheel:
/*
* Send wheel events to the guest regardless of window focus.
@@ -1075,61 +954,118 @@ - (bool) handleEventLocked:(NSEvent *)event
}
}
-- (bool) handleMouseEvent:(NSEvent *)event button:(InputButton)button down:(bool)down
+- (void) handleMouseEvent:(NSEvent *)event button:(InputButton)button down:(bool)down
{
- /* Don't send button events to the guest unless we've got a
- * mouse grab or window focus. If we have neither then this event
- * is the user clicking on the background window to activate and
- * bring us to the front, which will be done by the sendEvent
- * call below. We definitely don't want to pass that click through
- * to the guest.
- */
- if (!isMouseGrabbed && ![[self window] isKeyWindow]) {
- return false;
+ if (!isMouseGrabbed) {
+ return;
}
- qemu_input_queue_btn(dcl.con, button, down);
+ with_bql(^{
+ qemu_input_queue_btn(dcl.con, button, down);
+ });
- return [self handleMouseEvent:event];
+ [self handleMouseEvent:event];
}
-- (bool) handleMouseEvent:(NSEvent *)event
+- (void) handleMouseEvent:(NSEvent *)event
{
if (!isMouseGrabbed) {
- return false;
+ return;
}
- if (isAbsoluteEnabled) {
- NSPoint p = [self screenLocationOfEvent:event];
+ with_bql(^{
+ if (isAbsoluteEnabled) {
+ CGFloat d = (CGFloat)screen.height / [self frame].size.height;
+ NSPoint p = [event locationInWindow];
- /* Note that the origin for Cocoa mouse coords is bottom left, not top left.
- * The check on screenContainsPoint is to avoid sending out of range values for
- * clicks in the titlebar.
- */
- if ([self screenContainsPoint:p]) {
- qemu_input_queue_abs(dcl.con, INPUT_AXIS_X, p.x, 0, screen.width);
- qemu_input_queue_abs(dcl.con, INPUT_AXIS_Y, screen.height - p.y, 0, screen.height);
+ /* Note that the origin for Cocoa mouse coords is bottom left, not top left. */
+ qemu_input_queue_abs(dcl.con, INPUT_AXIS_X, p.x * d, 0, screen.width);
+ qemu_input_queue_abs(dcl.con, INPUT_AXIS_Y, screen.height - p.y * d, 0, screen.height);
+ } else {
+ qemu_input_queue_rel(dcl.con, INPUT_AXIS_X, [event deltaX]);
+ qemu_input_queue_rel(dcl.con, INPUT_AXIS_Y, [event deltaY]);
}
- } else {
- qemu_input_queue_rel(dcl.con, INPUT_AXIS_X, (int)[event deltaX]);
- qemu_input_queue_rel(dcl.con, INPUT_AXIS_Y, (int)[event deltaY]);
+
+ qemu_input_event_sync();
+ });
+}
+
+- (void) mouseExited:(NSEvent *)event
+{
+ if (isAbsoluteEnabled && isMouseGrabbed) {
+ [self ungrabMouse];
}
+}
+
+- (void) mouseEntered:(NSEvent *)event
+{
+ if (isAbsoluteEnabled && !isMouseGrabbed) {
+ [self grabMouse];
+ }
+}
+
+- (void) mouseMoved:(NSEvent *)event
+{
+ [self handleMouseEvent:event];
+}
+
+- (void) mouseDown:(NSEvent *)event
+{
+ [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:true];
+}
+
+- (void) rightMouseDown:(NSEvent *)event
+{
+ [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:true];
+}
+
+- (void) otherMouseDown:(NSEvent *)event
+{
+ [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:true];
+}
+
+- (void) mouseDragged:(NSEvent *)event
+{
+ [self handleMouseEvent:event];
+}
+
+- (void) rightMouseDragged:(NSEvent *)event
+{
+ [self handleMouseEvent:event];
+}
+
+- (void) otherMouseDragged:(NSEvent *)event
+{
+ [self handleMouseEvent:event];
+}
+
+- (void) mouseUp:(NSEvent *)event
+{
+ if (!isMouseGrabbed) {
+ [self grabMouse];
+ }
+
+ [self handleMouseEvent:event button:INPUT_BUTTON_LEFT down:false];
+}
- qemu_input_event_sync();
+- (void) rightMouseUp:(NSEvent *)event
+{
+ [self handleMouseEvent:event button:INPUT_BUTTON_RIGHT down:false];
+}
- return true;
+- (void) otherMouseUp:(NSEvent *)event
+{
+ [self handleMouseEvent:event button:INPUT_BUTTON_MIDDLE down:false];
}
- (void) grabMouse
{
COCOA_DEBUG("QemuCocoaView: grabMouse\n");
- if (!isFullscreen) {
- if (qemu_name)
- [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]];
- else
- [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"];
- }
+ if (qemu_name)
+ [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]];
+ else
+ [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"];
[self hideCursor];
CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
isMouseGrabbed = TRUE; // while isMouseGrabbed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:]
@@ -1139,15 +1075,14 @@ - (void) ungrabMouse
{
COCOA_DEBUG("QemuCocoaView: ungrabMouse\n");
- if (!isFullscreen) {
- if (qemu_name)
- [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
- else
- [normalWindow setTitle:@"QEMU"];
- }
+ if (qemu_name)
+ [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
+ else
+ [normalWindow setTitle:@"QEMU"];
[self unhideCursor];
CGAssociateMouseAndMouseCursorPosition(TRUE);
isMouseGrabbed = FALSE;
+ [self raiseAllButtons];
}
- (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {
@@ -1158,8 +1093,6 @@ - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {
}
- (BOOL) isMouseGrabbed {return isMouseGrabbed;}
- (BOOL) isAbsoluteEnabled {return isAbsoluteEnabled;}
-- (float) cdx {return cdx;}
-- (float) cdy {return cdy;}
- (QEMUScreen) gscreen {return screen;}
/*
@@ -1173,6 +1106,15 @@ - (void) raiseAllKeys
qkbd_state_lift_all_keys(kbd);
});
}
+
+- (void) raiseAllButtons
+{
+ with_bql(^{
+ qemu_input_queue_btn(dcl.con, INPUT_BUTTON_LEFT, false);
+ qemu_input_queue_btn(dcl.con, INPUT_BUTTON_RIGHT, false);
+ qemu_input_queue_btn(dcl.con, INPUT_BUTTON_MIDDLE, false);
+ });
+}
@end
@@ -1187,7 +1129,6 @@ @interface QemuCocoaAppController : NSObject
{
}
- (void)doToggleFullScreen:(id)sender;
-- (void)toggleFullScreen:(id)sender;
- (void)showQEMUDoc:(id)sender;
- (void)zoomToFit:(id) sender;
- (void)displayConsole:(id)sender;
@@ -1229,7 +1170,8 @@ - (id) init
exit(1);
}
[normalWindow setAcceptsMouseMovedEvents:YES];
- [normalWindow setTitle:@"QEMU"];
+ [normalWindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+ [normalWindow setTitle:qemu_name ? [NSString stringWithFormat:@"QEMU %s", qemu_name] : @"QEMU"];
[normalWindow setContentView:cocoaView];
[normalWindow makeKeyAndOrderFront:self];
[normalWindow center];
@@ -1299,10 +1241,21 @@ - (void)windowDidChangeScreen:(NSNotification *)notification
[cocoaView updateUIInfo];
}
+- (void)windowDidEnterFullScreen:(NSNotification *)notification
+{
+ [cocoaView grabMouse];
+}
+
+- (void)windowDidExitFullScreen:(NSNotification *)notification
+{
+ [cocoaView resizeWindow];
+ [cocoaView ungrabMouse];
+}
+
- (void)windowDidResize:(NSNotification *)notification
{
[cocoaView updateBounds];
- [cocoaView updateUIInfo];
+ [cocoaView frameUpdated];
}
/* Called when the user clicks on a window's close button */
@@ -1318,6 +1271,14 @@ - (BOOL)windowShouldClose:(id)sender
return NO;
}
+- (NSApplicationPresentationOptions) window:(NSWindow *)window
+ willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
+
+{
+ return (proposedOptions & ~(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)) |
+ NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
+}
+
/*
* Called when QEMU goes into the background. Note that
* [-NSWindowDelegate windowDidResignKey:] is used here instead of
@@ -1337,14 +1298,7 @@ - (void) windowDidResignKey: (NSNotification *)aNotification
*/
- (void) doToggleFullScreen:(id)sender
{
- [self toggleFullScreen:(id)sender];
-}
-
-- (void)toggleFullScreen:(id)sender
-{
- COCOA_DEBUG("QemuCocoaAppController: toggleFullScreen\n");
-
- [cocoaView toggleFullScreen:sender];
+ [normalWindow toggleFullScreen:sender];
}
- (void) setFullGrab:(id)sender
@@ -1395,6 +1349,7 @@ - (void)zoomToFit:(id) sender
if (stretch_video == true) {
[sender setState: NSControlStateValueOn];
} else {
+ [cocoaView resizeWindow];
[sender setState: NSControlStateValueOff];
}
}
@@ -2027,8 +1982,7 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
/* if fullscreen mode is to be used */
if (opts->has_full_screen && opts->full_screen) {
- [NSApp activateIgnoringOtherApps: YES];
- [controller toggleFullScreen: nil];
+ [normalWindow toggleFullScreen: nil];
}
if (opts->u.cocoa.has_full_grab && opts->u.cocoa.full_grab) {
[controller setFullGrab: nil];
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 07/10] ui/cocoa: Remove normalWindow
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (5 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 06/10] ui/cocoa: Let the platform toggle fullscreen Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-26 17:04 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 08/10] ui/cocoa: Make window resizable Akihiko Odaki
` (3 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
QemuCocoaView used to have fullScreenWindow but now it's gone, so we
do no longer have to call the window specifically "normalWindow".
Instead, refer to it with [-QemuCocoaView window].
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 88684af6f38b..05c91e4eed53 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -89,7 +89,6 @@ static void cocoa_switch(DisplayChangeListener *dcl,
static void cocoa_refresh(DisplayChangeListener *dcl);
-static NSWindow *normalWindow;
static const DisplayChangeListenerOps dcl_ops = {
.dpy_name = "cocoa",
.dpy_gfx_update = cocoa_update,
@@ -1063,9 +1062,9 @@ - (void) grabMouse
COCOA_DEBUG("QemuCocoaView: grabMouse\n");
if (qemu_name)
- [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]];
+ [[self window] setTitle:[NSString stringWithFormat:@"QEMU %s - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)", qemu_name]];
else
- [normalWindow setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"];
+ [[self window] setTitle:@"QEMU - (Press " UC_CTRL_KEY " " UC_ALT_KEY " G to release Mouse)"];
[self hideCursor];
CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
isMouseGrabbed = TRUE; // while isMouseGrabbed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:]
@@ -1076,9 +1075,9 @@ - (void) ungrabMouse
COCOA_DEBUG("QemuCocoaView: ungrabMouse\n");
if (qemu_name)
- [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
+ [[self window] setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
else
- [normalWindow setTitle:@"QEMU"];
+ [[self window] setTitle:@"QEMU"];
[self unhideCursor];
CGAssociateMouseAndMouseCursorPosition(TRUE);
isMouseGrabbed = FALSE;
@@ -1149,6 +1148,8 @@ - (void)adjustSpeed:(id)sender;
@implementation QemuCocoaAppController
- (id) init
{
+ NSWindow *window;
+
COCOA_DEBUG("QemuCocoaAppController: init\n");
self = [super init];
@@ -1162,20 +1163,20 @@ - (id) init
}
// create a window
- normalWindow = [[NSWindow alloc] initWithContentRect:[cocoaView frame]
+ window = [[NSWindow alloc] initWithContentRect:[cocoaView frame]
styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskClosable
backing:NSBackingStoreBuffered defer:NO];
- if(!normalWindow) {
+ if(!window) {
error_report("(cocoa) can't create window");
exit(1);
}
- [normalWindow setAcceptsMouseMovedEvents:YES];
- [normalWindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
- [normalWindow setTitle:qemu_name ? [NSString stringWithFormat:@"QEMU %s", qemu_name] : @"QEMU"];
- [normalWindow setContentView:cocoaView];
- [normalWindow makeKeyAndOrderFront:self];
- [normalWindow center];
- [normalWindow setDelegate: self];
+ [window setAcceptsMouseMovedEvents:YES];
+ [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+ [window setTitle:qemu_name ? [NSString stringWithFormat:@"QEMU %s", qemu_name] : @"QEMU"];
+ [window setContentView:cocoaView];
+ [window makeKeyAndOrderFront:self];
+ [window center];
+ [window setDelegate: self];
/* Used for displaying pause on the screen */
pauseLabel = [NSTextField new];
@@ -1298,7 +1299,7 @@ - (void) windowDidResignKey: (NSNotification *)aNotification
*/
- (void) doToggleFullScreen:(id)sender
{
- [normalWindow toggleFullScreen:sender];
+ [[cocoaView window] toggleFullScreen:sender];
}
- (void) setFullGrab:(id)sender
@@ -1982,7 +1983,7 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
/* if fullscreen mode is to be used */
if (opts->has_full_screen && opts->full_screen) {
- [normalWindow toggleFullScreen: nil];
+ [[cocoaView window] toggleFullScreen: nil];
}
if (opts->u.cocoa.has_full_grab && opts->u.cocoa.full_grab) {
[controller setFullGrab: nil];
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 08/10] ui/cocoa: Make window resizable
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (6 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 07/10] ui/cocoa: Remove normalWindow Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 09/10] ui/cocoa: Call console_select() with the BQL Akihiko Odaki
` (2 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
The window will be resizable when zoom-to-fit is on.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
ui/cocoa.m | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 05c91e4eed53..cebfae04d9e8 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1348,8 +1348,10 @@ - (void)zoomToFit:(id) sender
{
stretch_video = !stretch_video;
if (stretch_video == true) {
+ [cocoaView window].styleMask |= NSWindowStyleMaskResizable;
[sender setState: NSControlStateValueOn];
} else {
+ [cocoaView window].styleMask &= ~NSWindowStyleMaskResizable;
[cocoaView resizeWindow];
[sender setState: NSControlStateValueOff];
}
@@ -2002,6 +2004,7 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
if (opts->u.cocoa.has_zoom_to_fit && opts->u.cocoa.zoom_to_fit) {
stretch_video = true;
+ [cocoaView window].styleMask |= NSWindowStyleMaskResizable;
}
create_initial_menus();
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 09/10] ui/cocoa: Call console_select() with the BQL
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (7 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 08/10] ui/cocoa: Make window resizable Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 10/10] ui/cocoa: Remove stretch_video flag Akihiko Odaki
2024-02-26 18:19 ` [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Philippe Mathieu-Daudé
10 siblings, 0 replies; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
[-QemuCocoaView displayConsole:] can be called anytime so explicitly
take the BQL before it calls console_select().
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
ui/cocoa.m | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index cebfae04d9e8..33d31b82bcab 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1360,7 +1360,9 @@ - (void)zoomToFit:(id) sender
/* Displays the console on the screen */
- (void)displayConsole:(id)sender
{
- console_select([sender tag]);
+ with_bql(^{
+ console_select([sender tag]);
+ });
}
/* Pause the guest */
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v12 10/10] ui/cocoa: Remove stretch_video flag
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (8 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 09/10] ui/cocoa: Call console_select() with the BQL Akihiko Odaki
@ 2024-02-24 12:43 ` Akihiko Odaki
2024-02-26 17:02 ` Peter Maydell
2024-02-26 18:19 ` [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Philippe Mathieu-Daudé
10 siblings, 1 reply; 19+ messages in thread
From: Akihiko Odaki @ 2024-02-24 12:43 UTC (permalink / raw)
To: Peter Maydell, Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel, Akihiko Odaki
Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ui/cocoa.m | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 33d31b82bcab..b33842e70280 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -102,7 +102,6 @@ static void cocoa_switch(DisplayChangeListener *dcl,
static int left_command_key_enabled = 1;
static bool swap_opt_cmd;
-static bool stretch_video;
static NSTextField *pauseLabel;
static bool allow_events;
@@ -514,7 +513,7 @@ - (void) resizeWindow
{
[[self window] setContentAspectRatio:NSMakeSize(screen.width, screen.height)];
- if (!stretch_video) {
+ if (!([[self window] styleMask] & NSWindowStyleMaskResizable)) {
[[self window] setContentSize:NSMakeSize(screen.width, screen.height)];
[[self window] center];
} else if ([[self window] styleMask] & NSWindowStyleMaskFullScreen) {
@@ -1346,15 +1345,10 @@ - (void)showQEMUDoc:(id)sender
/* Stretches video to fit host monitor size */
- (void)zoomToFit:(id) sender
{
- stretch_video = !stretch_video;
- if (stretch_video == true) {
- [cocoaView window].styleMask |= NSWindowStyleMaskResizable;
- [sender setState: NSControlStateValueOn];
- } else {
- [cocoaView window].styleMask &= ~NSWindowStyleMaskResizable;
- [cocoaView resizeWindow];
- [sender setState: NSControlStateValueOff];
- }
+ NSWindowStyleMask styleMask = [[cocoaView window] styleMask] ^ NSWindowStyleMaskResizable;
+
+ [[cocoaView window] setStyleMask:styleMask];
+ [sender setState:styleMask & NSWindowStyleMaskResizable ? NSControlStateValueOn : NSControlStateValueOff];
}
/* Displays the console on the screen */
@@ -1619,7 +1613,7 @@ static void create_initial_menus(void)
menu = [[NSMenu alloc] initWithTitle:@"View"];
[menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter Fullscreen" action:@selector(doToggleFullScreen:) keyEquivalent:@"f"] autorelease]]; // Fullscreen
menuItem = [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" action:@selector(zoomToFit:) keyEquivalent:@""] autorelease];
- [menuItem setState: stretch_video ? NSControlStateValueOn : NSControlStateValueOff];
+ [menuItem setState: [[cocoaView window] styleMask] & NSWindowStyleMaskResizable ? NSControlStateValueOn : NSControlStateValueOff];
[menu addItem: menuItem];
menuItem = [[[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""] autorelease];
[menuItem setSubmenu:menu];
@@ -2005,7 +1999,6 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
}
if (opts->u.cocoa.has_zoom_to_fit && opts->u.cocoa.zoom_to_fit) {
- stretch_video = true;
[cocoaView window].styleMask |= NSWindowStyleMaskResizable;
}
--
2.43.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:]
2024-02-24 12:43 ` [PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:] Akihiko Odaki
@ 2024-02-26 16:58 ` Peter Maydell
0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2024-02-26 16:58 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel, qemu-devel
On Sat, 24 Feb 2024 at 12:43, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> Currently [-QemuCocoaView handleEventLocked:] parses the passed event,
> stores operations to be done to variables, and perform them according
> to the variables. This construct will be cluttered with variables and
> hard to read when we need more different operations for different
> events.
>
> Split the methods so that we can call appropriate methods depending on
> events instead of relying on variables.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v12 02/10] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]
2024-02-24 12:43 ` [PATCH v12 02/10] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:] Akihiko Odaki
@ 2024-02-26 16:59 ` Peter Maydell
0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2024-02-26 16:59 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel, qemu-devel
On Sat, 24 Feb 2024 at 12:43, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> Instead of using mouse_event variable to tell to handle a mouse event
> later, immediately call [-QemuCocoaView handleMouseEvent:buttons:].
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v12 03/10] ui/cocoa: Release specific mouse buttons
2024-02-24 12:43 ` [PATCH v12 03/10] ui/cocoa: Release specific mouse buttons Akihiko Odaki
@ 2024-02-26 17:00 ` Peter Maydell
0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2024-02-26 17:00 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel, qemu-devel
On Sat, 24 Feb 2024 at 12:43, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> ui/cocoa used to release all mouse buttons when it sees
> NSEventTypeLeftMouseUp, NSEventTypeRightMouseUp, or
> NSEventTypeOtherMouseUp, but it can instead release specific one
> according to the delivered event.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> ui/cocoa.m | 36 +++++++++++++++---------------------
> 1 file changed, 15 insertions(+), 21 deletions(-)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v12 05/10] ui/cocoa: Fix pause label coordinates
2024-02-24 12:43 ` [PATCH v12 05/10] ui/cocoa: Fix pause label coordinates Akihiko Odaki
@ 2024-02-26 17:01 ` Peter Maydell
0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2024-02-26 17:01 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel, qemu-devel
On Sat, 24 Feb 2024 at 12:43, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> A subview is positioned in the superview so the superview's frame
> should be used instead of one of the window to determine the
> coordinates.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v12 10/10] ui/cocoa: Remove stretch_video flag
2024-02-24 12:43 ` [PATCH v12 10/10] ui/cocoa: Remove stretch_video flag Akihiko Odaki
@ 2024-02-26 17:02 ` Peter Maydell
0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2024-02-26 17:02 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel, qemu-devel
On Sat, 24 Feb 2024 at 12:44, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> --
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v12 07/10] ui/cocoa: Remove normalWindow
2024-02-24 12:43 ` [PATCH v12 07/10] ui/cocoa: Remove normalWindow Akihiko Odaki
@ 2024-02-26 17:04 ` Peter Maydell
0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2024-02-26 17:04 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel, qemu-devel
On Sat, 24 Feb 2024 at 12:44, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> QemuCocoaView used to have fullScreenWindow but now it's gone, so we
> do no longer have to call the window specifically "normalWindow".
> Instead, refer to it with [-QemuCocoaView window].
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> ui/cocoa.m | 33 +++++++++++++++++----------------
> 1 file changed, 17 insertions(+), 16 deletions(-)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v12 06/10] ui/cocoa: Let the platform toggle fullscreen
2024-02-24 12:43 ` [PATCH v12 06/10] ui/cocoa: Let the platform toggle fullscreen Akihiko Odaki
@ 2024-02-26 17:14 ` Peter Maydell
0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2024-02-26 17:14 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Philippe Mathieu-Daudé, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel, qemu-devel
On Sat, 24 Feb 2024 at 12:44, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> It allows making the window full screen by clicking full screen button
> provided by the platform (the left-top green button) and save some code.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> ui/cocoa.m | 408 +++++++++++++++++++++++++++----------------------------------
> 1 file changed, 181 insertions(+), 227 deletions(-)
>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
` (9 preceding siblings ...)
2024-02-24 12:43 ` [PATCH v12 10/10] ui/cocoa: Remove stretch_video flag Akihiko Odaki
@ 2024-02-26 18:19 ` Philippe Mathieu-Daudé
10 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-26 18:19 UTC (permalink / raw)
To: Akihiko Odaki, Peter Maydell, Gerd Hoffmann,
Marc-André Lureau, Marek Glogowski, BALATON Zoltan,
Rene Engel
Cc: qemu-devel
On 24/2/24 13:43, Akihiko Odaki wrote:
> Akihiko Odaki (10):
> ui/cocoa: Split [-QemuCocoaView handleEventLocked:]
> ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]
> ui/cocoa: Release specific mouse buttons
> ui/cocoa: Scale with NSView instead of Core Graphics
> ui/cocoa: Fix pause label coordinates
> ui/cocoa: Let the platform toggle fullscreen
> ui/cocoa: Remove normalWindow
> ui/cocoa: Make window resizable
> ui/cocoa: Call console_select() with the BQL
> ui/cocoa: Remove stretch_video flag
Series queued, thanks for all the people involved over
the various iterations!
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-02-26 18:21 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-24 12:43 [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 01/10] ui/cocoa: Split [-QemuCocoaView handleEventLocked:] Akihiko Odaki
2024-02-26 16:58 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 02/10] ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:] Akihiko Odaki
2024-02-26 16:59 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 03/10] ui/cocoa: Release specific mouse buttons Akihiko Odaki
2024-02-26 17:00 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 04/10] ui/cocoa: Scale with NSView instead of Core Graphics Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 05/10] ui/cocoa: Fix pause label coordinates Akihiko Odaki
2024-02-26 17:01 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 06/10] ui/cocoa: Let the platform toggle fullscreen Akihiko Odaki
2024-02-26 17:14 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 07/10] ui/cocoa: Remove normalWindow Akihiko Odaki
2024-02-26 17:04 ` Peter Maydell
2024-02-24 12:43 ` [PATCH v12 08/10] ui/cocoa: Make window resizable Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 09/10] ui/cocoa: Call console_select() with the BQL Akihiko Odaki
2024-02-24 12:43 ` [PATCH v12 10/10] ui/cocoa: Remove stretch_video flag Akihiko Odaki
2024-02-26 17:02 ` Peter Maydell
2024-02-26 18:19 ` [PATCH v12 00/10] ui/cocoa: Use NSWindow's ability to resize Philippe Mathieu-Daudé
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).