Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.9k stars 163 forks source link

python3 and gtk3 support #90

Closed totaam closed 9 years ago

totaam commented 12 years ago

Issue migrated from trac ticket # 90

component: core | priority: major | resolution: fixed

2012-03-27 08:53:09: antoine created the issue


Makes sense to bundle this together since python3 is only really supported with gtk3 and vice versa.

Main work items:

  • backwards compatible python3 changes (via 2to3 mostly), most already done in r618, r619, r620, r621 and r622
  • python3 strings: changes need testing on python2.5, also need to ensure that calling encode(..) and decode(..) does not adversely affect performance
  • for other non-backwards compatible python3 changes, find a way to run 2to3 during build so we can keep a unified source tree in python2 format. (main issue here: catch exception syntax change)
  • gtk3 imports have moved and now require annotation to silence pydev lint
  • gtk3 methods on gtk.Window have changed, client.py will need to provide wrapper methods:
    • gdk.get_default_root_window().get_pointer() (removed)
    • gdk.get_default_root_window().get_size() (removed)
    • gtk.Window.__init__(win, wintype) (removed: no arg constructor now)
    • window.set_geometry_hints(...) (signature changed)
    • window.flags() (removed - must call get_$FLAGNAME)
    • window.window.set_cursor(..) (renamed to window.override_cursor?)
    • window.window.invalidate_rect (now window.queue_draw_area)
    • do_expose_event(event) is now do_draw(context)
    • window.window.get_geometry (removed, must now call get_position() and get_size()?)
    • constants have moved
    • gdk.keymap_get_default (removed?)
    • gdk.Cursor can no longer use pixbuf..
    • ...
  • gtk3 removed GdkPixmap and GdkImage, we're supposed to be using cairo but cairo.ImageSurface.create_for_data is not implemented in pycairo and there are no alternatives (ouch!)
  • PIL (Python Imaging Library) is not available on python3 (so we can't use that to fix cairo either)
totaam commented 12 years ago

2012-03-27 12:32:55: antoine changed status from new to accepted

totaam commented 12 years ago

2012-03-27 12:32:55: antoine commented


More done in r626, r627, r628, r629 and r630: most of the code is now python3/gtk3 compatible, except for:

  • client.py (large changes due to cairo brokenness)
  • protocol.py (string encoding changes - painful as this as repercussions elsewhere)
totaam commented 12 years ago

2012-03-27 20:10:02: antoine commented


Some useful links:

totaam commented 12 years ago

2012-03-27 20:10:02: antoine

totaam commented 12 years ago

2012-03-27 20:10:02: antoine

totaam commented 12 years ago

2012-03-28 08:50:54: antoine uploaded file xpra-gtk3.patch (33.0 KiB)

rough patch for gtk3/python3 support

totaam commented 12 years ago

2012-03-28 08:58:18: antoine commented


The patch above "works" in the sense that one can get something on screen with gtk3, but it has a number of important shortcomings:

  • problems with the new StringIO class, which fails because of a missing fileno()
  • jpeg and rgb24 have to be parsed using PIL then exported to PNG to then be loaded by cairo as cairo is incapable of loading anything else (seriously!? gtk devs, this is not an upgrade by a giant leap backwards). For rgb24 it seems to require an unnecessarily large rowstride (RGBA? according to this answer it uses 32 bit per channel data no matter what) - which we do not control as it is generated by gdk on the server side. This means making png the default and finding a solution for the mmap case: possibly using cairo server side to export with the rowstride expected by cairo on the client? Maybe also moving the draw/expose code to a utility class so we can use the current code on gtk2 and the new horrible mess on gtk3 only.
  • some re-drawing problems due to coordinates and clipping interfering with each other (shouldn't be too hard to fix)
totaam commented 12 years ago

2012-03-28 08:58:18: antoine

totaam commented 12 years ago

2012-03-28 18:31:06: antoine commented


r640 makes python3 + gtk3 almost usable by providing two different window backing mechanisms (we keep the old/fast code for gtk2, cairo for gtk3). But there are still many issues remaining:

  • most of the gtk3 function stubs at the top of client.py are still missing an actual implementation (no cursors, no keyboard support, etc)
  • display = gdk.display_get_default() and watching for screen changes has been hacked out with a if not is_gtk3() guard
  • the gtk3 version of the tray menu is mostly broken due to api changes: missing icons, about dialog errors, etc
totaam commented 12 years ago

2012-03-28 18:31:06: antoine

totaam commented 12 years ago

2012-03-30 13:44:20: antoine commented


  • r654 fixes the about dialog
  • r653 fixes the session info dialog
totaam commented 12 years ago

2012-03-30 15:48:45: antoine commented


  • r667 fixes get_modifiers_mask, set_geometry_hints and is_flag_set vs MAPPED/REALIZED
totaam commented 12 years ago

2012-04-04 07:10:08: antoine commented


There are serious compatibility issues between the new io.StringIO module and PIL, r697 reverts back to StringIO.StringIO in order to fix window icons - this will cause problems when trying to port the server to gtk3/python3.

totaam commented 12 years ago

2012-05-04 10:48:56: antoine

totaam commented 12 years ago

2012-05-04 10:48:56: antoine commented


delayed, this is hard!

totaam commented 11 years ago

2012-09-27 16:23:25: antoine

totaam commented 11 years ago

2013-07-16 07:10:28: antoine changed status from accepted to new

totaam commented 11 years ago

2013-07-16 07:10:28: antoine

totaam commented 11 years ago

2013-07-16 07:10:28: antoine commented


Worth updating and getting the basics to work properly (keyboard, etc)

And maybe also: transparency, GL, cursors, ..

totaam commented 11 years ago

2013-07-16 07:10:28: antoine

totaam commented 11 years ago

2013-07-16 07:10:28: antoine

totaam commented 10 years ago

2013-10-17 08:47:28: totaam

totaam commented 10 years ago

2013-10-17 08:47:28: totaam commented


too much work, too little time

totaam commented 10 years ago

2014-04-27 14:04:10: antoine commented


Lots of updates, this may be a better option than #300:

It is in a much better shape now, including some keyboard support.

[[BR]]

Things that just need more work:

  • transparency (should now work on osx and win32 without opengl?)
  • window state (fullscreen, etc)
  • spinner
  • workspaces
  • launcher
  • session info and about dialog
  • clipboard (oh joy)
  • sound (gstreamer 1.x)
  • osx integration work (..)

[[BR]]

Things that won't work out of the box with python3:

[[BR]]


MS Windows issues

GTK (what a mess):

  • pygobjectwin32 seems to be the place to get everything - the alternative would be to build from source with mingw and jhbuild...

[[BR]]

Things that install OK on win32 via installers (preferred):

[[BR]]

Things that install OK on win32 via scripts\pip.exe install or py -3 -m pip install:

  • Pillow
  • PyOpenGL (but PyOpenGL_accelerate needs a C compiler, see below)

[[BR]]

Things that need a C compiler to install on win32. Note: I have used mingw32 as per [http://stackoverflow.com/questions/3297254/how-to-use-mingws-gcc-compiler-when-installing-python-package-using-pip ] instead of Visual Studio 2010 normally used with Python 3.4 because I already have Visual Studio 2008 installed for Python 2.7... for now.

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-27 14:04:10: antoine

totaam commented 10 years ago

2014-04-28 09:55:08: antoine uploaded file netifaces-python3.patch (6.8 KiB)

fixes netifaces to build with python3

totaam commented 10 years ago

2014-04-28 09:58:45: antoine commented


Using Porting Extension Modules to Python 3 and Porting Extension Modules To Py3k, it was relatively easy to port netifaces. Now builds on both Linux and win32 with Python 3.4. I have sent the patch to the author, who said he was going to look at it. Alternatively, netifaces-merged could be used.

totaam commented 10 years ago

2014-04-28 09:58:45: antoine

totaam commented 10 years ago

2014-04-28 09:58:45: antoine

totaam commented 10 years ago

2014-04-28 17:16:10: antoine uploaded file win32-build-with-mingw.patch (15.6 KiB)

with this patch I can build with python3.4 and mingw

totaam commented 10 years ago

2014-04-29 08:32:09: antoine commented


More fixes:

Harder (delayed):

  • client launcher
  • latency graphs (need porting to cairo..)
totaam commented 10 years ago

2014-04-29 17:25:59: antoine commented


Many build updates in r6233, r6236, r6237, r6238, r6239, r6240, r6241, r6242

We can now build all the cython modules properly easily with unmodified build files:

set PYTHON=C:\Python34
set PATH=%PATH%;C:\MinGW\bin
set PKG_CONFIG_PATH=C:\MinGW\lib\pkgconfig;C:\MinGW\msys\1.0\local\lib\pkgconfig;C:\MinGW\msys\1.0\lib\pkgconfig
win32\MAKE-INSTALLER.BAT /silent

You must build ffmpeg and libvpx into the mingw environment to use them via pkg-config:

./configure (...) --prefix=C:\MinGW
make
make install
totaam commented 10 years ago

2014-04-29 17:25:59: antoine

totaam commented 10 years ago

2014-04-29 17:25:59: totaam

totaam commented 10 years ago

2014-04-29 18:21:40: antoine commented


And... cx freeze (stub added in r6243) is not available for Python 3.4 on win32, it does not build either. So I will start again from the top with Python 3.3.5 instead.

totaam commented 10 years ago

2014-04-30 15:08:47: antoine commented


Things to install using pygobjectwin32:

  • gobject-introspection (replaces pygtk)
  • gst-plugins
  • gdkglext
  • gst-plugins-extra
  • gtk+
  • pango
  • gstreamer
  • gdk-pixbuf
  • dbus-glib
  • gtkglext
  • Development packages (use defaults)

More build updates in r6245, r6246, r6247, r6248, r6249, r6250, r6251. Big change in r6252 allows us to build correctly again on all (?) platforms (fixes buffer compilation issues with Visual Studio)