sculpt: restrict un-merging of fb connectors

In setups with 3 or more displays, allow the un-merging of connectors
only for the last mirrored connector. Otherwise, the operation would
implicitely change the order of connectors because the new discrete
connector needs appear after all merged connectors.

Issue #5286
This commit is contained in:
Norman Feske 2024-10-29 15:39:12 +01:00 committed by Christian Helmuth
parent 2d3170124d
commit 324245d029

View File

@ -117,12 +117,21 @@ struct Sculpt::Fb_widget : Widget<Vbox>
s.sub_scope<Float>([&] (Scope<Vbox, Float> &s) {
s.sub_scope<Hbox>(id, [&] (Scope<Vbox, Float, Hbox> &s) {
s.sub_scope<Float>(Id { "equal" }, [&] (Scope<Vbox, Float, Hbox, Float> &s) {
/*
* Restrict merge/unmerge toggle to last merged and first
* discrete connector.
*/
bool const toggle_allowed = (count == num_merged || count == num_merged + 1);
Id const equal_id { toggle_allowed ? "equal" : "_equal" };
s.sub_scope<Float>(equal_id,
[&] (Scope<Vbox, Float, Hbox, Float> &s) {
s.sub_scope<Button>([&] (Scope<Vbox, Float, Hbox, Float, Button> &s) {
s.attribute("style", "vconn");
if (count <= num_merged)
s.attribute("selected", "yes");
if (count == num_merged || count == num_merged + 1) {
if (toggle_allowed) {
if (s.hovered() && !s.dragged())
s.attribute("hovered", "yes");
}