]> granicus.if.org Git - nethack/commitdiff
extended command menu for X11
authorPatR <rankin@nethack.org>
Sun, 14 Feb 2016 02:06:50 +0000 (18:06 -0800)
committerPatR <rankin@nethack.org>
Sun, 14 Feb 2016 02:06:50 +0000 (18:06 -0800)
When the extended command menu is big enough to need a scrollbar,
leave more elbow room when forcing its height to fit on screen.
The last entry was frequently obscured by OSX's "docking tray"
desktop decoration and the resize hotspot (bottom right corner of
the menu popup) could be hard to access.

I'm not particularly happy with this code.  There really has to be
a better way to accomplish what's needed.

win/X11/winmisc.c

index 136002f46bc162e265cdef77e0ed098b9f228c74..114d8b3d6ff1f4257cd4803d46d2f6b31d34f7e5 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 winmisc.c       $NHDT-Date: 1455389908 2016/02/13 18:58:28 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ */
+/* NetHack 3.6 winmisc.c       $NHDT-Date: 1455415590 2016/02/14 02:06:30 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.23 $ */
 /* Copyright (c) Dean Luick, 1992                                 */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1154,11 +1154,18 @@ Widget *formp; /* return */
      * scroll bar (enabled but not forced above) to be included.
      */
     if (cumulative_height >= screen_height) {
-        /* trial and error:  25 is a guesstimate for scrollbar width on
-           width adjustment and for title bar height on height adjustment */
+        /* trial and error:
+           25 is a guesstimate for scrollbar width on width adjustment;
+           75 is for cumulative height of 3 title bars (desktop,
+           application, and popup) on height adjustment; that will be
+           bigger than needed if the popup can overlap the application's
+           title bar or if there is no desktop title bar; this ought to
+           be deriveable on the fly, or at least user-controlled by a
+           resource, but for now it's hardcoded--user can manually
+           resize if sufficiently motivated... */
         num_args = 0;
         XtSetArg(args[num_args], XtNwidth, max_width + 25); num_args++;
-        XtSetArg(args[num_args], XtNheight, screen_height - 25); num_args++;
+        XtSetArg(args[num_args], XtNheight, screen_height - 75); num_args++;
         XtSetValues(popup, args, num_args);
     }
     XtRealizeWidget(popup);