Re: [gtk-osx-users] command-h to hide app?




On Oct 14, 2013, at 10:51 AM, Allin Cottrell <cottrell wfu edu> wrote:

Using gtkosxapplication, I get a "Hide <app>" item under my app's top-of-screen Mac menu, and this works 
fine if moused. However, it shows an accelerator of command-h and that doesn't work.

One thing that could be stopping it from working is that gtk-quartz (2.24) uses command-h as the 
accelerator with GTK_STOCK_HELP, but I've switched the help accelerator to command-question mark and that 
didn't help with the Hide business.

Can anyone suggest a way of getting command-h to do the hiding thing? I admit I'm a bit hazy on which if 
any key-strokes get handled by OS X versus getting passed on to GDK. But I guess I'm asking whether (a) 
there's way to get the OS to handle command-h, or failing that (b) there's a way, within my GTK code, to 
call the hide-app function that the OS would otherwise call. (I can iconify all my app's windows easily 
enough, but that's not really the same as what OS X's "Hide" does.)


Hide and Hide Others are Apple functions, not Gtk ones, so the accelerators only work if 
use-quartz-accelerators is enabled. It isn't by default because it messes up the responder chain for key 
bindings by grabbing the accelerator event before it's passed to Gtk. I suppose the fix is to add 
corresponding GtkActions that call [theApp hide:] and [theApp hideOtherApplications:] to catch the 
accelerators.

Regards,
John Ralls




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