13
0

Fix interaction with snapshot list

* Select snapshot before showing relevant context menu
* Ignore clicks on empty space (no path)
This commit is contained in:
Robin Gareus 2024-09-28 21:40:11 +02:00
parent 46f61d7662
commit c6ef4c3545
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -84,6 +84,10 @@ EditorSnapshots::button_press (GdkEventButton* ev)
int cx; int cx;
int cy; int cy;
_snapshot_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy); _snapshot_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy);
if (!path) {
return false;
}
_snapshot_display.get_selection()->select (path);
Gtk::TreeModel::iterator iter = _snapshot_model->get_iter (path); Gtk::TreeModel::iterator iter = _snapshot_model->get_iter (path);
if (iter) { if (iter) {
Gtk::TreeModel::Row row = *iter; Gtk::TreeModel::Row row = *iter;
@ -97,6 +101,9 @@ EditorSnapshots::button_press (GdkEventButton* ev)
int cy; int cy;
string snap_name; string snap_name;
_snapshot_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy); _snapshot_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy);
if (!path) {
return false;
}
Gtk::TreeModel::iterator iter = _snapshot_model->get_iter (path); Gtk::TreeModel::iterator iter = _snapshot_model->get_iter (path);
if (iter) { if (iter) {
Gtk::TreeModel::Row row = *iter; Gtk::TreeModel::Row row = *iter;