summaryrefslogtreecommitdiffstats
path: root/.gitmodules
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-03 14:44:32 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-03 14:44:32 -0500
commitd7ce859269d54441306f018440997fb8a115d60a (patch)
tree57907556bdec03282985da87a76f80b87f248019 /.gitmodules
parent26f5b1e5648c437e22cfcb7c87c22b40424ef198 (diff)
Compile with test coverage calculation.
Diffstat (limited to '.gitmodules')
0 files changed, 0 insertions, 0 deletions
120' href='#n120'>120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
From 0edba039247ce888dbb7ff0a93c7b9ec01bac46e Mon Sep 17 00:00:00 2001
From: Philippe Coval <philippe.coval@open.eurogiciel.org>
Date: Wed, 26 Mar 2014 10:16:01 +0100
Subject: [PATCH 17/21] xdg-shell: Add minimize feature to QWindow using
 wayland's xdg-shell

The feature is disabled by default,
and can be enabled at runtime
by exporting QT_WAYLAND_USE_XDG_SHELL env variable.

This patch relies on presence of protocol file
which has been imported from weston-1.4.0 sources,
until the xdg-shell is merge into wayland itself.

Because xdg-shell is experimental,
code fallback to WaylandShell if no XdgShell
but keep in mind those shells are exclusive.

Since xdg-shell and wayland-shell share most of the API,
some factorization is done by an (empty) abstraction class
to keep the code more readable.

Despite xdg-shell introduces new popups concept,
they're not used on this change for maitainance purpose.

Notes:

* This change depends on presence of xdg-shell protocol file.

* You can check a demo video
  (qt-tizen-cinematic-experience-20140430-rzr)
  of the test case at :
  https://www.youtube.com/watch?v=pY_XXvKc_0E#

* Use Super+Tab to show window again if hidden

Task-number: QTBUG-38633/part/2of2
Change-Id: I2d7ed85bea1847d82439fdfc893a3dbb2581ffff
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Origin: https://www.qt.gitorious.org/qt/qtwayland/commit/768484daaa64bea965bef981a16f59be8db0c190
Bug-Tizen: TIVI-3113/part
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
---
 src/client/client.pro                 |   5 +
 src/client/qwaylanddisplay.cpp        |   5 +
 src/client/qwaylanddisplay_p.h        |   4 +
 src/client/qwaylandshellsurface.cpp   | 134 ------------------------
 src/client/qwaylandshellsurface_p.h   |  40 +++-----
 src/client/qwaylandwindow.cpp         |  40 ++++++--
 src/client/qwaylandwlshellsurface.cpp | 186 ++++++++++++++++++++++++++++++++++
 src/client/qwaylandwlshellsurface_p.h | 101 ++++++++++++++++++
 src/client/qwaylandxdgsurface.cpp     | 173 +++++++++++++++++++++++++++++++
 src/client/qwaylandxdgsurface_p.h     | 105 +++++++++++++++++++
 10 files changed, 625 insertions(+), 168 deletions(-)
 create mode 100644 src/client/qwaylandwlshellsurface.cpp
 create mode 100644 src/client/qwaylandwlshellsurface_p.h
 create mode 100644 src/client/qwaylandxdgsurface.cpp
 create mode 100644 src/client/qwaylandxdgsurface_p.h

diff --git a/src/client/client.pro b/src/client/client.pro
index 10cbd31..9ecf82f 100644
--- a/src/client/client.pro
+++ b/src/client/client.pro
@@ -41,6 +41,7 @@ WAYLANDCLIENTSOURCES += \
             ../extensions/qtkey-extension.xml \
             ../extensions/windowmanager.xml \
             ../3rdparty/protocol/text.xml \
+            ../3rdparty/protocol/xdg-shell.xml \
 
 SOURCES +=  qwaylandintegration.cpp \
             qwaylandnativeinterface.cpp \
@@ -57,6 +58,8 @@ SOURCES +=  qwaylandintegration.cpp \
             qwaylanddatadevicemanager.cpp \
             qwaylanddatasource.cpp \
             qwaylandshellsurface.cpp \
+            qwaylandwlshellsurface.cpp \
+            qwaylandxdgsurface.cpp \
             qwaylandextendedoutput.cpp \
             qwaylandextendedsurface.cpp \
             qwaylandsubsurface.cpp \
@@ -85,6 +88,8 @@ HEADERS +=  qwaylandintegration_p.h \
             qwaylanddatadevicemanager_p.h \
             qwaylanddatasource_p.h \
             qwaylandshellsurface_p.h \
+            qwaylandwlshellsurface_p.h \
+            qwaylandxdgsurface_p.h \
             qwaylandextendedoutput_p.h \
             qwaylandextendedsurface_p.h \
             qwaylandsubsurface_p.h \
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 0b715c0..7f953ad 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -61,6 +61,7 @@
 #include "qwaylandqtkey_p.h"
 
 #include <QtWaylandClient/private/qwayland-text.h>
+#include <QtWaylandClient/private/qwayland-xdg-shell.h>
 
 #include <QtCore/QAbstractEventDispatcher>
 #include <QtGui/private/qguiapplication_p.h>
@@ -206,6 +207,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
         mCompositor.init(registry, id);
     } else if (interface == QStringLiteral("wl_shm")) {
         mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
+    } else if (interface == QStringLiteral("xdg_shell")
+               && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) {
+        mShellXdg.reset(new QtWayland::xdg_shell(registry, id));
+        mShellXdg->use_unstable_version(QtWayland::xdg_shell::version_current);
     } else if (interface == QStringLiteral("wl_shell")){
         mShell.reset(new QtWayland::wl_shell(registry, id));
     } else if (interface == QStringLiteral("wl_seat")) {
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 40cb2b2..cf5dfc2 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -51,6 +51,7 @@
 
 #include <QtWaylandClient/private/qwayland-wayland.h>
 #include <QtWaylandClient/private/qwaylandclientexport_p.h>
+#include <QtWaylandClient/private/qwayland-xdg-shell.h>
 
 struct wl_cursor_image;
 
@@ -78,6 +79,7 @@ namespace QtWayland {
     class qt_sub_surface_extension;
     class qt_surface_extension;
     class wl_text_input_manager;
+    class xdg_shell;
 }
 
 typedef void (*RegistryListener)(void *data,
@@ -113,6 +115,7 @@ public:
     QtWayland::wl_compositor *compositor() { return &mCompositor; }
 
     QtWayland::wl_shell *shell() { return mShell.data(); }
+    QtWayland::xdg_shell *shellXdg() { return mShellXdg.data(); }
 
     QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
     QWaylandInputDevice *defaultInputDevice() const;
@@ -168,6 +171,7 @@ private:
     QThread *mEventThread;
     QWaylandEventThread *mEventThreadObject;
     QScopedPointer<QtWayland::wl_shell> mShell;
+    QScopedPointer<QtWayland::xdg_shell> mShellXdg;
     QList<QPlatformScreen *> mScreens;
     QList<QWaylandInputDevice *> mInputDevices;
     QList<Listener> mRegistryListeners;
diff --git a/src/client/qwaylandshellsurface.cpp b/src/client/qwaylandshellsurface.cpp
index b7a819f..80e509b 100644
--- a/src/client/qwaylandshellsurface.cpp
+++ b/src/client/qwaylandshellsurface.cpp
@@ -40,137 +40,3 @@
 ****************************************************************************/
 
 #include "qwaylandshellsurface_p.h"
-
-#include "qwaylanddisplay_p.h"
-#include "qwaylandwindow_p.h"
-#include "qwaylandinputdevice_p.h"
-#include "qwaylanddecoration_p.h"
-#include "qwaylandscreen_p.h"
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-QWaylandShellSurface::QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window)
-    : QtWayland::wl_shell_surface(shell_surface)
-    , m_window(window)
-    , m_maximized(false)
-    , m_fullscreen(false)
-{
-}
-
-QWaylandShellSurface::~QWaylandShellSurface()
-{
-    wl_shell_surface_destroy(object());
-}
-
-void QWaylandShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges)
-{
-    resize(inputDevice->wl_seat(),
-           inputDevice->serial(),
-           edges);
-}
-
-void QWaylandShellSurface::move(QWaylandInputDevice *inputDevice)
-{
-    move(inputDevice->wl_seat(),
-         inputDevice->serial());
-}
-
-void QWaylandShellSurface::setMaximized()
-{
-    m_maximized = true;
-    m_size = m_window->window()->geometry().size();
-    set_maximized(0);
-}
-
-void QWaylandShellSurface::setFullscreen()
-{
-    m_fullscreen = true;
-    m_size = m_window->window()->geometry().size();
-    set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, 0);
-}
-
-void QWaylandShellSurface::setNormal()
-{
-    if (m_fullscreen || m_maximized) {
-        m_fullscreen = m_maximized = false;
-        setTopLevel();
-        QMargins m = m_window->frameMargins();
-        m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom());
-    }
-}
-
-void QWaylandShellSurface::setMinimized()
-{
-    // TODO: There's no wl_shell_surface API for this
-}
-
-void QWaylandShellSurface::setTopLevel()
-{
-    set_toplevel();
-}
-
-void QWaylandShellSurface::updateTransientParent(QWindow *parent)
-{
-    QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
-    if (!parent_wayland_window)
-        return;
-
-    // set_transient expects a position relative to the parent
-    QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
-    QWindow *parentWin = m_window->window()->transientParent();
-    transientPos -= parentWin->geometry().topLeft();
-    if (parent_wayland_window->decoration()) {
-        transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
-        transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
-    }
-
-    uint32_t flags = 0;
-    Qt::WindowFlags wf = m_window->window()->flags();
-    if (wf.testFlag(Qt::ToolTip)
-            || wf.testFlag(Qt::WindowTransparentForInput))
-        flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
-
-    set_transient(parent_wayland_window->object(),
-                  transientPos.x(),
-                  transientPos.y(),
-                  flags);
-}
-
-void QWaylandShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
-{
-    QWaylandWindow *parent_wayland_window = parent;
-    if (!parent_wayland_window)
-        return;
-
-    // set_popup expects a position relative to the parent
-    QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
-    transientPos -= parent_wayland_window->geometry().topLeft();
-    if (parent_wayland_window->decoration()) {
-        transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
-        transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
-    }
-
-    set_popup(device->wl_seat(), serial, parent_wayland_window->object(),
-              transientPos.x(), transientPos.y(), 0);
-}
-
-void QWaylandShellSurface::shell_surface_ping(uint32_t serial)
-{
-    pong(serial);
-}
-
-void QWaylandShellSurface::shell_surface_configure(uint32_t edges,
-                                                   int32_t width,
-                                                   int32_t height)
-{
-    m_window->configure(edges, width, height);
-}
-
-void QWaylandShellSurface::shell_surface_popup_done()
-{
-    QCoreApplication::postEvent(m_window->window(), new QCloseEvent());
-}
-
-QT_END_NAMESPACE
diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h
index 2477c3f..2f59f60 100644
--- a/src/client/qwaylandshellsurface_p.h
+++ b/src/client/qwaylandshellsurface_p.h
@@ -55,39 +55,25 @@ class QWaylandWindow;
 class QWaylandInputDevice;
 class QWindow;
 
-class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface : public QtWayland::wl_shell_surface
+class Q_WAYLAND_CLIENT_EXPORT QWaylandShellSurface
 {
 public:
-    QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window);
-    ~QWaylandShellSurface();
+    virtual ~QWaylandShellSurface() {}
+    virtual void resize(QWaylandInputDevice * /*inputDevice*/, enum wl_shell_surface_resize /*edges*/)
+    {}
 
-    using QtWayland::wl_shell_surface::resize;
-    void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges);
-
-    using QtWayland::wl_shell_surface::move;
-    void move(QWaylandInputDevice *inputDevice);
+    virtual void move(QWaylandInputDevice * /*inputDevice*/) {}
+    virtual void setTitle(const QString & /*title*/) {}
+    virtual void setAppId(const QString & /*appId*/) {}
 
 private:
-    void setMaximized();
-    void setFullscreen();
-    void setNormal();
-    void setMinimized();
-
-    void setTopLevel();
-    void updateTransientParent(QWindow *parent);
-    void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial);
-
-    QWaylandWindow *m_window;
-    bool m_maximized;
-    bool m_fullscreen;
-    QSize m_size;
-
-    void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE;
-    void shell_surface_configure(uint32_t edges,
-                                 int32_t width,
-                                 int32_t height) Q_DECL_OVERRIDE;
-    void shell_surface_popup_done() Q_DECL_OVERRIDE;
+    virtual void setMaximized() {}
+    virtual void setFullscreen() {}
+    virtual void setNormal() {}
+    virtual void setMinimized() {}
 
+    virtual void setTopLevel() {}
+    virtual void updateTransientParent(QWindow * /*parent*/) {}
     friend class QWaylandWindow;
 };
 
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 920c977..3fb3a49 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -46,6 +46,8 @@
 #include "qwaylandinputdevice_p.h"
 #include "qwaylandscreen_p.h"
 #include "qwaylandshellsurface_p.h"
+#include "qwaylandwlshellsurface_p.h"
+#include "qwaylandxdgsurface_p.h"
 #include "qwaylandextendedsurface_p.h"
 #include "qwaylandsubsurface_p.h"
 #include "qwaylanddecoration_p.h"
@@ -92,8 +94,16 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
     static WId id = 1;
     mWindowId = id++;
 
-    if (mDisplay->shell() && window->type() & Qt::Window && !(window->flags() & Qt::BypassWindowManagerHint))
-        mShellSurface = new QWaylandShellSurface(mDisplay->shell()->get_shell_surface(object()), this);
+    if (!(window->flags() & Qt::BypassWindowManagerHint)) {
+        if (mDisplay->shellXdg()) {
+           if (window->type() & Qt::Window) {
+                mShellSurface = new QWaylandXdgSurface(mDisplay->shellXdg()->get_xdg_surface(object()), this);
+            }
+        } else if (mDisplay->shell() && window->type() & Qt::Window) {
+            mShellSurface = new QWaylandWlShellSurface(mDisplay->shell()->get_shell_surface(object()), this);
+        }
+    }
+
     if (mDisplay->windowExtension())
         mExtendedWindow = new QWaylandExtendedSurface(this, mDisplay->windowExtension()->get_extended_surface(object()));
     if (mDisplay->subSurfaceExtension())
@@ -101,12 +111,12 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
 
     if (mShellSurface) {
         // Set initial surface title
-        mShellSurface->set_title(window->title());
+        mShellSurface->setTitle(window->title());
 
         // Set surface class to the .desktop file name (obtained from executable name)
         QFileInfo exeFileInfo(qApp->applicationFilePath());
         QString className = exeFileInfo.baseName() + QLatin1String(".desktop");
-        mShellSurface->set_class(className);
+        mShellSurface->setAppId(className);
     }
 
     if (QPlatformWindow::parent() && mSubSurfaceWindow) {
@@ -170,7 +180,7 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent)
 void QWaylandWindow::setWindowTitle(const QString &title)
 {
     if (mShellSurface) {
-        mShellSurface->set_title(title);
+        mShellSurface->setTitle(title);
     }
 
     if (mWindowDecoration && window()->isVisible())
@@ -212,8 +222,10 @@ void QWaylandWindow::setVisible(bool visible)
             mMouseDevice = parent->mMouseDevice;
             mMouseSerial = parent->mMouseSerial;
 
-            if (mMouseDevice)
-                mShellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial);
+            QWaylandWlShellSurface *wlshellSurface = dynamic_cast<QWaylandWlShellSurface*>(mShellSurface);
+            if (mMouseDevice && wlshellSurface) {
+                wlshellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial);
+            }
         }
 
         if (!mSentInitialResize) {
@@ -428,6 +440,20 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags)
 
 bool QWaylandWindow::createDecoration()
 {
+    // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere
+    if (mState == Qt::WindowMinimized) {
+        QWaylandXdgSurface *xdgSurface = dynamic_cast<QWaylandXdgSurface *>(mShellSurface);
+        if ( xdgSurface ) {
+            if (xdgSurface->isFullscreen()) {
+                setWindowStateInternal(Qt::WindowFullScreen);
+            } else if (xdgSurface->isMaximized()) {
+                setWindowStateInternal(Qt::WindowMaximized);
+            } else {
+                setWindowStateInternal(Qt::WindowNoState);
+            }
+        }
+    }
+
     static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty();
     if (disableWaylandDecorations)
         return false;
diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp
new file mode 100644
index 0000000..4b73ec2
--- /dev/null
+++ b/src/client/qwaylandwlshellsurface.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandwlshellsurface_p.h"
+
+#include "qwaylanddisplay_p.h"
+#include "qwaylandwindow_p.h"
+#include "qwaylandinputdevice_p.h"
+#include "qwaylanddecoration_p.h"
+#include "qwaylandscreen_p.h"
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window)
+    : QtWayland::wl_shell_surface(shell_surface)
+    , m_window(window)
+    , m_maximized(false)
+    , m_fullscreen(false)
+{
+}
+
+QWaylandWlShellSurface::~QWaylandWlShellSurface()
+{
+    wl_shell_surface_destroy(object());
+}
+
+void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges)
+{
+    resize(inputDevice->wl_seat(),
+           inputDevice->serial(),
+           edges);
+}
+
+void QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice)
+{
+    move(inputDevice->wl_seat(),
+         inputDevice->serial());
+}
+
+void QWaylandWlShellSurface::setTitle(const QString & title)
+{
+    return QtWayland::wl_shell_surface::set_title(title);
+}
+
+void QWaylandWlShellSurface::setAppId(const QString & appId)
+{
+    return QtWayland::wl_shell_surface::set_class(appId);
+}
+
+void QWaylandWlShellSurface::setMaximized()
+{
+    m_maximized = true;
+    m_size = m_window->window()->geometry().size();
+    set_maximized(0);
+}
+
+void QWaylandWlShellSurface::setFullscreen()
+{
+    m_fullscreen = true;
+    m_size = m_window->window()->geometry().size();
+    set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, 0);
+}
+
+void QWaylandWlShellSurface::setNormal()
+{
+    if (m_fullscreen || m_maximized) {
+        m_fullscreen = m_maximized = false;
+        setTopLevel();
+        QMargins m = m_window->frameMargins();
+        m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom());
+    }
+}
+
+void QWaylandWlShellSurface::setMinimized()
+{
+    // TODO: There's no wl_shell_surface API for this
+}
+
+void QWaylandWlShellSurface::setTopLevel()
+{
+    set_toplevel();
+}
+
+void QWaylandWlShellSurface::updateTransientParent(QWindow *parent)
+{
+    QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
+    if (!parent_wayland_window)
+        return;
+
+    // set_transient expects a position relative to the parent
+    QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
+    QWindow *parentWin = m_window->window()->transientParent();
+    transientPos -= parentWin->geometry().topLeft();
+    if (parent_wayland_window->decoration()) {
+        transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
+        transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
+    }
+
+    uint32_t flags = 0;
+    Qt::WindowFlags wf = m_window->window()->flags();
+    if (wf.testFlag(Qt::ToolTip)
+            || wf.testFlag(Qt::WindowTransparentForInput))
+        flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
+
+    set_transient(parent_wayland_window->object(),
+                  transientPos.x(),
+                  transientPos.y(),
+                  flags);
+}
+
+void QWaylandWlShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial)
+{
+    QWaylandWindow *parent_wayland_window = parent;
+    if (!parent_wayland_window)
+        return;
+
+    // set_popup expects a position relative to the parent
+    QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
+    transientPos -= parent_wayland_window->geometry().topLeft();
+    if (parent_wayland_window->decoration()) {
+        transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
+        transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
+    }
+
+    set_popup(device->wl_seat(), serial, parent_wayland_window->object(),
+              transientPos.x(), transientPos.y(), 0);
+}
+
+void QWaylandWlShellSurface::shell_surface_ping(uint32_t serial)
+{
+    pong(serial);
+}
+
+void QWaylandWlShellSurface::shell_surface_configure(uint32_t edges,
+                                                     int32_t width,
+                                                     int32_t height)
+{
+    m_window->configure(edges, width, height);
+}
+
+void QWaylandWlShellSurface::shell_surface_popup_done()
+{
+    QCoreApplication::postEvent(m_window->window(), new QCloseEvent());
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandwlshellsurface_p.h b/src/client/qwaylandwlshellsurface_p.h
new file mode 100644
index 0000000..d02bb7b
--- /dev/null
+++ b/src/client/qwaylandwlshellsurface_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDWLSHELLSURFACE_H
+#define QWAYLANDWLSHELLSURFACE_H
+
+#include <QtCore/QSize>
+
+#include <wayland-client.h>
+
+#include <QtWaylandClient/private/qwayland-wayland.h>
+#include <QtWaylandClient/private/qwaylandclientexport_p.h>
+#include "qwaylandshellsurface_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandWindow;
+class QWaylandInputDevice;
+class QWindow;
+
+class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QtWayland::wl_shell_surface
+        , public QWaylandShellSurface
+{
+public:
+    QWaylandWlShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window);
+    virtual ~QWaylandWlShellSurface();
+
+    using QtWayland::wl_shell_surface::resize;
+    void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE;
+
+    using QtWayland::wl_shell_surface::move;
+    void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE;
+
+    void setTitle(const QString & title) Q_DECL_OVERRIDE;
+    void setAppId(const QString &appId) Q_DECL_OVERRIDE;
+
+private:
+    void setMaximized() Q_DECL_OVERRIDE;
+    void setFullscreen() Q_DECL_OVERRIDE;
+    void setNormal() Q_DECL_OVERRIDE;
+    void setMinimized() Q_DECL_OVERRIDE;
+
+    void setTopLevel() Q_DECL_OVERRIDE;
+    void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE;
+    void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial);
+
+    QWaylandWindow *m_window;
+    bool m_maximized;
+    bool m_fullscreen;
+    QSize m_size;
+
+    void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE;
+    void shell_surface_configure(uint32_t edges,
+                                 int32_t width,
+                                 int32_t height) Q_DECL_OVERRIDE;
+    void shell_surface_popup_done() Q_DECL_OVERRIDE;
+
+    friend class QWaylandWindow;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDSHELLSURFACE_H
diff --git a/src/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp
new file mode 100644
index 0000000..1b8affa
--- /dev/null
+++ b/src/client/qwaylandxdgsurface.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandxdgsurface_p.h"
+
+#include "qwaylanddisplay_p.h"
+#include "qwaylandwindow_p.h"
+#include "qwaylandinputdevice_p.h"
+#include "qwaylanddecoration_p.h"
+#include "qwaylandscreen_p.h"
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window)
+    : QtWayland::xdg_surface(xdg_surface)
+    , m_window(window)
+    , m_maximized(false)
+    , m_minimized(false)
+    , m_fullscreen(false)
+{
+}
+
+QWaylandXdgSurface::~QWaylandXdgSurface()
+{
+    xdg_surface_destroy(object());
+}
+
+void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges)
+{
+    // May need some conversion if types get incompatibles, ATM they're identical
+    enum resize_edge const * const arg = reinterpret_cast<enum resize_edge const * const>(&edges);
+    resize(inputDevice, *arg);
+}
+
+void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum resize_edge edges)
+{
+    resize(inputDevice->wl_seat(),
+           inputDevice->serial(),
+           edges);
+}
+
+void QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice)
+{
+    move(inputDevice->wl_seat(),
+         inputDevice->serial());
+}
+
+void QWaylandXdgSurface::setMaximized()
+{
+    m_maximized = true;
+    m_size = m_window->window()->geometry().size();
+    set_maximized();
+}
+
+void QWaylandXdgSurface::setFullscreen()
+{
+    m_fullscreen = true;
+    m_size = m_window->window()->geometry().size();
+    set_fullscreen();
+}
+
+void QWaylandXdgSurface::setNormal()
+{
+    if (m_fullscreen || m_maximized  || m_minimized) {
+        if (m_maximized) { unset_maximized(); }
+        if (m_fullscreen) { unset_fullscreen(); }
+
+        m_fullscreen = m_maximized = m_minimized = false;
+        setTopLevel();
+        QMargins m = m_window->frameMargins();
+        m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom());
+    }
+}
+
+void QWaylandXdgSurface::setMinimized()
+{
+    m_minimized = true;
+    m_size = m_window->window()->geometry().size();
+    set_minimized();
+}
+
+void QWaylandXdgSurface::setTopLevel()
+{
+    // There's no xdg_shell_surface API for this, ignoring
+}
+
+void QWaylandXdgSurface::updateTransientParent(QWindow *parent)
+{
+    QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
+    if (!parent_wayland_window)
+        return;
+
+    // set_transient expects a position relative to the parent
+    QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
+    QWindow *parentWin = m_window->window()->transientParent();
+    transientPos -= parentWin->geometry().topLeft();
+    if (parent_wayland_window->decoration()) {
+        transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left());
+        transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top());
+    }
+
+    uint32_t flags = 0;
+    Qt::WindowFlags wf = m_window->window()->flags();
+    if (wf.testFlag(Qt::ToolTip)
+            || wf.testFlag(Qt::WindowTransparentForInput))
+        flags |= XDG_SURFACE_SET_TRANSIENT_FOR;
+
+    set_transient_for(parent_wayland_window->object());
+}
+
+void QWaylandXdgSurface::setTitle(const QString & title)
+{
+    return QtWayland::xdg_surface::set_title(title);
+}
+
+void QWaylandXdgSurface::setAppId(const QString & appId)
+{
+    return QtWayland::xdg_surface::set_app_id(appId);
+}
+
+void QWaylandXdgSurface::xdg_surface_ping(uint32_t serial)
+{
+    pong(serial);
+}
+
+void QWaylandXdgSurface::xdg_surface_configure(uint32_t edges, int32_t width,
+                                               int32_t height)
+{
+    m_window->configure(edges, width, height);
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h
new file mode 100644
index 0000000..744d3f3
--- /dev/null
+++ b/src/client/qwaylandxdgsurface_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDXDGSURFACE_H
+#define QWAYLANDXDGSURFACE_H
+
+#include <QtCore/QSize>
+
+#include <wayland-client.h>
+
+#include <QtWaylandClient/private/qwayland-xdg-shell.h>
+#include <QtWaylandClient/private/qwaylandclientexport_p.h>
+#include "qwaylandshellsurface_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandWindow;
+class QWaylandInputDevice;
+class QWindow;
+
+class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QtWayland::xdg_surface
+        , public QWaylandShellSurface
+{
+public:
+    QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window);
+    virtual ~QWaylandXdgSurface();
+
+    using QtWayland::xdg_surface::resize;
+    void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges);
+
+    void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE;
+
+    using QtWayland::xdg_surface::move;
+    void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE;
+
+    void setTitle(const QString &title) Q_DECL_OVERRIDE;
+    void setAppId(const QString &appId) Q_DECL_OVERRIDE;
+
+    bool isFullscreen() const { return m_fullscreen; }
+    bool isMaximized() const { return m_maximized; }
+
+private:
+    void setMaximized() Q_DECL_OVERRIDE;
+    void setFullscreen() Q_DECL_OVERRIDE;
+    void setNormal() Q_DECL_OVERRIDE;
+    void setMinimized() Q_DECL_OVERRIDE;
+
+    void setTopLevel() Q_DECL_OVERRIDE;
+    void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE;
+
+private:
+    QWaylandWindow *m_window;
+    bool m_maximized;
+    bool m_minimized;
+    bool m_fullscreen;
+    QSize m_size;
+
+    void xdg_surface_ping(uint32_t serial) Q_DECL_OVERRIDE;
+    void xdg_surface_configure(uint32_t edges,
+                               int32_t width,
+                               int32_t height) Q_DECL_OVERRIDE;
+    friend class QWaylandWindow;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDXDGSURFACE_H
-- 
1.9.1