From: PatR Date: Sun, 7 Feb 2021 00:04:44 +0000 (-0800) Subject: partial fix for #K3262 - X11 perm_invent panic X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67d94d29309a31028debd3453d09005eda5aea93;p=nethack partial fix for #K3262 - X11 perm_invent panic Prevent the "X Error (bad Atom)" situation that causes an "X Error" panic. The issue isn't fixed. This fails to implement the intended functionality of having the X server remember the persistent inventory window's location across games (until the next time that the X server restarts). Worse, on OSX the window creeps each time it is updated (visually it seems to be moving down by the height of the window's title bar). That's not as bad as having it move to the pointer's location as it did in 3.6.1, but prior to the commit which introduced this code that had been fixed and it stayed put during the current game, so more work is definitely needed. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index f7dc5b31b..3d7b4be45 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.443 $ $NHDT-Date: 1612400970 2021/02/04 01:09:30 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.446 $ $NHDT-Date: 1612656277 2021/02/07 00:04:37 $ General Fixes and Modified Features ----------------------------------- @@ -657,6 +657,8 @@ X11: substantial overhaul of status display, both 'fancy' and 'tty-style' X11: extend fancy status one-turn inverse video status-change highlighting to hunger, encumbrance, and conditions X11: stop including unused column 0 in the map +X11: avoid 'bad Atom X Error' when perm_invent is enabled (seemingly window + manager dependent) General New Features diff --git a/win/X11/winX.c b/win/X11/winX.c index daa06622f..303886d24 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 winX.c $NHDT-Date: 1611105313 2021/01/20 01:15:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */ +/* NetHack 3.7 winX.c $NHDT-Date: 1612656277 2021/02/07 00:04:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.93 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -559,7 +559,9 @@ nhCvtStringToPixel(Display *dpy, XrmValuePtr args, Cardinal *num_args, /* Ask the WM for window frame size */ void -get_window_frame_extents(Widget w, long *top, long *bottom, long *left, long *right) +get_window_frame_extents(Widget w, + long *top, long *bottom, + long *left, long *right) { XEvent event; Display *dpy = XtDisplay(w); @@ -571,16 +573,19 @@ get_window_frame_extents(Widget w, long *top, long *bottom, long *left, long *ri unsigned char *data = 0; long *extents; + *top = *bottom = *left = *right = 0L; + prop = XInternAtom(dpy, "_NET_FRAME_EXTENTS", True); + if (prop == None) + return; while (XGetWindowProperty(dpy, win, prop, 0, 4, False, AnyPropertyType, &retprop, &retfmt, &nitems, &nbytes, &data) != Success - || nitems != 4 || nbytes != 0) - { - XNextEvent(dpy, &event); - } + || nitems != 4 || nbytes != 0) { + XNextEvent(dpy, &event); + } extents = (long *) data;