Revert "magic: make background work with cleanup (#496)"

This reverts commit f862be4a2a.
This commit is contained in:
Maxime Desroches
2025-10-15 22:17:55 -07:00
parent 7a23dc61a2
commit 1a0d421e6e

View File

@@ -61,10 +61,7 @@ def power_screen():
except Exception:
pass
def show_background(img):
tex = rl.load_texture_from_image(img)
rl.set_texture_filter(tex, rl.TextureFilter.TEXTURE_FILTER_BILINEAR)
pos = rl.Vector2((rl.get_screen_width() - tex.width)/2.0, (rl.get_screen_height() - tex.height)/2.0)
def show_background(tex, pos):
rl.begin_drawing()
rl.draw_texture(tex, int(pos.x), int(pos.y), rl.WHITE)
rl.end_drawing()
@@ -89,10 +86,14 @@ def main():
drm_master = os.open(DRM_DEVICE, os.O_RDWR | os.O_CLOEXEC)
os.environ['DRM_FD'] = str(drm_master)
rl.init_window(0, 0, "")
rl.init_window(0, 0, "not weston")
img = rl.load_image(BACKGROUND)
rl.image_resize(img, rl.get_screen_width(), rl.get_screen_width()//2)
show_background(img)
tex = rl.load_texture_from_image(img)
rl.set_texture_filter(tex, rl.TextureFilter.TEXTURE_FILTER_BILINEAR)
pos = rl.Vector2((rl.get_screen_width() - tex.width)/2.0, (rl.get_screen_height() - tex.height)/2.0)
rl.unload_image(img)
show_background(tex, pos)
try:
os.unlink(SOCK_PATH)
@@ -114,9 +115,7 @@ def main():
clients.discard(t)
if not clients and need_background:
need_background = False
rl.close_window()
rl.init_window(0, 0, "")
show_background(img)
show_background(tex, pos)
try:
client, _ = server.accept()