xpra icon
Bug tracker and wiki

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#84 closed defect (fixed)

cannot paste to Qt applications

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 0.1
Component: core Version: 0.1.0
Keywords: Cc:

Description

It seems that Qt is doing something unusual (it could also be that gtk tries to compensate for it).
Copying from a Qt application works, but pasting to it does not.

The application does ask for the selection TARGETS, but using the _QT_SELECTION property (whereas normally it is ">"), we reply with the required list of atoms then the application requests one of them (ie: "COMPOUND_TEXT" - I've tried to force it to use others too, no difference), but the call never makes it to do_selection_get:

do_selection_request_event(<gtk.gdk.Event at 0x17bab48: GDK_SELECTION_REQUEST selection=PRIMARY, target=TARGETS, property=_QT_SELECTION>)
do_selection_get(<GtkSelectionData at 0x7ffff76af8f0>,0,16802993) target=TARGETS
get clipboard from remote handler id=3, proxy=<ClipboardProxy object at 0x7fa7693c8d70 (xpra+platform+clipboard_base+ClipboardProxy at 0x16ffa30)>, selection=PRIMARY, target=TARGETS
process clipboard packet type=clipboard-contents
process clipboard contents, selection=PRIMARY, type=ATOM, format=32
gdkatoms(['TIMESTAMP', 'TARGETS', 'MULTIPLE', 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING', 'text/plain;charset=utf-8', 'text/plain'])=[119L, 122L, 121L, 71L, 152L, 153L, 31L, 154L, 155L]
clipboard wire -> raw: ('ATOM', 32, 'atoms', ['TIMESTAMP', 'TARGETS', 'MULTIPLE', 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING', 'text/plain;charset=utf-8', 'text/plain']) -> 'w\x00\x00\x00z\x00\x00\x00y\x00\x00\x00G\x00\x00\x00\x98\x00\x00\x00\x99\x00\x00\x00\x1f\x00\x00\x00\x9a\x00\x00\x00\x9b\x00\x00\x00'
got clipboard contents(3)=36 (type=ATOM, format=32)
get clipboard from remote result(3)={'data': 'w\x00\x00\x00z\x00\x00\x00y\x00\x00\x00G\x00\x00\x00\x98\x00\x00\x00\x99\x00\x00\x00\x1f\x00\x00\x00\x9a\x00\x00\x00\x9b\x00\x00\x00', 'type': 'ATOM', 'format': 32}
do_selection_get(<GtkSelectionData at 0x7ffff76af8f0>,0,16802993) calling selection_data.set(ATOM,32,36)
do_selection_request_event(<gtk.gdk.Event at 0x17bab48: GDK_SELECTION_REQUEST selection=PRIMARY, target=COMPOUND_TEXT, property=_QT_SELECTION>)

For completeness, this is the xpra client log (which just responds to the TARGETS request):

process clipboard packet type=clipboard-request
process clipboard request, request_id=3, selection=PRIMARY, local name=PRIMARY, target=TARGETS
get_contents(TARGETS,<function got_contents at 0x1ba0230>)
got_contents(ATOM,32,72)
clipboard raw -> wire: ('ATOM', 32, '\x7f\x00\x00\x00\x00\x00\x00\x00|\x00\x00\x00\x00\x00\x00\x00~\x00\x00\x00\x7f\x00\x00\x00G\x00\x00\x00\x00\x00\x00\x00\x81\x00\x00\x00\x87\x00\x00\x00\x82\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x84\x00\x00\x00G\x00\x00\x00') -> ('atoms', ['TIMESTAMP', 'TARGETS', 'MULTIPLE', 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING', 'text/plain;charset=utf-8', 'text/plain'])

Change History (4)

comment:1 Changed 7 years ago by Antoine Martin

Owner: changed from Antoine Martin to Antoine Martin
Status: newaccepted

New info: this may have been working previously, so this may be caused by struct packing (32 vs 64, long vs int) etc, which was "fixed" in r490 or r575 - will need to revert those and re-test.

comment:2 Changed 7 years ago by Antoine Martin

This bug was caused by r490, reverting the part of this changeset that touches xposix/xclipboard.py fixes this issue:

Index: xpra/xposix/xclipboard.py
===================================================================
--- xpra/xposix/xclipboard.py	(revision 559)
+++ xpra/xposix/xclipboard.py	(working copy)
@@ -4,11 +4,9 @@
 # later version. See the file COPYING for details.
 
 import struct
+import gtk
 
-from wimpiggy.lowlevel import (
-                               gdk_atom_objects_from_gdk_atom_array,    #@UnresolvedImport
-                               gdk_atom_array_from_gdk_atoms            #@UnresolvedImport
-                               )
+from wimpiggy.lowlevel import (get_xatom, gdk_atom_objects_from_gdk_atom_array) #@UnresolvedImport
 from wimpiggy.log import Logger
 log = Logger()
 
@@ -33,7 +31,7 @@
 
     def _munge_wire_selection_to_raw(self, encoding, datatype, format, data):
         if encoding == "atoms":
-            gdkatoms = gdk_atom_array_from_gdk_atoms(data)
-            log.debug("gdkatoms(%s)=%s", data, gdkatoms)
-            return struct.pack("=" + "L" * len(gdkatoms), *gdkatoms)
+            d = gtk.gdk.display_get_default()
+            ints = [get_xatom(a) for a in data]
+            return struct.pack("@" + "L" * len(ints), *ints)
         return ClipboardProtocolHelperBase._munge_wire_selection_to_raw(self, encoding, datatype, format, data)

Before I revert this, I will try to figure out why this caused problems.

comment:3 Changed 7 years ago by Antoine Martin

Resolution: fixed
Status: acceptedclosed

fixed in r598

comment:4 Changed 7 years ago by Antoine Martin

sill some problems with CLIPBOARD ("PRIMARY" is ok): #99

Note: See TracTickets for help on using tickets.