[Glade-users] pointer_motion, button_press, etc. not working

Damon Chaplin damon@karuna.uklinux.net
29 Jan 2004 12:22:23 +0000


That is because you passed GDK_POINTER_MOTION_HINT_MASK (which is
generally a good idea to do).

Without that mask you will get an event each time the mouse moves, and
it is possible that your code won't be fast enough to handle them, so it
will start to lag behind.

If you pass HINT_MASK, you need to call get_pointer() to get a new
event.

Damon


On Wed, 2004-01-28 at 04:45, Greg Hamilton wrote:
> In reply to my own question, if the motion_notify_event handler calls 
> event.window.get_pointer() to get the x,y position of the mouse and the 
> buttons state then the events keep occurring. If, as I was doing, you 
> just print a debug message and don't bother grabbing that information 
> the event only happens once.
> 
> Odd.
> 
> On 28/01/2004, at 3:24 PM, Greg Hamilton wrote:
> 
> > Hi,
> >
> > I'm having what I gather is a fairly common Glade newbie problem. I 
> > want to handle pointer motion and button press signals over a drawing 
> > area. I'm using Glade 2.0.0, Python 2.2 and PyGTK 2.0
> >
> > I've created a simple test window in Glade - a drawing area in a vbox 
> > in a window. I've added signal handlers to the drawing area for 
> > 'button_press_event', 'motion_notify_event', 'configure_event' and 
> > 'expose_event'. As expected configure and expose worked straight away. 
> > Using Google I found that for the other signals I needed to modify the 
> > events mask on the command tab of the properties window. I selected 
> > GDK_EXPOSURE_MASK, GDK_POINTER_MOTION_MASK, 
> > GDK_POINTER_MOTION_HINT_MASK and GDK_BUTTON_PRESS_MASK.
> >
> > This didn't work which I thought was a little odd. If, after loading 
> > the Glade file, I call add_events for the drawing area widget and add 
> > each of the above events it almost works. The button press events 
> > occur but the motion events are borken. When I enter the window I see 
> > a single motion event. When I move the mouse after a button press I 
> > see a single motion event. I think I should see motion events 
> > repeatedly as I move the mouse about over the drawing area but it's 
> > not happening.
> >
> > There's a pygtk demo app called Scribble which handles all these 
> > events. It doesn't use Glade.
> >
> > Help?
> >
> > _______________________________________________
> > Glade-users maillist  -  Glade-users@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/glade-users
> >
> 
> _______________________________________________
> Glade-users maillist  -  Glade-users@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users
>