Fix crashes
This commit is contained in:
parent
017e3e12af
commit
9d028b2662
23
azot/X.py
23
azot/X.py
|
@ -2,17 +2,22 @@ from Xlib import display
|
|||
|
||||
# Get screen resolution
|
||||
def get_geometry():
|
||||
try:
|
||||
width = display.Display().screen().width_in_pixels
|
||||
height = display.Display().screen().height_in_pixels
|
||||
|
||||
return {"x": width, "y": height}
|
||||
except:
|
||||
get_geometry()
|
||||
while 1:
|
||||
try:
|
||||
width = display.Display().screen().width_in_pixels
|
||||
height = display.Display().screen().height_in_pixels
|
||||
|
||||
return {"x": width, "y": height}
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
# Get mouse cursor position
|
||||
def get_cursor_position():
|
||||
data = display.Display().screen().root.query_pointer()._data
|
||||
while 1:
|
||||
try:
|
||||
data = display.Display().screen().root.query_pointer()._data
|
||||
|
||||
return {'x': data['root_x'], 'y': data['root_y']}
|
||||
return {'x': data['root_x'], 'y': data['root_y']}
|
||||
except:
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue
Block a user