From 089e45544824981564a45393c51a970ec428003b Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sat, 27 Dec 2025 18:36:09 +0900 Subject: [PATCH] fix some logic --- milkwm/xserver.c | 8 ++++++-- mpanel/mpanelrc.in | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/milkwm/xserver.c b/milkwm/xserver.c index 1b02456..19cd785 100644 --- a/milkwm/xserver.c +++ b/milkwm/xserver.c @@ -155,7 +155,7 @@ static Pixmap render_image(Window wnd, const char* path, int tile, int fit) { double sx = (double)w / xwa.width; double sy = (double)h / xwa.height; - if(fit ? (sx > sy) : (sy < sx)) { + if(fit ? (sx > sy) : (sx < sy)) { width = w / sx; height = h / sx; } else { @@ -517,7 +517,7 @@ void loop_x(void) { window_t w; int i; int ret = 0; - XWindowAttributes xwa; + XWindowAttributes xwa, xwar; XConfigureEvent ev2; if(!XGetWindowAttributes(xdisplay, ev.xmaprequest.window, &xwa)) continue; @@ -593,6 +593,10 @@ void loop_x(void) { set_name(w.client); } + + XGetWindowAttributes(xdisplay, DefaultRootWindow(xdisplay), &xwar); + + XMoveWindow(xdisplay, w.client, rand() % (xwar.width - wm_entire_width(xwa.width)), rand() % (xwar.height - wm_entire_height(xwa.height))); } else if(ev.type == PropertyNotify) { int i; for(i = 0; i < arrlen(windows); i++) { diff --git a/mpanel/mpanelrc.in b/mpanel/mpanelrc.in index 2955454..f0b65aa 100644 --- a/mpanel/mpanelrc.in +++ b/mpanel/mpanelrc.in @@ -1,4 +1,5 @@ + @@ -9,6 +10,16 @@ uxterm + + + + + + + + + +