andlabs / andlabs/libui

MacOSX menu item Quit not working

オープン
#501 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C
スター
10.9k
フォーク
612
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi,

First of all, I'd like to say thanks for this amazing library! I've used it in my cross-platform project:
https://gitlab.com/bztsrc/usbimager
which is an extremely small (ca. 256k) compressed disk image writer with a minimalistic GUI. I use libui for Cocoa and for GTK under Linux.

I had issues with linking the provided examples under Windows, so I gave up on that part and implemented win32 myself. Any reason why you've used C++ there instead of C? Just curious, off topic.

I also had some other issues under MacOSX, mostly with multiple threads and progressbars, but I was able to solve them all. There's one thing left though, which is kept reported over and over again. Under MacOSX the menu contains a grayed out Quit and the Cmd+Q shortcut does not work either.

I took a deep dive in the source, and I've found https://github.com/andlabs/libui/blob/master/darwin/menu.m#L176 which looks okay to me and also has the keybinding set. Yet Quit is not working. I don't use multiple windows, I don't need user defined menu items, nothing extra. I've found a ticket on the Go version with exactly the same problem, and it was closed pointing to issue #321. However there's no explanation in that issue on how to enable Quit.

So may question is, what I'm doing wrong? How should I change the code to have a working Quit menu item? Here's my code: https://gitlab.com/bztsrc/usbimager/-/blob/master/src/main_libui.c#L440

Do I need some special option or something? (However I did not see any "if"s in "makeMenubar" nor in "buildApplicationMenu"). If I need to add a Quit item manually, how can I do it? "uiMenuAppendQuitItem" requires an uiMenu pointer, but I don't want to call "uiNewMenu", as it has to be added to the already existing application menu. What is the correct way to do this?

Thanks for this awesome library,
bzt

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。