Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot paste to Qt applications #84

Closed
totaam opened this issue Mar 7, 2012 · 5 comments
Closed

cannot paste to Qt applications #84

totaam opened this issue Mar 7, 2012 · 5 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Mar 7, 2012

Issue migrated from trac ticket # 84

component: core | priority: major | resolution: fixed

2012-03-07 11:37:30: antoine created the issue


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'])
@totaam
Copy link
Collaborator Author

totaam commented Mar 13, 2012

2012-03-13 10:15:40: totaam changed status from new to accepted

@totaam
Copy link
Collaborator Author

totaam commented Mar 13, 2012

2012-03-13 10:15:40: totaam commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Mar 15, 2012

2012-03-15 10:46:13: antoine commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Mar 15, 2012

2012-03-15 11:00:24: antoine commented


fixed in r598

@totaam totaam closed this as completed Mar 15, 2012
@totaam
Copy link
Collaborator Author

totaam commented Apr 4, 2012

2012-04-04 14:25:25: antoine commented


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant