Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[GTK] Tree and table only react delayed on mouse selection if drag listener is configured

Aperta
#3,452 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
java
Ambito
desktop

Direzione di ricerca

The report provides a Java reproduction using SWT Tree, Table, and DragSource, but names no repository files or tests. First locate the Linux GTK implementations and related selection/drag tests, then reproduce the behavior with and without the drag listener on Linux. Done means rows become visibly selected and the selection event is sent immediately in both cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug
Normally, a Tree or Table immediately selects a row on mouse-down. However, this is not the case any more if a drag listener is added to the tree or table.

To Reproduce

  • run this snippet
import org.eclipse.swt.*;
import org.eclipse.swt.dnd.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class TreeTableDnD {

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

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

		final Tree tree = new Tree(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
		for (int i = 0; i < 4; i++) {
			final TreeItem item = new TreeItem(tree, 0);
			item.setText("TreeItem " + i);
		}
		tree.addListener(SWT.Selection, e -> System.out.println("Tree selection changed"));

		final Table table = new Table(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
		final TableColumn column = new TableColumn(table, SWT.DEFAULT);
		column.setText("Column");
		column.setWidth(250);
		table.setHeaderVisible(true);
		for (int i = 0; i < 4; i++) {
			final TableItem item = new TableItem(table, 0);
			item.setText("Item " + i);
		}
		table.addListener(SWT.Selection, e -> System.out.println("Table selection changed"));

//		new DragSource(tree, DND.DROP_MOVE).setTransfer(TextTransfer.getInstance());
//		new DragSource(table, DND.DROP_MOVE).setTransfer(TextTransfer.getInstance());

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

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

		display.dispose();
	}
}
  • select a tree or table row with a slow mouse click -> the visible selection occurs immediately on mouse-down, the selection event is sent delayed
  • now remove the comments to active the drag listener and try again -> the visually selection occurs delayed and the selection event even more delayed

Expected behavior
The tree and table rows get visually selected immediately and the selection event is sent immediately, independent of a drag listener.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Tried on Linux Mint (X11)
Lingua principale
Java
Stelle
202
Fork
206
Merge medio
14h 7m
PR unite (30g)
103

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di eclipse-platform/eclipse.platform.swt

Tutte le issue di eclipse-platform/eclipse.platform.swt

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.