I have a simple performance question related to animation based on mouse movement in an activity.<div><br></div><div>When you move the mouse, a colored rectangle follows the mouse around. When you click with the mouse, we change the way in which we get the mouse coordinates to position the colored rectangle (and change the color too):</div>
<div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace"> if (self.opt2):<br> #green ... fast<br> on, xx, yy, mod = gtk.gdk.Display.get_pointer( gtk.gdk.display_get_default() )<br>
self.fake_cursor.x = xx<br> self.fake_cursor.y = yy<br> else:<br> #red ... slow<br> #self.mouse_x and self.mouse_y are updated via motion_notify_event callbacks.<br> self.fake_cursor.x = self.mouse_x<br>
self.fake_cursor.y = self.mouse_y</font> </div></div><div><br>Here is a video showing the performance hit in both f13 yummed sugar (mistakenly called jhbuild in the video) and on an xo:<br><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; "><a href="http://www.youtube.com/watch?v=dq9_k1vyrLA" target="_new" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 51, 204); text-decoration: underline; background-position: initial initial; background-repeat: initial initial; ">http://www.youtube.com/watch?v=dq9_k1vyrLA</a></span></div>
<div><br></div><div>Here is the sample activity source:<br></div><div><a href="http://alumni.media.mit.edu/%7Eerikb/tmp/Test.activity.xo" target="_blank">http://alumni.media.mit.edu/~erikb/tmp/Test.activity.xo</a></div>
<div><br></div><div>I don't understand the poor performance when using the self.mouse_x and self.mouse_y variables. Shouldn't these two ways of positioning the cursor behave identically?</div>