system/xtrs: Fix window close button.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-05-17 15:34:59 -04:00 committed by Willy Sudiarto Raharjo
parent 865dfb9fe2
commit 6f1d2d54cd
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
3 changed files with 44 additions and 4 deletions

View File

@ -9,6 +9,3 @@ density, and even hard disk drives.
A simple xtrs.desktop file is included that will start xtrs with the
default options. Read the included 'xtrs' man page after installation
for more information and command-line options.
Note for first-time users: press F8 to exit xtrs. The regular
window-close button is non-functional.

View File

@ -0,0 +1,35 @@
diff -Naur xtrs-4.9d/trs_xinterface.c xtrs-4.9d.patched/trs_xinterface.c
--- xtrs-4.9d/trs_xinterface.c 2009-06-15 23:23:09.000000000 -0400
+++ xtrs-4.9d.patched/trs_xinterface.c 2023-05-17 15:31:29.237827697 -0400
@@ -730,6 +730,7 @@
Colormap color_map;
XColor cdef;
XGCValues gcvals;
+ Atom wm_delete_window;
char *fontname = NULL;
char *widefontname = NULL;
int len;
@@ -737,6 +738,7 @@
screen = DefaultScreen(display);
color_map = DefaultColormap(display,screen);
+ wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
(void) sprintf(option, "%s%s", program_name, ".foreground");
if (XrmGetResource(x_db, option, "Xtrs.Foreground", &type, &value)) {
@@ -937,6 +939,7 @@
trs_fix_size(window, OrigWidth, OrigHeight);
XStoreName(display,window,title);
XSelectInput(display, window, EVENT_MASK);
+ XSetWMProtocols(display, window, &wm_delete_window, 1);
(void) sprintf(option, "%s%s", program_name, ".iconic");
if (XrmGetResource(x_db, option, "Xtrs.Iconic", &type, &value)) {
@@ -1002,6 +1005,7 @@
if (wait) {
XNextEvent(display, &event);
} else {
+ if (XCheckTypedEvent(display, ClientMessage, &event)) trs_exit();
if (!XCheckMaskEvent(display, ~0, &event)) return;
}

View File

@ -7,6 +7,10 @@
# There was no license on the original version. Modified version is
# licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20230517 bkw: BUILD=4
# - include patch from Jens Guenther (sdltrs upstream maintainer) to
# make the window close button work.
# 20230418 bkw: BUILD=3
# - new maintainer.
# - use ROMs from trs80-roms package by default.
@ -21,7 +25,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=xtrs
VERSION=${VERSION:-4.9d}
BUILD=${BUILD:-3}
BUILD=${BUILD:-4}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -72,6 +76,10 @@ find . -type f -a -exec chmod 644 {} + -o \
# - use correct app-defaults dir.
patch -p1 < $CWD/sbo.diff
# 20230517 bkw: Jens Guenther's "quick and dirty" patch to make the
# windowmanager's close button work. Many thanks!
patch -p1 < $CWD/window_close.diff
# 20230418 bkw: the -laoss here allows xtrs to make sound via ALSA
# or PulseAudio (via /etc/asound.conf).
make DEBUG="$SLKCFLAGS" EXTRALIBS="-laoss"