Factor windowing system arbitration out of TasksModel.
ClosedPublic

Authored by hein on Aug 9 2016, 10:10 AM.

Details

Summary

This introduces a new WindowTasksModel which is a QIdentityProxyModel
around an instance of either WaylandTasksModel or XWindowsTasksModel.

This arbitration was previously done directly in TasksModel, along with
refcounting to share a single window tasks sub-model between TasksModel
instances. Factoring out both of these things has two goals:

  • It allows users of libtaskmanager which are solely interested in window data (e.g. the Pager) to skip the unnecessary complexity of TasksModel, while still sharing the windowing monitoring with users of TasksModel.
  • TasksModel becomes fully free of windowing system-specific code and calls to KWindowSystem (to query the platform), making its code a little cleaner.

The downside is another layer of indirection (the QIdentityProxyModel),
but the upside is clear: The Pager wants to share window data and
window monitoring with the Task Manager, but is not interested in
startup notifications, does its own sorting (using the window stacking
order), does not need grouping and has different filtering needs.

The Pager backend will use QSortFilterProxyModel around WindowTasksModel
to mix in its own data and sort by stacking order.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hein updated this revision to Diff 5762.Aug 9 2016, 10:10 AM
hein retitled this revision from to Factor windowing system arbitration out of TasksModel..
hein updated this object.
hein edited the test plan for this revision. (Show Details)
hein added reviewers: Plasma, mart, davidedmundson.
hein added a subscriber: plasma-devel.
Restricted Application added a project: Plasma. · View Herald TranscriptAug 9 2016, 10:10 AM

One question first:

It allows users of libtaskmanager which are solely interested in window data (e.g. the Pager) to skip the unnecessary complexity of TasksModel, while still sharing the windowing monitoring with users of TasksModel.

What's your longer term plan?
To export WindowTasksModel directly? You'd still need to go via TaskFilterProxyModel, and for the pager you'd need AbstractTasksModelIface too (for setVirtualDesktop)
...at which point you're pretty much back at using half of TasksModel anyway?

libtaskmanager/windowtasksmodel.h
44

Idea:
if you a subclass of AbstractTasksModelIface with a
virtual QAbstractProxyModel* source()

you could kill a tonne of duplicated code

hein added a comment.Aug 9 2016, 10:37 AM

To export WindowTasksModel directly?

It's already exported ...? See the change to CMakeLists.txt and the TASKMANAGER_EXPORT macro.

You'd still need to go via TaskFilterProxyModel

Yes, TaskFilterProxyModel is also useful with some changes (see D2380).

and for the pager you'd need AbstractTasksModelIface too (for setVirtualDesktop)

Indeed, libtaskmanager also installs the abstracttasksmodeliface.h header.

...at which point you're pretty much back at using half of TasksModel anyway?

That's addressed in the review request description: The Pager doesn't care about startup notifications, or launchers, or TasksModel's sort modes, or grouping, or has a need for a ConcatenateTasksProxyModel, ... all it wants to share with TasksModel is the window tasks sub-model (and from libtaskmanager it also wants to use TaskFilterProxyModel).

hein added inline comments.Aug 9 2016, 10:39 AM
libtaskmanager/windowtasksmodel.h
44

I'm having trouble parsing this due to missing words(?), can you explain more? :) Feel free to hit me up on IRC.

davidedmundson accepted this revision.Aug 9 2016, 10:50 AM
davidedmundson edited edge metadata.
This revision is now accepted and ready to land.Aug 9 2016, 10:50 AM
This revision was automatically updated to reflect the committed changes.