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
a92b465f
Commit
a92b465f
authored
Jan 06, 2021
by
Jan Blackquill
🌈
Browse files
Implement xdgshell v3
parent
26b24906
Changes
3
Hide whitespace changes
Inline
Side-by-side
autotests/integration/xdgshellclient_test.cpp
View file @
a92b465f
...
...
@@ -99,11 +99,72 @@ private Q_SLOTS:
void
testXdgWindowGeometryInteractiveResize
();
void
testXdgWindowGeometryFullScreen
();
void
testXdgWindowGeometryMaximize
();
void
testXdgWindowReactive
();
void
testXdgWindowRepositioning
();
void
testPointerInputTransform
();
void
testReentrantSetFrameGeometry
();
void
testDoubleMaximize
();
};
void
TestXdgShellClient
::
testXdgWindowReactive
()
{
QScopedPointer
<
Test
::
XdgPositioner
>
positioner
(
Test
::
createXdgPositioner
());
positioner
->
set_size
(
10
,
10
);
positioner
->
set_anchor_rect
(
10
,
10
,
10
,
10
);
positioner
->
set_reactive
();
QScopedPointer
<
Surface
>
rootSurface
(
Test
::
createSurface
());
QScopedPointer
<
Surface
>
childSurface
(
Test
::
createSurface
());
QScopedPointer
<
Test
::
XdgToplevel
>
root
(
Test
::
createXdgToplevelSurface
(
rootSurface
.
data
()));
QScopedPointer
<
Test
::
XdgPopup
>
popup
(
Test
::
createXdgPopupSurface
(
childSurface
.
data
(),
root
->
xdgSurface
(),
positioner
.
data
()));
auto
rootClient
=
Test
::
renderAndWaitForShown
(
rootSurface
.
data
(),
QSize
(
100
,
100
),
Qt
::
cyan
);
auto
childClient
=
Test
::
renderAndWaitForShown
(
childSurface
.
data
(),
QSize
(
10
,
10
),
Qt
::
cyan
);
QVERIFY
(
rootClient
);
QVERIFY
(
childClient
);
QSignalSpy
frameGeometryChangedSpy
(
childClient
,
&
AbstractClient
::
frameGeometryChanged
);
QVERIFY
(
frameGeometryChangedSpy
.
isValid
());
rootClient
->
move
(
rootClient
->
x
()
+
20
,
rootClient
->
y
()
+
20
);
QVERIFY
(
frameGeometryChangedSpy
.
wait
());
QCOMPARE
(
frameGeometryChangedSpy
.
count
(),
1
);
}
void
TestXdgShellClient
::
testXdgWindowRepositioning
()
{
QScopedPointer
<
Test
::
XdgPositioner
>
positioner
(
Test
::
createXdgPositioner
());
positioner
->
set_size
(
10
,
10
);
positioner
->
set_anchor_rect
(
10
,
10
,
10
,
10
);
QScopedPointer
<
Test
::
XdgPositioner
>
otherPositioner
(
Test
::
createXdgPositioner
());
otherPositioner
->
set_size
(
50
,
50
);
otherPositioner
->
set_anchor_rect
(
10
,
10
,
10
,
10
);
QScopedPointer
<
Surface
>
rootSurface
(
Test
::
createSurface
());
QScopedPointer
<
Surface
>
childSurface
(
Test
::
createSurface
());
QScopedPointer
<
Test
::
XdgToplevel
>
root
(
Test
::
createXdgToplevelSurface
(
rootSurface
.
data
()));
QScopedPointer
<
Test
::
XdgPopup
>
popup
(
Test
::
createXdgPopupSurface
(
childSurface
.
data
(),
root
->
xdgSurface
(),
positioner
.
data
()));
auto
rootClient
=
Test
::
renderAndWaitForShown
(
rootSurface
.
data
(),
QSize
(
100
,
100
),
Qt
::
cyan
);
auto
childClient
=
Test
::
renderAndWaitForShown
(
childSurface
.
data
(),
QSize
(
10
,
10
),
Qt
::
cyan
);
QVERIFY
(
rootClient
);
QVERIFY
(
childClient
);
QSignalSpy
reconfigureSpy
(
popup
.
data
(),
&
Test
::
XdgPopup
::
configureRequested
);
QVERIFY
(
reconfigureSpy
.
isValid
());
popup
->
reposition
(
otherPositioner
->
object
(),
500000
);
QVERIFY
(
reconfigureSpy
.
wait
());
QCOMPARE
(
reconfigureSpy
.
count
(),
1
);
}
void
TestXdgShellClient
::
initTestCase
()
{
qRegisterMetaType
<
KWin
::
Deleted
*>
();
...
...
xdgshellclient.cpp
View file @
a92b465f
...
...
@@ -1705,10 +1705,37 @@ XdgPopupClient::XdgPopupClient(XdgPopupInterface *shellSurface)
this
,
&
XdgPopupClient
::
handleGrabRequested
);
connect
(
shellSurface
,
&
XdgPopupInterface
::
initializeRequested
,
this
,
&
XdgPopupClient
::
initialize
);
connect
(
shellSurface
,
&
XdgPopupInterface
::
repositionRequested
,
this
,
&
XdgPopupClient
::
handleRepositionRequested
);
connect
(
shellSurface
,
&
XdgPopupInterface
::
destroyed
,
this
,
&
XdgPopupClient
::
destroyClient
);
}
void
XdgPopupClient
::
handlePositionerBindings
()
{
if
(
m_shellSurface
->
positioner
().
isReactive
())
{
connect
(
transientFor
(),
&
AbstractClient
::
frameGeometryChanged
,
this
,
&
XdgPopupClient
::
relayout
,
Qt
::
UniqueConnection
);
}
else
{
disconnect
(
transientFor
(),
&
AbstractClient
::
frameGeometryChanged
,
this
,
&
XdgPopupClient
::
relayout
);
}
}
void
XdgPopupClient
::
handleRepositionRequested
(
quint32
token
)
{
handlePositionerBindings
();
m_shellSurface
->
sendRepositioned
(
token
);
relayout
();
}
void
XdgPopupClient
::
relayout
()
{
GeometryUpdatesBlocker
blocker
(
this
);
Placement
::
self
()
->
place
(
this
,
QRect
());
scheduleConfigure
(
ConfigureRequired
);
}
XdgPopupClient
::~
XdgPopupClient
()
{
}
...
...
xdgshellclient.h
View file @
a92b465f
...
...
@@ -249,7 +249,10 @@ protected:
private:
void
handleGrabRequested
(
KWaylandServer
::
SeatInterface
*
seat
,
quint32
serial
);
void
handlePositionerBindings
();
void
handleRepositionRequested
(
quint32
token
);
void
initialize
();
void
relayout
();
KWaylandServer
::
XdgPopupInterface
*
m_shellSurface
;
bool
m_haveExplicitGrab
=
false
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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