2

I've got a drawing area inside a scrolled window (with convenience viewport), and this drawing area updates itself according to incoming motion-notify-events. When I scroll the area though obviously no motion events are emitted, but I wanted to work around this, and so tried to connect the drawing area's "scroll-event" signal to the same motion-notify callback.

The problem I'm facing here is that this signal is emitted before the scrolled window has update its viewport, so in the callback, I end up with pointer coordinates that were true just before scrolling, making it look like the drawing area is always "lagging a step behind" the actual pointer when scrolling while not moving the pointer itself. I thought I could compensate for this by manually extracting the coordinates with gdk_window_get_pointer, but then I realized this cannot work as the pointer is technically still at its old position when the callback is commencing. I also tried using g_signal_connect_after in hopes it would have the callback get called after the viewport was scrolled, but it didn't help.

My last hope would be to start a timer on scroll-events, and have the callback fire after a minimal amount of time, but this sounds realllly ugly, and I'd like to avoid that at any cost.

Any ideas as to how this could be realized? Thanks in advance!

Ancurio
  • 1,698
  • 1
  • 17
  • 32
  • I have the same problem and would like to know the answer, in case you've solve it remember you can post an answer yourself too. – Nelson Oct 21 '13 at 08:18
  • @Nelson I think I actually gave up back then and never fixed it. My GTK knowledge was also pretty limited at the time.. – Ancurio Oct 22 '13 at 20:58

1 Answers1

1

A solution would be to connect to the "value-changed" signal of the GtkScrolledWindow adjustments.

Source: https://mail.gnome.org/archives/gtk-app-devel-list/2011-September/msg00014.html

Nelson
  • 49,283
  • 8
  • 68
  • 81