Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
d7a1067a
Commit
d7a1067a
authored
Mar 12, 2021
by
adrien faveraux
Browse files
move output management to the new approach
parent
a0419fae
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/wayland/CMakeLists.txt
View file @
d7a1067a
...
...
@@ -80,9 +80,9 @@ ecm_add_qtwayland_server_protocol_kde(SERVER_LIB_SRCS
BASENAME wayland
)
ecm_add_wayland_server_protocol
(
SERVER_LIB_SRCS
ecm_add_
qt
wayland_server_protocol
_kde
(
SERVER_LIB_SRCS
PROTOCOL
${
PLASMA_WAYLAND_PROTOCOLS_DIR
}
/output-management.xml
BASENAME output
-
management
BASENAME outputmanagement
)
ecm_add_qtwayland_server_protocol_kde
(
SERVER_LIB_SRCS
...
...
src/wayland/autotests/client/test_wayland_outputmanagement.cpp
View file @
d7a1067a
...
...
@@ -129,8 +129,6 @@ void TestWaylandOutputManagement::init()
m_serverOutputs
<<
outputDeviceInterface
;
m_outputManagementInterface
=
new
OutputManagementInterface
(
m_display
,
this
);
m_outputManagementInterface
->
create
();
QVERIFY
(
m_outputManagementInterface
->
isValid
());
// setup connection
m_connection
=
new
KWayland
::
Client
::
ConnectionThread
;
...
...
src/wayland/autotests/server/test_display.cpp
View file @
d7a1067a
...
...
@@ -183,9 +183,7 @@ void TestWaylandServerDisplay::testOutputManagement()
Display
display
;
display
.
addSocketName
(
"kwayland-test-0"
);
display
.
start
();
auto
kwin
=
new
OutputManagementInterface
(
&
display
,
this
);
kwin
->
create
();
QVERIFY
(
kwin
->
isValid
());
new
OutputManagementInterface
(
&
display
,
this
);
}
void
TestWaylandServerDisplay
::
testAutoSocketName
()
...
...
src/wayland/server/outputchangeset.cpp
View file @
d7a1067a
...
...
@@ -10,107 +10,82 @@
namespace
KWaylandServer
{
OutputChangeSet
::
Private
::
Private
(
OutputDeviceInterface
*
outputdevice
,
OutputChangeSet
*
parent
)
OutputChangeSetPrivate
::
OutputChangeSet
Private
(
OutputDeviceInterface
*
outputdevice
,
OutputChangeSet
*
parent
)
:
q
(
parent
)
,
o
(
outputdevice
)
,
enabled
(
o
->
enabled
())
,
modeId
(
o
->
currentModeId
())
,
transform
(
o
->
transform
())
,
position
(
o
->
globalPosition
())
,
scale
(
o
->
scaleF
())
,
colorCurves
(
o
->
colorCurves
())
,
o
utputDevice
(
outputdevice
)
,
enabled
(
o
utputDevice
->
enabled
())
,
modeId
(
o
utputDevice
->
currentModeId
())
,
transform
(
o
utputDevice
->
transform
())
,
position
(
o
utputDevice
->
globalPosition
())
,
scale
(
o
utputDevice
->
scaleF
())
,
colorCurves
(
o
utputDevice
->
colorCurves
())
{
}
OutputChangeSet
::
Private
::~
Private
()
=
default
;
OutputChangeSet
::
OutputChangeSet
(
OutputDeviceInterface
*
outputdevice
,
QObject
*
parent
)
:
QObject
(
parent
)
,
d
(
new
Private
(
outputdevice
,
this
))
,
d
(
new
OutputChangeSet
Private
(
outputdevice
,
this
))
{
}
OutputChangeSet
::~
OutputChangeSet
()
=
default
;
OutputChangeSet
::
Private
*
OutputChangeSet
::
d_func
()
const
{
return
reinterpret_cast
<
Private
*>
(
d
.
data
());
}
bool
OutputChangeSet
::
enabledChanged
()
const
{
Q_D
();
return
d
->
enabled
!=
d
->
o
->
enabled
();
return
d
->
enabled
!=
d
->
outputDevice
->
enabled
();
}
OutputDeviceInterface
::
Enablement
OutputChangeSet
::
enabled
()
const
{
Q_D
();
return
d
->
enabled
;
}
bool
OutputChangeSet
::
modeChanged
()
const
{
Q_D
();
return
d
->
modeId
!=
d
->
o
->
currentModeId
();
return
d
->
modeId
!=
d
->
outputDevice
->
currentModeId
();
}
int
OutputChangeSet
::
mode
()
const
{
Q_D
();
return
d
->
modeId
;
}
bool
OutputChangeSet
::
transformChanged
()
const
{
Q_D
();
return
d
->
transform
!=
d
->
o
->
transform
();
return
d
->
transform
!=
d
->
outputDevice
->
transform
();
}
OutputDeviceInterface
::
Transform
OutputChangeSet
::
transform
()
const
{
Q_D
();
return
d
->
transform
;
}
bool
OutputChangeSet
::
positionChanged
()
const
{
Q_D
();
return
d
->
position
!=
d
->
o
->
globalPosition
();
return
d
->
position
!=
d
->
outputDevice
->
globalPosition
();
}
QPoint
OutputChangeSet
::
position
()
const
{
Q_D
();
return
d
->
position
;
}
bool
OutputChangeSet
::
scaleChanged
()
const
{
Q_D
();
return
!
qFuzzyCompare
(
d
->
scale
,
d
->
o
->
scaleF
());
}
int
OutputChangeSet
::
scale
()
const
{
Q_D
();
return
qRound
(
d
->
scale
);
return
!
qFuzzyCompare
(
d
->
scale
,
d
->
outputDevice
->
scaleF
());
}
qreal
OutputChangeSet
::
scaleF
()
const
{
Q_D
();
return
d
->
scale
;
}
bool
OutputChangeSet
::
colorCurvesChanged
()
const
{
Q_D
();
return
d
->
colorCurves
!=
d
->
o
->
colorCurves
();
return
d
->
colorCurves
!=
d
->
outputDevice
->
colorCurves
();
}
OutputDeviceInterface
::
ColorCurves
OutputChangeSet
::
colorCurves
()
const
{
Q_D
();
return
d
->
colorCurves
;
}
...
...
src/wayland/server/outputchangeset.h
View file @
d7a1067a
...
...
@@ -14,6 +14,8 @@
namespace
KWaylandServer
{
class
OutputChangeSetPrivate
;
/**
* @brief Holds a set of changes to an OutputInterface or OutputDeviceInterface.
*
...
...
@@ -28,30 +30,34 @@ class KWAYLANDSERVER_EXPORT OutputChangeSet : public QObject
{
Q_OBJECT
public:
virtual
~
OutputChangeSet
();
~
OutputChangeSet
()
override
;
/** Whether the enabled() property of the outputdevice changed.
* @returns @c true if the enabled property of the outputdevice has changed.
*/
bool
enabledChanged
()
const
;
/** Whether the currentModeId() property of the outputdevice changed.
* @returns @c true if the enabled property of the outputdevice has changed.
* bool modeChanged() const;
*/
/** Whether the transform() property of the outputdevice changed. */
bool
transformChanged
()
const
;
/** Whether the currentModeId() property of the outputdevice changed.
* @returns @c true if the currentModeId() property of the outputdevice has changed.
*/
bool
modeChanged
()
const
;
/** Whether the globalPosition() property of the outputdevice changed.
* @returns @c true if the globalPosition() property of the outputdevice has changed.
*/
bool
positionChanged
()
const
;
/** Whether the scale() property of the outputdevice changed.
* @returns @c true if the scale() property of the outputdevice has changed.
*/
bool
scaleChanged
()
const
;
/** Whether the colorCurves() property of the outputdevice changed.
* @returns @c true if the colorCurves() property of the outputdevice has changed.
*/
...
...
@@ -59,36 +65,31 @@ public:
/** The new value for enabled. */
OutputDeviceInterface
::
Enablement
enabled
()
const
;
/** The new mode id.*/
int
mode
()
const
;
/** The new value for transform. */
OutputDeviceInterface
::
Transform
transform
()
const
;
/** The new value for globalPosition. */
QPoint
position
()
const
;
#if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 50)
/** The new value for scale.
@deprecated Since 5.50, use scaleF
*/
KWAYLANDSERVER_DEPRECATED_VERSION
(
5
,
50
,
"Use OutputChangeSet::scaleF()"
)
int
scale
()
const
;
#endif
/** The new value for scale.
* @since 5.50
*/
qreal
scaleF
()
const
;
/** The new value for colorCurves.
* @since 5.XX
*/
OutputDeviceInterface
::
ColorCurves
colorCurves
()
const
;
private:
friend
class
OutputConfigurationInterface
;
friend
class
OutputConfigurationInterface
Private
;
explicit
OutputChangeSet
(
OutputDeviceInterface
*
outputdevice
,
QObject
*
parent
=
nullptr
);
class
Private
;
QScopedPointer
<
Private
>
d
;
Private
*
d_func
()
const
;
QScopedPointer
<
OutputChangeSetPrivate
>
d
;
};
}
src/wayland/server/outputchangeset_p.h
View file @
d7a1067a
...
...
@@ -10,14 +10,13 @@
namespace
KWaylandServer
{
class
OutputChangeSet
::
Private
class
OutputChangeSetPrivate
{
public:
Private
(
OutputDeviceInterface
*
outputdevice
,
OutputChangeSet
*
parent
);
~
Private
();
OutputChangeSetPrivate
(
OutputDeviceInterface
*
outputdevice
,
OutputChangeSet
*
parent
);
OutputChangeSet
*
q
;
OutputDeviceInterface
*
o
;
OutputDeviceInterface
*
o
utputDevice
;
OutputDeviceInterface
::
Enablement
enabled
;
int
modeId
;
...
...
src/wayland/server/outputconfiguration_interface.cpp
View file @
d7a1067a
...
...
@@ -4,29 +4,25 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include
"display.h"
#include
"outputconfiguration_interface.h"
#include
"outputdevice_interface.h"
#include
"logging.h"
#include
"resource_p.h"
#include
"display.h"
#include
"outputchangeset_p.h"
#include
<wayland-server.h>
#include
"wayland-output
-
management
-server-protocol
.h"
#include
"wayland-org-kde-kwin-outputdevice
-server-protocol
.h"
#include
"
q
wayland-
server-
outputmanagement.h"
#include
"
q
wayland-
server-
org-kde-kwin-outputdevice.h"
#include
<QDebug>
#include
<QSize>
namespace
KWaylandServer
{
class
OutputConfigurationInterface
::
Private
:
public
Resource
::
Private
class
OutputConfigurationInterfacePrivate
:
public
QtWaylandServer
::
org_kde_kwin_outputconfiguration
{
public:
Private
(
OutputConfigurationInterface
*
q
,
OutputManagementInterface
*
c
,
wl_resource
*
parentResource
);
~
Private
();
OutputConfigurationInterfacePrivate
(
OutputConfigurationInterface
*
q
,
OutputManagementInterface
*
outputManagement
,
wl_resource
*
resource
);
void
sendApplied
();
void
sendFailed
();
...
...
@@ -38,77 +34,39 @@ public:
OutputManagementInterface
*
outputManagement
;
QHash
<
OutputDeviceInterface
*
,
OutputChangeSet
*>
changes
;
static
const
quint32
s_version
=
2
;
private:
static
void
enableCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
enable
);
static
void
modeCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
mode_id
);
static
void
transformCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
transform
);
static
void
positionCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
x
,
int32_t
y
);
static
void
scaleCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
scale
);
static
void
applyCallback
(
wl_client
*
client
,
wl_resource
*
resource
);
static
void
scaleFCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
wl_fixed_t
scale
);
static
void
colorcurvesCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
wl_array
*
red
,
wl_array
*
green
,
wl_array
*
blue
);
OutputConfigurationInterface
*
q_func
()
{
return
reinterpret_cast
<
OutputConfigurationInterface
*>
(
q
);
}
static
const
struct
org_kde_kwin_outputconfiguration_interface
s_interface
;
OutputConfigurationInterface
*
q
;
protected:
void
org_kde_kwin_outputconfiguration_enable
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
enable
)
override
;
void
org_kde_kwin_outputconfiguration_mode
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
mode_id
)
override
;
void
org_kde_kwin_outputconfiguration_transform
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
transform
)
override
;
void
org_kde_kwin_outputconfiguration_position
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
x
,
int32_t
y
)
override
;
void
org_kde_kwin_outputconfiguration_scale
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
scale
)
override
;
void
org_kde_kwin_outputconfiguration_apply
(
Resource
*
resource
)
override
;
void
org_kde_kwin_outputconfiguration_scalef
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
wl_fixed_t
scale
)
override
;
void
org_kde_kwin_outputconfiguration_colorcurves
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
wl_array
*
red
,
wl_array
*
green
,
wl_array
*
blue
)
override
;
void
org_kde_kwin_outputconfiguration_destroy
(
Resource
*
resource
)
override
;
void
org_kde_kwin_outputconfiguration_destroy_resource
(
Resource
*
resource
)
override
;
};
const
struct
org_kde_kwin_outputconfiguration_interface
OutputConfigurationInterface
::
Private
::
s_interface
=
{
enableCallback
,
modeCallback
,
transformCallback
,
positionCallback
,
scaleCallback
,
applyCallback
,
scaleFCallback
,
colorcurvesCallback
,
resourceDestroyedCallback
};
OutputConfigurationInterface
::
OutputConfigurationInterface
(
OutputManagementInterface
*
parent
,
wl_resource
*
parentResource
)
:
Resource
(
new
Private
(
this
,
parent
,
parentResource
))
{
Q_D
();
d
->
outputManagement
=
parent
;
}
OutputConfigurationInterface
::~
OutputConfigurationInterface
()
{
Q_D
();
d
->
clearPendingChanges
();
}
void
OutputConfigurationInterface
::
Private
::
enableCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
enable
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_enable
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
enable
)
{
Q_UNUSED
(
client
);
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
Q_UNUSED
(
resource
)
auto
_enable
=
(
enable
==
ORG_KDE_KWIN_OUTPUTDEVICE_ENABLEMENT_ENABLED
)
?
OutputDeviceInterface
::
Enablement
::
Enabled
:
OutputDeviceInterface
::
Enablement
::
Disabled
;
OutputDeviceInterface
*
o
=
OutputDeviceInterface
::
get
(
outputdevice
);
s
->
pendingChanges
(
o
)
->
d_func
()
->
enabled
=
_enable
;
OutputDeviceInterface
*
output
=
OutputDeviceInterface
::
get
(
outputdevice
);
pendingChanges
(
output
)
->
d
->
enabled
=
_enable
;
}
void
OutputConfigurationInterface
::
Private
::
modeCallback
(
wl_client
*
client
,
wl_r
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
mode_id
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_mode
(
R
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
mode_id
)
{
Q_UNUSED
(
client
);
OutputDeviceInterface
*
o
=
OutputDeviceInterface
::
get
(
outputdevice
);
Q_UNUSED
(
resource
)
OutputDeviceInterface
*
o
utput
=
OutputDeviceInterface
::
get
(
outputdevice
);
bool
modeValid
=
false
;
for
(
const
auto
&
m
:
o
->
modes
())
{
for
(
const
auto
&
m
:
o
utput
->
modes
())
{
if
(
m
.
id
==
mode_id
)
{
modeValid
=
true
;
break
;
...
...
@@ -118,14 +76,13 @@ void OutputConfigurationInterface::Private::modeCallback(wl_client *client, wl_r
qCWarning
(
KWAYLAND_SERVER
)
<<
"Set invalid mode id:"
<<
mode_id
;
return
;
}
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
s
->
pendingChanges
(
o
)
->
d_func
()
->
modeId
=
mode_id
;
pendingChanges
(
output
)
->
d
->
modeId
=
mode_id
;
}
void
OutputConfigurationInterface
::
Private
::
transformCallback
(
wl_client
*
client
,
wl_r
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
transform
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_transform
(
R
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
transform
)
{
Q_UNUSED
(
client
);
Q_UNUSED
(
resource
)
auto
toTransform
=
[
transform
]()
{
switch
(
transform
)
{
case
WL_OUTPUT_TRANSFORM_90
:
...
...
@@ -148,66 +105,55 @@ void OutputConfigurationInterface::Private::transformCallback(wl_client *client,
}
};
auto
_transform
=
toTransform
();
OutputDeviceInterface
*
o
=
OutputDeviceInterface
::
get
(
outputdevice
);
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
s
->
pendingChanges
(
o
)
->
d_func
()
->
transform
=
_transform
;
OutputDeviceInterface
*
output
=
OutputDeviceInterface
::
get
(
outputdevice
);
pendingChanges
(
output
)
->
d
->
transform
=
_transform
;
}
void
OutputConfigurationInterface
::
Private
::
positionCallback
(
wl_client
*
client
,
wl_r
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
x
,
int32_t
y
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_position
(
R
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
x
,
int32_t
y
)
{
Q_UNUSED
(
client
);
Q_UNUSED
(
resource
)
auto
_pos
=
QPoint
(
x
,
y
);
OutputDeviceInterface
*
o
=
OutputDeviceInterface
::
get
(
outputdevice
);
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
s
->
pendingChanges
(
o
)
->
d_func
()
->
position
=
_pos
;
OutputDeviceInterface
*
output
=
OutputDeviceInterface
::
get
(
outputdevice
);
pendingChanges
(
output
)
->
d
->
position
=
_pos
;
}
void
OutputConfigurationInterface
::
Private
::
scaleCallback
(
wl_client
*
client
,
wl_r
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
scale
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_scale
(
R
esource
*
resource
,
wl_resource
*
outputdevice
,
int32_t
scale
)
{
Q_UNUSED
(
client
);
Q_UNUSED
(
resource
)
if
(
scale
<=
0
)
{
qCWarning
(
KWAYLAND_SERVER
)
<<
"Requested to scale output device to"
<<
scale
<<
", but I can't do that."
;
return
;
}
OutputDeviceInterface
*
o
=
OutputDeviceInterface
::
get
(
outputdevice
);
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
s
->
pendingChanges
(
o
)
->
d_func
()
->
scale
=
scale
;
OutputDeviceInterface
*
output
=
OutputDeviceInterface
::
get
(
outputdevice
);
pendingChanges
(
output
)
->
d
->
scale
=
scale
;
}
void
OutputConfigurationInterface
::
Private
::
scaleFCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
wl_fixed_t
scale_fixed
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_apply
(
Resource
*
resource
)
{
Q_UNUSED
(
client
);
const
qreal
scale
=
wl_fixed_to_double
(
scale_fixed
);
if
(
scale
<=
0
)
{
qCWarning
(
KWAYLAND_SERVER
)
<<
"Requested to scale output device to"
<<
scale
<<
", but I can't do that."
;
return
;
}
OutputDeviceInterface
*
o
=
OutputDeviceInterface
::
get
(
outputdevice
);
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
s
->
pendingChanges
(
o
)
->
d_func
()
->
scale
=
scale
;
Q_UNUSED
(
resource
)
emitConfigurationChangeRequested
();
}
void
OutputConfigurationInterface
::
Private
::
applyCallback
(
wl_client
*
client
,
wl_resource
*
resourc
e
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_scalef
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
wl_fixed_t
scal
e
)
{
Q_UNUSED
(
client
);
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
s
->
emitConfigurationChangeRequested
();
Q_UNUSED
(
resource
)
const
qreal
doubleScale
=
wl_fixed_to_double
(
scale
);
if
(
doubleScale
<=
0
)
{
qCWarning
(
KWAYLAND_SERVER
)
<<
"Requested to scale output device to"
<<
doubleScale
<<
", but I can't do that."
;
return
;
}
OutputDeviceInterface
*
output
=
OutputDeviceInterface
::
get
(
outputdevice
);
pendingChanges
(
output
)
->
d
->
scale
=
doubleScale
;
}
void
OutputConfigurationInterface
::
Private
::
colorcurvesCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
wl_resource
*
outputdevice
,
wl_array
*
red
,
wl_array
*
green
,
wl_array
*
blue
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_colorcurves
(
Resource
*
resource
,
wl_resource
*
outputdevice
,
wl_array
*
red
,
wl_array
*
green
,
wl_array
*
blue
)
{
Q_UNUSED
(
client
);
OutputDeviceInterface
*
o
=
OutputDeviceInterface
::
get
(
outputdevice
);
OutputDeviceInterface
::
ColorCurves
oldCc
=
o
->
colorCurves
();
Q_UNUSED
(
resource
)
OutputDeviceInterface
*
o
utput
=
OutputDeviceInterface
::
get
(
outputdevice
);
OutputDeviceInterface
::
ColorCurves
oldCc
=
o
utput
->
colorCurves
();
auto
checkArg
=
[](
const
wl_array
*
newColor
,
const
QVector
<
quint16
>
&
oldColor
)
{
return
(
newColor
->
size
%
sizeof
(
uint16_t
)
==
0
)
&&
...
...
@@ -217,9 +163,7 @@ void OutputConfigurationInterface::Private::colorcurvesCallback(wl_client *clien
qCWarning
(
KWAYLAND_SERVER
)
<<
"Requested to change color curves, but have wrong size."
;
return
;
}
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
s
);
OutputDeviceInterface
::
ColorCurves
cc
;
auto
fillVector
=
[](
const
wl_array
*
array
,
QVector
<
quint16
>
*
v
)
{
...
...
@@ -230,69 +174,66 @@ void OutputConfigurationInterface::Private::colorcurvesCallback(wl_client *clien
pos
++
;
}
};
fillVector
(
red
,
&
cc
.
red
);
fillVector
(
green
,
&
cc
.
green
);
fillVector
(
blue
,
&
cc
.
blue
);
s
->
pendingChanges
(
o
)
->
d_func
()
->
colorCurves
=
cc
;
pendingChanges
(
o
utput
)
->
d
->
colorCurves
=
cc
;
}
void
OutputConfigurationInterface
::
Private
::
emitConfigurationChangeRequested
()
const
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_destroy
(
Resource
*
resource
)
{
auto
configinterface
=
reinterpret_cast
<
OutputConfigurationInterface
*>
(
q
);
emit
outputManagement
->
configurationChangeRequested
(
configinterface
);
wl_resource_destroy
(
resource
->
handle
);
}
OutputConfigurationInterface
::
Private
::
Private
(
OutputConfigurationInterface
*
q
,
OutputManagementInterface
*
c
,
wl_resource
*
parentResource
)
:
Resource
::
Private
(
q
,
c
,
parentResource
,
&
org_kde_kwin_outputconfiguration_interface
,
&
s_interface
)
void
OutputConfigurationInterfacePrivate
::
org_kde_kwin_outputconfiguration_destroy_resource
(
Resource
*
resource
)
{
Q_UNUSED
(
resource
)
delete
q
;
}
OutputConfigurationInterface
::
Private
::~
Private
()
=
default
;
void
OutputConfigurationInterfacePrivate
::
emitConfigurationChangeRequested
()
const
{
auto
configinterface
=
reinterpret_cast
<
OutputConfigurationInterface
*>
(
q
);
Q_EMIT
outputManagement
->
configurationChangeRequested
(
configinterface
);
}
OutputConfigurationInterface
::
Private
*
OutputConfigurationInterface
::
d_func
()
const
OutputConfigurationInterfacePrivate
::
OutputConfigurationInterfacePrivate
(
OutputConfigurationInterface
*
q
,
OutputManagementInterface
*
outputManagement
,
wl_resource
*
resource
)
:
QtWaylandServer
::
org_kde_kwin_outputconfiguration
(
resource
)
,
outputManagement
(
outputManagement
)
,
q
(
q
)
{
return
reinterpret_cast
<
Private
*>
(
d
.
data
());
}
QHash
<
OutputDeviceInterface
*
,
OutputChangeSet
*>
OutputConfigurationInterface
::
changes
()
const
{
Q_D
();
return
d
->
changes
;
}
void
OutputConfigurationInterface
::
setApplied
()
{
Q_D
();
d
->
clearPendingChanges
();
d
->
sendApplied
();
}
void
OutputConfigurationInterface
::
Private
::
sendApplied
()
void
OutputConfigurationInterfacePrivate
::
sendApplied
()
{
if
(
!
resource
)
{
return
;
}
org_kde_kwin_outputconfiguration_send_applied
(
resource
);
send_applied
();
}
void
OutputConfigurationInterface
::
setFailed
()