[Win32] Table column resizing broken
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by tracing how Table.getClientArea() and TableColumn.setWidth() interact with scrollbar sizing on Windows at 175% zoom. The issue provides a reproducer but names no implementation files or tests, so locate the relevant Win32 table code and existing resizing tests first. Done means resizing the window no longer shows a horizontal scrollbar when the column should fit the client area.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
We want a table column to be as wide as the table to avoid a horizontal scrollbar. This is broken with the rounding of getClientArea() for zoom factors like 175% (typical for 4k displays).
To Reproduce
import org.eclipse.swt.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class OneTableColumn {
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.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
table.setHeaderVisible(false);
final TableColumn column = new TableColumn(table, SWT.LEFT);
column.setResizable(false);
table.addListener(SWT.Resize, new Listener() {
private boolean updating;
@Override
public void handleEvent(Event event) {
updateColumnWidth();
// Update again after SWT has adjusted the scrollbars.
display.asyncExec(() -> {
if (!table.isDisposed()) {
updateColumnWidth();
}
});
}
private void updateColumnWidth() {
if (updating) {
return;
}
updating = true;
try {
final int width = table.getClientArea().width;
if (column.getWidth() != width) {
column.setWidth(width);
}
}
finally {
updating = false;
}
}
});
for (int i = 0; i < 10; i++) {
new TableItem(table, SWT.NONE).setText("Item " + i);
}
shell.setSize(400, 300);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
- run this snippet on Windows with a zoom factor of 175%
- resize the window -> the horizontal scrollbar occurs for some window widths
- even changing
column.setWidth(width)tocolumn.setWidth(width - 1)does not prevent the scrollbar from occurring
Expected behavior
The column should be as wide as the client area, but not wider, so no horizontal scrollbar is shown.
Screenshots
Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
- Additional OS info (e.g. OS version, Linux Desktop, etc)
Windows 11 25H2
Workaround (or) Additional context
Workaround: use SWT v4972r4 or earlier
- 主要语言
- Java
- 星标
- 202
- 派生
- 206
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 99
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
eclipse-platform/eclipse.platform.swt 的其他 Issue
-
[Win32] Table tooltip indexes cell font with subitem -1可能已有人在做 @fdesbiens 于 13 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
eclipse-platform/eclipse.platform.swt#3752 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
eclipse-platform/eclipse.platform.swt#3546 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
eclipse-platform/eclipse.platform.swt#3428 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 75/100
eclipse-platform/eclipse.platform.swt#3336 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 18/100
eclipse-platform/eclipse.platform.swt#3790 ·
维护者通常 1 天内回复
查看 eclipse-platform/eclipse.platform.swt 的全部 Issue
相似的 Issue
-
5.0.x backport enhancement
难度 2/5 1-3 小时 新手友好度 63/100
spring-cloud/spring-cloud-function#1507 ·
维护者通常 1 天内回复
-
ai-driven-fuzzing bug claude Minor
难度 2/5 1-3 小时 新手友好度 66/100
linagora/twake-calendar-side-service#1417 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
line/armeria#7109 · 3 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
a2aproject/a2a-java#1275 ·
维护者通常 1 天内回复
-
module/ftp Type/Bug
难度 2/5 1-3 小时 新手友好度 72/100
ballerina-platform/ballerina-library#9476 ·
维护者通常 1 天内回复