Re: GTK3 -- query mouse pointer coordinates for keyboard input?



Yeah. This is to maintain ABI compatibility. Technically, events have private internal data, and you can use gdk_event_get_device(); to get the keyboard device for a key event.

This isn't documented very well; we should perhaps clean this up.


On Fri, Jan 17, 2014 at 5:05 PM, Stefan Salewski <mail ssalewski de> wrote:
On Fri, 2014-01-17 at 16:38 -0500, Jasper St. Pierre wrote:
> If you have a keyboard device, you can use
> gdk_device_get_associated_device() to return the paired mouse device.

Fine -- but currently I have only a keyboard event as described in

https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#GdkEventKey

There is no reference to a device. For mouse buttons I have

https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#GdkEventButton

which has a device field. That is fine.

After much googling I found GdkDisplay

https://developer.gnome.org/gdk/unstable/GdkDisplay.html

which may help finding a pointing device, but that seems to be much
complicated overhead.

You may say that mouse and keyboard input is generally fully unrelated.
In theory  that may be true, but for CAD applications we really want
keyboard input related to current mouse pointer position, i.e. delete
object under mouse cursor when 'X' or 'DEL' key is pressed. That is much
faster than context menu or button clicks. And professionals prefer
working fast.

Best regards,

Stefan Salewski





--
  Jasper


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]