1. 01 Feb, 2021 1 commit
  2. 23 Oct, 2020 1 commit
  3. 14 Oct, 2020 1 commit
    • Vlad Zahorodnii's avatar
      xwayland: Avoid creating a tree query on crash · 2093820a
      Vlad Zahorodnii authored
      If Xwayland has crashed, the Workspace will block stacking order updates
      and start destroying all X11 clients.
      
      Once stacking order updates are unblocked, the Workspace will mark the X
      stacking order as dirty and create a new Xcb::Tree object.
      
      We don't want to create that Xcb::Tree object because accessing it
      after the XCB connection has been shut down will lead to a crash.
      
      BUG: 427688
      FIXED-IN: 5.20.1
      2093820a
  4. 09 Sep, 2020 3 commits
  5. 02 Sep, 2020 1 commit
  6. 01 Sep, 2020 3 commits
  7. 12 Aug, 2020 2 commits
  8. 11 Aug, 2020 1 commit
    • Vlad Zahorodnii's avatar
      xwayland: Make DataBridge a native event filter · 8baf535a
      Vlad Zahorodnii authored
      With the DataBridge being a native event filter, we can further separate
      DataBridge-specific and generic Xwayland bits. In particular, we no
      longer have to call DataBridge::filterEvent() from the dispatchEvents()
      method, whose main purpose is to dispatch X11 events to kwin.
      8baf535a
  9. 07 Aug, 2020 2 commits
    • Vlad Zahorodnii's avatar
      Prettify license headers · 4ce853e8
      Vlad Zahorodnii authored
      4ce853e8
    • Vlad Zahorodnii's avatar
      Switch to SPDX license markers · 1fb9f6f1
      Vlad Zahorodnii authored
      The main advantage of SPDX license identifiers over the traditional
      license headers is that it's more difficult to overlook inappropriate
      licenses for kwin, for example GPL 3. We also don't have to copy a
      lot of boilerplate text.
      
      In order to create this change, I ran licensedigger -r -c from the
      toplevel source directory.
      1fb9f6f1
  10. 05 Aug, 2020 6 commits
    • Vlad Zahorodnii's avatar
      Port Xwayland data bridge to xcbutils · 51f926c0
      Vlad Zahorodnii authored
      This spares a redundant xcb_prefetch_extension_data() during startup.
      51f926c0
    • Vlad Zahorodnii's avatar
      Introduce X11 default screen property in Application · e7d02ad3
      Vlad Zahorodnii authored
      This spares unnecessary looping through all available X11 screens.
      e7d02ad3
    • Vlad Zahorodnii's avatar
      Stop Xwayland server when X11 connection breaks · 7ec93493
      Vlad Zahorodnii authored
      There is no point for processing X11 events if the connection has been
      shut down due to a fatal error.
      7ec93493
    • Vlad Zahorodnii's avatar
      Survive Xwayland crashes · 19ad1725
      Vlad Zahorodnii authored
      If the Xwayland process crashes, it will bring down the entire session
      together with itself. Obviously, we don't want that. At least, Wayland
      clients should survive the crash.
      
      This change refactors relevant X11 parts to handle Xwayland crashes in a
      less fatal way.
      
      In order to handle Xwayland crashes better, a pair of start() and stop()
      methods had been introduced in the Xwayland class to allow starting and
      stopping the Xwayland process at any moment.
      
      If we detect that the Xwayland process has crashed, we will immediately
      stop the Xwayland server, which in its turn will deactivate the socket
      notifier and destroy all connected X11 clients. Unfortunately, a couple
      of subtle changes in X11Client::releaseWindow() and Unmanaged::release()
      had to be made to ensure that we are left with a valid state after the
      Xwayland server has been stopped.
      19ad1725
    • Vlad Zahorodnii's avatar
      Clean up X11 connection setup code · fff2bfe7
      Vlad Zahorodnii authored
      This method removes a code path that we can never hit and fixes some
      minor coding style issues.
      fff2bfe7
    • Vlad Zahorodnii's avatar
      Add a simple test to check Xwayland dying · 707a0207
      Vlad Zahorodnii authored
      The new test verifies that we handle Xwayland crashes gracefully.
      707a0207
  11. 17 Jul, 2020 1 commit
  12. 25 Jan, 2020 1 commit
  13. 07 Aug, 2019 1 commit
  14. 31 Jul, 2019 1 commit
    • Vlad Zahorodnii's avatar
      wayland: Terminate client connections before Workspace is destroyed · 826b9742
      Vlad Zahorodnii authored
      Summary:
      When ShellClient tears down, it needs to access RuleBook in order to
      discard temporary rules. The problem is that WaylandServer outlives
      Workspace and therefore so does ShellClient.
      
      We can't guard against the case when RuleBook::self() is nullptr as it
      is vital to discard temporary rules.
      
      This change adjusts termination sequence so all shell clients are
      destroyed before Workspace(and thus RuleBook) is gone.
      
      ASAN output:
          ==19922==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000142060 at pc 0x7fbc0fb878bb bp 0x7ffd7d464520 sp 0x7ffd7d464518
          READ of size 8 at 0x606000142060 thread T0
              #0 0x7fbc0fb878ba in QList<KWin::Rules*>::detach() /usr/include/qt5/QtCore/qlist.h:172
              #1 0x7fbc0fb8538d in QList<KWin::Rules*>::begin() /usr/include/qt5/QtCore/qlist.h:324
              #2 0x7fbc0fb808b6 in KWin::RuleBook::discardUsed(KWin::AbstractClient*, bool) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/rules.cpp:1144
              #3 0x7fbc0fe36e32 in KWin::ShellClient::destroyClient() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/shell_client.cpp:435
              #4 0x7fbc0fe7a726 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::ShellClient::*)()>::call(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
              #5 0x7fbc0fe784c3 in void QtPrivate::FunctionPointer<void (KWin::ShellClient::*)()>::call<QtPrivate::List<>, void>(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
              #6 0x7fbc0fe74de9 in QtPrivate::QSlotObject<void (KWin::ShellClient::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/home/jenkins/install-prefix/lib64/libkwin.so.5+0x1677de9)
              #7 0x7fbc04f27357 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3357)
              #8 0x7fbc074e1970 in KWayland::Server::Resource::unbound() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/build/src/server/KF5WaylandServer_autogen/EWIEGA46WW/moc_resource.cpp:142
              #9 0x7fbc0766b4b4 in KWayland::Server::Resource::Private::unbind(wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:68
              #10 0x7fbc00bdc2ae  (/usr/lib64/libwayland-server.so.0+0x92ae)
              #11 0x7fbc00bdc32f in wl_resource_destroy (/usr/lib64/libwayland-server.so.0+0x932f)
              #12 0x7fbc0766b53f in KWayland::Server::Resource::Private::resourceDestroyedCallback(wl_client*, wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:76
              #13 0x7fbbff481d8c  (/usr/lib64/libffi.so.7+0x6d8c)
              #14 0x7fbbff481179  (/usr/lib64/libffi.so.7+0x6179)
              #15 0x7fbc00bdfa5f  (/usr/lib64/libwayland-server.so.0+0xca5f)
              #16 0x7fbc00bdc6d1  (/usr/lib64/libwayland-server.so.0+0x96d1)
              #17 0x7fbc00bddc71 in wl_event_loop_dispatch (/usr/lib64/libwayland-server.so.0+0xac71)
              #18 0x7fbc07541e50 in KWayland::Server::Display::Private::dispatch() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:148
              #19 0x7fbc075432de in KWayland::Server::Display::dispatchEvents(int) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:220
              #20 0x7fbc0fe864ca in KWin::WaylandServer::dispatch() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/wayland_server.cpp:616
              #21 0x451ce0 in KWin::WaylandTestApplication::~WaylandTestApplication() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/kwin_wayland_test.cpp:91
              #22 0x42faa1 in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/globalshortcuts_test.cpp:381
              #23 0x7fbc04796bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
              #24 0x413ea9 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testGlobalShortcuts+0x413ea9)
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D22821
      826b9742
  15. 02 Jul, 2019 1 commit
  16. 27 Jun, 2019 1 commit
  17. 23 Feb, 2019 1 commit
    • David Edmundson's avatar
      [wayland] Keep application startup flow inside main_wayland · 5e902394
      David Edmundson authored
      Summary:
      In a recent patch the newly added xwayland class ended up being
      responsible for continuing the startup, calling back into the main app
      to spawn the workspace.
      
      It moves the flow of startup about so it's not very readable or
      following class structure.
      
      This patch moves the code back into main_wayland and removes the
      duplication between xwayland and non-xwayland modes.
      
      There was also a misnaming of methods.
      
      Previously:
      continueStartupWithScreens was called after platform screens are created
      continueStartupWithScene was called after the scene was created
      continueStartupWithXwayland was called before xwayland is created
      
      This was confusing, so the names have been shuffled around to follow a
      consistent pattern of what has been done so far.
      
      Test Plan:
      Started kwin_wayland in normal and xwayland mode
      Ran unit tests (though some failed due to a local unrelated and as yet unindentified bug)
      
      Reviewers: #kwin, romangg
      
      Reviewed By: #kwin, romangg
      
      Subscribers: romangg, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D19232
      5e902394
  18. 19 Feb, 2019 5 commits
    • Roman Gilg's avatar
      [xwl] Drag and drop between Xwayland and Wayland native clients · 548978bf
      Roman Gilg authored
      Summary:
      Building upon the generic X Selection support this patch establishes another
      selection class representing the XDND selection and provides interfaces
      to communicate drags originating from Xwayland windows to the Wayland
      server KWin and drags originating from Wayland native drags to Xwayland.
      
      For Wayland native drags KWin will claim the XDND selection as owner and
      will simply translate all relevant events to the XDND protocol and receive
      alike messages by X clients.
      
      When an X client claims the XDND selection KWin is notified via the X protocol
      and it decides if it allows the X drag to transcend into the Wayland protocol.
      If this is the case the mouse position is tracked and on entering a Wayland
      native window a proxy X Window is mapped to the top of the window stack. This
      proxy window acts as a drag destination for the drag origin window and again
      X messages will be translated into respective Wayland protocol calls. If the
      cursor leaves the Wayland window geometry before a drop is registered, the
      proxy window is unmapped, what triggers a subsequent drag leave event.
      
      In both directions the necessary core integration is minimal. There is a single
      call to be done in the drag and drop event filter through the Xwayland
      interface class.
      
      From my tests this patch facilitates drags between any Qt/KDE apps. What needs
      extra care are the browsers, which use target formats, that are not directly
      compatible with the Wayland protocol's MIME representation. For Chromium an
      additional integration step must be done in order to provide it with a net
      window stack containing the proxy window.
      
      Test Plan: Manually. Auto tests planned.
      
      Reviewers: #kwin
      
      Subscribers: zzag, kwin, alexde
      
      Tags: #kwin
      
      Maniphest Tasks: T4611
      
      Differential Revision: https://phabricator.kde.org/D15627
      548978bf
    • Roman Gilg's avatar
      [xwl] Add Xwayland interface class · ad1bcbec
      Roman Gilg authored
      Summary: Adds an interface class to access Xwayland members from within KWin core.
      
      Reviewers: #kwin, davidedmundson, zzag
      
      Subscribers: zzag, davidedmundson, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D15419
      ad1bcbec
    • Roman Gilg's avatar
      [xwl] Generic X selections translation mechanism with Clipboard support · 6e08fb2f
      Roman Gilg authored
      Summary:
      In this patch an infrastructure is created to represent generic X selections
      in a Wayland session and use them for data transfers between Xwayland windows
      and Wayland native clients.
      
      The central manager is the DataBridge class, in which Selection objects can be
      created. This is hard-coded and such a Selection object persists until the end
      of the session, so no arbitrary selections can be created on the fly. For now
      the X Clipboard selection is supported, whose corresponding mechanism in the
      Wayland protocol is just called Selection.
      
      A Selection object listens for selection owner changes on the X side and for
      similar events into the Wayland server interfaces. If a data provider is
      available a selection source object is created by the Selection object. In case
      data is requested on the other side, a data transfer is initialized by creating
      a Transfer object. A Selection keeps track of all transfers and makes sure that
      they are destroyed when they are finished or in case they idle because of
      misbehaving clients.
      
      The Clipboard class translates the X Clipboard via a proxy window. Selection
      changes on the Wayland side are listened to through a new signal on the active
      KWayland seat interface.
      
      The previously used X clipboard syncer helper is disabled. The clipboard sync
      autotest is changed to the new mechanism.
      
      BUG: 394765
      BUG: 395313
      
      Test Plan: Manually and clipboard sync autotest.
      
      Reviewers: #kwin
      
      Subscribers: zzag, graesslin, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D15061
      6e08fb2f
    • Roman Gilg's avatar
      [autotests] Use Xwayland class in WaylandTestApplication · 608a89a8
      Roman Gilg authored
      Summary:
      By using the new Xwayland class we can reduce code duplication.
      
      An abstract parent class is introduced, that allows interfacing
      with the Xwayland class from the test binaries.
      
      Test Plan: Autotests still pass.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D15022
      608a89a8
    • Roman Gilg's avatar
      [xwl] Move Xwayland parts into separate class · 050cf045
      Roman Gilg authored
      Summary:
      The Xwayland code path is moved from ApplicationWayland to a dedicated class
      Xwayland in a new top-level directory xwl.
      
      This is a direct preparation step for generic support of Xwayland Selections.
      
      On a longer timescale this should also allow us to further separate Wayland
      native functionality from Xwayland to allow us at one point to build KWin's
      Wayland binary optionally without X dependencies. Another long term goal, that
      becomes possible through this separation is to recover from Xwayland crashes.
      
      Test Plan: Manually and auto tests
      
      Reviewers: #kwin, davidedmundson
      
      Subscribers: davidedmundson, zzag, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D15020
      050cf045
  19. 12 Jan, 2019 1 commit
    • Martin Flöser's avatar
      Ensure the Compositor does not start during termination · c2c92fab
      Martin Flöser authored
      Summary:
      The SceneOpenGLES test was starting to randomly crash on my system. On
      investigation I observed that there was a graphics reset ("Attempting to
      reset compositing.") which triggered a delayed restart of the
      compositor. This even was only processed while waiting for XWayland to
      terminate. Which resulted in a crash in KWin::getXServerVersion as the
      xcb connection broke.
      
      It makes no sense to setup the compositor again during application
      shutdown. Thus the dtors set a flag that they are terminating the
      application and Compositor::setup is checking for it.
      
      Test Plan: Test no longer crashes, although it goes through the crashing path
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D18015
      c2c92fab
  20. 13 Dec, 2018 1 commit
    • Martin Flöser's avatar
      Build platform plugins in correct sub directory of build dir · c8ede9a5
      Martin Flöser authored
      Summary:
      This brings KWin a step closer to be run from build dir without having
      to install at all. The integration tests are adjusted so that the
      virtual platform is still found which makes the code be closer to what
      is used in normal kwin_wayland.
      
      Test Plan: ctest passes, manually verified correct plugin is loaded
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D17388
      c8ede9a5
  21. 01 Dec, 2018 1 commit
    • Martin Flöser's avatar
      Delete kglobalshortcutsrc before executing a test · 260646ed
      Martin Flöser authored
      Summary:
      When running the complete test suite the ScriptedEffectsTest::testShortcuts
      registers the shortcut meta+shift+y. But GlobalShortcutsTest::testX11ClientShortcut
      also tries to use this shortcut for a window shortcut which fails if it
      is already registered. So when running the complete test suite it
      depends on the order of execution whether the GlobalShortcutsTest passes
      or not.
      
      Test should be clean - also the globalshortcuts. As the config is read
      from test directory anyway, we can delete the file prior to init of
      kglobalaccel.
      
      Test Plan: Run ctest, test did not fail anymore
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D16932
      260646ed
  22. 07 Nov, 2018 1 commit
    • Martin Flöser's avatar
      Unset XKB_DEFAULT_* in tests to make tests better reproducable · 0e839c4d
      Martin Flöser authored
      Summary:
      On one of my systems XKB_DEFAULT_LAYOUT is set to "de". This makes a few
      tests fail, e.g. pointer input and modifier only shortcuts.
      
      The reason is that those tests assume the xkb default layout behavior,
      that is how xkb functions without any layout being set. So having the
      env variable around influences the layout generation.
      
      To prevent this the environment variables are unset and thus a
      reproducable environment is created.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D16737
      0e839c4d
  23. 27 Feb, 2018 1 commit
  24. 21 Nov, 2017 1 commit
  25. 01 Oct, 2017 1 commit