GtkTreeView: "changed" signal sent when clicking an already selected row in GTK_SELECTION_BROWSE mode
Steps to reproduce
Create a tree view with a the tree selection mode set to GTK_SELECTION_BROWSE
and connect a signal changed
handler for the tree selection.
A modified example is attached for both Gtk3 and Gtk4. Compile and run the attached programs.
-
bug3.c is the Gtk3 version, compile with
gcc bug3.c -o bug3 $(pkg-config --cflags --libs gtk+-3.0)
-
bug4.c is the Gtk4 version, compile with
gcc bug4.c -o bug4 $(pkg-config --cflags --libs gtk4)
- Run the resulting binary from the terminal.
- Repeatedly left click the first row
Row 0
Current behavior
Each left click will print a Selection changed, selected row is: 'Row 0'.
message even though the clicked row is already selected, meaning the selection changed
signal is emitted although the selection has not changed.
Expected outcome
The changed
signal should only be emitted when the selection actually changes, as is the case when setting the selection mode to GTK_SELECTION_SINGLE
.
Version information
Arch Linux
Both Gtk3 and Gtk4
- Gtk 3.24.34
- Gtk 4.6.6
Additional information
Terminal output:
Selection changed, selected row is: 'Row 0'.
Selection changed, selected row is: 'Row 0'.
Selection changed, selected row is: 'Row 0'.
Selection changed, selected row is: 'Row 0'.
Selection changed, selected row is: 'Row 0'.