Re: [gtk-osx-users] getting a signal when the dock icon is clicked on



Hi Antoine,

Clicking the app dock icon or double clicking the app in Finder generates a reopen event, which causes the 
NSApplication delegate to receive the applicationShouldHandleReopen:hasVisibleWindows: message.

You could add support for this to gtkosxapplication_quartz.c and GtkApplicationDelegate.[hc] and make a pull 
request.

For now, the simple way to handle this is to just link a category on GtkApplicationDelegate.
You might want to use g_signal_emit(), like GtkApplicationDelegate does.

// GtkApplicationDelegate_Additions.m

#include "GtkApplicationDelegate.h"
extern void handle_dock_icon_clicked();

@implementation GtkApplicationDelegate (GtkApplicationDelegate_Additions)

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication
                    hasVisibleWindows:(BOOL)flag
{
    handle_dock_icon_clicked();
    return YES;
}

@end



On Mar 15, 2016, at 10:54 PM, Antoine Martin <antoine nagafix co uk> wrote:

Hi,

I would like to get notified when the dock is clicked on, so that I can
restore any windows currently minimized. (that's the expected behaviour
on OSX apparently)

The only signal I can listen for that fires when one clicks on the dock
is the "NSApplicationDidBecomeActive", but that's not really what I am
looking for since it will also fire in other cases.
Am I missing something?
Is anyone already doing this in other gtk-osx applications?

Thanks
Antoine
_______________________________________________
Gtk-osx-users-list mailing list
Gtk-osx-users-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-osx-users-list



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