Move groupTransient and group from Client to AbstractClient as virtual
ClosedPublic

Authored by graesslin on Dec 31 2018, 5:59 PM.

Details

Summary

The default implementations just return false/nullptr. The advantage of
having this in AbstractClient is that we can reduce the needed casts
from AbstractClient to Client in core as can be seen in this change.

There are more cases which can be improved thanks to this refactoring
which will follow in dedicated commits.

Test Plan

ctest passes

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Dec 31 2018, 5:59 PM
Restricted Application added a project: KWin. · View Herald TranscriptDec 31 2018, 5:59 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
graesslin requested review of this revision.Dec 31 2018, 5:59 PM
zzag added a subscriber: zzag.Dec 31 2018, 6:07 PM
zzag added inline comments.
abstract_client.h
758

If it's X11 specific, doesn't it make sense to keep groupTransient in Client?

graesslin added inline comments.Jan 1 2019, 8:22 AM
abstract_client.h
758

The reason I moved it is that we need to cast in Workspace and similar places. The casts are a problem. Every cast is a potential "forgot to port". I recently stumbled over a few and thought: let's try to get rid of all.

We have more such API in AbstractClient: e.g. shade is only in X11.

zzag accepted this revision.Jan 1 2019, 1:52 PM
zzag added inline comments.
abstract_client.h
773

Please fix coding style.

This revision is now accepted and ready to land.Jan 1 2019, 1:52 PM
graesslin added inline comments.Jan 1 2019, 3:57 PM
abstract_client.h
773

Stupid question: what's wrong? I just copied the method definitions from client.h and added a virtual...

zzag added inline comments.Jan 1 2019, 4:00 PM
abstract_client.h
773

I think there should be a whitespace before *, e.g.

virtual const Group *group() const;
graesslin updated this revision to Diff 48481.Jan 1 2019, 4:25 PM

Fix coding style

This revision was automatically updated to reflect the committed changes.