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
85161bb6
Commit
85161bb6
authored
May 08, 2020
by
Vlad Zahorodnii
Browse files
xdg-shell: Reset xdg_toplevel and xdg_popup on unmap
parent
e3ad23cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/wayland/xdgshell_interface.cpp
View file @
85161bb6
...
...
@@ -16,8 +16,6 @@
namespace
KWaylandServer
{
// TODO: Reset the surface when it becomes unmapped.
XdgShellInterfacePrivate
::
XdgShellInterfacePrivate
(
XdgShellInterface
*
shell
)
:
q
(
shell
)
{
...
...
@@ -151,6 +149,14 @@ void XdgSurfaceInterfacePrivate::commit()
current
.
windowGeometry
=
next
.
windowGeometry
;
emit
q
->
windowGeometryChanged
(
current
.
windowGeometry
);
}
isMapped
=
surface
->
buffer
();
}
void
XdgSurfaceInterfacePrivate
::
reset
()
{
isConfigured
=
false
;
current
=
next
=
State
();
emit
q
->
resetOccurred
();
}
XdgSurfaceInterfacePrivate
*
XdgSurfaceInterfacePrivate
::
get
(
XdgSurfaceInterface
*
surface
)
...
...
@@ -307,6 +313,8 @@ void XdgToplevelInterfacePrivate::commit()
{
auto
xdgSurfacePrivate
=
XdgSurfaceInterfacePrivate
::
get
(
xdgSurface
);
bool
isResettable
=
xdgSurfacePrivate
->
isConfigured
&&
xdgSurfacePrivate
->
isMapped
;
if
(
xdgSurfacePrivate
->
isConfigured
)
{
xdgSurfacePrivate
->
commit
();
}
else
{
...
...
@@ -314,6 +322,11 @@ void XdgToplevelInterfacePrivate::commit()
return
;
}
if
(
isResettable
&&
!
xdgSurfacePrivate
->
isMapped
)
{
reset
();
return
;
}
if
(
current
.
minimumSize
!=
next
.
minimumSize
)
{
current
.
minimumSize
=
next
.
minimumSize
;
emit
q
->
minimumSizeChanged
(
current
.
minimumSize
);
...
...
@@ -324,6 +337,18 @@ void XdgToplevelInterfacePrivate::commit()
}
}
void
XdgToplevelInterfacePrivate
::
reset
()
{
auto
xdgSurfacePrivate
=
XdgSurfaceInterfacePrivate
::
get
(
xdgSurface
);
xdgSurfacePrivate
->
reset
();
windowTitle
=
QString
();
windowClass
=
QString
();
current
=
next
=
State
();
emit
q
->
resetOccurred
();
}
void
XdgToplevelInterfacePrivate
::
xdg_toplevel_destroy_resource
(
Resource
*
resource
)
{
Q_UNUSED
(
resource
)
...
...
@@ -600,11 +625,24 @@ void XdgPopupInterfacePrivate::commit()
{
auto
xdgSurfacePrivate
=
XdgSurfaceInterfacePrivate
::
get
(
xdgSurface
);
bool
isResettable
=
xdgSurfacePrivate
->
isConfigured
&&
xdgSurfacePrivate
->
isMapped
;
if
(
xdgSurfacePrivate
->
isConfigured
)
{
xdgSurfacePrivate
->
commit
();
}
else
{
emit
q
->
initializeRequested
();
return
;
}
if
(
isResettable
&&
!
xdgSurfacePrivate
->
isMapped
)
{
reset
();
}
}
void
XdgPopupInterfacePrivate
::
reset
()
{
auto
xdgSurfacePrivate
=
XdgSurfaceInterfacePrivate
::
get
(
xdgSurface
);
xdgSurfacePrivate
->
reset
();
}
void
XdgPopupInterfacePrivate
::
xdg_popup_destroy_resource
(
Resource
*
resource
)
...
...
src/wayland/xdgshell_interface.h
View file @
85161bb6
...
...
@@ -176,6 +176,11 @@ Q_SIGNALS:
*/
void
windowGeometryChanged
(
const
QRect
&
rect
);
/**
* This signal is emitted when the surface has been unmapped and its state has been reset.
*/
void
resetOccurred
();
private:
QScopedPointer
<
XdgSurfaceInterfacePrivate
>
d
;
friend
class
XdgSurfaceInterfacePrivate
;
...
...
@@ -283,6 +288,11 @@ Q_SIGNALS:
*/
void
initializeRequested
();
/**
* This signal is emitted when the toplevel has been unmapped and its state has been reset.
*/
void
resetOccurred
();
/**
* This signal is emitted when the toplevel's title has been changed.
*/
...
...
src/wayland/xdgshell_interface_p.h
View file @
85161bb6
...
...
@@ -82,12 +82,14 @@ public:
XdgSurfaceInterfacePrivate
(
XdgSurfaceInterface
*
xdgSurface
);
void
commit
();
void
reset
();
XdgSurfaceInterface
*
q
;
XdgShellInterface
*
shell
;
QPointer
<
XdgToplevelInterface
>
toplevel
;
QPointer
<
XdgPopupInterface
>
popup
;
QPointer
<
SurfaceInterface
>
surface
;
bool
isMapped
=
false
;
bool
isConfigured
=
false
;
struct
State
...
...
@@ -115,6 +117,7 @@ public:
XdgToplevelInterfacePrivate
(
XdgToplevelInterface
*
toplevel
,
XdgSurfaceInterface
*
surface
);
void
commit
()
override
;
void
reset
();
static
XdgToplevelInterfacePrivate
*
get
(
XdgToplevelInterface
*
toplevel
);
static
XdgToplevelInterfacePrivate
*
get
(
::
wl_resource
*
resource
);
...
...
@@ -160,6 +163,7 @@ public:
XdgPopupInterfacePrivate
(
XdgPopupInterface
*
popup
,
XdgSurfaceInterface
*
surface
);
void
commit
()
override
;
void
reset
();
XdgPopupInterface
*
q
;
XdgSurfaceInterface
*
parentXdgSurface
;
...
...
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