diff --git a/src/setup.py b/src/setup.py index 4097c2a099..7d63ca94e0 100755 --- a/src/setup.py +++ b/src/setup.py @@ -1096,7 +1096,7 @@ def add_DLLs(*dll_names): #list of DLLs we want to include, without the "lib" prefix, or the version and extension #(ie: "libatk-1.0-0.dll" -> "atk") - add_DLLs('atk', 'cairo-gobject', + add_DLLs('atk', 'cairo-gobject', 'cairo', 'dbus', 'dbus-glib', 'gdk', 'gdk_pixbuf', 'openraw', 'gdkglext', 'gio', 'girepository', 'glib', 'gnutls', 'gobject', 'gthread', @@ -1105,7 +1105,7 @@ def add_DLLs(*dll_names): 'p11-kit', 'proxy', 'pango', 'pangocairo', 'pangoft2', 'pangowin32', 'png16', - 'rsvg', 'webp', + 'rsvg', 'webp', "iconv", 'winpthread', 'zzz') #this one may be missing in pygi-aio 3.14? @@ -1440,6 +1440,9 @@ def add_keywords(path_dirs=[], inc_dirs=[], lib_dirs=[], libs=[], noref=True, no elif "cairo" in pkgs_options: add_to_keywords(kw, 'include_dirs', GTK_INCLUDE_DIR, cairo_include_dir) add_to_keywords(kw, 'libraries', "cairo") + if PYTHON3: + cairo_library_dir = os.path.join(PYCAIRO_DIR, "lib") + add_to_keywords(kw, "library_dirs", cairo_library_dir) checkdirs(cairo_include_dir) elif "pycairo" in pkgs_options: kw = pycairo_pkgconfig(*pkgs_options, **ekw) diff --git a/src/xpra/client/gtk3/cairo_backing.py b/src/xpra/client/gtk3/cairo_backing.py index dad7bef211..6721f086fe 100644 --- a/src/xpra/client/gtk3/cairo_backing.py +++ b/src/xpra/client/gtk3/cairo_backing.py @@ -77,7 +77,7 @@ def ui_paint_image(): def _do_paint_rgb(self, cairo_format, has_alpha, img_data, x, y, width, height, rowstride, options): """ must be called from UI thread """ - log("cairo._do_paint_rgb(%s, %s, %s bytes,%s,%s,%s,%s,%s,%s)", FORMATS.get(cairo_format, cairo_format), has_alpha, len(img_data), x, y, width, height, rowstride, options) + log("cairo._do_paint_rgb(%s, %s, %s %s,%s,%s,%s,%s,%s,%s) set_image_surface_data=%s", FORMATS.get(cairo_format, cairo_format), has_alpha, len(img_data), type(img_data), x, y, width, height, rowstride, options, set_image_surface_data) rgb_format = options.strget("rgb_format", "RGB") #this format we can handle with the workaround: if cairo_format==cairo.FORMAT_RGB24 and rgb_format=="RGB" and set_image_surface_data: diff --git a/src/xpra/client/gtk_base/cairo_backing_base.py b/src/xpra/client/gtk_base/cairo_backing_base.py index 098e8a024e..c9739ef0c5 100644 --- a/src/xpra/client/gtk_base/cairo_backing_base.py +++ b/src/xpra/client/gtk_base/cairo_backing_base.py @@ -13,7 +13,7 @@ from xpra.gtk_common.gtk_util import cairo_set_source_pixbuf, gdk_cairo_context from xpra.client.gtk_base.gtk_window_backing_base import GTKWindowBacking from xpra.codecs.loader import get_codec -from xpra.os_util import BytesIOClass +from xpra.os_util import BytesIOClass, memoryview_to_bytes from xpra.log import Logger log = Logger("paint", "cairo") @@ -114,7 +114,11 @@ def nasty_rgb_via_png_paint(self, cairo_format, has_alpha, img_data, x, y, width oformat = "RGBA" else: oformat = "RGB" - img = PIL.Image.frombuffer(oformat, (width,height), img_data, "raw", rgb_format, rowstride, 1) + #use frombytes rather than frombuffer to be compatible with python3 new-style buffers + #this is slower, but since this codepath is already dreadfully slow, we don't care + bdata = memoryview_to_bytes(img_data) + log("bdata=%s", type(bdata)) + img = PIL.Image.frombytes(oformat, (width,height), bdata, "raw", rgb_format, rowstride, 1) #This is insane, the code below should work, but it doesn't: # img_data = bytearray(img.tostring('raw', oformat, 0, 1)) # pixbuf = pixbuf_new_from_data(img_data, COLORSPACE_RGB, True, 8, width, height, rowstride) diff --git a/src/xpra/os_util.py b/src/xpra/os_util.py index e3d63469fe..3bf685f539 100644 --- a/src/xpra/os_util.py +++ b/src/xpra/os_util.py @@ -69,6 +69,8 @@ def bytestostr(x): if _memoryview: def memoryview_to_bytes(v): + if type(v)==bytes: + return v if isinstance(v, _memoryview): return v.tobytes() return str(v)