From 04b43be9b261f36edc4b0300a9784ec5dcbe1c52 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Thu, 8 Jan 2026 16:33:18 +0300 Subject: twin: better rules when to set custom_opacity flag This patch implements next peaces of logic: - If opacity is not completely opaque by default, changing it to opaque won't result it resetting the flag anymore. - Also in such a case the X11 property will be set for completely opaque windows as well. That way we can restore it in case of WM restart. - On WM initialization we check if the X11 opacity property has value we would expectto be left behind by previous WM instance and if it does we won't set the custom_opacity flag. Signed-off-by: Alexander Golubev --- twin/useractions.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'twin/useractions.cpp') diff --git a/twin/useractions.cpp b/twin/useractions.cpp index c573e8214..8051c9574 100644 --- a/twin/useractions.cpp +++ b/twin/useractions.cpp @@ -652,21 +652,22 @@ bool Client::performMouseCommand( Options::MouseCommand command, TQPoint globalP { if (opacity_ < Opacity::Opaque - Opacity::MouseStep) { - setOpacity(true, opacity_ + Opacity::MouseStep); custom_opacity = true; + setOpacity(true, opacity_ + Opacity::MouseStep); } else { - setOpacity(false, Opacity::Opaque); - custom_opacity = false; + if (defaultOpacity() == Opacity::Opaque) + custom_opacity = false; + setOpacity(true, Opacity::Opaque); } } break; case Options::MouseOpacityLess: if (opacity_ > 0) { - setOpacity(true, (opacity_ > Opacity::MouseStep) ? opacity_ - Opacity::MouseStep : Opacity::Transparent); custom_opacity = true; + setOpacity(true, (opacity_ > Opacity::MouseStep) ? opacity_ - Opacity::MouseStep : Opacity::Transparent); } break; case Options::MouseNothing: -- cgit v1.2.3