Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 393727 - [GTK3] Search box in eclipse is clipped on the right
Summary: [GTK3] Search box in eclipse is clipped on the right
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M4   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-11-06 17:41 EST by Silenio Quarti CLA
Modified: 2012-11-16 10:56 EST (History)
1 user (show)

See Also:


Attachments
The patch. (808 bytes, patch)
2012-11-08 06:05 EST, Alexander Kurtakov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Silenio Quarti CLA 2012-11-06 17:41:25 EST
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.
Comment 1 Alexander Kurtakov CLA 2012-11-08 06:05:48 EST
Created attachment 223340 [details]
The patch.
Comment 2 Alexander Kurtakov CLA 2012-11-08 06:08:36 EST
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.
Comment 3 Silenio Quarti CLA 2012-11-08 09:48:59 EST
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.
Comment 4 Alexander Kurtakov CLA 2012-11-09 05:28:29 EST
(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.
Comment 5 Silenio Quarti CLA 2012-11-12 16:07:56 EST
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