Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[albireo-dev] size and border

Hi Gordon,

Now that size/layout is generally working fine, I'm tackling this bug:
  <https://bugs.eclipse.org/bugs/show_bug.cgi?id=91896>

The problem is that - as we have seen - on Gtk and Carbon the low-level SWT
handle of the SwingControl and the EmbeddedFrame instance are tied; a size
change on the SWT handle implies automatically a size change on the
EmbeddedFrame. This notification knows nothing about the border.

This bug is still visible with SwingControl even if I add or subtract
2*getBorderWidth() at the appropriate places.

The fix that works is to create a child Composite of the SwingControl
that has no border, and pass this child to SWT_AWT.new_Frame. Some of the
size management methods need to be copied to the class of this borderless
child. But duplicated code is unprofessional. I therefore propose to create
a class BorderlessSwingControl, subclass of Composite, parent class of
SwingControl, to collect these few methods that deal with size.
A class comment like this should discourage the direct use of this
intermediate class:

/**
 * Internal class.
 * Please don't use this class; use {@link SwingControl} instead.
 */

Does this sound acceptable?

The patch works, but I need to refine and test it more, and will commit it
on Friday.

Bruno


Back to the top