-
Notifications
You must be signed in to change notification settings - Fork 3
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
AttributeError: 'int' object has no attribute 'xinput_select_events' #8
Comments
Thanks for the report @jeason1997 :) I couldn't replicate this bug, could you provide the Also, could you run this code: from Xlib.display import Display
xdisplay = Display()
extension_info = xdisplay.query_extension("XInputExtension")
input_focus = xdisplay.get_input_focus()
term_window = input_focus.focus
print(f"{extension_info=}\n{input_focus=}\n{term_window=}") For the reference, I get the following trace:
|
Hi @vxgmichel , my python-xlib version is same to yours ~> pip3 show python-xlib
Name: python-xlib
Version: 0.33
Summary: Python X Library
Home-page: https://github.com/python-xlib/python-xlib
Author: Peter Liljenberg
Author-email: petli@ctrl-c.liu.se
License: LGPLv2+
Location: /usr/local/lib/python3.10/dist-packages
Requires: six
Required-by: gambaterm` after run the code it output: In [1]: from Xlib.display import Display
...:
...: xdisplay = Display()
...: extension_info = xdisplay.query_extension("XInputExtension")
...: input_focus = xdisplay.get_input_focus()
...: term_window = input_focus.focus
...: print(f"{extension_info=}\n{input_focus=}\n{term_window=}")
extension_info=<QueryExtension serial = 15, data = {'sequence_number': 15, 'present': 1, 'major_opcode': 131, 'first_event': 66, 'first_error': 129}, error = None>
input_focus=<GetInputFocus serial = 16, data = {'revert_to': 0, 'sequence_number': 16, 'focus': 1}, error = None>
term_window=1` My computer environment is wsl: ~> uname -a
Linux DESKTOP-10NTA73 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
Hello, Same issue here.
Ubuntu 23.10, please let me know if you need something else tested :) |
Oh interesting, I admit I wasn't too motivated to install WSL but if you can reproduce this on ubuntu that's good news. Do you use Wayland or X11? Could you provide the |
Ahah, I totally understand ! I'm on wayland, I did not try it out on X11. And i'm using the same python-xlib version than you : 0.33
I could try it out on X11 and report back if you want |
That'd be awesome :) I'll run some tests on wayland on my own as well |
Working as intended on X11! Un problème avec Wayland alors ? :) |
I ran some tests on wayland and it seems like some windows are not accessible through the xlib API. I wrote this script to show the full window tree along with their respective geometry: from Xlib.display import Display
def print_window(window, indent=0):
wid = hex(window.id)
name = window.get_wm_name()
geometry = window.get_geometry()
x, y, width, height = geometry.x, geometry.y, geometry.width, geometry.height
print(f"{' '*indent}* [{wid}] {name} ({x}, {y}) {width}x{height}")
for child in window.query_tree().children:
print_window(child, indent+2)
xdisplay = Display()
screen = xdisplay.screen()
root = screen.root
print_window(root) I ran it several times while changing the terminal window size but there was no difference in the output. It seems like the terminal window simply does not appear. I noticed the same thing using this gist to get the current active window. Funnily enough, VSCode does appear in the list. That means that if you use the VSCode terminal to run I also tried to capture the keyboard input at root level (as a fallback workaround) but the key presses are not captured if the terminal window is focused. The key presses are properly captured if another "available" window is focused though, which is not helpful at all but does indicated that some windows are somehow "protected". This might be a security feature but I didn't look too long into it. @diminou91 I'm currently running out of ideas here but I'd be curious to hear your opinion about it :) |
Hmm I've tried forcing xwayland and X11 by un-setting WAYLAND_DISPLAY and by using GDK_BACKEND=x11 but same results. Is there any other software that you know of using the same mechanism to draw a window on screen ? Just to be able to compare if it is working and if so what are the differences ? EDIT : tried it in vscode terminal, different issue :
But I'm guessing this could be easily sorted out, just wanted to see if it was working as well |
It seems like
You mean a GUI program that appears in the window tree? Apart from desktop related stuff, I've tested with VSCode and |
Yes using --disable-audio makes it work in vscode! I mean any other piece of software using the same methods as yours to draw a window and use the keyboard, taht we could launch in X and Wayland to test if it is working or not, but that's a bit far fetched. Maybe a rewrite to pywayland lib could work ? But that's a bit of work, I'd like to try but I'm no dev :D |
That's a good idea, I didn't know about pywayland. That seems pretty tricky though, I could not find similar examples to start from. I don't have time to work on that at the moment, feel free to post your attempt if you end up giving it a try :) |
The text was updated successfully, but these errors were encountered: