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

python3 and gtk3 support #90

Closed
totaam opened this issue Mar 27, 2012 · 143 comments
Closed

python3 and gtk3 support #90

totaam opened this issue Mar 27, 2012 · 143 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Mar 27, 2012

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
Copy link
Collaborator Author

totaam commented Mar 27, 2012

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

@totaam
Copy link
Collaborator Author

totaam commented Mar 27, 2012

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
Copy link
Collaborator Author

totaam commented Mar 27, 2012

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

1 similar comment
@totaam
Copy link
Collaborator Author

totaam commented Mar 27, 2012

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

@totaam
Copy link
Collaborator Author

totaam commented Mar 28, 2012

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

rough patch for gtk3/python3 support

@totaam
Copy link
Collaborator Author

totaam commented Mar 28, 2012

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
Copy link
Collaborator Author

totaam commented Mar 28, 2012

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

@totaam
Copy link
Collaborator Author

totaam commented Mar 28, 2012

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
Copy link
Collaborator Author

totaam commented Mar 28, 2012

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

@totaam
Copy link
Collaborator Author

totaam commented Mar 30, 2012

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


  • r654 fixes the about dialog
  • r653 fixes the session info dialog

@totaam
Copy link
Collaborator Author

totaam commented Mar 30, 2012

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


  • r667 fixes get_modifiers_mask, set_geometry_hints and is_flag_set vs MAPPED/REALIZED

@totaam
Copy link
Collaborator Author

totaam commented Apr 4, 2012

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
Copy link
Collaborator Author

totaam commented May 4, 2012

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

@totaam
Copy link
Collaborator Author

totaam commented May 4, 2012

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


delayed, this is hard!

@totaam
Copy link
Collaborator Author

totaam commented Sep 27, 2012

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

@totaam
Copy link
Collaborator Author

totaam commented Jul 16, 2013

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

@totaam
Copy link
Collaborator Author

totaam commented Jul 16, 2013

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

@totaam
Copy link
Collaborator Author

totaam commented Jul 16, 2013

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
Copy link
Collaborator Author

totaam commented Jul 16, 2013

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

1 similar comment
@totaam
Copy link
Collaborator Author

totaam commented Jul 16, 2013

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

@totaam
Copy link
Collaborator Author

totaam commented Oct 17, 2013

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

@totaam
Copy link
Collaborator Author

totaam commented Oct 17, 2013

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


too much work, too little time

@totaam
Copy link
Collaborator Author

totaam commented Apr 27, 2014

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
Copy link
Collaborator Author

totaam commented Apr 27, 2014

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

5 similar comments
@totaam
Copy link
Collaborator Author

totaam commented Apr 27, 2014

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

@totaam
Copy link
Collaborator Author

totaam commented Apr 27, 2014

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

@totaam
Copy link
Collaborator Author

totaam commented Apr 27, 2014

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

@totaam
Copy link
Collaborator Author

totaam commented Apr 27, 2014

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

@totaam
Copy link
Collaborator Author

totaam commented Apr 27, 2014

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

@totaam
Copy link
Collaborator Author

totaam commented Apr 20, 2015

2015-04-20 20:05:59: maxmylyn changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Apr 20, 2015

2015-04-20 20:05:59: maxmylyn set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Apr 20, 2015

2015-04-20 20:05:59: maxmylyn commented


Retried with the following builds against an r9087 Fedora 21 server:


MSVC:

  • Client connected and gave me my windows (currently starting with Firefox, xterm, xterm), however, I was unable to right click on the tray icon to disconnect
  • in addition a CTRL-C to the CMD window started a disconnect but then the client hung, before closing but not exiting completely.
    Got the following output from the server:
2015-04-20 11:35:25,311 client Protocol(SocketConnection(('10.0.32.137', 2200) - ('10.0.11.113', 59162))) has requested disconnection: CTRL_C
2015-04-20 11:35:25,311 Disconnecting client Protocol(SocketConnection(('10.0.32.137', 2200) - ('10.0.11.113', 59162))): client request
2015-04-20 11:35:25,328 internal error: read connection SocketConnection(('10.0.32.137', 2200) - ('10.0.11.113', 59162)) reset: [Errno 104] Connection reset by peer
  • However, a re-launch(closing the CMD window and opening a new one) with and without OpenGl works as expected. Must have been a one-time fluke, but I can investigate further if needed

MinGW:

  • I get a generic error ("blah" has stopped working, Windows isn't checking to fix it, etc etc) on disconnect every time. Other than that it works as expected.

edit: I see the caveat on #640 now. I'll refrain from posting the obvious and leave this be.


  • No longer asking about the E: drive.

Closing.

@totaam
Copy link
Collaborator Author

totaam commented Apr 20, 2015

2015-04-20 20:05:59: maxmylyn

1 similar comment
@totaam
Copy link
Collaborator Author

totaam commented Apr 20, 2015

2015-04-20 20:05:59: maxmylyn

@totaam totaam closed this as completed Apr 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant