Skip to content

Commit

Permalink
#2019: clipboard.set_with_data does not work with GTK2 on macos, so u…
Browse files Browse the repository at this point in the history
…se clipboard.set_text instead

git-svn-id: https://xpra.org/svn/Xpra/trunk@21135 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 28, 2018
1 parent 7c94d83 commit c5aa2a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/xpra/gtk_common/gtk_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os.path
import array
from xpra.util import iround, first_time
from xpra.os_util import strtobytes, bytestostr, WIN32, PYTHON2
from xpra.os_util import strtobytes, bytestostr, WIN32, OSX, PYTHON2
from xpra.gtk_common.gobject_compat import import_gtk, import_gdk, import_glib, import_pixbufloader, import_pango, import_cairo, import_gobject, import_pixbuf, is_gtk3
gtk = import_gtk()
gdk = import_gdk()
Expand Down Expand Up @@ -429,11 +429,10 @@ def load_contents_finish(gfile, res):
_, data, etag = gfile.load_contents_finish(res)
return data, len(data), etag

def set_clipboard_data(clipboard, thevalue, vtype="STRING"):
def set_clipboard_data(clipboard, thevalue, _vtype="STRING"):
#only strings with GTK3?
thestring = str(thevalue)
clipboard.set_text(thestring, len(thestring))
return

def wait_for_contents(clipboard, target):
atom = gdk.Atom.intern(target, False)
Expand Down Expand Up @@ -718,6 +717,10 @@ def load_contents_finish(gfile, res):
return gfile.load_contents_finish(res)

def set_clipboard_data(clipboard, thevalue, vtype="STRING"):
TEXT_TARGETS = ("UTF8_STRING", "TEXT", "STRING", "text/plain")
if OSX and vtype in TEXT_TARGETS:
clipboard.set_text(thevalue, len(thevalue))
return
value = [thevalue]
def get_func(clipboard, selection, info, targets):
log("get_func%s value=%s", (clipboard, selection, info, targets), value[0])
Expand Down

0 comments on commit c5aa2a8

Please sign in to comment.