- if (op_really_wants_one_region_if_none_are_selected) {
- selection->set (entered_regionview, false);
- }
+
+ /* heuristic:
+
+ - if there is no existing selection, don't change it. the operation will thus apply to "all"
+
+ - if there is an existing selection, but the entered regionview isn't in it, add it. this
+ avoids key-mouse ops on unselected regions from interfering with an existing selection,
+ but also means that the operation will apply to the pointed-at region.
+ */
+
+ if (!selection->regions.empty()) {
+ if (!selection->selected (entered_regionview)) {
+ selection->add (entered_regionview);
+ }
+ } else {
+ /* there is no selection, but this operation requires/prefers selected objects */
+
+ if (op_really_wants_one_region_if_none_are_selected) {
+ selection->set (entered_regionview, false);