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
21f8d7c2
Commit
21f8d7c2
authored
Dec 14, 2014
by
Martina Flöser
Committed by
Martin Flöser
Dec 15, 2014
Browse files
Implement ShellSurface::setMaximized
Client and Server part of setting a ShellSurface to maximized.
parent
5dcb3589
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/wayland/autotests/client/test_wayland_shell.cpp
View file @
21f8d7c2
...
...
@@ -45,6 +45,7 @@ private Q_SLOTS:
void
testCreateMultiple
();
void
testFullscreen
();
void
testMaximize
();
void
testPing
();
void
testTitle
();
void
testWindowClass
();
...
...
@@ -247,6 +248,46 @@ void TestWaylandShell::testFullscreen()
QVERIFY
(
!
fullscreenSpy
.
first
().
first
().
toBool
());
}
void
TestWaylandShell
::
testMaximize
()
{
using
namespace
KWayland
::
Server
;
QScopedPointer
<
KWayland
::
Client
::
Surface
>
s
(
m_compositor
->
createSurface
());
QVERIFY
(
!
s
.
isNull
());
QVERIFY
(
s
->
isValid
());
KWayland
::
Client
::
ShellSurface
*
surface
=
m_shell
->
createSurface
(
s
.
data
(),
m_shell
);
QSignalSpy
sizeSpy
(
surface
,
SIGNAL
(
sizeChanged
(
QSize
)));
QVERIFY
(
sizeSpy
.
isValid
());
QCOMPARE
(
surface
->
size
(),
QSize
());
QSignalSpy
serverSurfaceSpy
(
m_shellInterface
,
SIGNAL
(
surfaceCreated
(
KWayland
::
Server
::
ShellSurfaceInterface
*
)));
QVERIFY
(
serverSurfaceSpy
.
isValid
());
QVERIFY
(
serverSurfaceSpy
.
wait
());
ShellSurfaceInterface
*
serverSurface
=
serverSurfaceSpy
.
first
().
first
().
value
<
ShellSurfaceInterface
*>
();
QVERIFY
(
serverSurface
);
QVERIFY
(
serverSurface
->
parentResource
());
QSignalSpy
maximizedSpy
(
serverSurface
,
SIGNAL
(
maximizedChanged
(
bool
)));
QVERIFY
(
maximizedSpy
.
isValid
());
surface
->
setMaximized
();
QVERIFY
(
maximizedSpy
.
wait
());
QCOMPARE
(
maximizedSpy
.
count
(),
1
);
QVERIFY
(
maximizedSpy
.
first
().
first
().
toBool
());
serverSurface
->
requestSize
(
QSize
(
1024
,
768
));
QVERIFY
(
sizeSpy
.
wait
());
QCOMPARE
(
sizeSpy
.
count
(),
1
);
QCOMPARE
(
sizeSpy
.
first
().
first
().
toSize
(),
QSize
(
1024
,
768
));
QCOMPARE
(
surface
->
size
(),
QSize
(
1024
,
768
));
// set back to toplevel
maximizedSpy
.
clear
();
wl_shell_surface_set_toplevel
(
*
surface
);
QVERIFY
(
maximizedSpy
.
wait
());
QCOMPARE
(
maximizedSpy
.
count
(),
1
);
QVERIFY
(
!
maximizedSpy
.
first
().
first
().
toBool
());
}
void
TestWaylandShell
::
testPing
()
{
using
namespace
KWayland
::
Server
;
...
...
src/wayland/server/shell_interface.cpp
View file @
21f8d7c2
...
...
@@ -68,6 +68,7 @@ public:
Private
(
ShellSurfaceInterface
*
q
,
ShellInterface
*
shell
,
SurfaceInterface
*
surface
,
wl_resource
*
parentResource
);
void
setFullscreen
(
bool
fullscreen
);
void
setToplevel
(
bool
toplevel
);
void
setMaximized
(
bool
maximized
);
void
ping
();
SurfaceInterface
*
surface
;
...
...
@@ -77,6 +78,7 @@ public:
quint32
pingSerial
=
0
;
bool
fullscreen
=
false
;
bool
toplevel
=
false
;
bool
maximized
=
false
;
private:
// interface callbacks
...
...
@@ -188,6 +190,7 @@ ShellSurfaceInterface::ShellSurfaceInterface(ShellInterface *shell, SurfaceInter
}
Q_D
();
d
->
setToplevel
(
false
);
d
->
setMaximized
(
false
);
}
);
connect
(
this
,
&
ShellSurfaceInterface
::
toplevelChanged
,
this
,
...
...
@@ -197,6 +200,17 @@ ShellSurfaceInterface::ShellSurfaceInterface(ShellInterface *shell, SurfaceInter
}
Q_D
();
d
->
setFullscreen
(
false
);
d
->
setMaximized
(
false
);
}
);
connect
(
this
,
&
ShellSurfaceInterface
::
maximizedChanged
,
this
,
[
this
]
(
bool
maximized
)
{
if
(
!
maximized
)
{
return
;
}
Q_D
();
d
->
setFullscreen
(
false
);
d
->
setToplevel
(
false
);
}
);
}
...
...
@@ -345,7 +359,17 @@ void ShellSurfaceInterface::Private::setMaximizedCallback(wl_client *client, wl_
Q_UNUSED
(
output
)
auto
s
=
cast
<
Private
>
(
resource
);
Q_ASSERT
(
client
==
*
s
->
client
);
// TODO: implement
s
->
setMaximized
(
true
);
}
void
ShellSurfaceInterface
::
Private
::
setMaximized
(
bool
set
)
{
if
(
maximized
==
set
)
{
return
;
}
maximized
=
set
;
Q_Q
(
ShellSurfaceInterface
);
emit
q
->
maximizedChanged
(
maximized
);
}
void
ShellSurfaceInterface
::
Private
::
setTitleCallback
(
wl_client
*
client
,
wl_resource
*
resource
,
const
char
*
title
)
...
...
@@ -412,6 +436,11 @@ bool ShellSurfaceInterface::isToplevel() const {
return
d
->
toplevel
;
}
bool
ShellSurfaceInterface
::
isMaximized
()
const
{
Q_D
();
return
d
->
maximized
;
}
ShellSurfaceInterface
::
Private
*
ShellSurfaceInterface
::
d_func
()
const
{
return
reinterpret_cast
<
ShellSurfaceInterface
::
Private
*>
(
d
.
data
());
...
...
src/wayland/server/shell_interface.h
View file @
21f8d7c2
...
...
@@ -61,6 +61,7 @@ class KWAYLANDSERVER_EXPORT ShellSurfaceInterface : public Resource
Q_PROPERTY
(
QByteArray
windowClass
READ
windowClass
NOTIFY
windowClassChanged
)
Q_PROPERTY
(
bool
fullscreen
READ
isFullscreen
NOTIFY
fullscreenChanged
)
Q_PROPERTY
(
bool
toplevel
READ
isToplevel
NOTIFY
toplevelChanged
)
Q_PROPERTY
(
bool
maximized
READ
isMaximized
NOTIFY
maximizedChanged
)
public:
virtual
~
ShellSurfaceInterface
();
...
...
@@ -76,6 +77,7 @@ public:
QByteArray
windowClass
()
const
;
bool
isFullscreen
()
const
;
bool
isToplevel
()
const
;
bool
isMaximized
()
const
;
Q_SIGNALS:
void
titleChanged
(
const
QString
&
);
...
...
@@ -84,6 +86,7 @@ Q_SIGNALS:
void
pongReceived
();
void
fullscreenChanged
(
bool
);
void
toplevelChanged
(
bool
);
void
maximizedChanged
(
bool
);
private:
friend
class
ShellInterface
;
...
...
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