fixes3-7-0.txt catch-up; also replace some magic hex numbers

This commit is contained in:
nhmall
2025-06-30 09:04:41 -04:00
parent 2b0530a5ed
commit 1ece615eb2
2 changed files with 12 additions and 6 deletions

View File

@@ -2228,6 +2228,9 @@ X11: when trying to lookup scrollbars in order to handle scrolling via keys,
X11: enable horizontal scrollbar for persistent inventory window
X11: if a group accelerator matched a menu command ('^' in menu for '/')
it wouldn't work to select, just to manipulate the menu
X11: ascii_map could try to use a color value, with some added flag bits set,
as an index into the color_gcs[] and inv_color_gcs[] arrays leading
to a segfault; clear the flag bits before using the color as an index
X11+macOS: after the "bad Atom" fix (below), the persistent inventory window
crept downward every time it got updated

View File

@@ -56,6 +56,9 @@ extern int total_tiles_used, Tile_corr;
#define COL0_OFFSET 1 /* change to 0 to revert to displaying unused column 0 */
#define NH_INVERSE_COLOR 0x40000000
#define NH_ENHANCED_COLOR 0x80000000
static X11_map_symbol glyph_char(const glyph_info *glyphinfo);
static GC X11_make_gc(struct xwindow *wp, struct text_map_info_t *text_map,
X11_color color, boolean inverted);
@@ -170,9 +173,9 @@ X11_print_glyph(
? CLR_MAX : 0;
color += colordif;
if (nhcolor != 0)
color = nhcolor | 0x80000000;
color = nhcolor | NH_ENHANCED_COLOR;
if (colordif != 0)
color |= 0x40000000;
color |= NH_INVERSE_COLOR;
if (*co_ptr != color) {
*co_ptr = color;
@@ -1528,9 +1531,9 @@ X11_make_gc(
GC ggc;
#ifdef ENHANCED_SYMBOLS
if ((color & 0x80000000) != 0) {
if ((color & NH_ENHANCED_COLOR) != 0) {
/* We need a new GC */
if ((color & 0x40000000) != 0) {
if ((color & NH_INVERSE_COLOR) != 0) {
cur_inv = !cur_inv;
}
if (iflags.use_color) {
@@ -1540,7 +1543,7 @@ X11_make_gc(
/* FIXME: Does this still work when the display does not support
true color? */
fgpixel = color & 0xFFFFFF;
fgpixel = COLORVAL(color);
XtSetArg(arg[0], XtNbackground, &bgpixel);
XtGetValues(wp->w, arg, 1);
if (cur_inv) {
@@ -1580,7 +1583,7 @@ X11_make_gc(
static void
X11_free_gc(struct xwindow *wp, GC ggc, X11_color color)
{
if ((color & 0x80000000) != 0 && iflags.use_color) {
if ((color & NH_ENHANCED_COLOR) != 0 && iflags.use_color) {
/* X11_make_gc allocated a new GC */
XtReleaseGC(wp->w, ggc);
}