Bug 359764

Summary: Panel doesn't allow resizing
Product: [Plasma] plasmashell Reporter: Heiko Becker <heiko.becker>
Component: PanelAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: bzugmeyer, ciiol.mail, gavrilovp, georgy496, kde, mklapetek, notmart, tuomas.salokanto, urban.yoga.journeys
Priority: NOR    
Version: 5.5.95   
Target Milestone: 1.0   
Platform: Exherbo   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Heiko Becker 2016-02-24 17:08:17 UTC
I cannot resize my (horizontal) panel since quite some time with current master. Dragging the controls intended to resize it doesn't  have any effect, same for the "Maximize panel" button.

Furthermore, it resizes itself, apparently depending on the number of taskbar entries, drawing unnecessarily attention away.

Adding a new standard panel doesn't make it work. As soon as I enable "Show only tasks from the current desktop" (reducing the number of taskbar entries) the panel snaps back to a smaller size. Also locking it doesn't prevent this.
Comment 1 Marco Martin 2016-03-02 10:57:08 UTC
David: this is perhaps fixed by the recent fix you did where the same view object was binded for all panels?
Comment 2 Heiko Becker 2016-03-03 13:33:49 UTC
(In reply to Marco Martin from comment #1)
> David: this is perhaps fixed by the recent fix you did where the same view
> object was binded for all panels?

You mean d0440dd8203a7bcb52a8d4e2e16c53efa5fa60da in plasma-workspace? In that case it didn't fix my problem. Currently using 5.5.95 wich has that commit.
Comment 3 Heiko Becker 2016-03-10 11:18:57 UTC
Turns out this is partly caused by using a tiling wm and not kwin. I realize this will likely lead to closing this bugs as RESOLVED WONTFIX. However, it did work with Plasma 5.5 and on master until some point mid January and thus might be considered as a regression.

Any pointers where to look and how to improve or fix this would be greatly appreciated.
Comment 4 Martin Klapetek 2016-03-10 16:13:49 UTC
Best would be if you could identify the commit that broke it for you,
then we'd know what exactly is broken and we can see if there's a way
to fix it.
Comment 5 Tuomas Salokanto 2016-03-29 17:05:00 UTC
I can confirm this too. I'm using bspwm as a window manager, and recent update to 5.6 causes me this exact same behaviour.
Comment 6 David Edmundson 2016-03-29 23:18:37 UTC
Can you show me the output of xprop (and clicking on the panel) after resizing.

If that shows we're resizing properly and the WM is ignoring us, it'll be wontfix. 
If it shows we're not setting somethign properly I'll fix it.
Comment 7 Tuomas Salokanto 2016-03-30 16:48:20 UTC
Working panel in wanted size, plasma 5.5.x
http://pastebin.com/fMzZ8asf

Not working panel in wanted size, plasma 5.6.x
http://pastebin.com/RCubxhwk

I hope I understood your request!
Comment 8 Tuomas Salokanto 2016-03-31 09:26:05 UTC
You probably noticed this already, but only meaningful difference what I find in those two xprops:

In 5.5
user specified location: 312, 0
user specified size: 1608 by 28

In 5.6
user specified location: 365, 0
user specified size: 1555 by 28

That +53 difference in location is subtracted from the specified size. The rest goes somewhere hidden over borders?
Comment 9 mozart reina 2016-03-31 19:41:07 UTC
I have the same issue, my WM is XMonad.

http://pastebin.com/RMVMhtyp
Comment 10 David Edmundson 2016-04-03 21:45:55 UTC
*** Bug 361338 has been marked as a duplicate of this bug. ***
Comment 11 David Edmundson 2016-04-03 21:58:01 UTC
Not working in xmonad:

WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 365, 0
        user specified size: 1555 by 28
        program specified minimum size: 1607 by 28
        program specified maximum size: 1607 by 28
        window gravity: Static

Not working in xmonad:
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 312, 0
        user specified size: 1608 by 28
        program specified minimum size: 1608 by 28
        program specified maximum size: 1608 by 28
        window gravity: Static


Looks like I skip a resize as I set the min/max and assume it will then resize implicitly. 
(which a working WM would do)

If someone wants to make a patch, you'll need to adjust PanelView::resizePanel
so that resize() keeps it *also* within minimumSize() and maximiumSize()

can someone replace their panelsize::resizePanel() method to this:

void PanelView::resizePanel()
{
    QSize userSize;
    if (formFactor() == Plasma::Types::Vertical) {
        const int minSize = qMax(MINSIZE, m_minLength);
        const int maxSize = qMin(m_maxLength, screen()->size().height() - m_offset);
        setMinimumSize(QSize(thickness(), minSize));
        setMaximumSize(QSize(thickness(), maxSize));
        userSize = QSize(thickness(), qBound(minSize, m_contentLength, maxSize));
    } else {
        const int minSize = qMax(MINSIZE, m_minLength);
        const int maxSize = qMin(m_maxLength, screen()->size().width() - m_offset);
        setMinimumSize(QSize(minSize, thickness()));
        setMaximumSize(QSize(maxSize, thickness()));
        userSize = QSize(qBound(minSize, m_contentLength, maxSize), thickness());
    }
    resize(userSize.expandedTo(minimumSize()).boundTo(maximiumSize()));
    //positionPanel will be called implicitly from resizeEvent
}
Comment 12 David Edmundson 2016-04-03 22:00:18 UTC
Edit, the last line should be:
    resize(userSize.expandedTo(minimumSize()).boundedTo(maximumSize()));
Comment 13 Heiko Becker 2016-04-04 12:27:32 UTC
I tried  to follow your suggestions from comment #11 and noticed that there is no PanelView::resizePanel() on Plasma/5.6 (old master I reported the bug against has become Plasma/5.6 in the meantime).

After seeing that there 6 new commits compared to Plasma/5.6 touching that code, I just tested master and *tada*, resizing the panel does work again! Thanks for that.

So, I guess that poses the question if said commits can be safely backported. If you want I could check what commits are exactly necessary to fix the issue.
Comment 14 David Edmundson 2016-04-04 13:33:17 UTC
I'm a bit confused.

The commit that broke things is only in master.

When you say master works, do you mean with comment #11 or just master on it's own?
Comment 15 Heiko Becker 2016-04-04 14:15:15 UTC
(In reply to David Edmundson from comment #14)
> The commit that broke things is only in master.

Only speaking for me, but it broke at some point between Plasma 5.5 and 5.6.

> When you say master works, do you mean with comment #11 or just master on
> it's own?

Just master on its own.
Comment 16 Heiko Becker 2016-04-05 08:35:22 UTC
I failed to find the offending commit between 5.5.x and 5.6 when bisecting. (Maybe some other component influenced it.)
But I did the same reversely to see which commit fixed my issue on current master:

commit 6f70e9f2fcd3791c0a923302f51eb6742987e1bf
Author: David Edmundson <kde@davidedmundson.co.uk>
Date:   Thu Mar 17 16:31:54 2016 +0000
    Cleanup resize
    Always keep resize() call within bounds ourselve

Additionally I cherrry-picked the following commits on top of Plasma 5.6.1 as they seem to depend on another:
- 3dd1ec8 Remove invalid emit
- 12f7cbf Don't set min and max size of window twice

This fixes it for me with awesome as WM. I also did a quick check with kwin, which seems to work as well.
Comment 17 David Edmundson 2016-04-08 01:36:49 UTC
Oh, so I accidentally fixed things when I tidied them up \o/
That's good to know.

I'll backport those 3 into 5.6 then.
Comment 18 Andrey Fadeev 2016-08-05 18:32:00 UTC
I'm having same problem both with 5.6.5 and current plasma-desktop master (825f59e3f46978e3d51b279fbe01b5707874c927).

As bisecting shows, the offending commit is a ba733d16fb2849b2b2cc390ed89b5200dffb5c3f. When I reverted it, the panel resizing start working as expected
Comment 19 David Edmundson 2016-08-28 00:48:41 UTC
Based on comments in #17, I'm closing this as fixed.

Please reopen if it's not.