[Top][All Lists]

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

Re: [PATCH v2] ui/cocoa: Fix openFile: deprecation on Big Sur

From: BALATON Zoltan
Subject: Re: [PATCH v2] ui/cocoa: Fix openFile: deprecation on Big Sur
Date: Sat, 9 Jan 2021 00:13:36 +0100 (CET)

On Sat, 9 Jan 2021, Roman Bolshakov wrote:
On Fri, Jan 08, 2021 at 03:00:07PM +0000, Peter Maydell wrote:
On Fri, 8 Jan 2021 at 13:50, Peter Maydell <peter.maydell@linaro.org> wrote:

On Sat, 2 Jan 2021 at 15:14, Roman Bolshakov <r.bolshakov@yadro.com> wrote:

ui/cocoa.m:1188:44: warning: 'openFile:' is deprecated: first deprecated in 
macOS 11.0 - Use -[NSWorkspace openURL:] instead.
        if ([[NSWorkspace sharedWorkspace] openFile: full_file_path] == YES) {
      'openFile:' has been explicitly marked deprecated here
- (BOOL)openFile:(NSString *)fullPath API_DEPRECATED("Use -[NSWorkspace openURL:] 
instead.", macos(10.0, 11.0));

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

So I was just trying to test this patch, and I found that at least
for me the osx menu bar has stopped working in QEMU -- keyboard
shortcuts to it still work but none of the menu buttons respond
to the mouse. Does that happen for anybody else?

There's an old bug when QEMU menu bar is not responsive because it's not
properly activated. If you click off qemu and click on the qemu dock
icon then it "gets fixed" (cmd-tab works too). Do you hit the issue as
described in the article [1]? The code in the article does exactly the
same what I'm doing manually. I wanted to fix it but somehow it got
postponed for like a whole year :) I might try to make a fix this but
note, the issue is not related to the patch.

This does not sound like the best solution to the problem. There's some info on this here (and blog post linked from it):


Maybe we call makeKeyAndOrderFront: too early before the app is active and that's causing the problem? Would it work better if that's moved after [NSApp run]? (Maybe we also need canBecomeKey: somewhere but I don't see why would that be needed for normal windows.)


Also, the "bring up the docs" help option (which is what this
patch is changing) doesn't seem to work when QEMU is run from
the source tree and the docs haven't been installed to the
locations where it expects it might find them. Probably the
code needs updating to work with qemu_find_file() or some
variant on it.

If I add:
diff --git a/ui/cocoa.m b/ui/cocoa.m
index ea3b845b53..4772b7f981 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1189,6 +1189,7 @@ - (void) openDocumentation: (NSString *) filename
                          path_array[index], filename];
        full_file_url = [NSURL fileURLWithPath: full_file_path
                                   isDirectory: false];
+        NSLog(@"%@", full_file_url);
        if ([[NSWorkspace sharedWorkspace] openURL: full_file_url] == YES) {

And click "Help"->"QEMU Documentation". I get the following logs:
2021-01-08 23:14:15.288 qemu-system-x86_64[46165:12969383] 
2021-01-08 23:14:15.288 qemu-system-x86_64[46165:12969383] 
2021-01-08 23:14:15.288 qemu-system-x86_64[46165:12969383] 

In order to get documentation on macOS. sphinx-doc has to be installed
from homebrew. The package is keg-only so sphinx-build has to be added
to PATH.

Then you can build with --enable-docs. Generated documentation resides
in the build tree after the QEMU has been switched to meson:

find . -name index.html

The problem is that the paths above don't point to docs in build tree.
The patch only fixes a warning and doesn't break existing path
resolution. The fix for out-of-tree docs is trivial:
diff --git a/ui/cocoa.m b/ui/cocoa.m
index ea3b845b53..13fba8103e 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1176,7 +1176,7 @@ - (void)toggleFullScreen:(id)sender
- (void) openDocumentation: (NSString *) filename
    /* Where to look for local files */
-    NSString *path_array[] = {@"../share/doc/qemu/", @"../doc/qemu/", 
+    NSString *path_array[] = {@"../share/doc/qemu/", @"../doc/qemu/", 
    NSString *full_file_path;
    NSURL *full_file_url;

I'll add it as a separate patch to v2.



reply via email to

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