Re: Focus events causing expose events.



On Wed, 2003-04-09 at 06:38, msevior physics unimelb edu au wrote:
> >
> > <msevior physics unimelb edu au> writes:
> >
> >> I meant to ask about this. I'm seeing focus-in events on the main
> >> window also issuing expose events. Is this something that is known? If
> >> so, how do I stop it?
> >
> > FWIW, I encountered this with the drawing area when I ported Sketch to
> > GTK2. The drawing area for some reason queues a redraw when it gets
> > focus events. My solution was to connect to the focus events and to
> > return true in my event handler so that the default implementation isn't
> > run.
> >
> HI Bernhard,
>            It's great to hear that sketch will be ported to GTK2. With
> SVG and SVG icons getting more and more popular, vector graphics apps like
> yours become ever more important.
> 
> Anyway, I just tried your suggestion and it worked! So this appears to be
> a bug in GTK2.
> 
> focus events shouldn't cause expose events.
> 
> I haven't tried GTK2.2 yet, I'll wait till I upgrade to RH 9 in a couple
> of weeks.
> 
> In any case I think I can clobber together a work-around.

Not a bug - most widgets _do_ need to redraw on focus in/out so the 
default GTK+ focus handlers queue a redraw. The code would have to
be duplicated in a dozen or so places in GTK+ otherwise, and in
most custom widgets. If you don't want that for your widget, you can
override.

Logically, if you set the CAN_FOCUS flag on your widget, whether
it is a drawing area or not, you should draw a visual indication
of focus, otherwise, the user won't be able tell where the focus
is when your widget has the focus.

Regards,
                                        Owen





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