From 70ef9860be38fbe194d9f9f478dea02d0f1a7869 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Fri, 23 Oct 2026 19:06:31 +0300 Subject: [PATCH] fix(games): inset windows so dwm's native border stays on-screen dwm adds a borderpx (1) border around every client, so a window sized to fill the usable area (240x296) overflowed the 240x320 screen by 2px on the right and bottom, clipping the native window border. Offset the requested position by the border width and shrink by 3*borderpx so the framed window exactly meets the screen edges with the native border fully visible. --- overlay/rootfs/usr/bin/snake | Bin 13672 -> 13672 bytes overlay/rootfs/usr/bin/tetris | Bin 13668 -> 13668 bytes prebuilt/games/usr/bin/snake | Bin 13672 -> 13672 bytes prebuilt/games/usr/bin/tetris | Bin 13668 -> 13668 bytes src/games/snake.cpp | 11 ++++++++--- src/games/tetris.cpp | 11 ++++++++--- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/overlay/rootfs/usr/bin/snake b/overlay/rootfs/usr/bin/snake index 0ad153715fe11a1d9444aba3452d2d4eb16440e1..6b11ff99886c7c986e16bed83bbd53a097c43bcd 100755 GIT binary patch delta 129 zcmV-{0Dk}IYUpaPWC0YxKANh<_#mxZoO|dkvFTsrin;x>cmZ7tMKXLu13Mc!Un|7v z05aUaU?U@7Un)TJr-O-T03^-n05S)Z0V2)m1SAHO86(Z<0z}{V5J~^{xbENh3@HId jd_;Og;AyiO4J8KzB78(*vqKcs0R<>C005G+9TrO;;(aww delta 129 zcmV-{0Dk}IYUpaPWC0Ybk>52gz)Gcau}|M#};-}neA j0Y>0ydPK7t4J8KzBYZ?-vqKcs0R==e005A)9TrO;Qt~tL diff --git a/overlay/rootfs/usr/bin/tetris b/overlay/rootfs/usr/bin/tetris index 77556a81e9bddf5c7412df18950ad18290da6507..10d304463f7700bdf552e3c8462ed2a1656fb0ed 100755 GIT binary patch delta 130 zcmV-|0Db@DYUFCLWC0YrJ_<&{(c|g`_%D^x{igj->W`MQcmX8~M>2dw13Mc!Un|7v z10&qOU?U@8Un)TJ)P#v>03^-n05S)Z0V2)m1SAHO86(Z<0z}{VC`$kLzV6@nBq{+$ kd_;Og)c7O=v*ZkY2?Qd1MB-}pRA&FKImd_({v2a^FJ&FKR&&FKX*0+Sj>|M$G^-}oRZ k0Y=pLBm;Uxv*ZkY2?Qg2MB|fX7Lx^hGXMbUv;7ul9w*5*jsO4v diff --git a/prebuilt/games/usr/bin/snake b/prebuilt/games/usr/bin/snake index 0ad153715fe11a1d9444aba3452d2d4eb16440e1..6b11ff99886c7c986e16bed83bbd53a097c43bcd 100755 GIT binary patch delta 129 zcmV-{0Dk}IYUpaPWC0YxKANh<_#mxZoO|dkvFTsrin;x>cmZ7tMKXLu13Mc!Un|7v z05aUaU?U@7Un)TJr-O-T03^-n05S)Z0V2)m1SAHO86(Z<0z}{V5J~^{xbENh3@HId jd_;Og;AyiO4J8KzB78(*vqKcs0R<>C005G+9TrO;;(aww delta 129 zcmV-{0Dk}IYUpaPWC0Ybk>52gz)Gcau}|M#};-}neA j0Y>0ydPK7t4J8KzBYZ?-vqKcs0R==e005A)9TrO;Qt~tL diff --git a/prebuilt/games/usr/bin/tetris b/prebuilt/games/usr/bin/tetris index 77556a81e9bddf5c7412df18950ad18290da6507..10d304463f7700bdf552e3c8462ed2a1656fb0ed 100755 GIT binary patch delta 130 zcmV-|0Db@DYUFCLWC0YrJ_<&{(c|g`_%D^x{igj->W`MQcmX8~M>2dw13Mc!Un|7v z10&qOU?U@8Un)TJ)P#v>03^-n05S)Z0V2)m1SAHO86(Z<0z}{VC`$kLzV6@nBq{+$ kd_;Og)c7O=v*ZkY2?Qd1MB-}pRA&FKImd_({v2a^FJ&FKR&&FKX*0+Sj>|M$G^-}oRZ k0Y=pLBm;Uxv*ZkY2?Qg2MB|fX7Lx^hGXMbUv;7ul9w*5*jsO4v diff --git a/src/games/snake.cpp b/src/games/snake.cpp index 797f28c..e4fa960 100644 --- a/src/games/snake.cpp +++ b/src/games/snake.cpp @@ -287,11 +287,16 @@ static void setup_window() { screen = DefaultScreen(dpy); int sw = DisplayWidth(dpy, screen); int scrH = DisplayHeight(dpy, screen); - winW = sw; - winH = scrH - TOPBAR; // fill the area below the status bar + // dwm draws a `borderpx` border around every client (src/sxmo-dwm/config.h). + // Size/position the window so that, once dwm adds its border back on each + // side, the framed window exactly meets the screen edges and the native + // border stays fully visible instead of being clipped off the right/bottom. + int bw = 1; // must match dwm borderpx + winW = sw - 3 * bw; + winH = (scrH - TOPBAR) - 3 * bw; // room for the status bar + border if (winW < 96) winW = 96; if (winH < 96) winH = 96; - win = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0, winW, winH, 0, + win = XCreateWindow(dpy, RootWindow(dpy, screen), bw, TOPBAR + bw, winW, winH, 0, CopyFromParent, InputOutput, CopyFromParent, 0, nullptr); XStoreName(dpy, win, "Snake"); XClassHint* ch = XAllocClassHint(); diff --git a/src/games/tetris.cpp b/src/games/tetris.cpp index 5d71159..1a6e8e7 100644 --- a/src/games/tetris.cpp +++ b/src/games/tetris.cpp @@ -329,11 +329,16 @@ static void setup_window() { screen = DefaultScreen(dpy); int sw = DisplayWidth(dpy, screen); int scrH = DisplayHeight(dpy, screen); - winW = sw; - winH = scrH - TOPBAR; // fill the area below the status bar + // dwm draws a `borderpx` border around every client (src/sxmo-dwm/config.h). + // Size/position the window so that, once dwm adds its border back on each + // side, the framed window exactly meets the screen edges and the native + // border stays fully visible instead of being clipped off the right/bottom. + int bw = 1; // must match dwm borderpx + winW = sw - 3 * bw; + winH = (scrH - TOPBAR) - 3 * bw; // room for the status bar + border if (winW < 96) winW = 96; if (winH < 96) winH = 96; - win = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0, winW, winH, 0, + win = XCreateWindow(dpy, RootWindow(dpy, screen), bw, TOPBAR + bw, winW, winH, 0, CopyFromParent, InputOutput, CopyFromParent, 0, nullptr); XStoreName(dpy, win, "Tetris"); XClassHint* ch = XAllocClassHint();