]> granicus.if.org Git - nethack/commitdiff
partial fix for #K3262 - X11 perm_invent panic
authorPatR <rankin@nethack.org>
Sun, 7 Feb 2021 00:04:44 +0000 (16:04 -0800)
committerPatR <rankin@nethack.org>
Sun, 7 Feb 2021 00:04:44 +0000 (16:04 -0800)
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.

doc/fixes37.0
win/X11/winX.c

index f7dc5b31bf324c8a6fad95d5c2e5ce4de830d220..3d7b4be45c8fad11d9b295827c7ccfdb048be9d5 100644 (file)
@@ -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
index daa06622fb58080318492c738f178037528203ee..303886d2412de4c51491bcc4b58484eb4192fb86 100644 (file)
@@ -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;