From: PatR Date: Fri, 4 Mar 2016 08:13:23 +0000 (-0800) Subject: X11 extcmd_height_delta resourse X-Git-Tag: NetHack-3.6.1_RC01~889 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef9cd1794276f3a69ea93de3f1ea4825c6ceabc6;p=nethack X11 extcmd_height_delta resourse Umpteenth revision of the X11 extended command menu. Add a new resource to NetHack.ad to control its initial size. I still hope there's a better way to do this, but this is my last shot at it. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 02618470f..f1f03b2cc 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -251,6 +251,11 @@ unix: add CHECK_PLNAME-option to sysconf to make WIZARDS, EXPLORERS, and X11: new NetHack*highlight_prompt resource to control whether the persistent prompt line between the map and message windows for the NetHack*slow configuration will be highlighted when it's expecting input +X11: NetHack*extcmd_height_delta resource can be used to adjust initial size + of the extended commands menu +X11: status display split into three columns to accomodate Stone/Deaf/Lev/&c; + NetHack*status_condition.foreground, .background, and .showGrip + resources replaced by status_condition[1-3].* NetHack Community Patches (or Variation) Included diff --git a/include/winX.h b/include/winX.h index 78648c8b4..796121405 100644 --- a/include/winX.h +++ b/include/winX.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 winX.h $NHDT-Date: 1454977916 2016/02/09 00:31:56 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ */ +/* NetHack 3.6 winX.h $NHDT-Date: 1457079196 2016/03/04 08:13:16 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.23 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -252,6 +252,7 @@ typedef struct { String tile_file; /* name of file to open for tiles */ String icon; /* name of desired icon */ int message_lines; /* number of lines to attempt to show */ + int extcmd_height_delta; /* bottom margin for extended command menu */ String pet_mark_bitmap; /* X11 bitmap file used to mark pets */ Pixel pet_mark_color; /* color of pet mark */ String pilemark_bitmap; /* X11 bitmap file used to mark item piles */ diff --git a/win/X11/NetHack.ad b/win/X11/NetHack.ad index 89a29fd58..0ad47b36b 100644 --- a/win/X11/NetHack.ad +++ b/win/X11/NetHack.ad @@ -1,4 +1,4 @@ -! $NHDT-Date: 1454977917 2016/02/09 00:31:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ +! $NHDT-Date: 1457079198 2016/03/04 08:13:18 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.11 $ ! The display_file, tombstone, and menu windows are all formatted assuming ! a fixed width font. Text windows may or may not be formatted as above. @@ -188,6 +188,15 @@ NetHack*extended_commands*help.accelerators: #override\n\ :?: set() notify() unset() NetHack*extended_commands*dismiss.accelerators: #override\n\ Escape: set() notify() unset() +! +! The extended command menu may be too big to fit on the screen so need +! a vertical scroll bar. When truncated, its height will be as tall as +! possible unless height_delta is non-zero, in which case there will be +! that many pixels of margin left unused. On OSX, this can be used to +! avoid overlapping with the desktop docking tray to prevent that from +! obscuring the bottom of the menu. +NetHack*extcmd_height_delta: 75 + ! ! ! The following are the default 15 colors that the nethack map uses. diff --git a/win/X11/winX.c b/win/X11/winX.c index 491f6f11e..25229541a 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 winX.c $NHDT-Date: 1455389907 2016/02/13 18:58:27 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.40 $ */ +/* NetHack 3.6 winX.c $NHDT-Date: 1457079197 2016/03/04 08:13:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.41 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -1064,6 +1064,9 @@ static XtResource resources[] = { XtOffset(AppResources *, icon), XtRString, nhStr("nh72") }, { nhStr("message_lines"), nhStr("Message_lines"), XtRInt, sizeof(int), XtOffset(AppResources *, message_lines), XtRString, nhStr("12") }, + { nhStr("extcmd_height_delta"), nhStr("Extcmd_height_delta"), + XtRInt, sizeof (int), + XtOffset(AppResources *, extcmd_height_delta), XtRString, nhStr("0") }, { nhStr("pet_mark_bitmap"), nhStr("Pet_mark_bitmap"), XtRString, sizeof(String), XtOffset(AppResources *, pet_mark_bitmap), XtRString, nhStr("pet_mark.xbm") }, diff --git a/win/X11/winmisc.c b/win/X11/winmisc.c index 23253f4a3..f9d4a248a 100644 --- a/win/X11/winmisc.c +++ b/win/X11/winmisc.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 winmisc.c $NHDT-Date: 1455526714 2016/02/15 08:58:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.24 $ */ +/* NetHack 3.6 winmisc.c $NHDT-Date: 1457079197 2016/03/04 08:13:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.25 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -1199,36 +1199,20 @@ Widget *formp; /* return */ else free((char *) commands); - /* - * We actually want height of topmost background window, which - * may or may not be the root window. - * - * On OSX, screen height includes the space taken up by the - * desktop title bar, which isn't accessible to applications - * unless the preference settings for X11 are changed to force - * full-screen mode (so by default, this 'screen_height' value - * ends up being bigger than the available size...). - */ - screen_height = XHeightOfScreen(XtScreen(popup)); - /* * If the menu's complete height is too big for the display, * forcing the height to be smaller will cause the vertical * scroll bar (enabled but not forced above) to be included. */ + screen_height = XHeightOfScreen(XtScreen(popup)); + screen_height -= appResources.extcmd_height_delta; /* NetHack.ad */ if (cumulative_height >= screen_height) { - /* 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... */ + /* 25 is a guesstimate for scrollbar width; + window manager might override the request for y==1 */ num_args = 0; + XtSetArg(args[num_args], XtNy, 1); num_args++; XtSetArg(args[num_args], XtNwidth, max_width + 25); num_args++; - XtSetArg(args[num_args], XtNheight, screen_height - 75); num_args++; + XtSetArg(args[num_args], XtNheight, screen_height - 1); num_args++; XtSetValues(popup, args, num_args); } XtRealizeWidget(popup);