|
From: | Imran Yusuff |
Subject: | Re: [PATCH] ui/cocoa: Fixed modeswitching glitch in zoomed fullscreen mode |
Date: | Sun, 19 Jun 2022 08:38:40 +0100 |
On 2022/06/19 9:41, Imran Yusuff wrote:
> This applies only on macOS using cocoa UI library.
>
> In zoom-to-fit fullscreen mode, upon graphics mode switch,
> the viewport size is wrong, and the usual consequence
> is only a part of the screen is visible. One have to exit
> and reenter fullscreen mode to fix this.
>
> This is reproducible by setting up a Windows 3.11 system,
> booting into DOS, enable zoom-to-fit, enter fullscreen mode and
> start Windows by 'win'. Then you can see only part of the screen.
>
> This commit fixes this problem, by including one line of code
> which is from the fullscreen mode initialization.
>
> Signed-off-by: Imran Yusuff <imranyusuff@gmail.com>
> ---
> ui/cocoa.m | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 84c84e98fc..bd602817cd 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -636,6 +636,7 @@ - (void) switchSurface:(pixman_image_t *)image
> 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];
> + [self setFrame:NSMakeRect(cx, cy, cw, ch)];
> } else {
> if (qemu_name)
> [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]];
[self setFrame:NSMakeRect(cx, cy, cw, ch)] already exist in the earlier
part of the method. It is redundant and not a proper way to fix. It is
necessary to understand why adding the same statement fixes the problem,
and to fix it without duplicate statements. I can think of two
possibilities:
1. The isResize variable is not enough to cover all the situations when
the statement needs to be executed.
2. The statement needs to be executed after [normalWindow setFrame:].
In case 1, you need to assign a correct value to isResize or add [self
setFrame:] to somewhere else, but not in [-CocoaView switchSurface].
Putting the statement in [-CocoaView switchSurface] may cause redundant
execution of the statement when isResize is true as I explained.
In case 2, the existing statement should be simply moved.
By the way, I have a patch to rewrite the code implementing full screen
so you may try it. If you tested the patch, please give Tested-by.
https://patchew.org/QEMU/20220316060244.46669-1-akihiko.odaki@gmail.com/
Regards,
Akihiko Odaki
[Prev in Thread] | Current Thread | [Next in Thread] |