Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330063 - [Trim] Shell (TrimLayout + TrimArea) enforces a 4 pixel "margin"
Summary: [Trim] Shell (TrimLayout + TrimArea) enforces a 4 pixel "margin"
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-12 04:47 EST by Peer Törngren CLA
Modified: 2021-10-30 16:34 EDT (History)
1 user (show)

See Also:


Attachments
Screenshot showing the desired look (31.17 KB, image/jpeg)
2010-11-12 05:00 EST, Peer Törngren CLA
no flags Details
Screenshot showing the unwanted (default) look (31.35 KB, image/jpeg)
2010-11-12 05:01 EST, Peer Törngren CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peer Törngren CLA 2010-11-12 04:47:41 EST
Build Identifier: 20100617-1415

When opening a UI thru org.eclipse.ui.application.WorkbenchWindowAdvisor.createWindowContents(Shell), the call is delegated to org.eclipse.ui.internal.WorkbenchWindow.createDefaultContents(Shell), which uses a TrimLayout to arrange the contents. If content is empty (no toolbar, coolbar, or anything), the TrimArea will leave a 4 pixel "margin". The problem seems to be caused by org.eclipse.ui.internal.layout.TrimArea.computeWrappedTrim(int), which adds both tile and line spacing even if content is blank. For instance, the line before the last looks like this:

		// Finally, add enough room to provide spacing between the lines
		totalMinor += (lines.size() + 1) * LINE_SPACING;

Even if lines are empty, it will return 1 * LINE_SPACING. A possible solution could be to do something like this (and similar for TILE_SPACING)

	if (!lines.isEmpty()) {
		totalMinor += (lines.size() + 1) * LINE_SPACING;
	}


Reproducible: Always

Steps to Reproduce:
1. create a UI with a standadalone view and no menu or toolbars
2. add a single component to the UI, use a FillLayout to make it fill the entire space
3. set the shell background color to black
4. launch the UI - you will see a black "margin" around the UI

(hopefully this is clear enough, otherwise I can try to produce code snippet to illustrate)
Comment 1 Peer Törngren CLA 2010-11-12 05:00:18 EST
Created attachment 182975 [details]
Screenshot showing the desired look

In this screenshot, the "footer" fills the entire bottom area.
Comment 2 Peer Törngren CLA 2010-11-12 05:01:51 EST
Created attachment 182976 [details]
Screenshot showing the unwanted (default) look 

In this screenshot, there is a 4 pixel white "margin" around the footer.
Comment 3 Peer Törngren CLA 2010-11-12 05:10:26 EST
By running in debug mode, I was able to produce the same result by forcing TrimArea.computeWrappedTrim(int)) to return 0, which appears to be the proper solution if content is empty (as stated above).

Since it seems hard to get at the specific method in TrimArea, the way to produce the desired look (as seen in the screenshot above) is to override the method that creates the window content altogether. This works well as long as the windows is completely empty, but doesn't solve the core problem.

Workaround is to override org.eclipse.ui.application.WorkbenchWindowAdvisor.createWindowContents(Shell):

	@Override
	public void createWindowContents(Shell shell) {
		shell.setLayout(new FillLayout());
		getWindowConfigurer().createPageComposite(shell);
	}
Comment 4 Eclipse Webmaster CLA 2019-09-06 16:12:45 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 5 Eclipse Genie CLA 2021-10-30 16:34:24 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.