diff options
| author | Alexander Golubev <fatzer2@gmail.com> | 2026-01-08 16:33:18 +0300 |
|---|---|---|
| committer | Fat-Zer <fatzer2@gmail.com> | 2026-02-13 19:41:02 +0000 |
| commit | 04b43be9b261f36edc4b0300a9784ec5dcbe1c52 (patch) | |
| tree | 967aafbc0ce7c706cafe3dbb0f804a2cf0bb8544 /twin/client.cpp | |
| parent | 97e3bd0ca6cdc58c1915038eaf28822a60d0206e (diff) | |
| download | tdebase-04b43be9b261f36edc4b0300a9784ec5dcbe1c52.tar.gz tdebase-04b43be9b261f36edc4b0300a9784ec5dcbe1c52.zip | |
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 <fatzer2@gmail.com>
Diffstat (limited to 'twin/client.cpp')
| -rw-r--r-- | twin/client.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/twin/client.cpp b/twin/client.cpp index e9e74e139..7cdf00a77 100644 --- a/twin/client.cpp +++ b/twin/client.cpp @@ -2801,8 +2801,8 @@ void Client::setOpacity(bool translucent, uint opacity) return; // xcompmgr does not like non solid desktops and the user could set it accidently by mouse scrolling // tqWarning("setting opacity for %d",tqt_xdisplay()); //rule out activated translulcency with 100% opacity - if (!translucent || opacity == Opacity::Opaque) - { + if ((!translucent || opacity == Opacity::Opaque) && !custom_opacity) + { // Note: if it is custom_opacity we want to keep the properties in case of WM restart opacity_ = Opacity::Opaque; XDeleteProperty (tqt_xdisplay(), frameId(), atoms->net_wm_window_opacity); XDeleteProperty (tqt_xdisplay(), window(), atoms->net_wm_window_opacity); // ??? frameId() is necessary for visible changes, window() is the winId() that would be set by apps - we set both to be sure the app knows what's currently displayd @@ -2827,7 +2827,12 @@ void Client::setShadowSize(uint shadowSize) uint Client::defaultOpacity() { - if (isActive() || (keepAbove() && options->keepAboveAsActive)) + return defaultOpacity(isActive() || (keepAbove() && options->keepAboveAsActive)); + } + +uint Client::defaultOpacity(bool active) + { + if (active) { if( ruleOpacityActive() ) return rule_opacity_active; @@ -2941,7 +2946,15 @@ bool Client::getWindowOpacity() //query translucency settings from X, returns tr if (result == Success && data && format == 32 ) { opacity_ = *reinterpret_cast< long* >( data ); - custom_opacity = true; + // Don't set custom_opacity flag during initialization if the opacity looks like what it + // supposed to be for the given type of window. As in a such case it is likely set by us + // and the WM is just restarting + if ( !(Workspace::self()->initializing() + && ( opacity_ == defaultOpacity(/*active*/ false) + || opacity_ == defaultOpacity(/*active*/ true) ) ) ) + { + custom_opacity = true; + } // setOpacity(opacity_ < 0xFFFFFFFF, opacity_); XFree ((char*)data); return true; |
