Bug 407989

Summary: Maximized windows can be resized on multi monitor setups
Product: [Plasma] Breeze Reporter: Sefa Eyeoglu <contact>
Component: window decorationAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Status: RESOLVED FIXED    
Severity: normal CC: hugo.pereira.da.costa, nate
Priority: NOR    
Version: 5.15.90   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.17.0
Sentry Crash Report:
Attachments: kwinrc
breezerc
KWin Support Information
xprop for Firefox

Description Sefa Eyeoglu 2019-05-27 10:08:56 UTC
SUMMARY
KWin allows resizing windows at the screenedges on multi-monitor setups. This behaviour is not affected by the setting "Allow resizing maximized windows from window edges" for Breeze Window Decoration.

STEPS TO REPRODUCE
1. Open any resizable window
2. Maximize it on screen X
3. Try to drag the window at the edge, where screen X and screen Y meet, but while staying on screen Y.

OBSERVED RESULT
Window can be resized although it is maximized.

EXPECTED RESULT
The window border should be disabled for interactions

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.15.90
KDE Frameworks Version: 5.58.0
Qt Version: 5.13.0
Kernel Version: 5.1.4-zen1-1-zen
OS Type: 64-bit

ADDITIONAL INFORMATION
This bug persists over many KWin versions.
Comment 1 Vlad Zahorodnii 2019-05-27 11:52:19 UTC
Please post your kwinrc and if you use breeze decoration, breezerc as well.
Comment 2 Sefa Eyeoglu 2019-05-27 13:40:32 UTC
Created attachment 120341 [details]
kwinrc
Comment 3 Sefa Eyeoglu 2019-05-27 13:41:02 UTC
Created attachment 120342 [details]
breezerc
Comment 4 Vlad Zahorodnii 2019-05-27 15:08:41 UTC
Can you post xprop of the maximized client and also output of `qdbus org.kde.KWin /KWin supportInformation`?
Comment 5 Sefa Eyeoglu 2019-05-27 16:50:21 UTC
Created attachment 120347 [details]
KWin Support Information
Comment 6 Sefa Eyeoglu 2019-05-27 16:50:45 UTC
Created attachment 120348 [details]
xprop for Firefox
Comment 7 Vlad Zahorodnii 2019-05-27 17:11:54 UTC
Nothing looks suspicious in the xprop output; the culprit seems to be

> borderSize: 0
Comment 8 Vlad Zahorodnii 2019-05-27 17:18:43 UTC
For the record: it seems like this is a Breeze/Oxygen decoration theme issue.
Comment 9 Sefa Eyeoglu 2019-05-27 17:44:16 UTC
I can confirm, that if I set the Window border size to Normal the issue is gone. The same issue happens with window decoration themes other than Breeze and Oxygen, like Plastik.
Comment 10 Vlad Zahorodnii 2019-05-27 18:59:59 UTC
Can confirm with the Plastik decoration theme, but not with other Aurorae decoration themes.
Comment 11 Vlad Zahorodnii 2019-05-27 19:01:56 UTC
Tracking this bugs becomes a bit messy. Can you please file corresponding bug against Plastik? (product: kwin, component: Aurorae)
Comment 12 Hugo Pereira Da Costa 2019-06-03 08:59:01 UTC
for oxygen and breeze at least, this is probably due to the "extended window borders", the ability to resize windows from "outside" the window. It is enabled only when there is no border drawn. 
It is not disabled for maximized windows it seems. 
When you have only one monitor, this is not an issue because outside of the window for a maximized window means outside of the screen. This is not the case in multimonitor setup. 
I think it can be disabled inside the window decoration code itself. But should it not better be disabled upstream ? (in kdecoration or kwin) ? 

Hugo
Comment 13 Hugo Pereira Da Costa 2019-06-03 09:07:17 UTC
Patch for breeze: 

diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp
index 10686506..d5526ce2 100644
--- a/kdecoration/breezedecoration.cpp
+++ b/kdecoration/breezedecoration.cpp
@@ -423,10 +423,10 @@ namespace Breeze
         int extBottom = 0;
         if( hasNoBorders() )
         {
-            extSides = extSize;
-            extBottom = extSize;
+            if( !isMaximizedHorizontally() ) extSides = extSize;
+            if( !isMaximizedVertically() ) extBottom = extSize;
 
-        } else if( hasNoSideBorders() ) {
+        } else if( hasNoSideBorders() && !isMaximizedHorizontally() ) {
 
             extSides = extSize;
Comment 14 Vlad Zahorodnii 2019-06-03 09:48:16 UTC
(In reply to Hugo Pereira Da Costa from comment #12)
> I think it can be disabled inside the window decoration code itself. But
> should it not better be disabled upstream ? (in kdecoration or kwin) ? 
It can be disabled in kdecoration, but I'm personally more in favor leaving this decision to the decoration theme.

(In reply to Hugo Pereira Da Costa from comment #13)
> Patch for breeze: 
> 
Heh, it's more simpler than the one I proposed. Perhaps we need to unset resize-only borders for shaded clients too, so there is no dead zone around each shaded client.
Comment 15 Hugo Pereira Da Costa 2019-06-03 09:55:36 UTC
 
> > 
> Heh, it's more simpler than the one I proposed. Perhaps we need to unset
> resize-only borders for shaded clients too, so there is no dead zone around
> each shaded client.

Interesting: right now, in breeze, if I set the window borders to no-sides or no-borders, in fact the extended sides do not apply to the decoration title (whether the window is shaded or not), and shaded windows cannot be resized at all. 
Not from the top or bottom, by construction, but also not on the sides, because there is no extended sides. 
So: I don't see a dead zone around shaded clients, but there is no way to resize them either. This is true whether or not you allow resizing maximized windows. Do you confirm ? Should this be considered a bug ?
Comment 16 Vlad Zahorodnii 2019-06-03 10:19:43 UTC
Not exactly, you cannot resize shaded windows because kwin doesn't allow that. Perhaps kwin could reset the decoration input window for shaded clients without relying on the decoration theme to update resize-only borders accordingly...

In either case, your patch is good to go. :-)
Comment 17 Hugo Pereira Da Costa 2019-06-03 10:23:33 UTC
(In reply to Vlad Zagorodniy from comment #16)
> Not exactly, you cannot resize shaded windows because kwin doesn't allow
> that. 

Right ! confirmed. (I thought it was possible with non zero side borders, but indeed it is not, even in that case)

> Perhaps kwin could reset the decoration input window for shaded
> clients without relying on the decoration theme to update resize-only
> borders accordingly...
> 
> In either case, your patch is good to go. :-)

ok. I'll push for both oxygen and breeze. Sorry if I missed some existing review requests on this: I don't automatically get the notificatiosn of those anymore after having stepped down from maintainership (and because of being annoyed by some people commenting excessively on those in the past). 

Hugo
Comment 18 Hugo Pereira Da Costa 2019-06-03 10:26:27 UTC
Git commit c95b7652b7afbcc1bfc54f9185d2be4953acc119 by Hugo Pereira Da Costa.
Committed on 03/06/2019 at 10:25.
Pushed by hpereiradacosta into branch 'master-kde'.

Disable extended resize borders for maximized windows

M  +3    -3    kdecoration/breezedecoration.cpp

https://commits.kde.org/breeze/c95b7652b7afbcc1bfc54f9185d2be4953acc119
Comment 19 Vlad Zahorodnii 2019-06-03 10:30:54 UTC
> Sorry if I missed some existing review requests on this:
No problemo. :-)
Comment 20 Hugo Pereira Da Costa 2019-06-03 10:38:57 UTC
Git commit 72a70ceacc0434c04ddd795b5f2c093cba588b26 by Hugo Pereira Da Costa.
Committed on 03/06/2019 at 10:38.
Pushed by hpereiradacosta into branch 'master'.

Disable extended resize borders for maximized windows

M  +3    -3    kdecoration/oxygendecoration.cpp

https://commits.kde.org/oxygen/72a70ceacc0434c04ddd795b5f2c093cba588b26
Comment 21 Vlad Zahorodnii 2019-06-03 11:48:47 UTC
I think it can be marked as fixed, at least Breeze/Oxygen part. Aurorae part has to be fixed in KWin itself.