Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[GTK] Table.getClientArea reports incorrect values

Đang mở
#3,294 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, linux
Lĩnh vực
desktop

Hướng nghiên cứu

Start at the GTK3 implementation of Table.getClientArea() and compare how it calculates the rectangle with the behavior on Windows. Run the supplied snippet on Linux and Windows to reproduce the difference. Done means the reported rectangle has consistent bounds across the supported platforms.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Java
Star
202
Fork
206
Merge trung bình
16 giờ 56 phút
Pull request đã merge (30 ngày)
110

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eclipse-platform/eclipse.platform.swt

Tất cả issue của eclipse-platform/eclipse.platform.swt

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.