Bug 359797

Summary: BorderlessMaximizedWindows=true forces server-side decorations
Product: [Plasma] kwin Reporter: Francis Herne <mail>
Component: decorationsAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: minor Flags: thomas.luebking: ReviewRequest+
Priority: NOR    
Version First Reported In: 5.5.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: https://git.reviewboard.kde.org/r/127198/
Latest Commit: Version Fixed In: 5.6
Sentry Crash Report:
Attachments: xprop output, before maximising (no border)
diff to after maximising/unmaximising (with border added)

Description Francis Herne 2016-02-25 17:13:08 UTC
Applications with client-side decorations shouldn't have server-side decorations drawn (unless the script for that is enabled), because the double titlebar wastes space and looks broken.

With the setting BorderlessMaximisedWindows false or unset, this is the case.

When set to 'true', maximising and then unmaximising a window gives it server-side decorations even if it didn't originally have them.
Comment 1 Thomas Lübking 2016-02-25 20:29:38 UTC
Wild guess:

diff --git a/geometry.cpp b/geometry.cpp
index 1bffa9b..9b06d32 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -2256,7 +2256,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
         // triggers a maximize change.
         // The next setNoBorder interation will exit since there's no change but the first recursion pullutes the restore geometry
         changeMaximizeRecursion = true;
-        setNoBorder(app_noborder || max_mode == MaximizeFull);
+        setNoBorder(app_noborder || m_motif.noBorder() || max_mode == MaximizeFull);
         changeMaximizeRecursion = false;
     }


If you can try the patch, that would be awesome - otherwise please attach the output of "xprop" on such window (state doesn't matter)
Comment 2 Francis Herne 2016-02-26 01:06:55 UTC
Created attachment 97560 [details]
xprop output, before maximising (no border)

Output of running xprop on a gitg window under KWin, before maximising the window.
Comment 3 Francis Herne 2016-02-26 01:08:05 UTC
Created attachment 97561 [details]
diff to after maximising/unmaximising (with border added)

After maximising and unmaximising, a border is added and xprop's output changes slightly.
Comment 4 Francis Herne 2016-02-26 01:10:20 UTC
I tried the patch (compiling KWin made my laptop's fan rather unhappy, not to mention my ears).

Unfortunately there was no noticeable change; decorations still appear when unmaximising the window.

xprop output is attached above.
Comment 5 Thomas Lübking 2016-02-26 17:27:47 UTC
You likely installed the recompiled kwin version out of PATH or similar - the patch works (tested gtk3-demo which shares CSD & relevant props) and the props support that.

Correct patch (motif hint must be flagged & invoking rules is nice - neither is relevant for the behavior)

diff --git a/geometry.cpp b/geometry.cpp
index 1bffa9b..2a07a20 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -2256,7 +2256,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
         // triggers a maximize change.
         // The next setNoBorder interation will exit since there's no change but the first recursion pullutes the restore geometry
         changeMaximizeRecursion = true;
-        setNoBorder(app_noborder || max_mode == MaximizeFull);
+        setNoBorder(rules()->checkNoBorder(app_noborder || (m_motif.hasDecoration() && m_motif.noBorder()) || max_mode == MaximizeFull));
         changeMaximizeRecursion = false;
     }


Review-request as soon as I can focus for more than a minute next time :-(
Comment 6 Francis Herne 2016-02-26 22:23:23 UTC
Sorry, yes, I must have done something wrong.
Latest patch works for me.
Comment 7 Thomas Lübking 2016-02-29 08:49:33 UTC
Git commit 9d09cf6dc9cb36ebf94663106a87141642599430 by Thomas Lübking.
Committed on 29/02/2016 at 08:48.
Pushed by luebking into branch 'master'.

respect motif and rules on unmaximizing

when restoring a borderless maximized, the window shall
not suddenly be decorated
FIXED-IN: 5.6
REVIEW: 127198

M  +1    -1    geometry.cpp

http://commits.kde.org/kwin/9d09cf6dc9cb36ebf94663106a87141642599430