GTK3 -- query mouse pointer coordinates for keyboard input?

I recently ported a GTK2 application to GTK3

I had some working Ruby code like this for GTK2:

def distribute_events(pda, event)
if event.event_type == Gdk::Event::Type::KEY_PRESS
px, py = pda.get_user_coordinates(*pda.pointer)
px, py = pda.get_user_coordinates(event.x, event.y)

window.get_pointer() is deprecated in GTK3.

We should use

But for this function we need a reference to the pointing device, which
is not available from keyboard event.

Or in other words:
In GTK3-demo there is an Drawing_Area application where we can draw when
we held down the left mouse key: How can we draw a circle at the current
mouse position when we press 'C' key?

Best regards,

Stefan Salewski

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