mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
app/internal/wm: [macOS] make app emnu responsive on launch
The macOS app menu would respond to clicks, only to shotcuts (Cmd-Q, Cmd-H). Moving setActivationPolicy to applicationDidFinishLaunching seems to fix that, although I can't explain why. Move a SetDriver call after initialization while here. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -395,9 +395,9 @@ func NewWindow(win Callbacks, opts *Options) error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
errch <- nil
|
errch <- nil
|
||||||
win.SetDriver(w)
|
|
||||||
w.w = win
|
w.w = win
|
||||||
w.window = C.gio_createWindow(w.view, nil, 0, 0, 0, 0, 0, 0)
|
w.window = C.gio_createWindow(w.view, nil, 0, 0, 0, 0, 0, 0)
|
||||||
|
win.SetDriver(w)
|
||||||
w.Option(opts)
|
w.Option(opts)
|
||||||
if nextTopLeft.x == 0 && nextTopLeft.y == 0 {
|
if nextTopLeft.x == 0 && nextTopLeft.y == 0 {
|
||||||
// cascadeTopLeftFromPoint treats (0, 0) as a no-op,
|
// cascadeTopLeftFromPoint treats (0, 0) as a no-op,
|
||||||
|
|||||||
@@ -316,7 +316,8 @@ CFTypeRef gio_createView(void) {
|
|||||||
|
|
||||||
@implementation GioAppDelegate
|
@implementation GioAppDelegate
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||||
[[NSRunningApplication currentApplication] activateWithOptions:(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
gio_onFinishLaunching();
|
gio_onFinishLaunching();
|
||||||
}
|
}
|
||||||
- (void)applicationDidHide:(NSNotification *)aNotification {
|
- (void)applicationDidHide:(NSNotification *)aNotification {
|
||||||
@@ -332,7 +333,6 @@ void gio_main() {
|
|||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
GioAppDelegate *del = [[GioAppDelegate alloc] init];
|
GioAppDelegate *del = [[GioAppDelegate alloc] init];
|
||||||
[NSApp setDelegate:del];
|
[NSApp setDelegate:del];
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
|
||||||
|
|
||||||
NSMenuItem *mainMenu = [NSMenuItem new];
|
NSMenuItem *mainMenu = [NSMenuItem new];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user