Community
Participate
Working Groups
1) Run eclipse on GTK3 (export org.eclipse.swt.gtk3=1) 2) Give focus to the search box (Quick Acess) Note that the right edge of the widget is clipped.
Created attachment 223340 [details] The patch.
The way we compute size based on the pango layout no longer works properly with GTK 3 as gtk_entry minimum size is bigger than the pango layout size. We might try utilizing the new preferred size api in GTK 3 it seems to work perfect for me but I attach it here as I might not be testing smth. Also I do return immediately as the preferred size seems to contain the trim area and we don't want it doubled.
This patch is not using the wHint and hHint parameters. They make a difference if the Text widget is wrappable for example and should be returned if different than SWT.DEFAULT. We can try to use the new API in GTK3 gtk_widget_get_preferred_height_for_width() for the wrappable case.
(In reply to comment #3) > This patch is not using the wHint and hHint parameters. They make a > difference if the Text widget is wrappable for example and should be > returned if different than SWT.DEFAULT. > > We can try to use the new API in GTK3 > gtk_widget_get_preferred_height_for_width() for the wrappable case. I would appreciate help with handling the hints.
The wHint (when different of SWT.DEFAULT) is the desired width for the content. Text.computeSize() is supposed to add all the trimming around that: borders, padding, etc. The gtk API gtk_widget_get_preferred_size() (or gtk_widget_get_preferred_height_for_width()) cannot be used because it does not calculate the size based on the current contents of the widget. It returns either a constant value or it multiples the value set by gtk_entry_set_width_chars () by the average character width. This does not match the SWT behavior. The problem is not in Text.computeSize(), it is in Text.computeTrim(). It needs to add the icons width and style context border/padding. Fixed http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=8619e947eac7fa56991129fea0c5b3d12c3121b0