Skip to content

Commit

Permalink
restore more correct way of converting atom names to atom array: gtk …
Browse files Browse the repository at this point in the history
…expects an array of GdkAtom values - so do that (trick here is that GdkAtoms are actually unsigned long)

git-svn-id: https://xpra.org/svn/Xpra/trunk@705 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 5, 2012
1 parent c54adca commit 62bc016
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/wimpiggy/lowlevel/bindings.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,16 @@ def gdk_atom_objects_from_gdk_atom_array(atom_string):
objects.append(PyGdkAtom_New(array[i]))
return objects

def gdk_atom_array_from_gdk_atom_objects(gdk_atom_objects):
cdef GdkAtom c_gdk_atom
cdef unsigned long gdk_atom_value
atom_array = []
for atom_object in gdk_atom_objects:
c_gdk_atom = PyGdkAtom_Get(atom_object)
gdk_atom_value = <unsigned long> c_gdk_atom
atom_array.append(gdk_atom_value)
return atom_array


# Property handling:

Expand Down
10 changes: 6 additions & 4 deletions src/xpra/xposix/xclipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import struct

from wimpiggy.lowlevel import (get_xatom, gdk_atom_objects_from_gdk_atom_array) #@UnresolvedImport
from wimpiggy.lowlevel import (gdk_atom_objects_from_gdk_atom_array, #@UnresolvedImport
gdk_atom_array_from_gdk_atom_objects) #@UnresolvedImport
from wimpiggy.log import Logger
log = Logger()

Expand All @@ -30,7 +31,8 @@ def _do_munge_raw_selection_to_wire(self, type, format, data):

def _munge_wire_selection_to_raw(self, encoding, datatype, format, data):
if encoding == "atoms":
ints = [get_xatom(a) for a in data]
log.debug("wire to raw: atoms(%s)=%s", data, ints)
return struct.pack("=" + "L" * len(ints), *ints)
import gtk.gdk
gdk_atoms = [gtk.gdk.atom_intern(a) for a in data]
atom_array = gdk_atom_array_from_gdk_atom_objects(gdk_atoms)
return struct.pack("=" + "I" * len(atom_array), *atom_array)
return ClipboardProtocolHelperBase._munge_wire_selection_to_raw(self, encoding, datatype, format, data)

0 comments on commit 62bc016

Please sign in to comment.