Re: drawing area and motion hint mask
- From: Emmanuel Touzery <emmanuel touzery free fr>
- To: gtk-app-devel-list gnome org
- Subject: Re: drawing area and motion hint mask
- Date: Thu, 30 Jul 2009 23:21:33 +0200
Hello,
That I'm getting more events (not just one, because I never call
gdk_event_request_motions() or gdk_window_get_pointer() anywhere in my
code) it seems somehow someone else is calling
gdk_event_request_motions() or gdk_window_get_pointer() (the examples
on internet are not really clear on which one to call, or both, maybe
this changed in the past?).
I guess the problem is kind of solved.
Based on the API documentation I would still not expect to be called
again on a motion event if I don't call gdk_event_request_motions() or
gdk_window_get_pointer(), but in the end I realized that the number of
calls I get is probably not excessive.
The reason the application seemed completely unresponsive and unable to
deal with the events was that it was dealing with the events coming in
the event handler (in the main loop) and the main loop was fully busy
dealing with those events and never actually re-rendered the screen...
I solved that part by adding this line in the event handler:
gdk_window_process_updates (GTK_WIDGET (drawing_area)->window, TRUE);
That way the GUI is reasonnably responsive while still dealing with the
events. Still too slow but the number of events I got is probably not
the problem (my code is probably just plain too slow).
Otherwise I also in the meantime got the same effect I wanted using
"button-press-event" and g_timeout_add() to redraw every X ms on mouse
move but now that I got it working with the pointer motion stuff I'll
see which one I'll pick (gdk_window_process_updates() is not needed when
I use the g_timeout_add() because it gives some breathing time to the
main loop but the motion handler could be more "smooth" i'll see).
I still have performance problems in my drawing and computations but
it's out of scope of this discussion, I'll handle it somehow :-)
Thank you for all the help!
emmanuel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]