mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-25 11:18:33 +02:00
i3-companion: avoid leaking X11 file descriptor
This commit is contained in:
parent
ae6e89e27e
commit
e79b7291ad
1 changed files with 24 additions and 21 deletions
|
@ -517,28 +517,31 @@ async def output_update(i3, event):
|
||||||
|
|
||||||
# Grab current setup. Synchronous, but it's short enough
|
# Grab current setup. Synchronous, but it's short enough
|
||||||
d = display.Display()
|
d = display.Display()
|
||||||
screen = d.screen()
|
try:
|
||||||
window = screen.root.create_window(0, 0, 1, 1, 1, screen.root_depth)
|
screen = d.screen()
|
||||||
screen_resources = randr.get_screen_resources_current(window)
|
window = screen.root.create_window(0, 0, 1, 1, 1, screen.root_depth)
|
||||||
current_setup = set()
|
screen_resources = randr.get_screen_resources_current(window)
|
||||||
for output in screen_resources.outputs:
|
current_setup = set()
|
||||||
output_info = randr.get_output_info(
|
for output in screen_resources.outputs:
|
||||||
window, output, screen_resources.timestamp
|
output_info = randr.get_output_info(
|
||||||
)
|
window, output, screen_resources.timestamp
|
||||||
if output_info.crtc == 0:
|
|
||||||
continue
|
|
||||||
crtc_info = randr.get_crtc_info(
|
|
||||||
window, output_info.crtc, output_info.timestamp
|
|
||||||
)
|
|
||||||
current_setup.add(
|
|
||||||
(
|
|
||||||
output_info.name,
|
|
||||||
crtc_info.width,
|
|
||||||
crtc_info.height,
|
|
||||||
crtc_info.x,
|
|
||||||
crtc_info.y,
|
|
||||||
)
|
)
|
||||||
)
|
if output_info.crtc == 0:
|
||||||
|
continue
|
||||||
|
crtc_info = randr.get_crtc_info(
|
||||||
|
window, output_info.crtc, output_info.timestamp
|
||||||
|
)
|
||||||
|
current_setup.add(
|
||||||
|
(
|
||||||
|
output_info.name,
|
||||||
|
crtc_info.width,
|
||||||
|
crtc_info.height,
|
||||||
|
crtc_info.x,
|
||||||
|
crtc_info.y,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
d.close()
|
||||||
|
|
||||||
# Compare to current setup
|
# Compare to current setup
|
||||||
if current_setup == output_update.last_setup:
|
if current_setup == output_update.last_setup:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue