Qt applications, running on Mac, do not show the list of opened windows in the
Dock menu. This patch fixes it by creating a custom menu with the list and
inserting it as the Dock menu.
Details
- Reviewers
rjvbb
Diff Detail
- Repository
- R223 Okular
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage
I'm not sure if all Mac applications always show the open documents under their Dock tile (that menu can be used for anything, of course), and I also think that it would be more useful to have a Windows menu like (most) native Mac apps have.
Other than that, LGTM.
Should the list be sorted btw (read: is that what Mac apps do)?
Not all of them (shall I reword the commit message?). Actually, I do not know, whether there is an API that allows to force Mac OS to create such list in the Dock menu, but if an app implements "Window" menu (systemMenu="window" in the menu xib file), then this list is generated automatically. Do you happen to know whether it would be possible to do from Qt?
and I also think that it would be more useful to have a Windows menu like (most) native Mac apps have.
Shall I consider this as a feature request? I personally do not use it.
Should the list be sorted btw (read: is that what Mac apps do)?
They are sorted for Cocoa apps. And I do not see an easy way to have them in the last-opened/last-used order. Widgets are stored in a set inside QApplication, so, it is good to have some sorting.
Actually, I do not know, whether there is an API that allows to force Mac OS to create such list in the Dock menu, but if an app implements "Window" menu (systemMenu="window" in the menu xib file), then this list is generated automatically.
It's been too long since I did native Mac GUI app development from scratch, so I'll take your word for this =)
Do you happen to know whether it would be possible to do from Qt?
Qt4 apps used to create a temporary NIB file in $TMPDIR and load that. I cannot recall having seen something similar in Qt5 and cannot find any evidence of it in the code. But just as with Info.plists there might be a way to create the information normally read from a nib/xib file purely in memory.
Shall I consider this as a feature request? I personally do not use it.
This is not something that should be implemented in individual applications. I was planning to ask on the Qt ML about implementing such a feature. If Qt doesn't have anything suitable for tracking window creation a logical place would be KWindowSystem (which already has some code for tracking window creation), and maybe the management of the Windows menu could be implemented in a platform integration plugin.
I do see there's a Qt systemMenu() equivalent for QMdiSubWindows.
They are sorted for Cocoa apps.
Interesting. I'm pretty certain that entries in the Windows menu are ordered chronologically, at least in those applications where they get a shortcut. (I've never checked if that's always the case.).
Right. QtCreator, by the way, keeps track of opened windows internally and also uses setAsDockMenu().
Interesting. I'm pretty certain that entries in the Windows menu are ordered chronologically, at least in those applications where they get a shortcut. (I've never checked if that's always the case.).
Probably, it has been changed in later versions. For me they are in alphabetical order.
Qt Assistant also rolls its own Window (sans s...) menu.
Let's forget the discussion about a Window menu for now. I still don't understand how come there is no such menu but managing it isn't trivial, in large part because the standard/automatic version works with toplevel windows (NSWindows) and Qt applications tend to use tabs or MdiSubWindows instead.