1 From c4219cca0febd7119e0bec776fdc2877b3448e0b Mon Sep 17 00:00:00 2001
2 From: Philippe Coval <philippe.coval@open.eurogiciel.org>
3 Date: Tue, 10 Jun 2014 16:22:17 +0200
4 Subject: [PATCH 19/21] xdg-shell: upgrade to support current version
7 The protocol file is a raw copy of
9 Source: http://cgit.freedesktop.org/wayland/weston/plain/protocol/xdg-shell.xml?id=1.5.0
11 Task-number: QTBUG-38633/related
12 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
13 Reviewed-by: Philippe Coval <rzr@gna.org>
14 Origin: https://www.qt.gitorious.org/qt/qtwayland/commit/4bac130b97fbaa565aa9883eb302557ef0185d50
15 Change-Id: I41ca2f89c09a8b6348ce2fbf6d59f44b4c81ffff
17 src/3rdparty/protocol/xdg-shell.xml | 288 ++++++++++++++++++------------------
18 src/client/client.pro | 2 +
19 src/client/qwaylanddisplay.cpp | 10 +-
20 src/client/qwaylanddisplay_p.h | 5 +-
21 src/client/qwaylandxdgshell.cpp | 77 ++++++++++
22 src/client/qwaylandxdgshell_p.h | 73 +++++++++
23 src/client/qwaylandxdgsurface.cpp | 60 ++++++--
24 src/client/qwaylandxdgsurface_p.h | 11 +-
25 8 files changed, 364 insertions(+), 162 deletions(-)
26 create mode 100644 src/client/qwaylandxdgshell.cpp
27 create mode 100644 src/client/qwaylandxdgshell_p.h
29 diff --git a/src/3rdparty/protocol/xdg-shell.xml b/src/3rdparty/protocol/xdg-shell.xml
30 index 4e5cff8..79a2831 100644
31 --- a/src/3rdparty/protocol/xdg-shell.xml
32 +++ b/src/3rdparty/protocol/xdg-shell.xml
36 <description summary="latest protocol version">
37 - Use this enum to check the protocol version, and it will be updated
39 + The 'current' member of this enum gives the version of the
40 + protocol. Implementations can compare this to the version
41 + they implement using static_assert to ensure the protocol and
42 + implementation versions match.
44 - <entry name="current" value="1" summary="Always the latest version"/>
45 + <entry name="current" value="3" summary="Always the latest version"/>
49 <request name="use_unstable_version">
50 <description summary="enable use of this unstable version">
51 - Use this request in order to enable use of this interface.
53 - Understand and agree that one is using an unstable interface,
54 - that will likely change in the future, breaking the API.
55 + Negotiate the unstable version of the interface. This
56 + mechanism is in place to ensure client and server agree on the
57 + unstable versions of the protocol that they speak or exit
58 + cleanly if they don't agree. This request will go away once
59 + the xdg-shell protocol is stable.
61 <arg name="version" type="int"/>
64 <arg name="y" type="int"/>
65 <arg name="flags" type="uint"/>
69 + <description summary="check if the client is alive">
70 + The ping event asks the client if it's still alive. Pass the
71 + serial specified in the event back to the compositor by sending
72 + a "pong" request back with the specified serial.
74 + Compositors can use this to determine if the client is still
75 + alive. It's unspecified what will happen if the client doesn't
76 + respond to the ping request, or in what timeframe. Clients should
77 + try to respond in a reasonable amount of time.
79 + <arg name="serial" type="uint" summary="pass this to the callback"/>
82 + <request name="pong">
83 + <description summary="respond to a ping event">
84 + A client must respond to a ping event with a pong request or
85 + the client may be deemed unresponsive.
87 + <arg name="serial" type="uint" summary="serial of the ping event"/>
91 <interface name="xdg_surface" version="1">
93 <arg name="parent" type="object" interface="wl_surface" allow-null="true"/>
96 + <request name="set_margin">
97 + <description summary="set the visible frame boundaries">
98 + This tells the compositor what the visible size of the window
99 + should be, so it can use it to determine what borders to use for
100 + constrainment and alignment.
102 + CSD often has invisible areas for decoration purposes, like drop
103 + shadows. These "shadow" drawings need to be subtracted out of the
104 + normal boundaries of the window when computing where to place
105 + windows (e.g. to set this window so it's centered on top of another,
106 + or to put it to the left or right of the screen.)
108 + This value should change as little as possible at runtime, to
111 + This value is also ignored when the window is maximized or
112 + fullscreen, and assumed to be 0.
114 + If never called, this value is assumed to be 0.
116 + <arg name="left_margin" type="int"/>
117 + <arg name="right_margin" type="int"/>
118 + <arg name="top_margin" type="int"/>
119 + <arg name="bottom_margin" type="int"/>
122 <request name="set_title">
123 <description summary="set surface title">
124 Set a short title for the surface.
126 <arg name="app_id" type="string"/>
129 - <request name="pong">
130 - <description summary="respond to a ping event">
131 - A client must respond to a ping event with a pong request or
132 - the client may be deemed unresponsive.
134 - <arg name="serial" type="uint" summary="serial of the ping event"/>
137 - <event name="ping">
138 - <description summary="ping client">
139 - Ping a client to check if it is receiving events and sending
140 - requests. A client is expected to reply with a pong request.
142 - <arg name="serial" type="uint"/>
145 <request name="move">
146 <description summary="start an interactive move">
147 Start a pointer-driven move of the surface.
149 ignore it if it doesn't resize, pick a smaller size (to
150 satisfy aspect ratio or resize in steps of NxM pixels).
152 - The edges parameter provides a hint about how the surface
153 - was resized. The client may use this information to decide
154 - how to adjust its content to the new size (e.g. a scrolling
155 - area might adjust its content position to leave the viewable
156 - content unmoved). Valid edge values are from resize_edge enum.
158 The client is free to dismiss all but the last configure
162 in surface local coordinates.
165 - <arg name="edges" type="uint"/>
166 <arg name="width" type="int"/>
167 <arg name="height" type="int"/>
169 @@ -250,128 +278,122 @@
170 <arg name="output" type="object" interface="wl_output" allow-null="true"/>
173 - <event name="request_set_fullscreen">
174 - <description summary="server requests that the client set fullscreen">
175 - Event sent from the compositor to the client requesting that the client
176 - goes to a fullscreen state. It's the client job to call set_fullscreen
177 - and really trigger the fullscreen state.
181 - <event name="request_unset_fullscreen">
182 - <description summary="server requests that the client unset fullscreen">
183 - Event sent from the compositor to the client requesting that the client
184 - leaves the fullscreen state. It's the client job to call
185 - unset_fullscreen and really leave the fullscreen state.
188 + <enum name="state">
189 + <description summary="types of state on the surface">
190 + The different state values used on the surface. This is designed for
191 + state values like maximized, fullscreen. It is paired with the
192 + request_change_state event to ensure that both the client and the
193 + compositor setting the state can be synchronized.
195 - <request name="set_fullscreen">
196 - <description summary="set the surface state as fullscreen">
197 - Set the surface as fullscreen.
198 + States set in this way are double-buffered. They will get applied on
201 - After this request, the compositor should send a configure event
202 - informing the output size.
203 + Desktop environments may extend this enum by taking up a range of
204 + values and documenting the range they chose in this description.
205 + They are not required to document the values for the range that they
206 + chose. Ideally, any good extensions from a desktop environment should
207 + make its way into standardization into this enum.
209 - This request informs the compositor that the next attached buffer
210 - committed will be in a fullscreen state. The buffer size should be the
211 - same size as the size informed in the configure event, if the client
212 - doesn't want to leave any empty area.
213 + The current reserved ranges are:
215 - In other words: the next attached buffer after set_maximized is the new
216 - maximized buffer. And the surface will be positioned at the maximized
217 - position on commit.
219 - A simple way to synchronize and wait for the correct configure event is
220 - to use a wl_display.sync request right after the set_fullscreen
221 - request. When the sync callback returns, the last configure event
222 - received just before it will be the correct one, and should contain the
223 - right size for the surface to maximize.
225 - Setting one state won't unset another state. Use
226 - xdg_surface.unset_fullscreen for unsetting it.
227 + 0x0000 - 0x0FFF: xdg-shell core values, documented below.
228 + 0x1000 - 0x1FFF: GNOME
231 + <entry name="maximized" value="1" summary="the surface is maximized">
232 + A non-zero value indicates the surface is maximized. Otherwise,
233 + the surface is unmaximized.
235 + <entry name="fullscreen" value="2" summary="the surface is fullscreen">
236 + A non-zero value indicates the surface is fullscreen. Otherwise,
237 + the surface is not fullscreen.
241 - <request name="unset_fullscreen">
242 - <description summary="unset the surface state as fullscreen">
243 - Unset the surface fullscreen state.
244 + <request name="request_change_state">
245 + <description summary="client requests to change a surface's state">
246 + This asks the compositor to change the state. If the compositor wants
247 + to change the state, it will send a change_state event with the same
248 + state_type, value, and serial, and the event flow continues as if it
249 + it was initiated by the compositor.
251 - Same negotiation as set_fullscreen must be used.
252 + If the compositor does not want to change the state, it will send a
253 + change_state to the client with the old value of the state.
255 + <arg name="state_type" type="uint" summary="the state to set"/>
256 + <arg name="value" type="uint" summary="the value to change the state to"/>
257 + <arg name="serial" type="uint" summary="an event serial">
258 + This serial is so the client can know which change_state event corresponds
259 + to which request_change_state request it sent out.
263 - <event name="request_set_maximized">
264 - <description summary="server requests that the client set maximized">
265 - Event sent from the compositor to the client requesting that the client
266 - goes to a maximized state. It's the client job to call set_maximized
267 - and really trigger the maximized state.
268 + <event name="change_state">
269 + <description summary="compositor wants to change a surface's state">
270 + This event tells the client to change a surface's state. The client
271 + should respond with an ack_change_state request to the compositor to
272 + guarantee that the compositor knows that the client has seen it.
276 - <event name="request_unset_maximized">
277 - <description summary="server requests that the client unset maximized">
278 - Event sent from the compositor to the client requesting that the client
279 - leaves the maximized state. It's the client job to call unset_maximized
280 - and really leave the maximized state.
282 + <arg name="state_type" type="uint" summary="the state to set"/>
283 + <arg name="value" type="uint" summary="the value to change the state to"/>
284 + <arg name="serial" type="uint" summary="a serial for the compositor's own tracking"/>
287 - <request name="set_maximized">
288 - <description summary="set the surface state as maximized">
289 - Set the surface as maximized.
291 - After this request, the compositor will send a configure event
292 - informing the output size minus panel and other MW decorations.
294 - This request informs the compositor that the next attached buffer
295 - committed will be in a maximized state. The buffer size should be the
296 - same size as the size informed in the configure event, if the client
297 - doesn't want to leave any empty area.
298 + <request name="ack_change_state">
299 + <description summary="ack a change_state event">
300 + When a change_state event is received, a client should then ack it
301 + using the ack_change_state request to ensure that the compositor
302 + knows the client has seen the event.
304 - In other words: the next attached buffer after set_maximized is the new
305 - maximized buffer. And the surface will be positioned at the maximized
306 - position on commit.
307 + By this point, the state is confirmed, and the next attach should
308 + contain the buffer drawn for the new state value.
310 - A simple way to synchronize and wait for the correct configure event is
311 - to use a wl_display.sync request right after the set_maximized request.
312 - When the sync callback returns, the last configure event received just
313 - before it will be the correct one, and should contain the right size
314 - for the surface to maximize.
316 - Setting one state won't unset another state. Use
317 - xdg_surface.unset_maximized for unsetting it.
318 + The values here need to be the same as the values in the cooresponding
319 + change_state event.
321 + <arg name="state_type" type="uint" summary="the state to set"/>
322 + <arg name="value" type="uint" summary="the value to change the state to"/>
323 + <arg name="serial" type="uint" summary="a serial to pass to change_state"/>
326 - <request name="unset_maximized">
327 - <description summary="unset the surface state as maximized">
328 - Unset the surface maximized state.
330 - Same negotiation as set_maximized must be used.
331 + <request name="set_minimized">
332 + <description summary="minimize the surface">
333 + Minimize the surface.
337 - <request name="set_minimized">
338 - <description summary="set the surface state as minimized">
339 - Set the surface minimized state.
341 - Setting one state won't unset another state.
342 + <event name="activated">
343 + <description summary="surface was activated">
344 + The activated_set event is sent when this surface has been
345 + activated, which means that the surface has user attention.
346 + Window decorations should be updated accordingly. You should
347 + not use this event for anything but the style of decorations
348 + you display, use wl_keyboard.enter and wl_keyboard.leave for
349 + determining keyboard focus.
354 - <event name="focused_set">
355 - <description summary="surface was focused">
356 - The focused_set event is sent when this surface has been
357 - activated. Window decorations should be updated accordingly.
358 + <event name="deactivated">
359 + <description summary="surface was deactivated">
360 + The deactivate event is sent when this surface has been
361 + deactivated, which means that the surface lost user attention.
362 + Window decorations should be updated accordingly. You should
363 + not use this event for anything but the style of decorations
364 + you display, use wl_keyboard.enter and wl_keyboard.leave for
365 + determining keyboard focus.
369 - <event name="focused_unset">
370 - <description summary="surface was unfocused">
371 - The focused_unset event is sent when this surface has been
372 - deactivated, because another surface has been activated. Window
373 - decorations should be updated accordingly.
374 + <event name="close">
375 + <description summary="surface wants to be closed">
376 + The close event is sent by the compositor when the user
377 + wants the surface to be closed. This should be equivalent to
378 + the user clicking the close button in client-side decorations,
379 + if your application has any...
381 + This is only a request that the user intends to close your
382 + window. The client may choose to ignore this request, or show
383 + a dialog to ask the user to save their data...
391 - <request name="pong">
392 - <description summary="respond to a ping event">
393 - A client must respond to a ping event with a pong request or
394 - the client may be deemed unresponsive.
396 - <arg name="serial" type="uint" summary="serial of the ping event"/>
399 - <event name="ping">
400 - <description summary="ping client">
401 - Ping a client to check if it is receiving events and sending
402 - requests. A client is expected to reply with a pong request.
404 - <arg name="serial" type="uint"/>
407 <event name="popup_done">
408 <description summary="popup interaction is done">
409 The popup_done event is sent out when a popup grab is broken,
410 diff --git a/src/client/client.pro b/src/client/client.pro
411 index 9ecf82f..73e3b7f 100644
412 --- a/src/client/client.pro
413 +++ b/src/client/client.pro
414 @@ -59,6 +59,7 @@ SOURCES += qwaylandintegration.cpp \
415 qwaylanddatasource.cpp \
416 qwaylandshellsurface.cpp \
417 qwaylandwlshellsurface.cpp \
418 + qwaylandxdgshell.cpp \
419 qwaylandxdgsurface.cpp \
420 qwaylandextendedoutput.cpp \
421 qwaylandextendedsurface.cpp \
422 @@ -89,6 +90,7 @@ HEADERS += qwaylandintegration_p.h \
423 qwaylanddatasource_p.h \
424 qwaylandshellsurface_p.h \
425 qwaylandwlshellsurface_p.h \
426 + qwaylandxdgshell_p.h \
427 qwaylandxdgsurface_p.h \
428 qwaylandextendedoutput_p.h \
429 qwaylandextendedsurface_p.h \
430 diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
431 index 7f953ad..2e25672 100644
432 --- a/src/client/qwaylanddisplay.cpp
433 +++ b/src/client/qwaylanddisplay.cpp
435 #include "qwaylandclipboard_p.h"
436 #include "qwaylanddatadevicemanager_p.h"
437 #include "qwaylandhardwareintegration_p.h"
439 +#include "qwaylandxdgshell_p.h"
441 #include "qwaylandwindowmanagerintegration_p.h"
443 @@ -209,8 +209,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
444 mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
445 } else if (interface == QStringLiteral("xdg_shell")
446 && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) {
447 - mShellXdg.reset(new QtWayland::xdg_shell(registry, id));
448 - mShellXdg->use_unstable_version(QtWayland::xdg_shell::version_current);
449 + mShellXdg.reset(new QWaylandXdgShell(registry,id));
450 } else if (interface == QStringLiteral("wl_shell")){
451 mShell.reset(new QtWayland::wl_shell(registry, id));
452 } else if (interface == QStringLiteral("wl_seat")) {
453 @@ -275,4 +274,9 @@ void QWaylandDisplay::forceRoundTrip()
454 wl_display_roundtrip(mDisplay);
457 +QtWayland::xdg_shell *QWaylandDisplay::shellXdg()
459 + return mShellXdg.data();
463 diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
464 index cf5dfc2..f1b35a7 100644
465 --- a/src/client/qwaylanddisplay_p.h
466 +++ b/src/client/qwaylanddisplay_p.h
467 @@ -72,6 +72,7 @@ class QWaylandWindow;
468 class QWaylandEventThread;
469 class QWaylandIntegration;
470 class QWaylandHardwareIntegration;
471 +class QWaylandXdgShell;
473 namespace QtWayland {
474 class qt_output_extension;
475 @@ -115,7 +116,7 @@ public:
476 QtWayland::wl_compositor *compositor() { return &mCompositor; }
478 QtWayland::wl_shell *shell() { return mShell.data(); }
479 - QtWayland::xdg_shell *shellXdg() { return mShellXdg.data(); }
480 + QtWayland::xdg_shell *shellXdg();
482 QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
483 QWaylandInputDevice *defaultInputDevice() const;
484 @@ -171,7 +172,7 @@ private:
485 QThread *mEventThread;
486 QWaylandEventThread *mEventThreadObject;
487 QScopedPointer<QtWayland::wl_shell> mShell;
488 - QScopedPointer<QtWayland::xdg_shell> mShellXdg;
489 + QScopedPointer<QWaylandXdgShell> mShellXdg;
490 QList<QPlatformScreen *> mScreens;
491 QList<QWaylandInputDevice *> mInputDevices;
492 QList<Listener> mRegistryListeners;
493 diff --git a/src/client/qwaylandxdgshell.cpp b/src/client/qwaylandxdgshell.cpp
495 index 0000000..eb9f91c
497 +++ b/src/client/qwaylandxdgshell.cpp
499 +/****************************************************************************
501 +** Copyright (C) 2014 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
502 +** Contact: http://www.qt-project.org/legal
504 +** This file is part of the config.tests of the Qt Toolkit.
506 +** $QT_BEGIN_LICENSE:LGPL$
507 +** Commercial License Usage
508 +** Licensees holding valid commercial Qt licenses may use this file in
509 +** accordance with the commercial license agreement provided with the
510 +** Software or, alternatively, in accordance with the terms contained in
511 +** a written agreement between you and Digia. For licensing terms and
512 +** conditions see http://qt.digia.com/licensing. For further information
513 +** use the contact form at http://qt.digia.com/contact-us.
515 +** GNU Lesser General Public License Usage
516 +** Alternatively, this file may be used under the terms of the GNU Lesser
517 +** General Public License version 2.1 as published by the Free Software
518 +** Foundation and appearing in the file LICENSE.LGPL included in the
519 +** packaging of this file. Please review the following information to
520 +** ensure the GNU Lesser General Public License version 2.1 requirements
521 +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
523 +** In addition, as a special exception, Digia gives you certain additional
524 +** rights. These rights are described in the Digia Qt LGPL Exception
525 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
527 +** GNU General Public License Usage
528 +** Alternatively, this file may be used under the terms of the GNU
529 +** General Public License version 3.0 as published by the Free Software
530 +** Foundation and appearing in the file LICENSE.GPL included in the
531 +** packaging of this file. Please review the following information to
532 +** ensure the GNU General Public License version 3.0 requirements will be
533 +** met: http://www.gnu.org/copyleft/gpl.html.
538 +****************************************************************************/
540 +#include "qwaylandxdgshell_p.h"
542 +#include "qwaylanddisplay_p.h"
543 +#include "qwaylandwindow_p.h"
544 +#include "qwaylandinputdevice_p.h"
545 +#include "qwaylanddecoration_p.h"
546 +#include "qwaylandscreen_p.h"
548 +#include <QtCore/QDebug>
552 +QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell)
553 + : QtWayland::xdg_shell(shell)
557 +QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id)
558 + : QtWayland::xdg_shell(registry, id)
560 + use_unstable_version(QtWayland::xdg_shell::version_current);
563 +QWaylandXdgShell::~QWaylandXdgShell()
565 + xdg_shell_destroy(object());
569 +void QWaylandXdgShell::xdg_shell_ping(uint32_t serial)
576 diff --git a/src/client/qwaylandxdgshell_p.h b/src/client/qwaylandxdgshell_p.h
578 index 0000000..6a396bd
580 +++ b/src/client/qwaylandxdgshell_p.h
582 +/****************************************************************************
584 +** Copyright (C) 2014 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
585 +** Contact: http://www.qt-project.org/legal
587 +** This file is part of the config.tests of the Qt Toolkit.
589 +** $QT_BEGIN_LICENSE:LGPL$
590 +** Commercial License Usage
591 +** Licensees holding valid commercial Qt licenses may use this file in
592 +** accordance with the commercial license agreement provided with the
593 +** Software or, alternatively, in accordance with the terms contained in
594 +** a written agreement between you and Digia. For licensing terms and
595 +** conditions see http://qt.digia.com/licensing. For further information
596 +** use the contact form at http://qt.digia.com/contact-us.
598 +** GNU Lesser General Public License Usage
599 +** Alternatively, this file may be used under the terms of the GNU Lesser
600 +** General Public License version 2.1 as published by the Free Software
601 +** Foundation and appearing in the file LICENSE.LGPL included in the
602 +** packaging of this file. Please review the following information to
603 +** ensure the GNU Lesser General Public License version 2.1 requirements
604 +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
606 +** In addition, as a special exception, Digia gives you certain additional
607 +** rights. These rights are described in the Digia Qt LGPL Exception
608 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
610 +** GNU General Public License Usage
611 +** Alternatively, this file may be used under the terms of the GNU
612 +** General Public License version 3.0 as published by the Free Software
613 +** Foundation and appearing in the file LICENSE.GPL included in the
614 +** packaging of this file. Please review the following information to
615 +** ensure the GNU General Public License version 3.0 requirements will be
616 +** met: http://www.gnu.org/copyleft/gpl.html.
621 +****************************************************************************/
623 +#ifndef QWAYLANDXDGSHELL_H
624 +#define QWAYLANDXDGSHELL_H
626 +#include <QtCore/QSize>
628 +#include <wayland-client.h>
630 +#include <QtWaylandClient/private/qwayland-xdg-shell.h>
631 +#include <QtWaylandClient/private/qwaylandclientexport_p.h>
632 +#include "qwaylandshellsurface_p.h"
636 +class QWaylandWindow;
637 +class QWaylandInputDevice;
640 +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell
643 + QWaylandXdgShell(struct ::xdg_shell *shell);
644 + QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id);
646 + virtual ~QWaylandXdgShell();
649 + void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE;
654 +#endif // QWAYLANDXDGSHELL_H
655 diff --git a/src/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp
656 index 1b8affa..5fb74d2 100644
657 --- a/src/client/qwaylandxdgsurface.cpp
658 +++ b/src/client/qwaylandxdgsurface.cpp
659 @@ -87,23 +87,25 @@ void QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice)
661 void QWaylandXdgSurface::setMaximized()
663 - m_maximized = true;
664 - m_size = m_window->window()->geometry().size();
667 + request_change_state(XDG_SURFACE_STATE_MAXIMIZED, true, 0);
670 void QWaylandXdgSurface::setFullscreen()
672 - m_fullscreen = true;
673 - m_size = m_window->window()->geometry().size();
676 + request_change_state(XDG_SURFACE_STATE_FULLSCREEN, true, 0);
679 void QWaylandXdgSurface::setNormal()
681 if (m_fullscreen || m_maximized || m_minimized) {
682 - if (m_maximized) { unset_maximized(); }
683 - if (m_fullscreen) { unset_fullscreen(); }
685 + request_change_state(XDG_SURFACE_STATE_MAXIMIZED, false, 0);
687 + if (m_fullscreen) {
688 + request_change_state(XDG_SURFACE_STATE_FULLSCREEN, false, 0);
691 m_fullscreen = m_maximized = m_minimized = false;
693 @@ -158,16 +160,48 @@ void QWaylandXdgSurface::setAppId(const QString & appId)
694 return QtWayland::xdg_surface::set_app_id(appId);
697 -void QWaylandXdgSurface::xdg_surface_ping(uint32_t serial)
698 +void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height)
701 + m_window->configure(0 , width, height);
704 -void QWaylandXdgSurface::xdg_surface_configure(uint32_t edges, int32_t width,
706 +void QWaylandXdgSurface::xdg_surface_change_state(uint32_t state,
710 - m_window->configure(edges, width, height);
712 + if (state == XDG_SURFACE_STATE_MAXIMIZED
713 + || state == XDG_SURFACE_STATE_FULLSCREEN) {
715 + m_size = m_window->window()->geometry().size();
717 + QMargins m = m_window->frameMargins();
718 + m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom());
723 + case XDG_SURFACE_STATE_MAXIMIZED:
724 + m_maximized = value;
726 + case XDG_SURFACE_STATE_FULLSCREEN:
727 + m_fullscreen = value;
731 + xdg_surface_ack_change_state(object(), state, value, serial);
734 +void QWaylandXdgSurface::xdg_surface_activated()
738 +void QWaylandXdgSurface::xdg_surface_deactivated()
742 +void QWaylandXdgSurface::xdg_surface_close()
747 diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h
748 index 744d3f3..d2a154e 100644
749 --- a/src/client/qwaylandxdgsurface_p.h
750 +++ b/src/client/qwaylandxdgsurface_p.h
751 @@ -93,10 +93,15 @@ private:
755 - void xdg_surface_ping(uint32_t serial) Q_DECL_OVERRIDE;
756 - void xdg_surface_configure(uint32_t edges,
758 + void xdg_surface_configure(int32_t width,
759 int32_t height) Q_DECL_OVERRIDE;
760 + void xdg_surface_change_state(uint32_t state,
762 + uint32_t serial) Q_DECL_OVERRIDE;
763 + void xdg_surface_activated() Q_DECL_OVERRIDE;
764 + void xdg_surface_deactivated() Q_DECL_OVERRIDE;
765 + void xdg_surface_close() Q_DECL_OVERRIDE;
767 friend class QWaylandWindow;