Summary:
Managing lifetime of objects during tear down is a bit clunky in KWin
mostly because the wayland server outlives the workspace.
3f4e733468 tried to tackle one aspect of this problem, but the proposed
solution is good only in short term. If a ShellClient wants to discard
force temporarily rules, it needs to access RuleBook, whose lifetime is
bounded to the workspace, no matter what happens. Otherwise, the force
temporarily rule will be applied again on the next startup.
It's worth to mention that there was another attempt to address this
problem, see commit 826b9742e9. It was reverted because some internal
clients may need to destroy Wayland resources during tear down.
This change takes another approach. In order to ensure that ShellClient
can access RuleBook during tear down, we manually destroy Wayland clients
in destructor of the Workspace class. Something is done already for X11
clients.
Reviewers: #kwin
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22986
Summary:
Apply the KDE HIG, use form layouts, make desktop files consistent and make the KCMs look better.
{F7323519}
{F7330485}
{F7330486}
{F7302318}
{F7302319}
Test Plan: Open the {nav Window Behavior} KCMs. All options should still work
Reviewers: #kwin, #plasma, #vdg, ngraham, zzag
Reviewed By: #kwin, #plasma, #vdg, ngraham, zzag
Subscribers: ngraham, davidedmundson, zzag, #vdg, #plasma, kwin, #kwin
Tags: #kwin
Maniphest Tasks: T10273
Differential Revision: https://phabricator.kde.org/D23615
Summary:
This allows all the section headers to always have the same look and feel and be
adjusted in just one place.
Depends on D23049
Test Plan: {F7181776}
Reviewers: #vdg, kwin, GB_2, #kwin
Reviewed By: #vdg, GB_2
Tags: #kwin
Maniphest Tasks: T10384
Differential Revision: https://phabricator.kde.org/D23055
Summary:
Given that wobbly windows effect takes optimized render path, it needs
to clear the clip region of about to be transformed opaque window.
BUG: 411092
FIXED-IN: 5.17.0
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23774
Summary:
Wobbly Windows effect is capable of animating a window when it's shown
or hidden. However, this feature has been hidden since it was added.
One needs to know how the effect works in order to enable these animations.
Therefore there's no good reason to keep these two animations because
practically no one uses them and they only add maintenance burden.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23763
Summary:
Compositor::hasScene() is redundant. Depending on use case, it can be
replaced by checking either m_state or Compositor::scene().
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23744
Summary:
Neither WaylandCompositor nor X11Compositor have at least one smart
pointer field that points to an incomplete class type, so the destructors
are kind of useless.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23747
Summary:
It doesn't make sense to update window margins in finishInit because no
buffer is attached yet at that moment.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23743
Summary:
This patch further refines output management.
We go now through AbstractWaylandOutput virtual functions to enable and
disable outputs.
Dpms changes and enablement switches use separate code paths at start in the
Drm backend code since they are similar but not the directly same. Common code
is shared though, functions are renamed accordingly.
Asserts have been put in place to better understand and check the control
flow. A seemingly unnecessary call to DrmOutput::pageFlipped on reactivation
after Vt switch has been removed to allow for that.
In future patches we need to look additionally at the legacy mode switching
code path which was and is still not working and better handling of the
current monitor Dpms state. For example a monitor being switched off is not
properly acted on and the workspace still expanded.
Test Plan:
With one and two monitors:
* Dpms off/on
* Vt switches
* Screen disable/enable
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Maniphest Tasks: T11459
Differential Revision: https://phabricator.kde.org/D23600
Summary:
Make it more explicit what the relation is between Wayland and XDG objects
existing and enablement:
The ouput is enabled if and only if Wayland and XDG output objects exist.
We can simplify the code by replacing checks on the outputs with checking
the current enablement value.
Test Plan: Wayland nested and virtual backends.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23553
Summary:
This lifts the enablement code for outputs from the DRM backend to Platform
allowing other Wayland backends in the future to use this interface as well.
To do that we also create some helper functions on Platform level and have to
spill some KWayland classes into AbstractOutput what motivates a further split
of Platform into a Wayland child class like for AbstractOutput.
Test Plan: Disabled and enabled an output in DRM session.
Reviewers: #kwin
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23545
Summary:
Since we now use in the backends the OutputDeviceInterface for output data
all access must be complete before the Wayland server goes down. For that
introduce a new function to prepare shutdown in the backends.
While at it also remove the output deletion, since they get deleted through
Qt's object system leading to crashes on double free.
Test Plan: Shutdown works without seg faults in the Drm backend.
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, kwin
Tags: #kwin
Maniphest Tasks: T11459
Differential Revision: https://phabricator.kde.org/D23602
Summary: Less likely to happen but still we need to handle this case.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23611
Summary: Overlay windows is an X11 thing.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23608
Summary:
Maximized clients weren't considered as resizeable when quick tiling was
added. Therefore, a special case was added in Client::setQuickTileMode().
However, that special case didn't take into account that a fullscreen
client can be also maximized. Clearly, we don't want users quick tile
fullscreen clients.
BUG: 411028
FIXED-IN: 5.17.0
Test Plan: No longer able to quick tile maximized fullscreen window of Konsole.
Reviewers: #kwin
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23604
Summary:
A declarative script may need to access internal id in order to
create an instance of WindowThumbnailItem.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23671
Summary:
Firstly, it was completely broken, no-one called registerObject.
Secondly deleting the adaptor doesn't really make sense, you'd still
leave the object valid, only have it broken. Docs of
QDBusAbstractAdaptor do say not to ever delete it manually.
Thirdly we don't need Q_CLASSINFO setting the DBus interface on the
exported item when we use an adaptor.
Test Plan:
Manually added some setEnabled/disabled
Could now see the path
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23610
Summary:
Switch to Q_ASSERT in order to make code a bit more consistent. We have
places where both assert and Q_ASSERT are used next to each other. Also,
distributions like Ubuntu don't strip away assert(), let's hope that
things are a bit different with Q_ASSERT.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: romangg, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23605
Summary:
In order to pick the next client to activate we traverse the stacking
order from bottom to top and assign to each client a score. The client
with the best score will be activated next. Function that assigns score
bases its decisions purely on geometry. This may backfire if there are
couple maximized or fullscreen clients on the screen - we'll activate
the bottom-most client.
This change toggles direction we traverse the stacking order. If there
are several clients with an identical score, then prefer the top-most
client, the one that the user most likely sees at the moment.
BUG: 411356
FIXED-IN: 5.17.0
Test Plan: New tests pass.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23521
Summary:
Any call made to a virtual method in constructor/destructor of a base
class won't go to a derived class because the base class may access
uninitialized or destroyed resources.
For example, let's consider the following two classes
class Base {
public:
Base() { foo()->bar(); }
virtual ~Base() { foo()->bar(); }
virtual Foo* foo() const { return nullptr; }
};
class Derived : public Base {
public:
Derived() : mFoo(new Foo) {}
~Derived() override { delete mFoo; }
Foo* foo() const override { return mFoo; }
private:
Foo* mFoo;
};
When an instance of Derived class is created, constructors will run in
the following order:
Base()
Derived()
It's not safe to dispatch foo() method call to Derived class because
constructor of Derived hasn't initialized yet mFoo.
Same story with destructors, they'll run in the following order:
~Derived()
~Base()
It's not safe to dispatch foo() method call in the destructor of Base
class to Derived class because mFoo was deleted.
So, what does that weird C++ behavior has something to do with KWin? Well,
recently Compositor class was split into two classes - WaylandCompositor,
and X11Compositor. Some functionality from X11 doesn't make sense on
Wayland. Therefore methods that implement that stuff were "purified," i.e.
they became pure virtual methods. Unfortunately, when Compositor tears
down it may call pure virtual methods on itself. Given that those calls
cannot be dispatched to X11Compositor or WaylandCompositor, the only
choice that C++ runtime has is to throw an exception.
The fix for this very delicate problem is very simple - do not call virtual
methods from constructors and the destructor. Avoid doing that if you can!
This change moves Compositor::updateClientCompositeBlocking to X11Compositor
so it longer has to be a virtual method. Also, it kind of doesn't make sense
to keep it in base Compositor class because compositing can be blocked only
on X11.
BUG: 411049
Test Plan: KWin no longer crashes when running kwin_x11 --replace command.
Reviewers: #kwin, romangg
Reviewed By: #kwin, romangg
Subscribers: anthonyfieroni, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23098
Summary:
We can simplify the AbstractWaylandOutput code some more by getting name and
refresh rate of an output from the always available output device object.
Test Plan: Tested with DRM, Wayland nested and virtual backends.
Reviewers: #kwin
Subscribers: davidedmundson, apol, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23546
Summary:
KWin blits contents into a QImage raster buffer. Because of this we
don't need our underlying GL surface to be double buffered as it
effectively makes the whole thing tripple buffered.
Test Plan: Ran Aurorae, looked the same, should save some memory
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23331