summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@theqtcompany.com>2016-03-11 11:59:19 +0100
committerJohan Helsing <johan.helsing@theqtcompany.com>2016-03-15 13:30:57 +0000
commit759822f33f56acb3e2bacf19c6431ea4fa2be229 (patch)
tree7fe0dd72ea266992ee07a586edadebdfc19abeab /src
parent19260d9846861212881e374229798b3863d1a78d (diff)
Fix client xdg_surface not handling all states from configure event
The code used sizeof(state) when it should have been sizeof(*state). Change-Id: Id1714a5e90e6c58850023424726de26719a69046 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandxdgsurface.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp
index c89e230db..202ac50bb 100644
--- a/src/client/qwaylandxdgsurface.cpp
+++ b/src/client/qwaylandxdgsurface.cpp
@@ -173,15 +173,13 @@ void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value
void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial)
{
- uint32_t *state = 0;
+ uint32_t *state = reinterpret_cast<uint32_t*>(states->data);
+ size_t numStates = states->size / sizeof(uint32_t);
bool aboutToMaximize = false;
bool aboutToFullScreen = false;
- state = (uint32_t*) states->data;
-
- for (uint32_t i = 0; i < states->size / sizeof(state) ; i++)
- {
- switch (*(state+i)) {
+ for (size_t i = 0; i < numStates; i++) {
+ switch (state[i]) {
case XDG_SURFACE_STATE_MAXIMIZED:
aboutToMaximize = ((width > 0) && (height > 0));
break;