[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Help with keyboard event capture and focus in/out
From:       Giovanni Panozzo <giovanni () panozzo ! it>
Date:       2016-10-23 19:13:19
Message-ID: 43bbad5c-448d-7e24-fab3-1864c33fe6e1 () panozzo ! it
[Download RAW message or body]


My application needs to capture keyboard events: when my windows is 
focused, I want all keystrokes routed to my app, and not to the WM.

For example pressing Super key on Ubutntu Unity, should not open the 
dash, but activate a function in my application.

So I used gdk_device_grab() to capture keyboard events.

But when gdk_device_grab() is in effect, I no longer receive 
"focus-out-event" signal, so my application can never release the grab.

How can I fix it ?

Attached is a full working example which exposes the problem, I'm using 
Ubuntu 16.04 (GTK 3.18).

Compile it with

gcc `pkg-config --cflags gtk+-3.0` -o testkbgrab \
    testkbgrab.c  `pkg-config --libs gtk+-3.0`

Thank you for your help.

Giovanni

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic