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

replace GTK glue wherever possible #1995

Closed
totaam opened this issue Oct 23, 2018 · 4 comments
Closed

replace GTK glue wherever possible #1995

totaam opened this issue Oct 23, 2018 · 4 comments
Milestone

Comments

@totaam
Copy link
Collaborator

totaam commented Oct 23, 2018

When we drop support for Python2 / GTK2, it will be easier to replace some of the GTK X11 glue code with pure Cython code. (see #1977 for GTK4 problems)

For example, composite and damage classes should handle raw X11 windows using their xid, the add_event_receiver / remove_event_receiver functions can just use the xid directly.

@totaam
Copy link
Collaborator Author

totaam commented May 16, 2023

May become more pressing due to issues such as #3822 and the fact that we can't use GTK4.

@totaam
Copy link
Collaborator Author

totaam commented May 18, 2023

A lot of progress has been made and #3822 is mostly resolved, at least in git master.

New issues:

  • the size in motif wm hints should probably be used as default size
  • "group-leader" and "transient-for" and window "parent", are tracking and forwarding these properly? even for OR windows?
  • X11Window.get_server_time needs implementing - XIfEvent in Cython is going to be a pain
  • event receivers: dictionary size should match the number of managed windows - dump to verify no leaks?
  • GDKX11Window is still used in 3 places: clipboard, tray and wm - should we get rid of it completely now?
  • is the X11 event mask set correctly on all window models

totaam added a commit that referenced this issue May 19, 2023
totaam added a commit that referenced this issue May 19, 2023
and remove the now unused GdkX11.x11_get_server_time function
totaam added a commit that referenced this issue May 22, 2023
totaam added a commit that referenced this issue May 25, 2023
@totaam
Copy link
Collaborator Author

totaam commented May 25, 2023

@borneoa had reported this in #3822:

Plus clipboard looks not working, probably by the same errors (two are in clipboard.py)

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/xpra/x11/gtk_x11/clipboard.py", line 160, in do_xpra_selection_request
    proxy.do_selection_request_event(event)
  File "/usr/lib/python3.11/site-packages/xpra/x11/gtk_x11/clipboard.py", line 373, in do_selection_request_event
    wininfo = self.get_wininfo(requestor.get_xid())
                               ^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'get_xid'
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/xpra/x11/gtk_x11/clipboard.py", line 200, in do_xpra_property_notify_event
    proxy.do_property_notify(event)
  File "/usr/lib/python3.11/site-packages/xpra/x11/gtk_x11/clipboard.py", line 659, in do_property_notify
    data = X11Window.XGetWindowProperty(self.xid, event.atom, dtype, None, MAX_DATA_SIZE, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xpra/x11/bindings/window_bindings.pyx", line 995, in xpra.x11.bindings.window_bindings.X11WindowBindingsInstance.XGetWindowProperty
TypeError: an integer is required

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/xpra/server/server_base.py", line 974, in call_handler
    handler(proto, packet)
  File "/usr/lib/python3.11/site-packages/xpra/x11/server.py", line 1028, in _process_configure_window
    self._tray.move_resize(window, x, y, w, h)
  File "/usr/lib/python3.11/site-packages/xpra/x11/gtk_x11/tray.py", line 274, in move_resize
    window.move_resize(x, y, w, h)
  File "/usr/lib/python3.11/site-packages/xpra/x11/models/systray.py", line 48, in move_resize
    if not X11Window.XMoveResizeWindow(self.xid, x, y, width, height):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'xpra.x11.bindings.window_bindings.X11WindowBinding' object has no attribute 'XMoveResizeWindow'. Did you mean: 'MoveResizeWindow'?

Then again, later:

On current master 370947e, still not fixed one point. The fix looks like:
sed -i '474s/.get_xid()//' xpra/x11/gtk_x11/clipboard.py

Then, menus doesn't work, and each attempt to open one causes the log

2023-05-23 22:47:22,952 Error: unmanaged X11 context
2023-05-23 22:47:22,952  MoveResizeWindow
(..)
2023-05-23 22:47:22,954    File "/usr/lib/python3.11/site-packages/xpra/x11/gtk_x11/tray.py", line 274, in move_resize
2023-05-23 22:47:22,954      window.move_resize(x, y, w, h)
2023-05-23 22:47:22,954    File "/usr/lib/python3.11/site-packages/xpra/x11/models/systray.py", line 48, in move_resize
2023-05-23 22:47:22,954      if not X11Window.MoveResizeWindow(self.xid, x, y, width, height):
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/xpra/server/server_base.py", line 974, in call_handler
    handler(proto, packet)
  File "/usr/lib/python3.11/site-packages/xpra/x11/server.py", line 1028, in _process_configure_window
    self._tray.move_resize(window, x, y, w, h)
  File "/usr/lib/python3.11/site-packages/xpra/x11/gtk_x11/tray.py", line 275, in move_resize
    embedded_window = self.window_trays[window.xid]
                      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 2097501

Should be fixed in 08cf69d

@totaam
Copy link
Collaborator Author

totaam commented May 28, 2023

That's enough for V5, will follow up in #3871

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