When building menu hyerarchies, parent menus to their containers
ClosedPublic

Authored by mart on May 11 2017, 8:56 AM.

Details

Summary

Wayland requires menu windows to have a "transient parent" as wl_shell
protocol refuses to either position correcty or assign the corrent
flags to popup windows that don't have a parent.
a lot of popup menus in KDE applications don't have any parent
and will look wrong in wayland. this fixes at least some of the occurrences
of popup menus build by kxmlgui

Test Plan

"Bookmarks" menu in konsole menubar is now correct in
wayland

Diff Detail

Repository
R263 KXmlGui
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart created this revision.May 11 2017, 8:56 AM
Restricted Application added projects: Plasma, Frameworks. · View Herald TranscriptMay 11 2017, 8:56 AM
Restricted Application added subscribers: Frameworks, plasma-devel. · View Herald Transcript
mart retitled this revision from [WIP] when building menu hierarchies, parent menus to their containers to [WIP] when building menu hyerarchies, parent menus to their containers.
davidedmundson accepted this revision.May 12 2017, 6:52 PM
davidedmundson added a subscriber: davidedmundson.

*hierarchy

looks sensible. Add a comment in the code as to why we're doing this.

This revision is now accepted and ready to land.May 12 2017, 6:52 PM
mart retitled this revision from [WIP] when building menu hyerarchies, parent menus to their containers to When building menu hyerarchies, parent menus to their containers.May 12 2017, 6:53 PM
This revision was automatically updated to reflect the committed changes.

Unfortunately this change causes crashes in KPart-using applications that do stuff with their QActions with Qt 5.9. okular and kontact are affected, at least.

This is a typical backtrace (got this from Eike, but I have the same):

#0  QAction::setEnabled (this=0xa4f160, b=b@entry=true) at /home/eike/devel/src/qt5/qtbase/src/widgets/kernel/qaction.cpp:1020                                                                                    
#1  0x00007fffd334e4a7 in PageView::updateActionState (this=this@entry=0x95ca80, haspages=haspages@entry=true, documentChanged=documentChanged@entry=true, hasformwidgets=hasformwidgets@entry=false)              
    at /home/eike/devel/src/kde/kdegraphics/okular/ui/pageview.cpp:1096                                                                                                                                            
#2  0x00007fffd33509fd in PageView::notifySetup (this=0x95ca80, pageSet=..., setupFlags=<optimized out>) at /home/eike/devel/src/kde/kdegraphics/okular/ui/pageview.cpp:1063                                      
#3  0x00007fffd2fe7e0b in Okular::Document::openDocument (this=<optimized out>, docFile=..., url=..., _mime=..., password=...) at /home/eike/devel/src/kde/kdegraphics/okular/core/document.cpp:2452              
#4  0x00007fffd32f474e in Okular::Part::doOpenFile (this=this@entry=0x740830, mimeA=..., fileNameToOpenA=..., isCompressedFile=isCompressedFile@entry=0x7fffffffc9ef)                                              
    at /home/eike/devel/src/kde/kdegraphics/okular/part.cpp:1292                                                                                                                                                  
#5  0x00007fffd32f5c56 in Okular::Part::openFile (this=0x740830) at /home/eike/devel/src/kde/kdegraphics/okular/part.cpp:1414                                                                                      
#6  0x00007ffff7b88385 in KParts::ReadOnlyPartPrivate::openLocalFile (this=0x719070) at /home/eike/devel/src/frameworks/kparts/src/readonlypart.cpp:187                                                            
#7  0x00007ffff7b88010 in KParts::ReadOnlyPart::openUrl (this=0x740830, url=...) at /home/eike/devel/src/frameworks/kparts/src/readonlypart.cpp:150                                                                
#8  0x00007fffd32e8139 in Okular::Part::openUrl (this=0x740830, _url=...) at /home/eike/devel/src/kde/kdegraphics/okular/part.cpp:1567                                                                            
#9  0x000000000041291c in Shell::openUrl (this=this@entry=0x6c6bf0, url=..., serializedOptions=...) at /home/eike/devel/src/kde/kdegraphics/okular/shell/shell.cpp:277
#10 0x0000000000412af2 in Shell::openDocument (this=this@entry=0x6c6bf0, url=..., serializedOptions=...) at /home/eike/devel/src/kde/kdegraphics/okular/shell/shell.cpp:218
#11 0x0000000000412b76 in Shell::openDocument (this=this@entry=0x6c6bf0, url=..., serializedOptions=...) at /home/eike/devel/src/kde/kdegraphics/okular/shell/shell.cpp:205
#12 0x000000000040c6c0 in Okular::main (paths=..., serializedOptions=...) at /home/eike/devel/src/kde/kdegraphics/okular/shell/okular_main.cpp:170
#13 0x000000000040be3b in main (argc=<optimized out>, argv=<optimized out>) at /home/eike/devel/src/kde/kdegraphics/okular/shell/main.cpp:72
cfeck added a subscriber: cfeck.May 17 2017, 11:28 AM

Konsole could also be affected, see https://bugs.kde.org/show_bug.cgi?id=379795
Timing indicate all reporters use newest frameworks.