use ctrl_nhwindow() for menu prompt style
This implements the mechanics to use the ctrl_nhwindow() interface capability to pass down a setting change from the core to the active window port, without resorting to accessing a core global variable from within the window port, and without altering the interface.. The passed setting is honored in the tty and curses window ports. X11 and mswin receive and store the values, but no implementation to change the menu prompt style is there yet. Qt does not store the values or have an implementation. The setting change is done in allmain.c immediately after creating the WIN_INVEN window.
This commit is contained in:
@@ -662,6 +662,7 @@ void
|
||||
init_sound_disp_gamewindows(void)
|
||||
{
|
||||
int menu_behavior = MENU_BEHAVE_STANDARD;
|
||||
color_attr menu_promptstyle = { NO_COLOR, ATR_INVERSE };
|
||||
|
||||
activate_chosen_soundlib();
|
||||
|
||||
@@ -680,6 +681,8 @@ init_sound_disp_gamewindows(void)
|
||||
}
|
||||
WIN_MAP = create_nhwindow(NHW_MAP);
|
||||
WIN_INVEN = create_nhwindow(NHW_MENU);
|
||||
if (WIN_INVEN != WIN_ERR)
|
||||
adjust_menu_promptstyle(WIN_INVEN, &menu_promptstyle);
|
||||
#ifdef TTY_PERM_INVENT
|
||||
if (WINDOWPORT(tty) && WIN_INVEN != WIN_ERR) {
|
||||
menu_behavior = MENU_BEHAVE_PERMINV;
|
||||
|
||||
@@ -45,7 +45,6 @@ static void itemactions_pushkeys(struct obj *, int);
|
||||
static void mime_action(const char *);
|
||||
|
||||
/* enum and structs are defined in wintype.h */
|
||||
static win_request_info zerowri = { { 0L, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0 } };
|
||||
static win_request_info wri_info;
|
||||
static int perminv_flags = InvOptNone;
|
||||
static boolean in_perm_invent_toggled;
|
||||
|
||||
@@ -1593,6 +1593,20 @@ mixed_to_glyphinfo(const char *str, glyph_info *gip)
|
||||
return str;
|
||||
}
|
||||
|
||||
/* enum and structs are defined in wintype.h */
|
||||
|
||||
win_request_info zerowri = { { 0L, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, { NO_COLOR, ATR_NONE }}};
|
||||
|
||||
void
|
||||
adjust_menu_promptstyle(winid window, color_attr *style)
|
||||
{
|
||||
win_request_info wri = zerowri;
|
||||
wri.fromcore.menu_promptstyle.color = style->color;
|
||||
wri.fromcore.menu_promptstyle.attr = style->attr;
|
||||
/* relay the style change to the window port */
|
||||
(void) ctrl_nhwindow(window, set_menu_promptstyle, &wri);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common code point leading into the interface-specifc
|
||||
|
||||
Reference in New Issue
Block a user