Bug 379790 - MDI SubWindows are frozen (non-responsive) with Breeze and Oxygen
Summary: MDI SubWindows are frozen (non-responsive) with Breeze and Oxygen
Status: RESOLVED WORKSFORME
Alias: None
Product: Breeze
Classification: Plasma
Component: QStyle (show other bugs)
Version: 5.9.5
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: Hugo Pereira Da Costa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-13 20:47 UTC by Tim E. Real
Modified: 2017-07-13 03:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Frozen MDI test UI file 1 (1.29 KB, application/xml)
2017-05-14 16:16 UTC, Tim E. Real
Details
another ui file with mdi windows, that work (1.14 KB, application/x-designer)
2017-05-15 07:06 UTC, Hugo Pereira Da Costa
Details
Simple cmake based Qt MDI program sets stylesheet (1.60 KB, application/gzip)
2017-06-06 00:14 UTC, Tim E. Real
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim E. Real 2017-05-13 20:47:15 UTC
Steps to reproduce: In Qt5Designer (or Creator), create a widget,
 add an QMDIArea, and add one or more sub windows. 
Set a stylesheet on the QMDIArea, such as a font or colour or gradient.
Preview the form in Breeze or Oxygen styles.
The MDI sub windows are frozen. Other styles are OK, such as Fusion.
This is under latest OpenSuse tumbleweed. But also under KUbuntu 16.04 LTS
 the problem is worse: The MDI sub windows are frozen even without
 setting a stylesheet on the QMDIArea.
This has plagued our app since Qt5 was released. Please help. Thanks.
Comment 1 Hugo Pereira Da Costa 2017-05-14 05:27:40 UTC
Hi 
Thanks for reporting and sorry for the annoyance.
Can you provide the version of Qt ? 
Here with QT5.7.1, Plasma 5.9.5 (same as you), I cannot reproduce.
Comment 2 Hugo Pereira Da Costa 2017-05-14 05:32:39 UTC
Also, could you attach a ui file for which the problem is evident (so that I am sure I am doing the right thing when trying to reproduce) ?
Comment 3 Tim E. Real 2017-05-14 16:16:06 UTC
Created attachment 105534 [details]
Frozen MDI test UI file 1

Open in Qt5Designer or Creator. The MDI sub windows are frozen
 in Breeze or Oxygen.
Comment 4 Tim E. Real 2017-05-14 16:37:49 UTC
Wow. I never tried saving/re-opening a test-case UI file before.
This fresh suse installation is on Breeze by default.
So the attached UI file's MDI sub windows are frozen even without
 previewing the form. They are frozen right in the Qt5Designer editor !
Qt Version 5.7.1

As mentioned, also observed on KUbuntu 6.0.4 LTS, worse it happens even 
 without setting any stylesheet on the QMDIArea. (The supplied UI file
 has a stylesheet set on the QMDIArea.)
Also observed on another, older PC running same KUbuntu 6.0.4 LTS.
Others in our group have also reported the problem.

Only commonality I can think of, at least in my setup, is the 
 Nouveau nVidia drivers. But I think I tried an ATI card at one point.

Everything is fine if the attached UI file is opened in Qt4Designer!
Indeed, our Qt app was fine in Qt4 (and Qt3, Qt2, Qt1, he he.)

Thanks.
Comment 5 Tim E. Real 2017-05-14 16:52:40 UTC
Wow! When the attached UI file is opened, it is not only the
 MDI sub windows that are affected - it is the ENTIRE QMainWindow
 containing the QMDIArea.
In fact, I am unable to even move the window around in Qt5Designer !
I can place items on the form, but I cannot select anything afterwards.
The rest of Qt5Designer is OK, of course.
Comment 6 Hugo Pereira Da Costa 2017-05-14 20:14:23 UTC
Thanks for posting the ui file
I can reproduce all the freezes you describe. Will investigate.
Raising as high priority
Comment 7 Hugo Pereira Da Costa 2017-05-15 07:02:29 UTC
Can you check with oxygen-demo5 if the mdi-window tab is responsive there ? 
It is, here.
Comment 8 Hugo Pereira Da Costa 2017-05-15 07:06:43 UTC
Created attachment 105543 [details]
another ui file with mdi windows, that work

Can you test this ui locally (it has mdi windows, no stylesheet)
Here nothing is frozen (which is why I reported that I cannot reproduce in the first place)
If confirmed that neither oxygen-demo5 nor this ui are frozen, it means that there is something specific to the ui you sent that makes the freeze happen. 

That could be a good base for further investigations
Comment 9 Hugo Pereira Da Costa 2017-05-15 07:10:11 UTC
Here at least it seems setting the stylesheet creates the freeze. 
Removing it on your ui file unfreezes things
Adding it on mine freezes things.
Comment 10 Tim E. Real 2017-05-16 05:16:10 UTC
(In reply to Hugo Pereira Da Costa from comment #7)
> Can you check with oxygen-demo5 if the mdi-window tab is responsive there ? 
> It is, here.

Yes. In the openSuSE Tumbleweed. 
There's no oxygen-demo5 in the older KUbuntu 16.04 LTS
Comment 11 Tim E. Real 2017-05-16 05:25:15 UTC
(In reply to Hugo Pereira Da Costa from comment #8)
> Created attachment 105543 [details]
> another ui file with mdi windows, that work
> 
> Can you test this ui locally (it has mdi windows, no stylesheet)
> Here nothing is frozen (which is why I reported that I cannot reproduce in
> the first place)
> If confirmed that neither oxygen-demo5 nor this ui are frozen, it means that
> there is something specific to the ui you sent that makes the freeze happen. 
> 
> That could be a good base for further investigations

Works OK here but this has nothing to do with ui files, 
 read "steps to reproduce" above.
It happens when previewing a newly created form, as described, and 
 selecting 'Preview in...' Breeze or Oxygen.
Comment 12 Tim E. Real 2017-05-16 06:19:12 UTC
(In reply to Hugo Pereira Da Costa from comment #9)
> Here at least it seems setting the stylesheet creates the freeze. 
> Removing it on your ui file unfreezes things
> Adding it on mine freezes things.

Yes, strange eh? 
Today I noticed that even after you do File > Close, then 
 try to create another new blank form, wham - it's frozen too! 
As if the freeze 'carried over' to the next form or something,
 having 'infected' Qt5Designer until restarted.

I did not want to bombard with too much info at first,
 just something clearly demonstrate-able.

But what is not so easily shown is that these problems 
 are also occurring on calls to qApp->setStyle().

The freeze can occur when a new MDI sub window is created.

The sub windows can freeze simply by maximizing or
 minimizing or restoring them, no joke.

That's /without/ stylesheets.

But as we see, stylesheets also make it worse.
I was really surprised to see the stylesheet freeze on openSuSE.
I was looking more for the style issues.

To me, it's clear the style and stylesheet problems are related.

Breeze and Oxygen sure don't seem to like MDI.
I've been tracking this bug for a while...

I found an awkward workaround. It mostly works, but not always.
I found that calling qApp->setStyle() TWICE makes it work.
setStyle() has a sort of toggling on/off effect on freeze.
But due to the differences in distros, it's not consistent.

Hope I can further assist in squashing this. T.
Comment 13 Hugo Pereira Da Costa 2017-05-16 07:30:26 UTC
> Today I noticed that even after you do File > Close, then 
>  try to create another new blank form, wham - it's frozen too! 
> As if the freeze 'carried over' to the next form or something,
>  having 'infected' Qt5Designer until restarted.
> 
> I did not want to bombard with too much info at first,
>  just something clearly demonstrate-able.
> 
> But what is not so easily shown is that these problems 
>  are also occurring on calls to qApp->setStyle().
> 
> The freeze can occur when a new MDI sub window is created.
> 
> The sub windows can freeze simply by maximizing or
>  minimizing or restoring them, no joke.
> 
> That's /without/ stylesheets.

I cannot reproduce that part.
from oxygen-demo5 (that you can get by manually compiling oxygen code, or possibly there is even a package for it somewhere), I am unable to make the mdi freeze.
Also not that in Qt Designer, the main view (in which newly created widgets/window forms appear), is a QMDI (and mdi subwindows). As far as I know, these do not freeze (unless you start adding mdi in the inside subwindows).

Or do I miss something ? 

Reason why the full window (and newly created forms) freeze after the first mdi freezes, it is a consequence from the fact that the main view is also mdi. It gets screwed at the same time the inner mdi is. 

... still investigated.
But if you could have either code snipset/example application/ui file that demonstrate that MDI freezes without stylesheet, that would also help.

Best

> But as we see, stylesheets also make it worse.
> I was really surprised to see the stylesheet freeze on openSuSE.
> I was looking more for the style issues.
> 
> To me, it's clear the style and stylesheet problems are related.
> 
> Breeze and Oxygen sure don't seem to like MDI.
> I've been tracking this bug for a while...
> 
> I found an awkward workaround. It mostly works, but not always.
> I found that calling qApp->setStyle() TWICE makes it work.
> setStyle() has a sort of toggling on/off effect on freeze.
> But due to the differences in distros, it's not consistent.
> 
> Hope I can further assist in squashing this. T.
Comment 14 Hugo Pereira Da Costa 2017-05-16 07:39:10 UTC
Note that in the meanwhile I have tracked down the origin of the issue a little (and why it happens only in breeze and oxygen). It boils down to the fact that we draw shadows around the mdi subwindows (unlike other styles).
These are realized with "invisible" widgets, which normally cannot received input events, and are hidden from the window stack.

Now what happens when a style sheet is set, at least, is that these shadows become "not invisible" anymore, and break the window stack. They start receiving mouse events (and keywords), instead of the window on top of them. Hence the freeze. 

The thing that I have not found out yet is why this happens only after stylesheet is set (and possibly on other conditions), and why this happen to all shadows, including the ones for which no stylesheet is set.
Comment 15 Hugo Pereira Da Costa 2017-05-18 10:05:08 UTC
Git commit 760cc2b71d544c8084f278bc2d6eb7cfa576b864 by Hugo Pereira Da Costa.
Committed on 18/05/2017 at 10:03.
Pushed by hpereiradacosta into branch 'master'.

set a mask to shadow widget to make sure that it does not overlap with the mdi window.

M  +10   -2    kstyle/breezemdiwindowshadow.cpp

https://commits.kde.org/breeze/760cc2b71d544c8084f278bc2d6eb7cfa576b864
Comment 16 Hugo Pereira Da Costa 2017-05-18 10:07:57 UTC
Previous commit fixes the issue for me.
I will backport to plasma 5.10.
Don't hesitate to reopen if the problem reappears after that.

best,

Hugo
Comment 17 Hugo Pereira Da Costa 2017-05-18 10:40:14 UTC
Git commit ac3136236da1854262387d2f24409b3bf6aeaca9 by Hugo Pereira Da Costa.
Committed on 18/05/2017 at 10:39.
Pushed by hpereiradacosta into branch 'master'.

Set a mask to shadow widget to make sure that it does not overlap with the mdi window.

M  +22   -3    kstyle/oxygenmdiwindowshadow.cpp
M  +29   -41   kstyle/oxygenmdiwindowshadow.h

https://commits.kde.org/oxygen/ac3136236da1854262387d2f24409b3bf6aeaca9
Comment 18 Hugo Pereira Da Costa 2017-05-18 10:41:20 UTC
Git commit 21f4e6ec82f1faef06cc31f0c14dbfcbbcac78f7 by Hugo Pereira Da Costa.
Committed on 18/05/2017 at 10:41.
Pushed by hpereiradacosta into branch 'Plasma/5.10'.

Set a mask to shadow widget to make sure that it does not overlap with the mdi window.

M  +22   -3    kstyle/oxygenmdiwindowshadow.cpp
M  +29   -41   kstyle/oxygenmdiwindowshadow.h

https://commits.kde.org/oxygen/21f4e6ec82f1faef06cc31f0c14dbfcbbcac78f7
Comment 19 Hugo Pereira Da Costa 2017-05-18 10:42:05 UTC
Git commit 71ac59a3b571e5bcf8f75b602951ae73069b34bf by Hugo Pereira Da Costa.
Committed on 18/05/2017 at 10:41.
Pushed by hpereiradacosta into branch 'Plasma/5.10'.

set a mask to shadow widget to make sure that it does not overlap with the mdi window.

M  +10   -2    kstyle/breezemdiwindowshadow.cpp

https://commits.kde.org/breeze/71ac59a3b571e5bcf8f75b602951ae73069b34bf
Comment 20 Tim E. Real 2017-06-06 00:14:34 UTC
Created attachment 105939 [details]
Simple cmake based Qt MDI program sets stylesheet

Hi, can you spare some more time? 5.10 packages came down the line 
 (with your fixes in the Oxygen/Breeze package change logs).
Strange, I looked at git repo and didn't see Oxygen changes. Wrong git?

At first it seemed to work. But no, still not working. 
Style and/or stylesheet are still freezing. 
Can you confirm? Several ways to reproduce the problem:

METHOD A (stylesheet freeze):
1) Set Plasma workspace Look and Feel to Breeze.
2) In Qt5Designer (or Creator), open my previously supplied 
 frozen_MDI_1.ui attachment (with stylesheets).
3) Maximize one of the sub windows.
4) Observe the sub window is frozen after maximizing.

METHOD B (style freeze, no stylesheets involved):
1)  Set Plasma workspace Look and Feel to Oxygen.
2)  In Qt5Designer (or Creator), open your previously
     supplied mdi-2.ui file (without stylesheets).
3)  Maximize one of the sub windows.
4)  Observe the sub windows should still both be OK.
5)  Now set Plasma workspace Look and Feel to Breeze.
6)  Observe the maximized sub window is frozen.
    (After switching to Breeze, one of two open KDevelop 
     instances was completely frozen. Repeatable. Unrelated?)
8)  Now set Plasma workspace Look and Feel back to Oxygen.
9)  Observe all is OK. (Well, except for KDevelop...)
10) Repeat switching Oxygen <- -> Breeze , observe the
     maximized MDI sub windows toggling freezing.

METHOD C (stylesheet freeze):
1) Run this newly attached small demonstration program.
2) Observe the sub window is frozen.
3) Also, try the test in METHOD B (switching between Oxygen/Breeze)
    and observe the freeze toggling.

Thanks.
Comment 21 Hugo Pereira Da Costa 2017-06-15 14:28:37 UTC
(In reply to Tim E. Real from comment #20)
> Created attachment 105939 [details]
> Simple cmake based Qt MDI program sets stylesheet
> 
> Hi, can you spare some more time? 5.10 packages came down the line 
>  (with your fixes in the Oxygen/Breeze package change logs).
> Strange, I looked at git repo and didn't see Oxygen changes. Wrong git?
> 

No clue. 
But I double checked that the oxygen changes are _in_ (both master and Plasma/5.10)

> At first it seemed to work. But no, still not working. 
> Style and/or stylesheet are still freezing. 
> Can you confirm? Several ways to reproduce the problem:
> 
> METHOD A (stylesheet freeze):
> 1) Set Plasma workspace Look and Feel to Breeze.
> 2) In Qt5Designer (or Creator), open my previously supplied 
>  frozen_MDI_1.ui attachment (with stylesheets).
> 3) Maximize one of the sub windows.
> 4) Observe the sub window is frozen after maximizing.
> 
> METHOD B (style freeze, no stylesheets involved):
> 1)  Set Plasma workspace Look and Feel to Oxygen.
> 2)  In Qt5Designer (or Creator), open your previously
>      supplied mdi-2.ui file (without stylesheets).
> 3)  Maximize one of the sub windows.
> 4)  Observe the sub windows should still both be OK.
> 5)  Now set Plasma workspace Look and Feel to Breeze.
> 6)  Observe the maximized sub window is frozen.
>     (After switching to Breeze, one of two open KDevelop 
>      instances was completely frozen. Repeatable. Unrelated?)
> 8)  Now set Plasma workspace Look and Feel back to Oxygen.
> 9)  Observe all is OK. (Well, except for KDevelop...)
> 10) Repeat switching Oxygen <- -> Breeze , observe the
>      maximized MDI sub windows toggling freezing.
> 
> METHOD C (stylesheet freeze):
> 1) Run this newly attached small demonstration program.
> 2) Observe the sub window is frozen.
> 3) Also, try the test in METHOD B (switching between Oxygen/Breeze)
>     and observe the freeze toggling.

So methods A and methods C are essentially the same, right ? (setting a stylesheet on a MDI window)

Will investigate

Will investigate also method B. Here the common denominator is maximizing windows. 

PS: for changing the status of the bug, just change the combobox in front of "status" (here to "REOPENED")

> 
> Thanks.
Comment 22 Tim E. Real 2017-06-15 15:32:03 UTC
(In reply to Hugo Pereira Da Costa from comment #21)
> (In reply to Tim E. Real from comment #20)
> > Created attachment 105939 [details]
> > Simple cmake based Qt MDI program sets stylesheet
> > 
> > Hi, can you spare some more time? 5.10 packages came down the line 
> >  (with your fixes in the Oxygen/Breeze package change logs).
> > Strange, I looked at git repo and didn't see Oxygen changes. Wrong git?
> > 
> 
> No clue. 
> But I double checked that the oxygen changes are _in_ (both master and
> Plasma/5.10)
> 
> > At first it seemed to work. But no, still not working. 
> > Style and/or stylesheet are still freezing. 
> > Can you confirm? Several ways to reproduce the problem:
> > 
> > METHOD A (stylesheet freeze):
> > 1) Set Plasma workspace Look and Feel to Breeze.
> > 2) In Qt5Designer (or Creator), open my previously supplied 
> >  frozen_MDI_1.ui attachment (with stylesheets).
> > 3) Maximize one of the sub windows.
> > 4) Observe the sub window is frozen after maximizing.
> > 
> > METHOD B (style freeze, no stylesheets involved):
> > 1)  Set Plasma workspace Look and Feel to Oxygen.
> > 2)  In Qt5Designer (or Creator), open your previously
> >      supplied mdi-2.ui file (without stylesheets).
> > 3)  Maximize one of the sub windows.
> > 4)  Observe the sub windows should still both be OK.
> > 5)  Now set Plasma workspace Look and Feel to Breeze.
> > 6)  Observe the maximized sub window is frozen.
> >     (After switching to Breeze, one of two open KDevelop 
> >      instances was completely frozen. Repeatable. Unrelated?)
> > 8)  Now set Plasma workspace Look and Feel back to Oxygen.
> > 9)  Observe all is OK. (Well, except for KDevelop...)
> > 10) Repeat switching Oxygen <- -> Breeze , observe the
> >      maximized MDI sub windows toggling freezing.
> > 
> > METHOD C (stylesheet freeze):
> > 1) Run this newly attached small demonstration program.
> > 2) Observe the sub window is frozen.
> > 3) Also, try the test in METHOD B (switching between Oxygen/Breeze)
> >     and observe the freeze toggling.
> 
> So methods A and methods C are essentially the same, right ? (setting a
> stylesheet on a MDI window)

Yes, thanks. Most importantly the maximizing effect.

Further info: For METHOD 'A':
I discovered that you can cause the bug simply by grabbing the 
 lower right corner of the MDI sub window and expanding its
 geometry /beyond/ the size of the MDI area. 
As soon as that is done, the window freezes.
From the right-click context menu, selecting 'Cascade' or 
 'Tile' un-freezes it.

So the bug seems to be oh-so-borderline sensitive to
 over-sized geometry. To within a few pixels. Maybe explains
 why it seems to work in some conditions (say, with Oxygen) 
 but not others.

> Will investigate
> 
> Will investigate also method B. Here the common denominator is maximizing
> windows. 
> 
> PS: for changing the status of the bug, just change the combobox in front of
> "status" (here to "REOPENED")

Hm, don't see that here.

Thanks very much for your help. Tim.
Comment 23 Hugo Pereira Da Costa 2017-06-16 11:38:19 UTC
Git commit da757f6683a2bd6cae348a83921ffa318acec569 by Hugo Pereira Da Costa.
Committed on 16/06/2017 at 11:23.
Pushed by hpereiradacosta into branch 'master'.

- hide shadow when mask is empty
- properly handle creating shadow when mdi window is already visible at registration
- added some "auto" declarations

M  +20   -8    kstyle/breezemdiwindowshadow.cpp

https://commits.kde.org/breeze/da757f6683a2bd6cae348a83921ffa318acec569
Comment 24 Hugo Pereira Da Costa 2017-06-16 11:38:30 UTC
Git commit 9d0123305d7d3d4916c0b4f3b1cf3d60c95489b7 by Hugo Pereira Da Costa.
Committed on 16/06/2017 at 11:35.
Pushed by hpereiradacosta into branch 'master'.

- hide shadow when mask is empty
- properly handle creating shadow when mdi window is already visible at registration
- added some "auto" declarations

M  +34   -20   kstyle/oxygenmdiwindowshadow.cpp
M  +4    -4    kstyle/oxygenmdiwindowshadow.h

https://commits.kde.org/oxygen/9d0123305d7d3d4916c0b4f3b1cf3d60c95489b7
Comment 25 Hugo Pereira Da Costa 2017-06-16 11:40:57 UTC
Git commit 466c4bab2ade755b8016f9e99c4d4801a65fb4f0 by Hugo Pereira Da Costa.
Committed on 16/06/2017 at 11:40.
Pushed by hpereiradacosta into branch 'Plasma/5.10'.

- hide shadow when mask is empty
- properly handle creating shadow when mdi window is already visible at registration
- added some "auto" declarations

M  +20   -8    kstyle/breezemdiwindowshadow.cpp

https://commits.kde.org/breeze/466c4bab2ade755b8016f9e99c4d4801a65fb4f0
Comment 26 Hugo Pereira Da Costa 2017-06-16 11:42:39 UTC
Git commit 0853eac4dfdc96b36006c6bc5f3277a46ecb424d by Hugo Pereira Da Costa.
Committed on 16/06/2017 at 11:42.
Pushed by hpereiradacosta into branch 'Plasma/5.10'.

- hide shadow when mask is empty
- properly handle creating shadow when mdi window is already visible at registration
- added some "auto" declarations

M  +35   -21   kstyle/oxygenmdiwindowshadow.cpp
M  +4    -4    kstyle/oxygenmdiwindowshadow.h

https://commits.kde.org/oxygen/0853eac4dfdc96b36006c6bc5f3277a46ecb424d
Comment 27 Hugo Pereira Da Costa 2017-06-16 11:44:21 UTC
The four commits above (to breeze and oxygen, both master and 5.10 branch) should fix the remaining issues (they do here), but feel free to double check, investigate some more.
And of course, re-close in case of success :)

Hugo
Comment 28 Tim E. Real 2017-07-13 03:11:27 UTC
This seems to be working now.
I noticed a couple of situations after switching
 desktop styles where it was frozen if I clicked 
 on the title bar, but I was able to continue simply 
 by (I think) clicking once more, or by using the 
 title bar icons to restore/minimize.
Minor graphical artifact: The MDI shadow is not drawn on
 a 'normal' subwin sometimes after a style change, but IIRC
 maximizing/minimizing cures it soon after.

Our project seems OK now. It uses MDI with styles/stylesheets.
It's the good ol' MusE midi/audio sequencer project.

Hope it's OK to change to this status.
Thanks very much for your help!
Tim.