1. 29 Oct, 2020 1 commit
  2. 28 Oct, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Send a cancelled() event if the dnd data source is not accepted · aa42b540
      Vlad Zahorodnii authored
      Currently, Firefox will stuck in "dnd" mode if you try to drag any of
      its tabs. The main reason for that is that kwin doesn't send the
      wl_data_source.cancelled event if the pointer button has been released
      and there is no target surface or if the data source hasn't been
      accepted by anyone.
      CCBUG: 427528
  3. 01 Oct, 2020 1 commit
    • David Edmundson's avatar
      Port DataDevice to the new inheritance approach · cd2c13bd
      David Edmundson authored
      This was done mostly because I wanted to get rid of the Resource
      dependency in AbstractDataSource so I can make our xwl bridge direct,
      but this also fixes up some issues with object lifespan present in the
      previous version and keeps all our clipboard code in-line.
  4. 22 Jun, 2020 1 commit
    • David Edmundson's avatar
      Scope dragAndDropActionsChanged to source lifespan · 5167c11b
      David Edmundson authored
      The source can have a different lifespan to the offer being made.
      If a source is removed and we get a drag actions changed before the
      offer is cancelled we don't want to crash.
      Couldn't reproduce locally, but the trace was good.
      BUG: 423127
  5. 26 May, 2020 2 commits
    • David Edmundson's avatar
      Introduce AbstractDataSource round the DataSourceInterface · e08b201b
      David Edmundson authored
      Clipboard managers and middle click paste are new protocols.
      We want to be able to copy from a clipboard manager to a regular
      clipboard and vice versa without duplicating loads of code.
      If we support kliper's "syncronise contents of the clipboard and
      selection" inside the compositor that would become an unmanageable amount
      of combinations.
      It also potentially allows the idea of our XWayland bridge not being a
      wayland client and simplifying that code.
      Test Plan: Unit test passes
      Reviewers: #kwin
      Subscribers: zzag
      Differential Revision: https://phabricator.kde.org/D29329
    • David Edmundson's avatar
      Manage active selection as active DataSource than DataDevice · f9da1809
      David Edmundson authored
      A DataDevice will have zero or one active DataSource as the seclection.
      In the existing code we track the current data device then update it to
      the newest data device
      when the source inside a data device changes.
      If we store the active data source inside Seat instead of the device
      everything becomes
      somewhat simpler and safer.
      An entire unit test vanishes as that case of an externally set
      DataDevice with no source
      can no longer happen.
      There's also a lot of duplication that's been merged in this patch so we
      have one path.
      There are some technical behavioural changes in particular we do cleanup
      when the
      source vanishes rather than the data device, but if anything that seems
      safer and more correct.
      It's a precursor for introducing an abstraction class round the source
      without needing to meddle
      with too much code.
      Test Plan: Relevant unit tests passed, ran with it for a while with no
      Reviewers: #kwin
      Differential Revision: https://phabricator.kde.org/D29328
  6. 29 Apr, 2020 1 commit
  7. 16 Mar, 2020 1 commit
  8. 23 Jan, 2020 1 commit
  9. 28 Aug, 2019 1 commit
    • David Edmundson's avatar
      [server] Wrap proxyRemoveSurface in smart pointer · f7763052
      David Edmundson authored
      proxyRemoteSurface is a fake wayland surface created for the drag and
      drop between X and wayland clients.
      The lifespan is not guaranteed to outlive the DataDevice.
      Kwin closes Xwl before the other wayland client connections so it's
      technically dangling for a bit when events could be dispatched.
      Probably will never happen, but better to guard and be safe.
      Test Plan: Compiles
      Reviewers: #kwin, zzag
      Reviewed By: #kwin, zzag
      Subscribers: kde-frameworks-devel
      Tags: #frameworks
      Differential Revision: https://phabricator.kde.org/D22862
  10. 06 Feb, 2019 1 commit
    • Roman Gilg's avatar
      [server] Add surface data proxy mechanism · 0b33f078
      Roman Gilg authored
      Allows a compositor to set a proxy surface to handle drag and drop
      operations place of the actual surface the drag originated from.
      One proxy surface can handle multiple origin surfaces at the same time. These
      need to get registered once. The active remote surface gets set when a pointer
      button is pressed on the surface.
      Test Plan: Manually with KWin's Xwayland DnD patches.
      Reviewers: #kwin
      Subscribers: davidedmundson, kde-frameworks-devel
      Tags: #frameworks
      Differential Revision: https://phabricator.kde.org/D15421
  11. 02 Dec, 2018 1 commit
    • Roman Gilg's avatar
      [server] Touch drag support · 09b5adee
      Roman Gilg authored
      Summary: Adds functionality to do drag and drop with touch screens.
      Test Plan: Manually. Autotest planned.
      Reviewers: #kwin, #frameworks, davidedmundson
      Reviewed By: #kwin, davidedmundson
      Subscribers: davidedmundson, kde-frameworks-devel
      Tags: #frameworks
      Differential Revision: https://phabricator.kde.org/D15464
  12. 06 Sep, 2018 2 commits
    • Roman Gilg's avatar
      [server] Do not try to create data offers without source · 698777a7
      Roman Gilg authored
      Summary: An internal drag is without data source. Still we tried to create offers.
      Test Plan: This change makes the updated autotest in D15072 pass without errors.
      Reviewers: #kwin, hein
      Reviewed By: hein
      Subscribers: kde-frameworks-devel
      Tags: #frameworks
      Differential Revision: https://phabricator.kde.org/D15074
    • Roman Gilg's avatar
      [server] Abort drag start on correct conditions and without posting error · 83d0c8d2
      Roman Gilg authored
      A drag start request should be dismissed when the client does not have an
      implicit pointer grab or the currently focused pointer surface is not the
      origin. The conditions for that were wrong in the past.
      Also just ignore the request and not post directly an error, that potentially
      kills the client since by concurrency the client might have send a valid
      request, that got invalidated through grab or focus change at the same time
      on the server side.
      Test Plan: Manually and autotest.
      Reviewers: #kwin, davidedmundson
      Reviewed By: #kwin, davidedmundson
      Subscribers: adridg, kde-frameworks-devel
      Tags: #frameworks
      Differential Revision: https://phabricator.kde.org/D15072
  13. 21 Jun, 2018 1 commit
    • Michal Srb's avatar
      Do not cancel old clipboard selection if it is same as the new one. · 0e580ae9
      Michal Srb authored
      GTK applications seem to call wl_data_device::set_selection multiple times with
      the same wl_data_source object, replacing it with itself. If we cancel it, they
      will destroy it and the selection will be gone.
      With this patch it is again possible to copy from GTK applications.
      BUG: 395366
      Test Plan: Patch provided by the reporter, he reported success.
      Reviewers: #plasma, #frameworks, romangg
      Reviewed By: #plasma, romangg
      Subscribers: michalsrb, romangg, graesslin, kde-frameworks-devel
      Tags: #frameworks
      Differential Revision: https://phabricator.kde.org/D13535
  14. 25 Feb, 2018 1 commit
    • Martin Flöser's avatar
      [server] Properly handle the situation when the DataSource for a drag gets destroyed · 2dfe16d7
      Martin Flöser authored
      This addresses the following situation:
      1. Start drag on a QtWayland based window
      2. Press escape
      3. Release mouse
      -> this results in a crash. The main reason for this is that QtWayland
      destroys the DataSource in step 2 and KWayland did not expect this at
      all. The drag and drop operation continued and results in step 3 in the
      drag target to request data from the no longer existing DataSource.
      This change addresses the root of the problem by cancelling the drag
      operation when the DataSource gets destroyed.
      BUG: 389221
      FIXED-IN: 5.44
      Test Plan:
      New test case exposing the problem and manual testing with
      kwin_wayland and dolphin (based on bug report)
      Reviewers: #frameworks, #kwin, #plasma
      Subscribers: plasma-devel
      Tags: #frameworks, #plasma
      Differential Revision: https://phabricator.kde.org/D10142
  15. 26 Dec, 2017 2 commits
    • Martin Flöser's avatar
      Fix regression caused by backward compatibility support in data source · e3a6fb6a
      Martin Flöser authored
      We should only enforce the check whether a data source has set the
      actions for drag on drop on a selection if it's at least version 3. For
      backward compatibility we used to set a default action which would
      ensure that a version <3 and >3 client can interact with each other. But
      due to that the action was set to a default value which breaks any
      selection. Sorry about that.
      This change ensures the backward compatibility behavior does not break
      As the regression causes all clients to quit it is a severe regression
      which requires fast action. Due to that I'm doing a maintainer push
      without review. I encourage everyone to do a post commit review.
      Sorry for not noticing the regression before. The backward compatibility
      was the last thing I added in that patch set and apparently I did not
      run all tests again.
    • Martin Flöser's avatar
      Add support for version 3 of data device manager interface · a715a6cd
      Martin Flöser authored
      The main difference compared to version 2 is additional drag and drop
      actions. The source and destination can negotiate whether the data
      should be copied or moved or the user should be asked for either or.
      This seems to be important for GTK, but is not yet implemented in Qt.
      The main motivation for adding support is that it is required by SDL to
      launch on Wayland.
      BUG: 386993
      Test Plan: Extended test case, sdl apps now start
      Reviewers: #frameworks, #plasma, #kwin
      Subscribers: plasma-devel
      Tags: #plasma_on_wayland, #frameworks
      Differential Revision: https://phabricator.kde.org/D9136
  16. 15 Aug, 2017 1 commit
    • David Edmundson's avatar
      Avoid sending data offers from an invalid source. · 1b279498
      David Edmundson authored
      A DataDevice will have a source when offers are available, but it can
      also be legitimately cleared.
      When calling DataDeviceInterface::sendSelection(DataDeviceInterface
      *other) if the other data device has no source, we should be setting
      that we also have no source.
      In addition this also guards against Seat tracking a DataDeviceInterface
      with no source when trying to sync x clipboards.
      BUG: 383054
      Reviewers: #plasma
      Subscribers: graesslin, plasma-devel, #frameworks
      Tags: #plasma_on_wayland, #frameworks
      Differential Revision: https://phabricator.kde.org/D7316
  17. 14 Sep, 2016 1 commit
    • Martin Flöser's avatar
      [server] When replacing the clipboard selection previous DataSource needs to be cancelled · 81635159
      Martin Flöser authored
      According to the Wayland documentation a data source needs to be
      cancelled whenever it is no longer valid. A reason for no longer being
      valid is that the data source has been replaced by another data source.
      So far KWayland did not implement this aspect which resulted in clipboard
      breaking in QtWayland applications. As soon as one copied once from an
      application it was no longer possible to paste to it from another
      With this change the data source gets properly cancelled and also
      ensured that the server code doesn't run into a possible crash condition
      when trying to cancel an already unbound data source.
      BUG: 368391
      Reviewers: #plasma_on_wayland
      Subscribers: plasma-devel
      Tags: #plasma_on_wayland
      Differential Revision: https://phabricator.kde.org/D2743
  18. 15 Jun, 2016 1 commit
    • Martin Flöser's avatar
      [server] Introduce a Resource::unbound signal emitted from unbind handler · ac491d58
      Martin Flöser authored
      So far for internal cleanup we mostly listen to QObject::destroyed.
      When a Resource gets unbind the wl_resource is set to null and the
      Resource gets deleteLater. This creates a short time frame when the
      Resource is still there, but the wl_resource is null. For most internal
      usages the Resource is completely useless at that point and should no
      longer be considered. So far it was still considered and could hit
      crashers, if a code path did not nullptr check. Unfortunately
      libwayland-server is not nullptr safe: if called with a null value it
      tends to crash.
      So this check introduces a new signal unbound which can be listend to
      in addition to the destroyed signal. It's used in SeatInterface for
      DataDeviceInterface, where we experienced a crash related to that.
      A test case is added which exposes the crash, but it already needs
      the unbound signal to get into the crashy condition. The actual crash
      is fixed twice - with the help of the unbound signal, but also by
      introducing the nullptr check where it's needed.
      Reviewers: #plasma_on_wayland
      Subscribers: plasma-devel
      Tags: #plasma_on_wayland
      Differential Revision: https://phabricator.kde.org/D1868
  19. 30 May, 2016 1 commit
    • Martin Flöser's avatar
      [server] Standardize the destructor request handling for Resources · 03594de1
      Martin Flöser authored
      This change standardizes the behavior regarding the destructor request.
      The destructor should destroy the resource and nothing else. The
      Wayland library invokes the static unbind method once the resource is
      destroyed. The implementation provided by Resource::Private::unbind
      triggers a delete later on the Resource. So there is no need to trigger
      a deleteLater from the destructor request callback.
      This change adds a generic implementation to Resource::Private which is
      now used by all inheriting classes replacing the custom implementations.
      Test Plan:
      For a few Resources the test is extended to ensure that the Resource
      gets deleted on server side.
      Reviewers: #plasma
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D1679
  20. 02 Mar, 2016 1 commit
    • Martin Flöser's avatar
      [server] Implement support for drag'n'drop through pointer device · 413025c2
      Martin Flöser authored
      How drag'n'drop works on Wayland:
      When a surface has a pointer grab and a button pressed on the surface
      (implicit grab) the client can initiate a drag'n'drop operation on the
      data device. For this the client needs to provide a data source
      describing the data to be transmitted with the drag'n'drop operation.
      When a drag'n'drop operation is active all pointer events are interpreted
      as part of the drag'n'drop operation, the pointer device is grabbed.
      Pointer events are no longer sent to the focused pointer but to the
      focused data device. When the pointer moves to another surface an
      enter event is sent to a data device for that surface and a leave
      event is sent to the data device previously focused. An enter event
      carries a data offer which is created from the data source for the
      During pointer motion there is a feedback mechanism. The data offer
      can signal to the data source that it can or cannot accept the data
      at the current pointer position. This can be used by the client being
      dragged from to update the cursor.
      The drag'n'drop operation ends with the implicit grab being removed,
      that is the pressed pointer button which triggered the operation gets
      released. The server sends a drop event to the focused data device.
      The data transfer can now be started. For that the receiving client
      creates a pipe and passes the file descriptor through the data offer
      to the sending data source. The sending client will write into the
      file descriptor and close it to finish the transfer.
      Drag'n'drop could also be initiated through a touch device grab, but
      this is not yet implemented.
      The implementation in this change focuses on the adjustments for pointer.
      For the user of the library drag'n'drop is implemented in the
      SeatInterface. Signals are emitted whenever drag is started or ended.
      The interaction for pointer events hardly changes. Motion, button press
      and button release can still be indicated in the same way. If a button
      release removes the implicit grab the drop is automatically performed,
      without the user of the library having to do anything.
      The only change during drag and drop for the library user is that
      setFocusedPointerSurface is blocked. To update the current drag target
      the library user should use setDragTarget. Sending the enter/leave to the
      data device gets performed automatically.
      The data device which triggered the drag and drop operation is exposed
      in the SeatInterface. The user of the library should make sure to render
      the additional drag icon provided on the data device. At least QtWayland
      based applications will freeze during drag and drop if the icon doesn't
      get rendered.
      The implementation is currently still lacking the client side and due to
      that also auto test. It's currently only tested with QtWayland clients.
      Reviewers: #plasma, sebas
      Subscribers: plasma-devel
      Projects: #plasma
      Differential Revision: https://phabricator.kde.org/D1046
  21. 09 Sep, 2015 2 commits
  22. 27 Nov, 2014 2 commits
    • Martin Flöser's avatar
      Add safety checks to DataDeviceInterface · 5e704c0c
      Martin Flöser authored
      It's possible that the Resource got already unbound when calling
      into clear selection, etc.
    • Martin Flöser's avatar
      Handle DataDeviceInterface selection in SeatInterface · 5fd8db6e
      Martin Flöser authored
      The selection is supposed to be sent to the DataDeviceInterface just
      before getting keyboard focus. In order to do that the SeatInterface
      keeps track of the DataDeviceInterface which is the current selection
      and the DataDeviceInterface of the focused keyboard client.
      SeatInterface friends DataDeviceManagerInterface so that the latter
      can register each created DataDevice for the SeatInterface.
  23. 25 Nov, 2014 2 commits
  24. 20 Nov, 2014 1 commit
  25. 19 Nov, 2014 1 commit
  26. 14 Nov, 2014 5 commits
  27. 06 Nov, 2014 2 commits