Thread: [Gtk-osx-users] StatusIcon, popup menu does not get focus
Status: Beta
Brought to you by:
jralls
From: Antoine M. <an...@na...> - 2011-05-02 10:12:08
Attachments:
test-statusicon.py
|
Hi, My app uses a popdown menu from a StatusIcon, it does not necessarily have any windows of its own shown on screen. The problem is that the popdown menu shown ('popup-menu' signal on the StatusIcon) will react to mouse clicks correctly if the app was already focused, but not if another app was in the foreground and the user clicks on the StatusIcon ('activate' signal). It then takes a long click to get the menu to register it (as the app has to gain focus). Is there a way I can force my application to gain focus when the StatusIcon is clicked on? Or another workaround? Simple example application attached (add a 'tray.png' icon of your choosing). Run it, then try to interact with the menu hanging of it. Thanks Antoine |
From: John R. <jr...@ce...> - 2011-05-02 17:36:11
|
On May 2, 2011, at 3:11 AM, Antoine Martin wrote: > Hi, > > My app uses a popdown menu from a StatusIcon, it does not necessarily > have any windows of its own shown on screen. > > The problem is that the popdown menu shown ('popup-menu' signal on the > StatusIcon) will react to mouse clicks correctly if the app was already > focused, but not if another app was in the foreground and the user > clicks on the StatusIcon ('activate' signal). It then takes a long click > to get the menu to register it (as the app has to gain focus). > > Is there a way I can force my application to gain focus when the > StatusIcon is clicked on? Or another workaround? > > Simple example application attached (add a 'tray.png' icon of your > choosing). Run it, then try to interact with the menu hanging of it. Interesting. I instrumented your sample with a few more print statements, and it looks like on OSX the "activate" signal is either not getting sent or not getting received. Please (after checking that there isn't one already) file a bug. Regards, John Ralls |
From: Antoine M. <an...@na...> - 2011-05-02 17:44:04
|
On 05/03/2011 12:36 AM, John Ralls wrote: > > On May 2, 2011, at 3:11 AM, Antoine Martin wrote: > >> Hi, >> >> My app uses a popdown menu from a StatusIcon, it does not necessarily >> have any windows of its own shown on screen. >> >> The problem is that the popdown menu shown ('popup-menu' signal on the >> StatusIcon) will react to mouse clicks correctly if the app was already >> focused, but not if another app was in the foreground and the user >> clicks on the StatusIcon ('activate' signal). It then takes a long click >> to get the menu to register it (as the app has to gain focus). >> >> Is there a way I can force my application to gain focus when the >> StatusIcon is clicked on? Or another workaround? >> >> Simple example application attached (add a 'tray.png' icon of your >> choosing). Run it, then try to interact with the menu hanging of it. > > Interesting. > > I instrumented your sample with a few more print statements, and it looks like on OSX the "activate" signal is either not getting sent or not getting received. IIRC, the 'activate' signal fires but only when the application is already in focus and you click on the StatusIcon again. > Please (after checking that there isn't one already) file a bug. Sorry, probably a silly question, but where? This bug (the only open gtk-osx one?) is also related to focus: http://sourceforge.net/tracker/?func=detail&aid=660693&group_id=70160&atid=526807 FYI: I did try all sorts of ways to focus the widget, or rather the gdk window that backs it, to no avail. Thanks Antoine > > Regards, > John Ralls > > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > Gtk-osx-users mailing list > Gtk...@li... > https://lists.sourceforge.net/lists/listinfo/gtk-osx-users |
From: John R. <jr...@ce...> - 2011-05-02 19:18:03
Attachments:
test-statusicon.py
|
On May 2, 2011, at 10:43 AM, Antoine Martin wrote: > On 05/03/2011 12:36 AM, John Ralls wrote: >> >> On May 2, 2011, at 3:11 AM, Antoine Martin wrote: >> >>> Hi, >>> >>> My app uses a popdown menu from a StatusIcon, it does not necessarily >>> have any windows of its own shown on screen. >>> >>> The problem is that the popdown menu shown ('popup-menu' signal on the >>> StatusIcon) will react to mouse clicks correctly if the app was already >>> focused, but not if another app was in the foreground and the user >>> clicks on the StatusIcon ('activate' signal). It then takes a long click >>> to get the menu to register it (as the app has to gain focus). >>> >>> Is there a way I can force my application to gain focus when the >>> StatusIcon is clicked on? Or another workaround? >>> >>> Simple example application attached (add a 'tray.png' icon of your >>> choosing). Run it, then try to interact with the menu hanging of it. >> >> Interesting. >> >> I instrumented your sample with a few more print statements, and it looks like on OSX the "activate" signal is either not getting sent or not getting received. > IIRC, the 'activate' signal fires but only when the application is > already in focus and you click on the StatusIcon again. Maybe in your application. In the test app, it never fires, only the popup-menu signal does... and it does even when the application doesn't have focus. What doesn't work when the app doesn't have focus is the menu, because the event loop that works the menu isn't running when the app doesn't have focus, so it can't get any events. I've attached my revised test-statusicon.py. Try it and see if you can get the "Icon Activated" message. > >> Please (after checking that there isn't one already) file a bug. > Sorry, probably a silly question, but where? > This bug (the only open gtk-osx one?) is also related to focus: > http://sourceforge.net/tracker/?func=detail&aid=660693&group_id=70160&atid=526807 > > FYI: I did try all sorts of ways to focus the widget, or rather the gdk > window that backs it, to no avail. > No, in bugzilla against Gtk. It's a gtk bug, not a gtk-osx bug. Regards, John Ralls |
From: Antoine M. <an...@na...> - 2011-05-12 09:44:09
|
(snip) > I've attached my revised test-statusicon.py. Try it and see if you can get the "Icon Activated" message. I'll give it a go asap (a week or two). > No, in bugzilla against Gtk. It's a gtk bug, not a gtk-osx bug. Found an existing bug so I added info there, looks like the same issue: https://bugzilla.gnome.org/show_bug.cgi?id=549153 Cheers Antoine |
From: John R. <jr...@ce...> - 2011-05-12 12:36:02
|
On May 12, 2011, at 5:43 AM, Antoine Martin wrote: > (snip) >> I've attached my revised test-statusicon.py. Try it and see if you can get the "Icon Activated" message. > I'll give it a go asap (a week or two). > >> No, in bugzilla against Gtk. It's a gtk bug, not a gtk-osx bug. > Found an existing bug so I added info there, looks like the same issue: > https://bugzilla.gnome.org/show_bug.cgi?id=549153 Great, thanks. Regards, John Ralls |
From: Antoine M. <an...@na...> - 2011-05-17 07:32:37
|
On 05/12/2011 07:35 PM, John Ralls wrote: > > On May 12, 2011, at 5:43 AM, Antoine Martin wrote: > >> (snip) >>> I've attached my revised test-statusicon.py. Try it and see if you can get the "Icon Activated" message. >> I'll give it a go asap (a week or two). I couldn't get it to fire... I must have imagined it. >> >>> No, in bugzilla against Gtk. It's a gtk bug, not a gtk-osx bug. >> Found an existing bug so I added info there, looks like the same issue: >> https://bugzilla.gnome.org/show_bug.cgi?id=549153 > > Great, thanks. The suggested patch sounds like it should solve the problem: https://bugzilla.gnome.org/show_bug.cgi?id=549153#c12 But it doesn't seem to be making any difference for me. Can you double check? Is there any way we can force the application to become active when the status icon is clicked? Whatever currently makes NSApplicationDidBecomeActive fire? Cheers Antoine > > Regards, > John Ralls |
From: John R. <jr...@ce...> - 2011-05-17 15:03:45
|
On May 17, 2011, at 12:32 AM, Antoine Martin wrote: > On 05/12/2011 07:35 PM, John Ralls wrote: >> >> On May 12, 2011, at 5:43 AM, Antoine Martin wrote: >> >>> (snip) >>>> I've attached my revised test-statusicon.py. Try it and see if you can get the "Icon Activated" message. >>> I'll give it a go asap (a week or two). > I couldn't get it to fire... I must have imagined it. > > >>> >>>> No, in bugzilla against Gtk. It's a gtk bug, not a gtk-osx bug. >>> Found an existing bug so I added info there, looks like the same issue: >>> https://bugzilla.gnome.org/show_bug.cgi?id=549153 >> >> Great, thanks. > The suggested patch sounds like it should solve the problem: > https://bugzilla.gnome.org/show_bug.cgi?id=549153#c12 > But it doesn't seem to be making any difference for me. Can you double > check? > > Is there any way we can force the application to become active when the > status icon is clicked? Whatever currently makes > NSApplicationDidBecomeActive fire? Can we keep the discussion about that on the bug? It's not really a gtk-osx issue, and AFAIK Paul doesn't read this list. As for getting the application to become active, the statusicon emits a POPUP_MENU_SIGNAL when it's clicked. You can handle that anyway you like. Regards, John Ralls |
From: Antoine M. <an...@na...> - 2011-05-27 05:49:14
|
On 05/17/2011 10:03 PM, John Ralls wrote: > > On May 17, 2011, at 12:32 AM, Antoine Martin wrote: > >> On 05/12/2011 07:35 PM, John Ralls wrote: >>> >>> On May 12, 2011, at 5:43 AM, Antoine Martin wrote: >>> >>>> (snip) >>>>> I've attached my revised test-statusicon.py. Try it and see if you can get the "Icon Activated" message. >>>> I'll give it a go asap (a week or two). >> I couldn't get it to fire... I must have imagined it. >> >> >>>> >>>>> No, in bugzilla against Gtk. It's a gtk bug, not a gtk-osx bug. >>>> Found an existing bug so I added info there, looks like the same issue: >>>> https://bugzilla.gnome.org/show_bug.cgi?id=549153 >>> >>> Great, thanks. >> The suggested patch sounds like it should solve the problem: >> https://bugzilla.gnome.org/show_bug.cgi?id=549153#c12 >> But it doesn't seem to be making any difference for me. Can you double >> check? >> >> Is there any way we can force the application to become active when the >> status icon is clicked? Whatever currently makes >> NSApplicationDidBecomeActive fire? > > Can we keep the discussion about that on the bug? It's not really a gtk-osx issue, and AFAIK Paul doesn't read this list. Yes, sorry about that and about the delay for this response. I was just hoping that someone could confirm my findings before posting. (bug has now been updated) > As for getting the application to become active, the statusicon emits a POPUP_MENU_SIGNAL when it's clicked. > You can handle that anyway you like. Yes, I can do anything I like when I get the event, I just don't know what OSX api to call to make the application active. Cheers Antoine > > Regards, > John Ralls > |