Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWayland Server
Commits
589e339d
Commit
589e339d
authored
Mar 23, 2021
by
Vlad Zahorodnii
Browse files
Rework OutputInterface following new design principles
parent
29e8cb43
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
autotests/client/test_wayland_output.cpp
View file @
589e339d
...
...
@@ -81,7 +81,6 @@ void TestWaylandOutput::init()
m_serverOutput
->
setCurrentMode
(
QSize
(
1024
,
768
));
QCOMPARE
(
m_serverOutput
->
pixelSize
(),
QSize
(
1024
,
768
));
QCOMPARE
(
m_serverOutput
->
refreshRate
(),
60000
);
m_serverOutput
->
create
();
QCOMPARE
(
m_serverOutput
->
isDpmsSupported
(),
false
);
QCOMPARE
(
m_serverOutput
->
dpmsMode
(),
OutputInterface
::
DpmsMode
::
Off
);
...
...
autotests/client/test_wayland_surface.cpp
View file @
589e339d
...
...
@@ -1051,7 +1051,6 @@ void TestWaylandSurface::testOutput()
QVERIFY
(
outputAnnouncedSpy
.
isValid
());
auto
serverOutput
=
new
OutputInterface
(
m_display
,
m_display
);
serverOutput
->
create
();
QVERIFY
(
outputAnnouncedSpy
.
wait
());
QScopedPointer
<
Output
>
clientOutput
(
registry
.
createOutput
(
outputAnnouncedSpy
.
first
().
first
().
value
<
quint32
>
(),
outputAnnouncedSpy
.
first
().
last
().
value
<
quint32
>
()));
QVERIFY
(
clientOutput
->
isValid
());
...
...
autotests/client/test_xdg_output.cpp
View file @
589e339d
...
...
@@ -61,7 +61,6 @@ void TestXdgOutput::init()
m_serverOutput
=
new
OutputInterface
(
m_display
,
this
);
m_serverOutput
->
addMode
(
QSize
(
1920
,
1080
),
OutputInterface
::
ModeFlags
(
OutputInterface
::
ModeFlag
::
Preferred
));
m_serverOutput
->
setCurrentMode
(
QSize
(
1920
,
1080
));
m_serverOutput
->
create
();
m_serverXdgOutputManager
=
new
XdgOutputManagerV1Interface
(
m_display
,
this
);
m_serverXdgOutput
=
m_serverXdgOutputManager
->
createXdgOutput
(
m_serverOutput
,
this
);
...
...
autotests/client/test_xdg_shell.cpp
View file @
589e339d
...
...
@@ -95,10 +95,8 @@ void XdgShellTest::init()
m_display
->
createShm
();
m_o1Interface
=
new
OutputInterface
(
m_display
,
m_display
);
m_o1Interface
->
addMode
(
QSize
(
1024
,
768
));
m_o1Interface
->
create
();
m_o2Interface
=
new
OutputInterface
(
m_display
,
m_display
);
m_o2Interface
->
addMode
(
QSize
(
1024
,
768
));
m_o2Interface
->
create
();
m_seatInterface
=
new
SeatInterface
(
m_display
,
m_display
);
m_seatInterface
->
setHasKeyboard
(
true
);
m_seatInterface
->
setHasPointer
(
true
);
...
...
autotests/server/test_inputmethod_interface.cpp
View file @
589e339d
...
...
@@ -180,8 +180,7 @@ void TestInputMethodInterface::initTestCase()
m_serverCompositor
=
new
CompositorInterface
(
&
m_display
,
this
);
m_inputMethodIface
=
new
InputMethodV1Interface
(
&
m_display
,
this
);
m_inputPanelIface
=
new
InputPanelV1Interface
(
&
m_display
,
this
);
auto
outputIface
=
new
OutputInterface
(
&
m_display
,
this
);
outputIface
->
create
();
new
OutputInterface
(
&
m_display
,
this
);
connect
(
m_serverCompositor
,
&
CompositorInterface
::
surfaceCreated
,
this
,
[
this
](
SurfaceInterface
*
surface
)
{
m_surfaces
+=
surface
;
...
...
src/server/output_interface.cpp
View file @
589e339d
This diff is collapsed.
Click to expand it.
src/server/output_interface.h
View file @
589e339d
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#pragma once
#include <KWaylandServer/kwaylandserver_export.h>
#include <QObject>
#include <QPoint>
#include <QSize>
#include <KWaylandServer/kwaylandserver_export.h>
#include "global.h"
struct
wl_global
;
struct
wl_client
;
struct
wl_resource
;
namespace
KWaylandServer
...
...
@@ -21,12 +19,13 @@ namespace KWaylandServer
class
ClientConnection
;
class
Display
;
class
OutputInterfacePrivate
;
/**
*
@brief Global for the wl_output interface.
*
*
The OutputInterface class represents a screen. This class corresponds to the Wayland
*
interface @c wl_output.
*/
class
KWAYLANDSERVER_EXPORT
OutputInterface
:
public
Global
class
KWAYLANDSERVER_EXPORT
OutputInterface
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QSize
physicalSize
READ
physicalSize
WRITE
setPhysicalSize
NOTIFY
physicalSizeChanged
)
...
...
@@ -73,7 +72,7 @@ public:
};
explicit
OutputInterface
(
Display
*
display
,
QObject
*
parent
=
nullptr
);
virtual
~
OutputInterface
();
~
OutputInterface
()
override
;
QSize
physicalSize
()
const
;
QPoint
globalPosition
()
const
;
...
...
@@ -127,6 +126,7 @@ public:
static
OutputInterface
*
get
(
wl_resource
*
native
);
Q_SIGNALS:
void
aboutToBeDestroyed
();
void
physicalSizeChanged
(
const
QSize
&
);
void
globalPositionChanged
(
const
QPoint
&
);
void
manufacturerChanged
(
const
QString
&
);
...
...
@@ -154,11 +154,10 @@ Q_SIGNALS:
void
bound
(
ClientConnection
*
client
,
wl_resource
*
boundResource
);
private:
class
Private
;
Private
*
d_func
()
const
;
QScopedPointer
<
OutputInterfacePrivate
>
d
;
};
}
}
// namespace KWaylandServer
Q_DECLARE_OPERATORS_FOR_FLAGS
(
KWaylandServer
::
OutputInterface
::
ModeFlags
)
Q_DECLARE_METATYPE
(
KWaylandServer
::
OutputInterface
::
SubPixel
)
...
...
src/server/surface_interface.cpp
View file @
589e339d
...
...
@@ -835,7 +835,7 @@ void SurfaceInterface::setOutputs(const QVector<OutputInterface *> &outputs)
for
(
wl_resource
*
outputResource
:
resources
)
{
d
->
send_enter
(
outputResource
);
}
d
->
outputDestroyedConnections
[
o
]
=
connect
(
o
,
&
Global
::
aboutToDestroy
Global
,
this
,
[
this
,
o
]
{
d
->
outputDestroyedConnections
[
o
]
=
connect
(
o
,
&
OutputInterface
::
aboutTo
Be
Destroy
ed
,
this
,
[
this
,
o
]
{
auto
outputs
=
d
->
outputs
;
if
(
outputs
.
removeOne
(
o
))
{
setOutputs
(
outputs
);
...
...
tests/renderingservertest.cpp
View file @
589e339d
...
...
@@ -251,7 +251,6 @@ int main(int argc, char **argv)
output
->
setPhysicalSize
(
QSize
(
269
,
202
));
const
QSize
windowSize
(
1024
,
768
);
output
->
addMode
(
windowSize
);
output
->
create
();
SeatInterface
*
seat
=
new
SeatInterface
(
&
display
);
seat
->
setHasKeyboard
(
true
);
seat
->
setHasPointer
(
true
);
...
...
tests/waylandservertest.cpp
View file @
589e339d
...
...
@@ -80,7 +80,6 @@ int main(int argc, char **argv)
OutputInterface
*
output
=
new
OutputInterface
(
&
display
,
&
display
);
output
->
setPhysicalSize
(
QSize
(
10
,
10
));
output
->
addMode
(
QSize
(
1024
,
768
));
output
->
create
();
// starts XWayland by forking and opening a pipe
const
int
pipe
=
startXServer
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment