Use the browse selection mode to ensure there is alway an item selected.

It was possible to deselect items when using a touch screen. This is done
by tapping on an item that's already selected. This would cause a segfault
in the select_item() function of src/wofi.c since
gtk_flow_box_get_selected_children() would return NULL in this case. By
setting the selection mode to GTK_SELECTION_BROWSE, we avoid this case
by ensuring an item is always selected.
This commit is contained in:
Brian Daniels 2020-04-25 12:09:17 -04:00
parent 17e43f2338
commit 8d1075eb2c

View File

@ -1608,6 +1608,7 @@ void wofi_init(struct map* _config) {
}
inner_box = gtk_flow_box_new();
gtk_flow_box_set_selection_mode(GTK_FLOW_BOX(inner_box), GTK_SELECTION_BROWSE);
gtk_flow_box_set_max_children_per_line(GTK_FLOW_BOX(inner_box), columns);
gtk_orientable_set_orientation(GTK_ORIENTABLE(inner_box), orientation);
gtk_widget_set_halign(inner_box, halign);