This is what we did in Record to remove extra buttons when a child hasn&#39;t moved the mouse in a while... (<a href="http://mediamods.com/public-svn/camera-activity/tags/54/ui.py">http://mediamods.com/public-svn/camera-activity/tags/54/ui.py</a>)&nbsp; But this has a very low sample rate:<br>
<br>This code might benefit from improvements.&nbsp; Suggestions?<br><br><pre>        def resetWidgetFadeTimer( self ):<br>                #only show the clutter when the mouse moves<br>                <a href="http://self.mx">self.mx</a> = -1<br>                self.my = -1<br>
                self.hideWidgetsTimer = time.time()<br>                if (self.hiddenWidgets):<br>                        self.showWidgets()<br>                        self.hiddenWidgets = False<br><br>                #remove, then add<br>                self.doMouseListener( False )<br>                if (self.HIDE_WIDGET_TIMEOUT_ID != 0):<br>
                        gobject.source_remove( self.HIDE_WIDGET_TIMEOUT_ID )<br><br>                self.HIDE_WIDGET_TIMEOUT_ID = gobject.timeout_add( 500, self._mouseMightaMovedCb )<br><br><br>        def doMouseListener( self, listen ):<br>                if (listen):<br>                        self.resetWidgetFadeTimer()<br>
                else:<br>                        if (self.HIDE_WIDGET_TIMEOUT_ID != None):<br>                                if (self.HIDE_WIDGET_TIMEOUT_ID != 0):<br>                                        gobject.source_remove( self.HIDE_WIDGET_TIMEOUT_ID )</pre><br><br><pre>        def _mouseMightaMovedCb( self ):<br>                x, y = self.ca.get_pointer()<br>
                passedTime = 0<br><br>                if (x != <a href="http://self.mx">self.mx</a> or y != self.my):<br>                        self.hideWidgetsTimer = time.time()<br>                        if (self.hiddenWidgets):<br>                                self.showWidgets()<br>                                self.hiddenWidgets = False<br>
                else:<br>                        passedTime = time.time() - self.hideWidgetsTimer<br><br>                if (self.ca.m.RECORDING):<br>                        self.hideWidgetsTimer = time.time()<br>                        passedTime = 0<br><br>                if (passedTime &gt;= 3):<br>                        if (not self.hiddenWidgets):<br>
                                if (self.mouseInWidget(x,y)):<br>                                        self.hideWidgetsTimer = time.time()<br>                                elif (self.RECD_INFO_ON):<br>                                        self.hideWidgetsTimer = time.time()<br>                                elif (self.UPDATE_TIMER_ID != 0):<br>                                        self.hideWidgetsTimer = time.time()<br>
                                else:<br>                                        self.hideWidgets()<br>                                        self.hiddenWidgets = True<br><br>                <a href="http://self.mx">self.mx</a> = x<br>                self.my = y<br>                return True</pre><br><div class="gmail_quote"><br><br>On Fri, May 30, 2008 at 9:38 PM, Benjamin M. Schwartz &lt;<a href="mailto:bmschwar@fas.harvard.edu">bmschwar@fas.harvard.edu</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Does anyone know how to capture all mouse events? &nbsp;I am trying to get all<br>
mouse button up/down events, and maybe even all motion events. &nbsp;I have<br>
tried using gdk to listen to all events on the root window, but it doesn&#39;t<br>
seem to capture mouse events.<br>
<br>
It seems like the right way might be to use Xlib, or to hook into the<br>
window manager, or the X driver, or just listen to /dev/input/mouse0. &nbsp;I<br>
don&#39;t know much about any of these. &nbsp;What would you do?<br>
<br>
- --Ben<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v2.0.9 (GNU/Linux)<br>
Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org" target="_blank">http://enigmail.mozdev.org</a><br>
<br>
iEYEARECAAYFAkhArB8ACgkQUJT6e6HFtqSRSQCfatqMr9Ksdn204nEtaH89dV8r<br>
kp8AnAxkPIq/bqnUJENnBze/GFMSgkXt<br>
=IdMQ<br>
-----END PGP SIGNATURE-----<br>
_______________________________________________<br>
Sugar mailing list<br>
<a href="mailto:Sugar@lists.laptop.org">Sugar@lists.laptop.org</a><br>
<a href="http://lists.laptop.org/listinfo/sugar" target="_blank">http://lists.laptop.org/listinfo/sugar</a><br>
</blockquote></div><br>