Cannot get GtkKeySnoopFunc to trigger

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Cannot get GtkKeySnoopFunc to trigger

Postby gonzobrains » Tue Dec 02, 2014 8:03 pm

Hi,

I've written an app based on the cefclient for Linux (using GTK). I want to intercept unwanted keys and block them, but I cannot seem to get my snooper function to be triggered using the gtk_key_snooper_install() method.

Has anyone tried this before? Any ideas?

Thanks,
gonzobrains
gonzobrains
Techie
 
Posts: 15
Joined: Tue Nov 04, 2014 11:44 am

Re: Cannot get GtkKeySnoopFunc to trigger

Postby magreenblatt » Wed Dec 03, 2014 4:23 am

Use CefKeyboardHandler::OnPreKeyEvent.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Cannot get GtkKeySnoopFunc to trigger

Postby gonzobrains » Wed Dec 03, 2014 1:55 pm

Hi again,

Thanks for the reply. I determined that the key snooper function was getting called but only when my splash screen was active. After I hid the splashscreen the snooper wouldn't get triggered when my "main" screen was up. I have no idea why but I will try your suggestion.

If I use CefKeyboardHandler::OnPreKeyEvent will I be able to catch all key events entered and selectively allow/disallow them?

Thanks,
Jeff
gonzobrains
Techie
 
Posts: 15
Joined: Tue Nov 04, 2014 11:44 am

Re: Cannot get GtkKeySnoopFunc to trigger

Postby magreenblatt » Wed Dec 03, 2014 2:23 pm

gonzobrains wrote:If I use CefKeyboardHandler::OnPreKeyEvent will I be able to catch all key events entered and selectively allow/disallow them?

Yes, if the browser has focus.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Cannot get GtkKeySnoopFunc to trigger

Postby gonzobrains » Wed Dec 03, 2014 2:32 pm

My intention is to make the browser full screen and prevent the browser from losing focus (i.e., kiosk mode). I need to trap all key events and deny any undesirable ones, especially those that would cause the browser to lose focus (i.e., task switching, print screen, etc.). Can I use this method for that?
gonzobrains
Techie
 
Posts: 15
Joined: Tue Nov 04, 2014 11:44 am

Re: Cannot get GtkKeySnoopFunc to trigger

Postby magreenblatt » Wed Dec 03, 2014 2:49 pm

It probably won't let you catch keyboard combinations usually handled by the WM. You'll likely need to hook the WM for that (or maybe the WM supports a kiosk-style mode?).
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Cannot get GtkKeySnoopFunc to trigger

Postby gonzobrains » Wed Dec 03, 2014 2:54 pm

That's why I was trying to get the GTK key snooping to work. Maybe I need to do this at the X-Windows level?
gonzobrains
Techie
 
Posts: 15
Joined: Tue Nov 04, 2014 11:44 am


Return to CEF Discussion

Who is online

Users browsing this forum: Google [Bot] and 46 guests