Re: [PATCH] gtkpixmap.c, bug in gtk_pixmap_set()




> Hi Owen!
> 
> On Mon, Jun 22, 1998 at 11:07:20PM -0400, Owen Taylor wrote:
> 
> > > I'm not completely sure about this, but I think the patch simply won't work.
> > > Gtk_pixmap_set should expose the area of the pixmap. The parent of the pixma
> p
> > > has to redraw the area, because gtk_pixmap has the GTK_NO_WINDOW flag set.
> > > Now the pixmap simply clears the area of the pixmap.
> >
> > I don't quite understand. The Pixmap still redraws it's own area -
> > the NO_WINDOW flags simply indicates that widget->window is the
> > same as parent->window; i.e., that it is drawing on its parent's
> > window. In this case, we simply clear the allocation when the
> > needs_clear flag is set.
> 
> Yes, and I think that's not enough. It's possible that the parent or a
> sibling has to draw something "under" the pixmap. If we simply clear the
> area, we also clear the drawing of the parent and nobody restores it after
> gdk_window_clear_area.

Hmmm. It is a sticky problem. The problem is that pixmaps (and
labels) are only partially transparent. There are a number of
circumstances in which GtkLabel, GtkPixmap, or even the core GTK+
code will do an XClearArea on a NO_WINDOW widget's background.

There are different solutions:

 - Say that something like GtkNotebook which wants a shaped 
   GtkPixmap on top of a background different from that of
   it's parent window needs to put the pixmap into an EventBox,
   and set the background for an EventBox.

 - Make GtkPixmap not NO_WINDOW and use a shaped window.

 - Have GtkPixmap, instead of calling gdk_window_clear_area,
   call:

     gtk_widget_draw (parent, &area)

   But unless the parent was well implemented, this could have
   a serious effect. (Flashing, etc.) 

> > > I think that's the reason, why the testgtk notebook example doesn't work
> > > correctly.
> >
> > What doesn't work correctly about it? As far as I can see, it still
> > looks fine.
> 
> Try to switch pages. The pixmap background of the old active tab is
> GTK_STATE_NORMAL and should be GTK_STATE_ACTIVE.

I see what you mean. (BTW, have any ideas about the 1-pixel splotch
that often shows up under the leftmost tab? It looks like an
off-by-one error somewhere in the NoteBook drawing code)

Regards,
                                        Owen



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