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
441266c4
Commit
441266c4
authored
May 17, 2022
by
Xaver Hugl
Browse files
wayland/outputinterface: use the same enums as core KWin
parent
4c05db3c
Pipeline
#177689
passed with stage
in 13 minutes and 4 seconds
Changes
11
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/wayland/autotests/client/test_wayland_output.cpp
View file @
441266c4
...
...
@@ -79,7 +79,7 @@ void TestWaylandOutput::init()
QCOMPARE
(
m_serverOutput
->
pixelSize
(),
QSize
(
1024
,
768
));
QCOMPARE
(
m_serverOutput
->
refreshRate
(),
60000
);
QCOMPARE
(
m_serverOutput
->
isDpmsSupported
(),
false
);
QCOMPARE
(
m_serverOutput
->
dpmsMode
(),
Output
Interface
::
DpmsMode
::
Off
);
QCOMPARE
(
m_serverOutput
->
dpmsMode
(),
KWin
::
Output
::
DpmsMode
::
Off
);
// setup connection
m_connection
=
new
KWayland
::
Client
::
ConnectionThread
;
...
...
@@ -278,22 +278,22 @@ void TestWaylandOutput::testSubPixel_data()
using
namespace
KWayland
::
Client
;
using
namespace
KWaylandServer
;
QTest
::
addColumn
<
KWayland
::
Client
::
Output
::
SubPixel
>
(
"expected"
);
QTest
::
addColumn
<
KW
aylandServer
::
OutputInterface
::
SubPixel
>
(
"actual"
);
QTest
::
addColumn
<
KW
in
::
Output
::
SubPixel
>
(
"actual"
);
QTest
::
newRow
(
"none"
)
<<
Output
::
SubPixel
::
None
<<
Output
Interface
::
SubPixel
::
None
;
QTest
::
newRow
(
"horizontal/rgb"
)
<<
Output
::
SubPixel
::
HorizontalRGB
<<
Output
Interface
::
SubPixel
::
HorizontalRGB
;
QTest
::
newRow
(
"horizontal/bgr"
)
<<
Output
::
SubPixel
::
HorizontalBGR
<<
Output
Interface
::
SubPixel
::
HorizontalBGR
;
QTest
::
newRow
(
"vertical/rgb"
)
<<
Output
::
SubPixel
::
VerticalRGB
<<
Output
Interface
::
SubPixel
::
VerticalRGB
;
QTest
::
newRow
(
"vertical/bgr"
)
<<
Output
::
SubPixel
::
VerticalBGR
<<
Output
Interface
::
SubPixel
::
VerticalBGR
;
QTest
::
newRow
(
"none"
)
<<
Output
::
SubPixel
::
None
<<
KWin
::
Output
::
SubPixel
::
None
;
QTest
::
newRow
(
"horizontal/rgb"
)
<<
Output
::
SubPixel
::
HorizontalRGB
<<
KWin
::
Output
::
SubPixel
::
Horizontal
_
RGB
;
QTest
::
newRow
(
"horizontal/bgr"
)
<<
Output
::
SubPixel
::
HorizontalBGR
<<
KWin
::
Output
::
SubPixel
::
Horizontal
_
BGR
;
QTest
::
newRow
(
"vertical/rgb"
)
<<
Output
::
SubPixel
::
VerticalRGB
<<
KWin
::
Output
::
SubPixel
::
Vertical
_
RGB
;
QTest
::
newRow
(
"vertical/bgr"
)
<<
Output
::
SubPixel
::
VerticalBGR
<<
KWin
::
Output
::
SubPixel
::
Vertical
_
BGR
;
}
void
TestWaylandOutput
::
testSubPixel
()
{
using
namespace
KWayland
::
Client
;
using
namespace
KWaylandServer
;
QFETCH
(
Output
Interface
::
SubPixel
,
actual
);
QCOMPARE
(
m_serverOutput
->
subPixel
(),
Output
Interface
::
SubPixel
::
Unknown
);
QSignalSpy
serverSubPixelChangedSpy
(
m_serverOutput
,
&
OutputInterface
::
subPixelChanged
);
QFETCH
(
KWin
::
Output
::
SubPixel
,
actual
);
QCOMPARE
(
m_serverOutput
->
subPixel
(),
KWin
::
Output
::
SubPixel
::
Unknown
);
QSignalSpy
serverSubPixelChangedSpy
(
m_serverOutput
,
&
KWaylandServer
::
OutputInterface
::
subPixelChanged
);
QVERIFY
(
serverSubPixelChangedSpy
.
isValid
());
m_serverOutput
->
setSubPixel
(
actual
);
QCOMPARE
(
m_serverOutput
->
subPixel
(),
actual
);
...
...
@@ -323,8 +323,8 @@ void TestWaylandOutput::testSubPixel()
// change back to unknown
outputChanged
.
clear
();
m_serverOutput
->
setSubPixel
(
Output
Interface
::
SubPixel
::
Unknown
);
QCOMPARE
(
m_serverOutput
->
subPixel
(),
Output
Interface
::
SubPixel
::
Unknown
);
m_serverOutput
->
setSubPixel
(
KWin
::
Output
::
SubPixel
::
Unknown
);
QCOMPARE
(
m_serverOutput
->
subPixel
(),
KWin
::
Output
::
SubPixel
::
Unknown
);
m_serverOutput
->
done
();
QCOMPARE
(
serverSubPixelChangedSpy
.
count
(),
2
);
if
(
outputChanged
.
isEmpty
())
{
...
...
@@ -338,24 +338,24 @@ void TestWaylandOutput::testTransform_data()
using
namespace
KWayland
::
Client
;
using
namespace
KWaylandServer
;
QTest
::
addColumn
<
KWayland
::
Client
::
Output
::
Transform
>
(
"expected"
);
QTest
::
addColumn
<
KW
aylandServer
::
OutputInterface
::
Transform
>
(
"actual"
);
QTest
::
newRow
(
"90"
)
<<
Output
::
Transform
::
Rotated90
<<
Output
Interface
::
Transform
::
Rotated90
;
QTest
::
newRow
(
"180"
)
<<
Output
::
Transform
::
Rotated180
<<
Output
Interface
::
Transform
::
Rotated180
;
QTest
::
newRow
(
"270"
)
<<
Output
::
Transform
::
Rotated270
<<
Output
Interface
::
Transform
::
Rotated270
;
QTest
::
newRow
(
"Flipped"
)
<<
Output
::
Transform
::
Flipped
<<
Output
Interface
::
Transform
::
Flipped
;
QTest
::
newRow
(
"Flipped 90"
)
<<
Output
::
Transform
::
Flipped90
<<
Output
Interface
::
Transform
::
Flipped90
;
QTest
::
newRow
(
"Flipped 180"
)
<<
Output
::
Transform
::
Flipped180
<<
Output
Interface
::
Transform
::
Flipped180
;
QTest
::
newRow
(
"Flipped 280"
)
<<
Output
::
Transform
::
Flipped270
<<
Output
Interface
::
Transform
::
Flipped270
;
QTest
::
addColumn
<
KW
in
::
Output
::
Transform
>
(
"actual"
);
QTest
::
newRow
(
"90"
)
<<
Output
::
Transform
::
Rotated90
<<
KWin
::
Output
::
Transform
::
Rotated90
;
QTest
::
newRow
(
"180"
)
<<
Output
::
Transform
::
Rotated180
<<
KWin
::
Output
::
Transform
::
Rotated180
;
QTest
::
newRow
(
"270"
)
<<
Output
::
Transform
::
Rotated270
<<
KWin
::
Output
::
Transform
::
Rotated270
;
QTest
::
newRow
(
"Flipped"
)
<<
Output
::
Transform
::
Flipped
<<
KWin
::
Output
::
Transform
::
Flipped
;
QTest
::
newRow
(
"Flipped 90"
)
<<
Output
::
Transform
::
Flipped90
<<
KWin
::
Output
::
Transform
::
Flipped90
;
QTest
::
newRow
(
"Flipped 180"
)
<<
Output
::
Transform
::
Flipped180
<<
KWin
::
Output
::
Transform
::
Flipped180
;
QTest
::
newRow
(
"Flipped 280"
)
<<
Output
::
Transform
::
Flipped270
<<
KWin
::
Output
::
Transform
::
Flipped270
;
}
void
TestWaylandOutput
::
testTransform
()
{
using
namespace
KWayland
::
Client
;
using
namespace
KWaylandServer
;
QFETCH
(
Output
Interface
::
Transform
,
actual
);
QCOMPARE
(
m_serverOutput
->
transform
(),
Output
Interface
::
Transform
::
Normal
);
QSignalSpy
serverTransformChangedSpy
(
m_serverOutput
,
&
OutputInterface
::
transformChanged
);
QFETCH
(
KWin
::
Output
::
Transform
,
actual
);
QCOMPARE
(
m_serverOutput
->
transform
(),
KWin
::
Output
::
Transform
::
Normal
);
QSignalSpy
serverTransformChangedSpy
(
m_serverOutput
,
&
KWaylandServer
::
OutputInterface
::
transformChanged
);
QVERIFY
(
serverTransformChangedSpy
.
isValid
());
m_serverOutput
->
setTransform
(
actual
);
QCOMPARE
(
m_serverOutput
->
transform
(),
actual
);
...
...
@@ -384,8 +384,8 @@ void TestWaylandOutput::testTransform()
// change back to normal
outputChanged
.
clear
();
m_serverOutput
->
setTransform
(
Output
Interface
::
Transform
::
Normal
);
QCOMPARE
(
m_serverOutput
->
transform
(),
Output
Interface
::
Transform
::
Normal
);
m_serverOutput
->
setTransform
(
KWin
::
Output
::
Transform
::
Normal
);
QCOMPARE
(
m_serverOutput
->
transform
(),
KWin
::
Output
::
Transform
::
Normal
);
m_serverOutput
->
done
();
QCOMPARE
(
serverTransformChangedSpy
.
count
(),
2
);
if
(
outputChanged
.
isEmpty
())
{
...
...
@@ -400,11 +400,11 @@ void TestWaylandOutput::testDpms_data()
using
namespace
KWaylandServer
;
QTest
::
addColumn
<
KWayland
::
Client
::
Dpms
::
Mode
>
(
"client"
);
QTest
::
addColumn
<
KW
aylandServer
::
OutputInterface
::
DpmsMode
>
(
"server"
);
QTest
::
addColumn
<
KW
in
::
Output
::
DpmsMode
>
(
"server"
);
QTest
::
newRow
(
"Standby"
)
<<
Dpms
::
Mode
::
Standby
<<
Output
Interface
::
DpmsMode
::
Standby
;
QTest
::
newRow
(
"Suspend"
)
<<
Dpms
::
Mode
::
Suspend
<<
Output
Interface
::
DpmsMode
::
Suspend
;
QTest
::
newRow
(
"On"
)
<<
Dpms
::
Mode
::
On
<<
Output
Interface
::
DpmsMode
::
On
;
QTest
::
newRow
(
"Standby"
)
<<
Dpms
::
Mode
::
Standby
<<
KWin
::
Output
::
DpmsMode
::
Standby
;
QTest
::
newRow
(
"Suspend"
)
<<
Dpms
::
Mode
::
Suspend
<<
KWin
::
Output
::
DpmsMode
::
Suspend
;
QTest
::
newRow
(
"On"
)
<<
Dpms
::
Mode
::
On
<<
KWin
::
Output
::
DpmsMode
::
On
;
}
void
TestWaylandOutput
::
testDpms
()
...
...
@@ -454,13 +454,13 @@ void TestWaylandOutput::testDpms()
QCOMPARE
(
dpms
->
isSupported
(),
true
);
// and let's change to suspend
QSignalSpy
serverDpmsModeChangedSpy
(
m_serverOutput
,
&
OutputInterface
::
dpmsModeChanged
);
QSignalSpy
serverDpmsModeChangedSpy
(
m_serverOutput
,
&
KWaylandServer
::
OutputInterface
::
dpmsModeChanged
);
QVERIFY
(
serverDpmsModeChangedSpy
.
isValid
());
QSignalSpy
clientDpmsModeChangedSpy
(
dpms
,
&
Dpms
::
modeChanged
);
QVERIFY
(
clientDpmsModeChangedSpy
.
isValid
());
QCOMPARE
(
m_serverOutput
->
dpmsMode
(),
Output
Interface
::
DpmsMode
::
Off
);
QFETCH
(
Output
Interface
::
DpmsMode
,
server
);
QCOMPARE
(
m_serverOutput
->
dpmsMode
(),
KWin
::
Output
::
DpmsMode
::
Off
);
QFETCH
(
KWin
::
Output
::
DpmsMode
,
server
);
m_serverOutput
->
setDpmsMode
(
server
);
QCOMPARE
(
m_serverOutput
->
dpmsMode
(),
server
);
QCOMPARE
(
serverDpmsModeChangedSpy
.
count
(),
1
);
...
...
@@ -482,7 +482,7 @@ void TestWaylandOutput::testDpms()
QVERIFY
(
dpms
->
isSupported
());
// and switch back to off
m_serverOutput
->
setDpmsMode
(
Output
Interface
::
DpmsMode
::
Off
);
m_serverOutput
->
setDpmsMode
(
KWin
::
Output
::
DpmsMode
::
Off
);
QVERIFY
(
clientDpmsModeChangedSpy
.
wait
());
QCOMPARE
(
clientDpmsModeChangedSpy
.
count
(),
2
);
QCOMPARE
(
dpms
->
mode
(),
Dpms
::
Mode
::
Off
);
...
...
@@ -494,12 +494,12 @@ void TestWaylandOutput::testDpmsRequestMode_data()
using
namespace
KWaylandServer
;
QTest
::
addColumn
<
KWayland
::
Client
::
Dpms
::
Mode
>
(
"client"
);
QTest
::
addColumn
<
KW
aylandServer
::
OutputInterface
::
DpmsMode
>
(
"server"
);
QTest
::
addColumn
<
KW
in
::
Output
::
DpmsMode
>
(
"server"
);
QTest
::
newRow
(
"Standby"
)
<<
Dpms
::
Mode
::
Standby
<<
Output
Interface
::
DpmsMode
::
Standby
;
QTest
::
newRow
(
"Suspend"
)
<<
Dpms
::
Mode
::
Suspend
<<
Output
Interface
::
DpmsMode
::
Suspend
;
QTest
::
newRow
(
"Off"
)
<<
Dpms
::
Mode
::
Off
<<
Output
Interface
::
DpmsMode
::
Off
;
QTest
::
newRow
(
"On"
)
<<
Dpms
::
Mode
::
On
<<
Output
Interface
::
DpmsMode
::
On
;
QTest
::
newRow
(
"Standby"
)
<<
Dpms
::
Mode
::
Standby
<<
KWin
::
Output
::
DpmsMode
::
Standby
;
QTest
::
newRow
(
"Suspend"
)
<<
Dpms
::
Mode
::
Suspend
<<
KWin
::
Output
::
DpmsMode
::
Suspend
;
QTest
::
newRow
(
"Off"
)
<<
Dpms
::
Mode
::
Off
<<
KWin
::
Output
::
DpmsMode
::
Off
;
QTest
::
newRow
(
"On"
)
<<
Dpms
::
Mode
::
On
<<
KWin
::
Output
::
DpmsMode
::
On
;
}
void
TestWaylandOutput
::
testDpmsRequestMode
()
...
...
@@ -541,13 +541,13 @@ void TestWaylandOutput::testDpmsRequestMode()
Dpms
*
dpms
=
dpmsManager
->
getDpms
(
output
,
&
registry
);
// and test request mode
QSignalSpy
modeRequestedSpy
(
m_serverOutput
,
&
OutputInterface
::
dpmsModeRequested
);
QSignalSpy
modeRequestedSpy
(
m_serverOutput
,
&
KWaylandServer
::
OutputInterface
::
dpmsModeRequested
);
QVERIFY
(
modeRequestedSpy
.
isValid
());
QFETCH
(
Dpms
::
Mode
,
client
);
dpms
->
requestMode
(
client
);
QVERIFY
(
modeRequestedSpy
.
wait
());
QTEST
(
modeRequestedSpy
.
last
().
first
().
value
<
Output
Interface
::
DpmsMode
>
(),
"server"
);
QTEST
(
modeRequestedSpy
.
last
().
first
().
value
<
KWin
::
Output
::
DpmsMode
>
(),
"server"
);
}
QTEST_GUILESS_MAIN
(
TestWaylandOutput
)
...
...
src/wayland/dpms_interface.cpp
View file @
441266c4
...
...
@@ -50,7 +50,7 @@ DpmsInterface::DpmsInterface(OutputInterface *output, wl_resource *resource)
sendSupported
();
sendDone
();
});
connect
(
output
,
&
OutputInterface
::
dpmsModeChanged
,
this
,
[
this
]
{
connect
(
output
,
&
KWaylandServer
::
OutputInterface
::
dpmsModeChanged
,
this
,
[
this
]
{
sendMode
();
sendDone
();
});
...
...
@@ -72,19 +72,19 @@ void DpmsInterface::org_kde_kwin_dpms_destroy_resource(Resource *resource)
void
DpmsInterface
::
org_kde_kwin_dpms_set
(
Resource
*
resource
,
uint32_t
mode
)
{
Q_UNUSED
(
resource
)
Output
Interface
::
DpmsMode
dpmsMode
;
KWin
::
Output
::
DpmsMode
dpmsMode
;
switch
(
mode
)
{
case
ORG_KDE_KWIN_DPMS_MODE_ON
:
dpmsMode
=
Output
Interface
::
DpmsMode
::
On
;
dpmsMode
=
KWin
::
Output
::
DpmsMode
::
On
;
break
;
case
ORG_KDE_KWIN_DPMS_MODE_STANDBY
:
dpmsMode
=
Output
Interface
::
DpmsMode
::
Standby
;
dpmsMode
=
KWin
::
Output
::
DpmsMode
::
Standby
;
break
;
case
ORG_KDE_KWIN_DPMS_MODE_SUSPEND
:
dpmsMode
=
Output
Interface
::
DpmsMode
::
Suspend
;
dpmsMode
=
KWin
::
Output
::
DpmsMode
::
Suspend
;
break
;
case
ORG_KDE_KWIN_DPMS_MODE_OFF
:
dpmsMode
=
Output
Interface
::
DpmsMode
::
Off
;
dpmsMode
=
KWin
::
Output
::
DpmsMode
::
Off
;
break
;
default:
return
;
...
...
@@ -102,16 +102,16 @@ void DpmsInterface::sendMode()
const
auto
mode
=
output
->
dpmsMode
();
org_kde_kwin_dpms_mode
wlMode
;
switch
(
mode
)
{
case
Output
Interface
::
DpmsMode
::
On
:
case
KWin
::
Output
::
DpmsMode
::
On
:
wlMode
=
ORG_KDE_KWIN_DPMS_MODE_ON
;
break
;
case
Output
Interface
::
DpmsMode
::
Standby
:
case
KWin
::
Output
::
DpmsMode
::
Standby
:
wlMode
=
ORG_KDE_KWIN_DPMS_MODE_STANDBY
;
break
;
case
Output
Interface
::
DpmsMode
::
Suspend
:
case
KWin
::
Output
::
DpmsMode
::
Suspend
:
wlMode
=
ORG_KDE_KWIN_DPMS_MODE_SUSPEND
;
break
;
case
Output
Interface
::
DpmsMode
::
Off
:
case
KWin
::
Output
::
DpmsMode
::
Off
:
wlMode
=
ORG_KDE_KWIN_DPMS_MODE_OFF
;
break
;
default:
...
...
src/wayland/dpms_interface.h
View file @
441266c4
...
...
@@ -34,13 +34,13 @@ class DpmsManagerInterfacePrivate;
* @code
* // We have our OutputInterface called output.
* output->setDpmsSupported(true);
* output->setDpmsMode(Output
Interface
::DpmsMode::On);
* output->setDpmsMode(
KWin::
Output::DpmsMode::On);
* @endcode
*
* To connect to Dpms change requests use:
* @code
* connect(output, &Output
Interface
::
d
pmsModeRequested,
* [] (KWaylandServer::Output
Interface
::DpmsMode requestedMode) { qDebug() << "Mode change requested"; });
* connect(output, &
KWin::
Output::
D
pmsModeRequested,
* [] (KWaylandServer::
KWin::
Output::DpmsMode requestedMode) { qDebug() << "Mode change requested"; });
* @endcode
*
* @see Display
...
...
src/wayland/output_interface.cpp
View file @
441266c4
...
...
@@ -37,12 +37,12 @@ public:
QString
manufacturer
=
QStringLiteral
(
"org.kde.kwin"
);
QString
model
=
QStringLiteral
(
"none"
);
int
scale
=
1
;
Output
Interface
::
SubPixel
subPixel
=
Output
Interface
::
SubPixel
::
Unknown
;
Output
Interface
::
Transform
transform
=
Output
Interface
::
Transform
::
Normal
;
KWin
::
Output
::
SubPixel
subPixel
=
KWin
::
Output
::
SubPixel
::
Unknown
;
KWin
::
Output
::
Transform
transform
=
KWin
::
Output
::
Transform
::
Normal
;
OutputInterface
::
Mode
mode
;
struct
{
Output
Interface
::
DpmsMode
mode
=
Output
Interface
::
DpmsMode
::
Off
;
KWin
::
Output
::
DpmsMode
mode
=
KWin
::
Output
::
DpmsMode
::
Off
;
bool
supported
=
false
;
}
dpms
;
...
...
@@ -71,44 +71,44 @@ void OutputInterfacePrivate::sendScale(Resource *resource)
}
}
static
quint32
kwaylandServerTransformToWaylandTransform
(
Output
Interface
::
Transform
transform
)
static
quint32
kwaylandServerTransformToWaylandTransform
(
KWin
::
Output
::
Transform
transform
)
{
switch
(
transform
)
{
case
Output
Interface
::
Transform
::
Normal
:
case
KWin
::
Output
::
Transform
::
Normal
:
return
OutputInterfacePrivate
::
transform_normal
;
case
Output
Interface
::
Transform
::
Rotated90
:
case
KWin
::
Output
::
Transform
::
Rotated90
:
return
OutputInterfacePrivate
::
transform_90
;
case
Output
Interface
::
Transform
::
Rotated180
:
case
KWin
::
Output
::
Transform
::
Rotated180
:
return
OutputInterfacePrivate
::
transform_180
;
case
Output
Interface
::
Transform
::
Rotated270
:
case
KWin
::
Output
::
Transform
::
Rotated270
:
return
OutputInterfacePrivate
::
transform_270
;
case
Output
Interface
::
Transform
::
Flipped
:
case
KWin
::
Output
::
Transform
::
Flipped
:
return
OutputInterfacePrivate
::
transform_flipped
;
case
Output
Interface
::
Transform
::
Flipped90
:
case
KWin
::
Output
::
Transform
::
Flipped90
:
return
OutputInterfacePrivate
::
transform_flipped_90
;
case
Output
Interface
::
Transform
::
Flipped180
:
case
KWin
::
Output
::
Transform
::
Flipped180
:
return
OutputInterfacePrivate
::
transform_flipped_180
;
case
Output
Interface
::
Transform
::
Flipped270
:
case
KWin
::
Output
::
Transform
::
Flipped270
:
return
OutputInterfacePrivate
::
transform_flipped_270
;
default:
Q_UNREACHABLE
();
}
}
static
quint32
kwaylandServerSubPixelToWaylandSubPixel
(
Output
Interface
::
SubPixel
subPixel
)
static
quint32
kwaylandServerSubPixelToWaylandSubPixel
(
KWin
::
Output
::
SubPixel
subPixel
)
{
switch
(
subPixel
)
{
case
Output
Interface
::
SubPixel
::
Unknown
:
case
KWin
::
Output
::
SubPixel
::
Unknown
:
return
OutputInterfacePrivate
::
subpixel_unknown
;
case
Output
Interface
::
SubPixel
::
None
:
case
KWin
::
Output
::
SubPixel
::
None
:
return
OutputInterfacePrivate
::
subpixel_none
;
case
Output
Interface
::
SubPixel
::
HorizontalRGB
:
case
KWin
::
Output
::
SubPixel
::
Horizontal
_
RGB
:
return
OutputInterfacePrivate
::
subpixel_horizontal_rgb
;
case
Output
Interface
::
SubPixel
::
HorizontalBGR
:
case
KWin
::
Output
::
SubPixel
::
Horizontal
_
BGR
:
return
OutputInterfacePrivate
::
subpixel_horizontal_bgr
;
case
Output
Interface
::
SubPixel
::
VerticalRGB
:
case
KWin
::
Output
::
SubPixel
::
Vertical
_
RGB
:
return
OutputInterfacePrivate
::
subpixel_vertical_rgb
;
case
Output
Interface
::
SubPixel
::
VerticalBGR
:
case
KWin
::
Output
::
SubPixel
::
Vertical
_
BGR
:
return
OutputInterfacePrivate
::
subpixel_vertical_bgr
;
default:
Q_UNREACHABLE
();
...
...
@@ -312,12 +312,12 @@ void OutputInterface::setScale(int scale)
Q_EMIT
scaleChanged
(
d
->
scale
);
}
Output
Interface
::
SubPixel
OutputInterface
::
subPixel
()
const
KWin
::
Output
::
SubPixel
OutputInterface
::
subPixel
()
const
{
return
d
->
subPixel
;
}
void
OutputInterface
::
setSubPixel
(
SubPixel
subPixel
)
void
OutputInterface
::
setSubPixel
(
KWin
::
Output
::
SubPixel
subPixel
)
{
if
(
d
->
subPixel
==
subPixel
)
{
return
;
...
...
@@ -327,12 +327,12 @@ void OutputInterface::setSubPixel(SubPixel subPixel)
Q_EMIT
subPixelChanged
(
d
->
subPixel
);
}
Output
Interface
::
Transform
OutputInterface
::
transform
()
const
KWin
::
Output
::
Transform
OutputInterface
::
transform
()
const
{
return
d
->
transform
;
}
void
OutputInterface
::
setTransform
(
Transform
transform
)
void
OutputInterface
::
setTransform
(
KWin
::
Output
::
Transform
transform
)
{
if
(
d
->
transform
==
transform
)
{
return
;
...
...
@@ -342,7 +342,7 @@ void OutputInterface::setTransform(Transform transform)
Q_EMIT
transformChanged
(
d
->
transform
);
}
void
OutputInterface
::
setDpmsMode
(
Output
Interface
::
DpmsMode
mode
)
void
OutputInterface
::
setDpmsMode
(
KWin
::
Output
::
DpmsMode
mode
)
{
if
(
d
->
dpms
.
mode
==
mode
)
{
return
;
...
...
@@ -360,7 +360,7 @@ void OutputInterface::setDpmsSupported(bool supported)
Q_EMIT
dpmsSupportedChanged
();
}
Output
Interface
::
DpmsMode
OutputInterface
::
dpmsMode
()
const
KWin
::
Output
::
DpmsMode
OutputInterface
::
dpmsMode
()
const
{
return
d
->
dpms
.
mode
;
}
...
...
@@ -388,7 +388,7 @@ bool OutputInterface::isEnabled() const
if
(
!
d
->
dpms
.
supported
)
{
return
true
;
}
return
d
->
dpms
.
mode
==
DpmsMode
::
On
;
return
d
->
dpms
.
mode
==
KWin
::
Output
::
DpmsMode
::
On
;
}
void
OutputInterface
::
done
()
...
...
src/wayland/output_interface.h
View file @
441266c4
...
...
@@ -7,6 +7,7 @@
#pragma once
#include
"kwin_export.h"
#include
"output.h"
#include
<QObject>
#include
<QPoint>
...
...
@@ -36,35 +37,11 @@ class KWIN_EXPORT OutputInterface : public QObject
Q_PROPERTY
(
int
refreshRate
READ
refreshRate
NOTIFY
refreshRateChanged
)
Q_PROPERTY
(
int
scale
READ
scale
WRITE
setScale
NOTIFY
scaleChanged
)
public:
enum
class
SubPixel
{
Unknown
,
None
,
HorizontalRGB
,
HorizontalBGR
,
VerticalRGB
,
VerticalBGR
,
};
enum
class
Transform
{
Normal
,
Rotated90
,
Rotated180
,
Rotated270
,
Flipped
,
Flipped90
,
Flipped180
,
Flipped270
,
};
struct
Mode
{
QSize
size
=
QSize
();
int
refreshRate
=
60000
;
};
enum
class
DpmsMode
{
On
,
Standby
,
Suspend
,
Off
,
};
explicit
OutputInterface
(
Display
*
display
,
QObject
*
parent
=
nullptr
);
~
OutputInterface
()
override
;
...
...
@@ -78,19 +55,19 @@ public:
QSize
pixelSize
()
const
;
int
refreshRate
()
const
;
int
scale
()
const
;
SubPixel
subPixel
()
const
;
Transform
transform
()
const
;
KWin
::
Output
::
SubPixel
subPixel
()
const
;
KWin
::
Output
::
Transform
transform
()
const
;
Mode
mode
()
const
;
bool
isDpmsSupported
()
const
;
DpmsMode
dpmsMode
()
const
;
KWin
::
Output
::
DpmsMode
dpmsMode
()
const
;
void
setPhysicalSize
(
const
QSize
&
size
);
void
setGlobalPosition
(
const
QPoint
&
pos
);
void
setManufacturer
(
const
QString
&
manufacturer
);
void
setModel
(
const
QString
&
model
);
void
setScale
(
int
scale
);
void
setSubPixel
(
SubPixel
subPixel
);
void
setTransform
(
Transform
transform
);
void
setSubPixel
(
KWin
::
Output
::
SubPixel
subPixel
);
void
setTransform
(
KWin
::
Output
::
Transform
transform
);
void
setMode
(
const
Mode
&
mode
);
void
setMode
(
const
QSize
&
size
,
int
refreshRate
=
60000
);
...
...
@@ -103,7 +80,7 @@ public:
* Sets the currently used dpms mode.
* Default is @c DpmsMode::On.
*/
void
setDpmsMode
(
DpmsMode
mode
);
void
setDpmsMode
(
KWin
::
Output
::
DpmsMode
mode
);
/**
* @returns all wl_resources bound for the @p client
...
...
@@ -135,8 +112,8 @@ Q_SIGNALS:
void
pixelSizeChanged
(
const
QSize
&
);
void
refreshRateChanged
(
int
);
void
scaleChanged
(
int
);
void
subPixelChanged
(
SubPixel
);
void
transformChanged
(
Transform
);
void
subPixelChanged
(
KWin
::
Output
::
SubPixel
);
void
transformChanged
(
KWin
::
Output
::
Transform
);
void
modeChanged
();
void
dpmsModeChanged
();
void
dpmsSupportedChanged
();
...
...
@@ -146,7 +123,7 @@ Q_SIGNALS:
* Change of dpms @p mode is requested.
* A server is free to ignore this request.
*/
void
dpmsModeRequested
(
KW
aylandServer
::
OutputInterface
::
DpmsMode
mode
);
void
dpmsModeRequested
(
KW
in
::
Output
::
DpmsMode
mode
);
/**
* Emitted when a client binds to a given output
...
...
@@ -159,7 +136,3 @@ private:
};
}
// namespace KWaylandServer
Q_DECLARE_METATYPE
(
KWaylandServer
::
OutputInterface
::
SubPixel
)
Q_DECLARE_METATYPE
(
KWaylandServer
::
OutputInterface
::
Transform
)
Q_DECLARE_METATYPE
(
KWaylandServer
::
OutputInterface
::
DpmsMode
)
src/wayland/surface_interface.cpp
View file @
441266c4
...
...
@@ -313,7 +313,7 @@ void SurfaceInterfacePrivate::surface_set_buffer_transform(Resource *resource, i
wl_resource_post_error
(
resource
->
handle
,
error_invalid_transform
,
"buffer transform must be a valid transform (%d specified)"
,
transform
);
return
;
}
pending
.
bufferTransform
=
Output
Interface
::
Transform
(
transform
);
pending
.
bufferTransform
=
KWin
::
Output
::
Transform
(
transform
);
pending
.
bufferTransformIsSet
=
true
;
}
...
...
@@ -409,34 +409,34 @@ QMatrix4x4 SurfaceInterfacePrivate::buildSurfaceToBufferMatrix()
surfaceToBufferMatrix
.
scale
(
current
.
bufferScale
,
current
.
bufferScale
);
switch
(
current
.
bufferTransform
)
{
case
Output
Interface
::
Transform
::
Normal
:
case
Output
Interface
::
Transform
::
Flipped
:
case
KWin
::
Output
::
Transform
::
Normal
:
case
KWin
::
Output
::
Transform
::
Flipped
:
break
;
case
Output
Interface
::
Transform
::
Rotated90
:
case
Output
Interface
::
Transform
::
Flipped90
:
case
KWin
::
Output
::
Transform
::
Rotated90
:
case
KWin
::
Output
::
Transform
::
Flipped90
:
surfaceToBufferMatrix
.
translate
(
0
,
bufferSize
.
height
()
/
current
.
bufferScale
);
surfaceToBufferMatrix
.
rotate
(
-
90
,
0
,
0
,
1
);
break
;
case
Output
Interface
::
Transform
::
Rotated180
:
case
Output
Interface
::
Transform
::
Flipped180
:
case
KWin
::
Output
::
Transform
::
Rotated180
:
case
KWin
::
Output
::
Transform
::
Flipped180
:
surfaceToBufferMatrix
.
translate
(
bufferSize
.
width
()
/
current
.
bufferScale
,
bufferSize
.
height
()
/
current
.
bufferScale
);
surfaceToBufferMatrix
.
rotate
(
-
180
,
0
,
0
,
1
);
break
;
case
Output
Interface
::
Transform
::
Rotated270
:
case
Output
Interface
::
Transform
::
Flipped270
:
case
KWin
::
Output
::
Transform
::
Rotated270
:
case
KWin
::
Output
::
Transform
::
Flipped270
:
surfaceToBufferMatrix
.
translate
(
bufferSize
.
width
()
/
current
.
bufferScale
,
0
);
surfaceToBufferMatrix
.
rotate
(
-
270
,
0
,
0
,
1
);
break
;
}
switch
(
current
.
bufferTransform
)
{
case
Output
Interface
::
Transform
::
Flipped
:
case
Output
Interface
::
Transform
::
Flipped180
:
case
KWin
::
Output
::
Transform
::
Flipped
:
case
KWin
::
Output
::
Transform
::
Flipped180
:
surfaceToBufferMatrix
.
translate
(
bufferSize
.
width
()
/
current
.
bufferScale
,
0
);
surfaceToBufferMatrix
.
scale
(
-
1
,
1
);
break
;
case
Output
Interface
::
Transform
::
Flipped90
:
case
Output
Interface
::
Transform
::
Flipped270
:
case
KWin
::
Output
::
Transform
::
Flipped90
:
case
KWin
::
Output
::
Transform
::
Flipped270
:
surfaceToBufferMatrix
.
translate
(
bufferSize
.
height
()
/
current
.
bufferScale
,
0
);
surfaceToBufferMatrix
.
scale
(
-
1
,
1
);
break
;
...
...
@@ -570,16 +570,16 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next)
implicitSurfaceSize
=
current
.
buffer
->
size
()
/
current
.
bufferScale
;
switch
(
current
.
bufferTransform
)
{
case
Output
Interface
::
Transform
::
Rotated90
:
case
Output
Interface
::
Transform
::
Rotated270
:
case
Output
Interface
::
Transform
::
Flipped90
:
case
Output
Interface
::
Transform
::
Flipped270
:
case
KWin
::
Output
::
Transform
::
Rotated90
:
case
KWin
::
Output
::
Transform
::
Rotated270
:
case
KWin
::
Output
::
Transform
::
Flipped90
:
case
KWin
::
Output
::
Transform
::
Flipped270
:
implicitSurfaceSize
.
transpose
();
break
;
case
Output
Interface
::
Transform
::
Normal
:
case
Output
Interface
::
Transform
::
Rotated180
:
case
Output
Interface
::
Transform
::
Flipped
:
case
Output
Interface
::
Transform
::
Flipped180
:
case
KWin
::
Output
::
Transform
::
Normal
:
case
KWin
::
Output
::
Transform
::
Rotated180
:
case
KWin
::
Output
::
Transform
::
Flipped
:
case
KWin
::
Output
::
Transform
::
Flipped180
:
break
;
}
...
...
@@ -753,7 +753,7 @@ qint32 SurfaceInterface::bufferScale() const
return
d
->
current
.
bufferScale
;
}
Output
Interface
::
Transform
SurfaceInterface
::
bufferTransform
()
const
KWin
::
Output
::
Transform
SurfaceInterface
::
bufferTransform
()
const
{
return
d
->
current
.
bufferTransform
;
}
...
...
src/wayland/surface_interface.h
View file @
441266c4
...
...
@@ -69,7 +69,7 @@ class KWIN_EXPORT SurfaceInterface : public QObject
*/
Q_PROPERTY
(
QRegion
input
READ
input
NOTIFY
inputChanged
)
Q_PROPERTY
(
qint32
bufferScale
READ
bufferScale
NOTIFY
bufferScaleChanged
)
Q_PROPERTY
(
KW
aylandServer
::
OutputInterface
::
Transform
bufferTransform
READ
bufferTransform
NOTIFY
bufferTransformChanged
)
Q_PROPERTY
(
KW
in
::
Output
::
Transform
bufferTransform
READ
bufferTransform
NOTIFY
bufferTransformChanged
)
Q_PROPERTY
(
QSize
size
READ
size
NOTIFY
sizeChanged
)
public:
explicit
SurfaceInterface
(
CompositorInterface
*
compositor
,
wl_resource
*
resource
);
...
...
@@ -169,7 +169,7 @@ public:
* If the surface is on an output that is rotated 90 degrees clockwise, the buffer will
* be rotated 90 degrees counter clockwise.
*/