Gtk3 hasn't changed that much in this area -- it is still incorrect to call gdk_window_get_device_position & friends from event handlers.
It seems that if you want or expect an integer, then you should just truncate/round the event.x / event.y values. On Sun Jan 04 2015 at 4:43:30 AM Andreas Lobinger <lobing...@gmail.com> wrote: > The code in Gtk/events.jl, signals.jl and cairo.jl is clearly gtk2 style > and working correctly. However in Gtk3 the event reporting slightly > changed, so using event->x and event->y returns (somehow) subpixel > resolution (which makes sense for some pointer devices, maybe not for a > mouse pointer), to get the 'regular' pixel resolution one needs to call > gdk_window_get_device_position > for events with event.is_hint = true. The Gtk3 documentation is blurry in > this case why this is needed or if it's just a side effect of some missing > configuration. > > (and actually just truncating the subpixel resolution to integers would > also not introduce a performance problem...) > > For code written in gtk2 style and maybe using the event coordinates to > draw something on screen and even maybe in cairo you might run into > problem, just using the entries in event.x and .y IF the unterlying library > isn't gtk2 anymore, but gtk3. If i use the rubberband in ImageView (gtk > branch) i get artifacts of the rubberband draw and redrawing. Which should > not be there on integer coordinates. > > Gtk3 is not fully backward compatible to Gtk2 (it doesn't claim to be), so > we have to live with workarounds here. > > > > <https://lh5.googleusercontent.com/-hHJ9sEm9W_I/VKkKhEkXPEI/AAAAAAAAABs/QFJBwS9wFeA/s1600/snapshot1.png> >