Skip to content

Conversation

ShahzaibIbrahim
Copy link
Contributor

The Table.INSET constant defines the spacing in the width of a table cell. Previously, this was a fixed value of 3px, which looks correct at 100% zoom but causes the image and text to appear cramped on higher-DPI displays.

This change defines INSET in points and converts it to pixels based on the current zoom level (e.g. 6px at 200%), ensuring consistent spacing across different monitor scale.

How to Test

  • Run the following snippet with 100% primary and 250% secondary monitor zoom
  • Note down the width of a cell by moving it from one monitor to other.
  • See if the values adhere to zoom levels.
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;

public class TableInsetTest {

public static void main (String [] args) {
	System.setProperty("swt.autoScale", "quarter");
	System.setProperty("swt.autoScale.updateOnRuntime", "true");
	Display display = new Display ();
	Shell shell = new Shell (display);
	shell.setText("Table Inset Test");
	Table table = new Table (shell, SWT.BORDER | SWT.MULTI);
	table.setLinesVisible(true);
	Rectangle clientArea = shell.getClientArea ();
	table.setBounds (clientArea.x, clientArea.y, 200, 200);
	for (int i=0; i<128; i++) {
		TableItem item = new TableItem (table, SWT.NONE);
		item.setText ("Item " + i);
	}
	table.setSelection (95);
	shell.pack ();
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}
}

Results:
Before Change
Width 150% = 77
Width 250% = 128

After change
Width 150% = 84
Width 250% = 139

Copy link
Contributor

github-actions bot commented Aug 27, 2025

Test Results

   546 files  ±0     546 suites  ±0   32m 59s ⏱️ +43s
 4 431 tests ±0   4 410 ✅  - 4   17 💤 ±0  4 ❌ +4 
16 764 runs  ±0  16 633 ✅  - 4  127 💤 ±0  4 ❌ +4 

For more details on these failures, see this check.

Results for commit feb86f6. ± Comparison against base commit 508ad4a.

♻️ This comment has been updated with latest results.

The Table.INSET constant defines the spacing in the width of a table
cell. Previously, this was a fixed value of 3px, which looks correct at
100% zoom but causes the image and text to appear cramped on higher-DPI
displays.

This change defines INSET in points and converts it to pixels based on
the current zoom level (e.g. 6px at 200%), ensuring consistent spacing
across different monitor scale.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scale Table.INSET by zoom level instead of using fixed pixels
1 participant