Merge branch 'NetHack-3.6.2'
This commit is contained in:
@@ -571,8 +571,6 @@ char ch;
|
||||
break;
|
||||
default:
|
||||
|
||||
// Temporary fix. Tty putstatusfield()
|
||||
|
||||
inverse = (console.current_nhattr[ATR_INVERSE] && iflags.wc_inverse);
|
||||
console.attr = (inverse) ?
|
||||
ttycolors_inv[console.current_nhcolor] :
|
||||
@@ -1666,6 +1664,12 @@ void set_cp_map()
|
||||
int count = MultiByteToWideChar(codePage, 0, &c, 1,
|
||||
&console.cpMap[i], 1);
|
||||
nhassert(count == 1);
|
||||
|
||||
// If a character was mapped to unicode control codes,
|
||||
// remap to the appropriate unicode character per our
|
||||
// code page 437 mappings.
|
||||
if (console.cpMap[i] < 32)
|
||||
console.cpMap[i] = cp437[console.cpMap[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,3 +44,40 @@ void win10_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void win10_monitor_size(HWND hWnd, int * width, int * height)
|
||||
{
|
||||
HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO info;
|
||||
info.cbSize = sizeof(MONITORINFO);
|
||||
BOOL success = GetMonitorInfo(monitor, &info);
|
||||
nhassert(success);
|
||||
*width = info.rcMonitor.right - info.rcMonitor.left;
|
||||
*height = info.rcMonitor.bottom - info.rcMonitor.top;
|
||||
}
|
||||
|
||||
int win10_monitor_dpi(HWND hWnd)
|
||||
{
|
||||
UINT monitorDpi = 96;
|
||||
|
||||
if (gWin10.Valid) {
|
||||
monitorDpi = gWin10.GetDpiForWindow(hWnd);
|
||||
if (monitorDpi == 0)
|
||||
monitorDpi = 96;
|
||||
}
|
||||
|
||||
monitorDpi = max(96, monitorDpi);
|
||||
|
||||
return monitorDpi;
|
||||
}
|
||||
|
||||
double win10_monitor_scale(HWND hWnd)
|
||||
{
|
||||
return (double) win10_monitor_dpi(hWnd) / 96.0;
|
||||
}
|
||||
|
||||
void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo)
|
||||
{
|
||||
monitorInfo->scale = win10_monitor_scale(hWnd);
|
||||
win10_monitor_size(hWnd, &monitorInfo->width, &monitorInfo->height);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,19 @@ typedef struct {
|
||||
GetDpiForWindowProc GetDpiForWindow;
|
||||
} Win10;
|
||||
|
||||
typedef struct {
|
||||
double scale; // dpi of monitor / 96
|
||||
int width; // in pixels
|
||||
int height; // in pixels
|
||||
} MonitorInfo;
|
||||
|
||||
extern Win10 gWin10;
|
||||
|
||||
void win10_init();
|
||||
int win10_monitor_dpi(HWND hWnd);
|
||||
double win10_monitor_scale(HWND hWnd);
|
||||
void win10_monitor_size(HWND hWnd, int * width, int * height);
|
||||
void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo);
|
||||
|
||||
#endif // WIN10_H
|
||||
|
||||
#endif // WIN10_H
|
||||
|
||||
@@ -37,9 +37,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* runtime cursor display control switch */
|
||||
boolean win32_cursorblink;
|
||||
|
||||
/* globals required within here */
|
||||
HANDLE ffhandle = (HANDLE) 0;
|
||||
WIN32_FIND_DATA ffd;
|
||||
|
||||
typedef HWND(WINAPI *GETCONSOLEWINDOW)();
|
||||
static HWND GetConsoleHandle(void);
|
||||
static HWND GetConsoleHwnd(void);
|
||||
@@ -581,6 +585,25 @@ BOOL winos_font_support_cp437(HFONT hFont)
|
||||
return allFound;
|
||||
}
|
||||
|
||||
int
|
||||
windows_early_options(window_opt)
|
||||
const char *window_opt;
|
||||
{
|
||||
/*
|
||||
* If you return 2, the game will exit before it begins.
|
||||
* Return 1, to say the option parsed okay.
|
||||
* Return 0, to say the option was bad.
|
||||
*/
|
||||
|
||||
if (match_optname(window_opt, "cursorblink", 5, FALSE)) {
|
||||
win32_cursorblink = TRUE;
|
||||
return 1;
|
||||
} else {
|
||||
raw_printf(
|
||||
"-%swindows:cursorblink is the only supported option.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*winnt.c*/
|
||||
/*winnt.c*/
|
||||
|
||||
Reference in New Issue
Block a user