Skip to content

Commit

Permalink
Fix passing window xid to prop_set, prop_del.
Browse files Browse the repository at this point in the history
Can be seen in mypy error:
xpra/x11/x11_server_core.py:206: error: Argument 1 to "prop_set" has incompatible type "Optional[Window]"; expected "int"

Transition to xid was started in commit 1994b30.

Causes this error at runtime:
2023-12-29 17:40:22,123 Error: <class 'TypeError'>, xid must be an int, not a <class 'gi.repository.GdkX11.X11Window'>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/x11/x11_server_core.py", line 170, in x11_init
    self.init_randr()
  File "/usr/lib/python3/dist-packages/xpra/x11/x11_server_core.py", line 206, in init_randr
    prop_set(self.root_window, "_XPRA_RANDR_EXACT_SIZE", "u32", 1)
  File "/usr/lib/python3/dist-packages/xpra/x11/gtk_x11/prop.py", line 73, in prop_set
    raw_prop_set(xid, key, dtype, dformat, data)
  File "/usr/lib/python3/dist-packages/xpra/x11/gtk_x11/prop.py", line 77, in raw_prop_set
    raise TypeError(f"xid must be an int, not a {type(xid)}")
TypeError: xid must be an int, not a <class 'gi.repository.GdkX11.X11Window'>

GitHub issue #4087

Run tested on v5.0.4 (because my system can't run newer)
  • Loading branch information
cpatulea authored and totaam committed Dec 30, 2023
1 parent 55f2cc6 commit c2dfebc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xpra/x11/x11_server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def init_randr(self) -> None:
sizes = RandR.get_xrr_screen_sizes()
if len(sizes)==1:
self.randr_exact_size = True
prop_set(self.root_window, "_XPRA_RANDR_EXACT_SIZE", "u32", 1)
prop_set(xid, "_XPRA_RANDR_EXACT_SIZE", "u32", 1)
elif not sizes:
#xwayland?
self.randr = False
Expand Down Expand Up @@ -321,7 +321,7 @@ def do_clean_x11_properties(self, *properties) -> None:
root = get_default_root_window()
for prop in properties:
try:
prop_del(root, prop)
prop_del(root.get_xid(), prop)
except Exception as e:
log("prop_del(%s, %s) %s", root, prop, e)

Expand Down

0 comments on commit c2dfebc

Please sign in to comment.