Skip to content
  • rk flx's avatar
    Disable setImageData for dragging of unmodified images · c61693cc
    rk flx authored
    Summary:
    3bb8beb5 and 984b9737 led to Gwenview adding the raw image data
    to the mimedata used when dragging or copying images. In general that's
    fine and sometimes even needed (e.g. when pasting to GIMP).
    
    However, when dragging to the Plasma desktop to copy the image or set it
    as a wallpaper, the drag cursor would stutter and only change to the
    green accepting cursor when hovering for a while. Furthermore, upon
    dropping the image the context menu presenting the actions would take a
    very long time showing up. This is caused by requesting a deep copy of
    the mimedata in `kdeclarative`, resulting in the conversion of the image
    data to all image formats Qt supports (for details, see D13249#300894).
    
    The same problem can be observed when trying to drop an image to
    Chromium, which does not work at all.
    
    Therefore we change `selectionMimeData` to only set the URL for dragging
    unmodified images, which solves the issue both for Plasma and for
    Chromium. (For modified images the problem persists, but it is
    considered more important to provide the modified image data in this
    case for applications supporting it.)
    
    Test Plan:
    In both {nav Browse} and {nav View} mode, drag images to the desktop.
    The context menu should appear swiftly. Also, the behaviour for copying
    and dragging in all other cases should work as specified in the added
    comment.
    
    Reviewers: #gwenview, muhlenpfordt
    
    Reviewed By: #gwenview, muhlenpfordt
    
    Differential Revision: https://phabricator.kde.org/D14543
    c61693cc