Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mac only?] Weird Menu Strings #1631

Closed
Kazzz-S opened this issue Feb 24, 2024 · 5 comments · Fixed by #1634
Closed

[mac only?] Weird Menu Strings #1631

Kazzz-S opened this issue Feb 24, 2024 · 5 comments · Fixed by #1634
Assignees
Labels

Comments

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Feb 24, 2024

This problem was reported by @stefanottili at least twice:

  1. compiling with qt6 shows one error, can't quit klayout on MacBook M1 #1452 (comment)
  2. [Qt6] Cannot normally quit the main application window #1602 (comment)

I could reproduce the problem on Monterey (Intel Mac) as follows.


Build and Deploy

  • Using Qt 6.6.2 from Homebrew,
% ./build4mac.py -q qt6brew -r hb33 -p hb311  (build)

% ./build4mac.py -q qt6brew -r hb33 -p hb311  -Y (deploy)

Test-1: direct start of the executable

  1. Copy the attached macQAT.py script to the qt6Brew.bin.macos-Monterey-release-Rhb33Phb311/ directory.
  2. Move to the directory.
  3. Then, invoke ./macQAT.py -k, where
    • the DYLD_LIBRARY_PATH environment variable is set appropriately.
    • the executable ./klayout.app/Contents/MacOS/klayout is invoked.

The outputs are as follows.
error-messages
weird-menu-strings-1
weird-menu-strings-2

  • All attempts (more than 10 times) started with Case-1. However, Case-2 occurred occasionally during a session (conditions not determinable).

Test-2: open the application bundle

  1. Move to the LW-qt6Brew.pkg.macos-Monterey-release-Rhb33Phb311 directory.
  2. Then, invoke open ./klayout.app/
    normal-menu-strings
  • Normal in all attempts.

Kazzz-S

@klayoutmatthias
Copy link
Collaborator

My guess is that for some reason MacOS picks the "Ruby program name" for the menus.

KLayout calls a function named "rb_set_progname" from the embedded Ruby interpreter. It does so that Ruby reports error messages in the proper context.

Maybe on MacOS, Ruby somehow passes this name to the system which makes it think that the program is called "" once a macro has been executed from the console.

Matthias

@klayoutmatthias klayoutmatthias linked a pull request Feb 26, 2024 that will close this issue
@klayoutmatthias
Copy link
Collaborator

klayoutmatthias commented Feb 26, 2024

After checking the Ruby source code I believe that the patch provided in the PR for this issue may fix the issue.

Apparently Ruby decided not only to change the internal program name, but also the process name when setting the "PROGRAM_NAME" global variable. There is an alternative function which appears to do the same thing without this side effect.

The important hint was the <immediate> string.

Maybe you can check this and give feedback whether the problem is fixed?

Thanks,

Matthias

@stefanottili
Copy link

Problem fixed, tested on M1 macOS Sonoma.

@klayoutmatthias
Copy link
Collaborator

klayoutmatthias commented Feb 26, 2024

OMG ... hard to believe it was that simple.

I swear I had no clue where to look at, until I saw the <immediate> thing. That was a kind of eye opener.

Matthias

@Kazzz-S
Copy link
Contributor Author

Kazzz-S commented Feb 26, 2024

Hi @klayoutmatthias,

Thank you for your efforts to resolve this issue.
I've re-run the same Test-1 and Test-2 above with the PR branch and confirmed that the issue has been resolved :-)

Best regards,
Kazzz-S

klayoutmatthias added a commit that referenced this issue Mar 9, 2024
Co-authored-by: Matthias Koefferlein <matthias@klayout.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants