Skip to content

[GTK] Table.getClientArea reports incorrect values #3294

@tmssngr

Description

@tmssngr

Describe the bug
The Table.getClientArea() method reports incorrect data on GTK3. The x position is wrong by one pixel and the height by approximately the table header.

To Reproduce
Launch this snippet on Windows 11 and Linux (for comparison).

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class PaintOverTable {

	public static void main(String[] args) {
		final Display display = new Display();

		final Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());

		final Table table = new Table(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
		final TableColumn column = new TableColumn(table, SWT.LEFT);
		column.setText("Column");
		column.setWidth(100);
		table.setHeaderVisible(true);

		table.addListener(SWT.Paint, event -> {
			final Rectangle clientArea = table.getClientArea();
			event.gc.drawRectangle(clientArea);
		});

		shell.setSize(400, 300);
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}
}

On Linux the right and lower lines are visible.

Expected behavior
The reported rectangle should cover the same area on all supported platforms.

Screenshots
Windows 11:
Image
This is reasonable, because the table header draws over the upper part and the lower and right lines are one pixel outside the visible area.

Ubuntu 26.04 (Wayland):
Image
Notice the left line is invisible, but the right one. And the lower line is largely off by approximately the table header height.

Note, this bug is not about painting. I just used this example to illustrate the incorrect values visually.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions