This is a very interesting auto test as Screens uses both Workspace
and Client. Thus it operates in the "impossible to mock" area.
The solution is to provide mock includes in autotests and ensure that
when building the auto-test the mock header includes will be picked
first. There is now a mock class for Workspace and Client providing
just the API pieces used inside Screens.
As Screens is abstract and we cannot properly interact with
QDesktopWidget there is also a MockScreens class inheriting from Screens
and mocking the required functionality (by just operating on a list of
QRects).
The auto-test itself is only performing checks on the abstract class.
The mock class is indirectly tested by Screens calling into the virtual
methods. The test case is not yet complete, but looking quite good
already.
At the same time adding an autotest for the Output, moving the listener
into the Output class and providing enums for Subpixel and Transform.
KWin now requires wl_ouput interface version 2 as that allows us to emit
the changed signal in a better way.
The unit test is not yet capable of testing everything, we need a mock
Wayland server which is more flexible.
So far the Wrapper class was not able to properly wrap all xcb calls and
there was the restriction that the request function needs to have an
xcb_window_t argument. The result was that wrapper functions were used
for calls with no arguments or for multiple arguments, but in a rather
limited way.
By using variadic template arguments this restriction is removed and the
Wrapper is able to wrap any xcb request/reply group. The main difference
is how the function pointers are defined. Those cannot be specified as
template arguments as the variadic arguments need to be the last in the
list.
The pointers are now defined by a WrapperData struct. For complete usage
please see the extensive documentation added to WrapperData on how it is
supposed to be used.
REVIEW: 117559
Most is just switched to the ::read(). That should be enough for all the
Effects which have a KSharedConfig::Ptr underneath. If not we just need
to find a good place to put the reload.
Uses the information provided by the Wayland outputs to setup the data
about the available screens.
In order to properly work together with the X Server the implementation
syncs the data to the X system using XRandR. If XRandR is not available
this is most likely going to not work correctly.
Screens provides a size which is constructed from the size of
the bounding geometry of all screens and provides an overload taking
an int to return the size of a specified screen. For geometry() a new
ovload is added without an argument, which is just a convenient wrapper
for QRect(QPoint(0, 0), size()).
Both new methods are exported to effects and scripting as new
properties there called virtualScreenSize and virtualScreenGeometry.
The (virtual) size gets cached in screens and is updated whenever the
count or geometry changes.
Construction of Screens is slightly changed by moving the init code
from ctor into a virtual method init(). Reason is that we ended in
a loop with accessing the singleton pointer before it was set.
REVIEW: 116114
largely reverts b164e9912c9b5f9c9ae619bbd79355d317174115
which prevented the crash but due to early screen updating
causes issues with scene/overlay update on at least intel chips
BUG: 322970
FIXED-IN: 4.11
CCBUG: 322156
REVIEW: https://git.reviewboard.kde.org/r/111811/
Following the approaches of other split out functionality Screens is a
singleton class created by Workspace.
The class takes over the responsibility for:
* screenChanged signal delayed by timer
* number of screens
* geometry of given screen
* active screen
* config option for active screen follows mouse
The class contains a small abstraction layer and has a concrete subclass
wrapping around QDesktopWidget, but the idea is to go more low level and
interact with XRandR directly to get more detailed information.
All over KWin the usage from QDesktopWidget is ported over to the new
Screens class.
REVIEW: 109839