diff -Naur xtetris-2.6/main.c xtetris-2.6.patched/main.c --- xtetris-2.6/main.c 1995-02-11 01:39:36.000000000 -0500 +++ xtetris-2.6.patched/main.c 2024-11-29 16:49:29.916217179 -0500 @@ -104,6 +104,27 @@ #include #include +Atom wm_delete_window; + +/* Xt decides the geometry of the toplevel window, based on the layout of + its child widgets. pin_geometry() gets the toplevel window geometry + and makes that the only size allowed. Normal window manages won't + allow resizing the window after this. Tiling WMs ignore size hints, + but there's nothing we can do about that... */ +static void pin_geometry(Display *display, Widget widget) { + XtWidgetGeometry geom; + Window *win; + XSizeHints size_hints; + + win = XtWindow(widget); + XtQueryGeometry(widget, NULL, &geom); + + size_hints.flags = PMinSize | PMaxSize; + size_hints.min_width = size_hints.max_width = geom.width; + size_hints.min_height = size_hints.max_height = geom.height; + XSetWMNormalHints(display, win, &size_hints); +} + int main(argc, argv, envp) int argc; char **argv; @@ -161,6 +182,9 @@ Resources, XtNumber(Resources), NULL, (Cardinal) 0); XtAppAddActions( context, actions, XtNumber(actions) ); + + XtOverrideTranslations(toplevel, + XtParseTranslationTable("WM_PROTOCOLS: Quit()\n")); if (resources.quayle) resources.usescorefile = False; @@ -221,6 +245,11 @@ XtInstallAllAccelerators( frame, toplevel ); XtRealizeWidget(toplevel); + pin_geometry(display, toplevel); + + wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False); + (void) XSetWMProtocols(display, XtWindow(toplevel), &wm_delete_window, 1); + XtMapWidget(toplevel); {