[maemo-developers] [maemo-developers] Sketch like pointer movement detection

From: Celso Pinto cpinto at yimports.com
Date: Tue Jan 17 00:20:23 EET 2006
Hello,

thanks for your helpful pointers but I have one doubt: if I invoke
gdk_event_get() in my motion event callback, is it positive that all
next events are going to be motion events? 

If those events aren't motion events, I'd be able to skip them but
wouldn't I lose the skipped events?

Furthermore, if I ask for the next event by calling gdk_event_get(),
will my pointer motion callback be invoked later for the returned event?

Thanks once again. 

Regards,
Celso



On Sat, 2006-01-14 at 14:55 +0100, Øyvind Kolås wrote:
> On 1/14/06, Celso Pinto <cpinto at yimports.com> wrote:
> > Hi everyone,
> >
> > I'm developing a small app just for kicks and I want to have a drawing
> > area similar to Sketch. I've followed the GTK tutorial, the Scribble
> > example part, on how to detect mouse movement and translate that to a
> > drawing.
> >
> > The thing is that compared to Scribble, Sketch is really slick because
> > Scribble fails a lot of movements,probably because drawing to the screen
> > is expensive, because the pixels only get drawn on screen with big
> > intervals.
> >
> > I was just wondering if it is possible to improve pointer motion by
> > having some other masks besides GDK_POINTER_MOTION_MASK? I've removed
> > the GDK_POINTER_MOTION_MASK_HINT but it hasn't improved the drawing.
> >
> > I want to improve on Scribble, so I'm already thinking about
> > alternatives like queuing all motion events and have a separate thread
> > doing the drawing bits if that is the only way to have slick motion
> > detection.
> 
> The best way of doing such things in my experience is:
> 
> 1: collect all motion events until the queue is empty
> 2: draw strokes/update screeen
> 
> No seperate thread should be needed since the xserver/gdk will have
> their own queues of events. Using event collapsing might not be what
> you want either, but you should strive towards minimizing the amount
> of work needed at each redraw.
> 
> My attempt at drawing doesn't use gtk/gdk, but xevents directly, since
> I also have added the option of using information about the amount of
> pressure.
> 
> The drawing application I am working on
> http://pippin.gimp.org/horizon/ is still not ready for prime time,
> thus it only exist in the work in process portion of the application
> catalog.
> 
> /Øyvind K.
> --
> «The future is already here. It's just not very evenly distributed»
>                                                  -- William Gibson
> http://pippin.gimp.org/                            http://ffii.org/
> 


More information about the maemo-developers mailing list