andlabs / andlabs/libui

MacOSX menu item Quit not working

Đang mở
#501 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C
Star
10.9k
Fork
612
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.