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

Reply via email to