RE: GDK_POINTER_MOTION_HINT_MASK has no effect



Many thanks for these posts. They are moving me closer to a better
understanding of the right way to tackle the drawing issues.
I still need a bit of clarification.

1. I am assuming that when I queue a draw for the old position of
the rubberbanded line, I am using XOR to draw it, so that it is in
effect, an erasing, right?

2. You say in the post referenced below that we should really draw
only in the expose event handler, not in the motion or button event
handlers.
Right now, my function to draw a line uses gdk_draw_line into the pixmap
and then calls gdk_window_invalidate_rect to send the expose event later.
If I actually call the gdk_draw_line in the expose event handler, directly
into the pixmap, would I then use gdk_draw_drawable to copy the pixmap into
the window?   I know I can't queue a drawing event in the handler or else
I have an infinite indirect recursive loop. Is this how?

Stewart

> -----Original Message-----
> From: jcupitt gmail com [mailto:jcupitt gmail com]
> Sent: Wednesday, November 28, 2007 3:53 AM
> To: stewart weiss acm org
> Cc: gtk-list
> Subject: Re: GDK_POINTER_MOTION_HINT_MASK has no effect
>
>
> On Nov 28, 2007 4:27 AM, Stewart Weiss <stewart weiss acm org> wrote:
> > Aha!  I did not know that I could configure the GC to draw using
> > various functions of the source and dest pixels values. Thanks !
>
> I posted a mail about rubberbanding a couple of months ago:
>
> http://mail.gnome.org/archives/gtk-app-devel-list/2007-October/msg
> 00007.html
>
> Might be helpful. In my opinion, you should structure your
> program like this:
>
> - appstate should have a flag for "displaying rubberband line", plus
> start/end points
> - in your expose handler, first draw the background for the exposed
> area, then draw the rubberband liine on top
> - in your button-press handler, set the rubber band flag and note the
> start position
> - in mouse-motion, if rubberband is set and this is a button drag
> event, queue a draw for the old position of the rubber band line,
> update appstate with the new position, and queue a draw there too
> - in button-release, unset the rubber flag and queue a draw for the
> position of the line
>
> John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]