Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Re: (GTK2) EclipseFixed problem

Boris_Shingarov@xxxxxxx writes:
> <FONT face="Default Sans Serif, Verdana, Arial, Helvetica,
> sans-serif"
> size=2><div>Havoc,</div><DIV>&nbsp;</DIV><DIV>EclipseFixed is now in
> the SWT/GTK2 stream, and seems to do a great job.&nbsp; It lays out
> the children OK, and nested SWT Composites work just great (and
> that's mainly how things are laid out in Eclipse).&nbsp; However, it
> doesn't seem to work well with other Gtk2 containers.&nbsp; A simple
> example is an EclipseFixed inside a
> GtkFrame:</DIV><DIV>&nbsp;</DIV><DIV>If I put a GtkButton inside a
> GtkFrame inside a GtkWindow, I get the button strictly inside the
> Frame.&nbsp; Now if I put an EclipseFixed inside a GtkFrame inside a
> GtkWindow, and add a button inside the EclipseFixed, I would expect
> the fixed (and therefore the buton) to be strictly inside the
> frame.&nbsp; This is not what's happening; the button is drawn on
> the window (and the position is relative to the window), and the
> frame's label is drawn over the
> button.</DIV><DIV>&nbsp;</DIV><DIV>Do you have any idea what to
> tweak to get&nbsp;it right?</DIV>

Hi,

Sorry for the slow reply, I haven't read my Eclipse mail folder in a
couple of days.

On the plus side, GTK+ 2.0.0 shipped today. Sadly we can't announce it
yet because www.gtk.org is hosted at Berkeley and they lost power to a
bunch of buildings last night apparently! ;-)

So on this question - what's supposed to happen is that
gtk_container_propagate_expose() is used to propagate exposes to the
children of the EclipseFixed. This function clips expose_event->area
to the child's widget->allocation.  So as long as widgets contained in
the EclipseFixed clip their drawing to expose_event->area things
should be fine.

With this in mind, I had a look at the EclipseFixed code; and it turns
out that I am a loser and screwed up eclipse_fixed_expose(). Or more
accurately, I copied gtk_fixed_expose() from the GTK 1.2 GtkFixed, and
it is no longer appropriate for GTK 2.

In GTK 2 I believe the right thing is to delete
eclipse_fixed_expose(), because the default GtkContainer
implementation should work fine. The default implementation uses
gtk_container_propagate_expose().

If you still have widgets drawing outside their parent widget when
using the default GtkContainer expose_event implementation, I would
speculate that the child widgets are buggy and don't set the clip
rectangle on their drawing operations.

While poking around in eclipsefixed.c I also noticed that
eclipse_fixed_draw() can be deleted, it isn't useful anymore in 2.0.

Havoc




Back to the top