mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 18:58: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
|
||||
d = display.Display()
|
||||
screen = d.screen()
|
||||
window = screen.root.create_window(0, 0, 1, 1, 1, screen.root_depth)
|
||||
screen_resources = randr.get_screen_resources_current(window)
|
||||
current_setup = set()
|
||||
for output in screen_resources.outputs:
|
||||
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,
|
||||
try:
|
||||
screen = d.screen()
|
||||
window = screen.root.create_window(0, 0, 1, 1, 1, screen.root_depth)
|
||||
screen_resources = randr.get_screen_resources_current(window)
|
||||
current_setup = set()
|
||||
for output in screen_resources.outputs:
|
||||
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,
|
||||
)
|
||||
)
|
||||
finally:
|
||||
d.close()
|
||||
|
||||
# Compare to current setup
|
||||
if current_setup == output_update.last_setup:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue