Skip to content

Commit

Permalink
OSX: Fix clipboard owner window title
Browse files Browse the repository at this point in the history
Fixes #1183

Signed-off-by: Lukas Holecek <[email protected]>
  • Loading branch information
hluk committed Aug 5, 2019
1 parent 8c3424c commit 4886dd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/platform/mac/macclipboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class MacClipboard final : public DummyClipboard {

void setData(ClipboardMode mode, const QVariantMap &dataMap) override;

QByteArray clipboardOwner() override;

private:
void clipboardTimeout();

Expand Down
9 changes: 9 additions & 0 deletions src/platform/mac/macclipboard.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "common/common.h"
#include "common/mimetypes.h"
#include "common/textdata.h"
#include "platform/platformnativeinterface.h"
#include "platform/platformwindow.h"

#include <QApplication>
#include <QMimeData>
Expand Down Expand Up @@ -61,6 +63,13 @@
return DummyClipboard::setData(mode, dataMapForMac);
}

QByteArray MacClipboard::clipboardOwner()
{
PlatformWindowPtr currentWindow = platformNativeInterface()->getCurrentWindow();
if (currentWindow)
return currentWindow->getTitle().toUtf8();
return QByteArray();
}

void MacClipboard::clipboardTimeout() {
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
Expand Down

0 comments on commit 4886dd7

Please sign in to comment.