Help with keyboard event capture and focus in/out
- From: Giovanni Panozzo <giovanni panozzo it>
- To: gtk-app-devel-list gnome org
- Subject: Help with keyboard event capture and focus in/out
- Date: Sun, 23 Oct 2016 21:13:19 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]