Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 465056 - [GTK3] Too narrow initial list size with scrollbars
Summary: [GTK3] Too narrow initial list size with scrollbars
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.6 M6   Edit
Assignee: Eric Williams CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 467921 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-04-20 15:23 EDT by Andrey Loskutov CLA
Modified: 2016-03-18 06:17 EDT (History)
8 users (show)

See Also:


Attachments
initial size (70.30 KB, image/png)
2015-04-20 15:23 EDT, Andrey Loskutov CLA
no flags Details
same dialog after clicking on the sash in the middle (101.58 KB, image/png)
2015-04-20 15:24 EDT, Andrey Loskutov CLA
no flags Details
The Annotations page (84.59 KB, image/png)
2015-11-05 06:12 EST, Snjezana Peco CLA
no flags Details
The Annotations page with getItemWidth() (89.29 KB, image/png)
2016-03-10 15:11 EST, Snjezana Peco CLA
no flags Details
The Annotations page with the https://git.eclipse.org/r/#/c/61863/ patch (86.00 KB, image/png)
2016-03-10 15:12 EST, Snjezana Peco CLA
no flags Details
A patch (1.90 KB, patch)
2016-03-10 17:55 EST, Snjezana Peco CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2015-04-20 15:23:40 EDT
Created attachment 252554 [details]
initial size

I'm on Fedora 21, KDE, Eclipse 4.5.0.N20150411-1500
gtk3-3.14.12-1.fc21.x86_64

Open Windows->Preferences->General->Appearance->Editors->Text Editors->Annotations

The selection list is way too narrow, please see the attached screenshot. After clicking on the sash between the tree and the preference page, the entire dialog "explodes" in the size and the list receives the appropriate size to see some content (second screenshot).

GTK2 has no problems to show the right list dimension at the very beginning.
Comment 1 Andrey Loskutov CLA 2015-04-20 15:24:06 EDT
Created attachment 252555 [details]
same dialog after clicking on the sash in the middle
Comment 2 Leo Ufimtsev CLA 2015-04-20 17:14:37 EDT
This might be a PlatformUi thing. SWT widgets generally go boy whatever layout they're given. But if this occurs with smaller swt snippets or you think this is SWT, please transfer back.
Comment 3 Lars Vogel CLA 2015-04-20 17:20:26 EDT
(In reply to Leo Ufimtsev from comment #2)
> This might be a PlatformUi thing. SWT widgets generally go boy whatever
> layout they're given. But if this occurs with smaller swt snippets or you
> think this is SWT, please transfer back.

If I open the same dialog the second time, it is correctly sized. Only the first time, the size is incorrect. I think that indicates a SWT problem.
Comment 4 Leo Ufimtsev CLA 2015-04-21 11:00:21 EDT
(In reply to Lars Vogel from comment #3)
> (In reply to Leo Ufimtsev from comment #2)
> > This might be a PlatformUi thing. SWT widgets generally go boy whatever
> > layout they're given. But if this occurs with smaller swt snippets or you
> > think this is SWT, please transfer back.
> 
> If I open the same dialog the second time, it is correctly sized. Only the
> first time, the size is incorrect. I think that indicates a SWT problem.

I see. I can reproduce on GTK3 but not on Gtk2. Seems like SWT after all. We should investigate.
Comment 5 Andrey Loskutov CLA 2015-05-21 16:31:10 EDT
*** Bug 467921 has been marked as a duplicate of this bug. ***
Comment 6 Eclipse Genie CLA 2015-11-02 11:11:23 EST
New Gerrit change created: https://git.eclipse.org/r/59486
Comment 7 Snjezana Peco CLA 2015-11-02 11:12:45 EST
https://git.eclipse.org/r/59486 fixes the issue in Platform UI.
Comment 8 Eclipse Genie CLA 2015-11-05 06:08:46 EST
New Gerrit change created: https://git.eclipse.org/r/59730
Comment 9 Snjezana Peco CLA 2015-11-05 06:10:28 EST
I think this bug is related to bug 465280. Namely, in GTK3, Control.getSize() returns (0,0) when a control is invisible.
However, there is another issue with this page. If a user declares the org.eclipse.ui.editors.markerAnnotationSpecification extension point with a very big label, he will get the page as shown in the attachment.
I have created a new patch against Platform Text. It fixes both of the issues.
Comment 10 Snjezana Peco CLA 2015-11-05 06:12:35 EST
Created attachment 257749 [details]
The Annotations page
Comment 11 Eclipse Genie CLA 2015-12-03 06:48:23 EST
New Gerrit change created: https://git.eclipse.org/r/61863
Comment 12 Snjezana Peco CLA 2015-12-03 06:50:05 EST
https://git.eclipse.org/r/61863 fixes the issue in SWT, but, I think, it would be also necessary to apply https://git.eclipse.org/r/59730.
Comment 13 Snjezana Peco CLA 2016-03-10 15:09:43 EST
Eric,

I have tried to use getItemWidth() and got the Annotations page too width.
See the screenshots.
Comment 14 Snjezana Peco CLA 2016-03-10 15:11:12 EST
Created attachment 260233 [details]
The Annotations page with getItemWidth()
Comment 15 Snjezana Peco CLA 2016-03-10 15:12:04 EST
Created attachment 260234 [details]
The Annotations page with the https://git.eclipse.org/r/#/c/61863/ patch
Comment 16 Eric Williams CLA 2016-03-10 16:06:15 EST
(In reply to Snjezana Peco from comment #14)
> Created attachment 260233 [details]
> The Annotations page with getItemWidth()

Would it be possible to see the code that generates this screenshot? It doesn't look to be far off from what the natural size should be.
Comment 17 Snjezana Peco CLA 2016-03-10 17:55:29 EST
Created attachment 260237 [details]
A patch
Comment 18 Eric Williams CLA 2016-03-11 11:13:11 EST
(In reply to Snjezana Peco from comment #17)
> Created attachment 260237 [details]
> A patch

Alright, looks like that approach isn't going to work. I'm investigating another possibility, will post a patch if I can get it to work.
Comment 19 Eclipse Genie CLA 2016-03-11 12:02:01 EST
New Gerrit change created: https://git.eclipse.org/r/68223
Comment 20 Eric Williams CLA 2016-03-11 12:06:24 EST
(In reply to Eclipse Genie from comment #19)
> New Gerrit change created: https://git.eclipse.org/r/68223

I discovered that calculateWidth() in Table calculates the width of a row for a TableItem. So when setting the text/image of a TableItem, we can just calculate the size of the row and update the maxWidth variable in Table (if necessary). maxWidth will be set to the widest TableItem in the Table, which we can use in computeSize().

Note that Tables with multiple columns seem to size themselves properly, so we don't need to be concerned about that case. With this approach we can also avoid looping through any TableItems in Table.
Comment 22 Eric Williams CLA 2016-03-15 09:32:39 EDT
(In reply to Eclipse Genie from comment #21)
> Gerrit change https://git.eclipse.org/r/68223 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=8e660b6aa364e12e42139eab0334fdf17deb8b66

In master now.
Comment 23 Sravan Kumar Lakkimsetti CLA 2016-03-18 06:17:50 EDT
verified in I20160317-0200 on ubuntu 15.10