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
c5691ba4
Commit
c5691ba4
authored
Jul 20, 2021
by
Vlad Zahorodnii
Browse files
Make xdg-surface acknowledged configure serials double-buffered state
This will be needed to delay applying surface state.
parent
9210e25c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/wayland/autotests/client/test_xdg_shell.cpp
View file @
c5691ba4
...
...
@@ -544,6 +544,7 @@ void XdgShellTest::testConfigureStates()
QVERIFY
(
ackSpy
.
isValid
());
xdgSurface
->
ackConfigure
(
configureSpy
.
first
().
at
(
2
).
value
<
quint32
>
());
surface
->
commit
(
Surface
::
CommitFlag
::
None
);
QVERIFY
(
ackSpy
.
wait
());
QCOMPARE
(
ackSpy
.
count
(),
1
);
QCOMPARE
(
ackSpy
.
first
().
first
().
value
<
quint32
>
(),
configureSpy
.
first
().
at
(
2
).
value
<
quint32
>
());
...
...
@@ -590,6 +591,7 @@ void XdgShellTest::testConfigureMultipleAcks()
QCOMPARE
(
xdgSurface
->
size
(),
QSize
(
30
,
40
));
xdgSurface
->
ackConfigure
(
serial3
);
surface
->
commit
(
Surface
::
CommitFlag
::
None
);
QVERIFY
(
ackSpy
.
wait
());
QCOMPARE
(
ackSpy
.
count
(),
1
);
QCOMPARE
(
ackSpy
.
last
().
first
().
value
<
quint32
>
(),
serial3
);
...
...
src/wayland/xdgshell_interface.cpp
View file @
c5691ba4
...
...
@@ -151,17 +151,26 @@ XdgSurfaceInterfacePrivate::XdgSurfaceInterfacePrivate(XdgSurfaceInterface *xdgS
void
XdgSurfaceInterfacePrivate
::
commit
()
{
if
(
current
.
windowGeometry
!=
next
.
windowGeometry
)
{
if
(
next
.
acknowledgedConfigureIsSet
)
{
current
.
acknowledgedConfigure
=
next
.
acknowledgedConfigure
;
next
.
acknowledgedConfigureIsSet
=
false
;
Q_EMIT
q
->
configureAcknowledged
(
current
.
acknowledgedConfigure
);
}
if
(
next
.
windowGeometryIsSet
)
{
current
.
windowGeometry
=
next
.
windowGeometry
;
next
.
windowGeometryIsSet
=
false
;
Q_EMIT
q
->
windowGeometryChanged
(
current
.
windowGeometry
);
}
isMapped
=
surface
->
buffer
();
}
void
XdgSurfaceInterfacePrivate
::
reset
()
{
isConfigured
=
false
;
current
=
next
=
State
();
current
=
XdgSurfaceState
{};
next
=
XdgSurfaceState
{};
Q_EMIT
q
->
resetOccurred
();
}
...
...
@@ -253,12 +262,14 @@ void XdgSurfaceInterfacePrivate::xdg_surface_set_window_geometry(Resource *resou
}
next
.
windowGeometry
=
QRect
(
x
,
y
,
width
,
height
);
next
.
windowGeometryIsSet
=
true
;
}
void
XdgSurfaceInterfacePrivate
::
xdg_surface_ack_configure
(
Resource
*
resource
,
uint32_t
serial
)
{
Q_UNUSED
(
resource
)
Q_EMIT
q
->
configureAcknowledged
(
serial
);
next
.
acknowledgedConfigure
=
serial
;
next
.
acknowledgedConfigureIsSet
=
true
;
}
XdgSurfaceInterface
::
XdgSurfaceInterface
(
XdgShellInterface
*
shell
,
SurfaceInterface
*
surface
,
...
...
src/wayland/xdgshell_interface_p.h
View file @
c5691ba4
...
...
@@ -84,6 +84,14 @@ protected:
void
xdg_positioner_set_parent_configure
(
Resource
*
resource
,
uint32_t
serial
)
override
;
};
struct
XdgSurfaceState
{
QRect
windowGeometry
;
quint32
acknowledgedConfigure
;
bool
acknowledgedConfigureIsSet
:
1
=
false
;
bool
windowGeometryIsSet
:
1
=
false
;
};
class
XdgSurfaceInterfacePrivate
:
public
QtWaylandServer
::
xdg_surface
{
public:
...
...
@@ -100,13 +108,8 @@ public:
bool
isMapped
=
false
;
bool
isConfigured
=
false
;
struct
State
{
QRect
windowGeometry
;
};
State
next
;
State
current
;
XdgSurfaceState
next
;
XdgSurfaceState
current
;
static
XdgSurfaceInterfacePrivate
*
get
(
XdgSurfaceInterface
*
surface
);
...
...
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