some mingw bits to move its gui variation closer to building and running

This commit is contained in:
nhmall
2020-06-11 12:26:44 -04:00
parent b87d2242af
commit f365bdd254
6 changed files with 43 additions and 16 deletions

View File

@@ -138,6 +138,10 @@ TARGET_CPU=x86
#
ADD_LUA=Y
LUATOP=../lib/lua-5.3.5
ifndef LUA_VERSION
LUA_VERSION=5.3.5
endif
#
#==============================================================================
# This marks the end of the BUILD DECISIONS section.
@@ -549,7 +553,7 @@ CFLAGSBASE = -c $(cflags) $(WINPINC) $(cdebug) $(CURSESDEF)
#LFLAGSBASEG = $(linkdebug) -mwindows
baselibs = -lwinmm -lshell32 -lole32 -luuid
conlibs = -lgdi32 $(baselibs) $(BCRYPT)
guilibs = -lcomctl32 $(baselibs)
guilibs = -lcomctl32 $(baselibs) $(BCRYPT)
ifeq "$(WANT_WIN_QT4)" "Y"
# Might be either Qt 4 or Qt 5
ifeq "$(HAVE_QT5)" "Y"
@@ -715,7 +719,7 @@ $(QT4)/%.moc : $(QT4)/%.h
ifeq "$(SKIP_NETHACKW)" "Y"
NETHACKW_EXE =
else
NETHACKW_EXE = $(GAMEDIR)/NetHack.exe
NETHACKW_EXE = $(GAMEDIR)/NetHackW.exe
endif
SHELL=CMD.EXE
@@ -1257,8 +1261,8 @@ endif
clean:
if exist initialchk del initialchk
if exist $(W_INCL)\nhlua.h del $(W_INCL)\nhlua.h
if exist $(O)install.tag del $(O)install.tag
if exist $(O)utility.tag del $(O)utility.tag
if exist $(W_OBJ)\install.tag del $(W_OBJ)\install.tag
if exist $(W_UTIL)utility.tag del $(W_UTIL)\utility.tag
ifneq "$(W_UTIL)" ""
if exist $(W_UTIL)\makedefs.exe del $(W_UTIL)\makedefs.exe
endif

View File

@@ -2,7 +2,6 @@
/* Copyright (C) 2018 by Bart House */
/* NetHack may be freely redistributed. See license for details. */
#ifdef _MSC_VER
#include "win10.h"
#include <process.h>
#include <VersionHelpers.h>
@@ -119,6 +118,3 @@ win10_is_desktop_bridge_application()
return FALSE;
}
#endif /* _MSC_VER */

View File

@@ -7,6 +7,28 @@
#include "win32api.h"
#ifdef __MINGW32__
#ifndef DECLARE_HANDLE
#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
#endif
DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
/* DPI awareness */
typedef enum DPI_AWARENESS
{
DPI_AWARENESS_INVALID = -1,
DPI_AWARENESS_UNAWARE = 0,
DPI_AWARENESS_SYSTEM_AWARE,
DPI_AWARENESS_PER_MONITOR_AWARE
} DPI_AWARENESS;
#define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
#endif
typedef struct {
double scale; // dpi of monitor / 96
int width; // in pixels

View File

@@ -10,8 +10,6 @@
#ifndef WIN32API
#define WIN32API
#if defined(_MSC_VER)
#if defined(HACK_H)
#error win32api.h must be included before hack.h
#endif
@@ -32,9 +30,10 @@
#error win32api.h should be included first
#endif
#if defined(_MSC_VER)
#pragma warning(disable : 4142) /* Warning, Benign redefinition of type */
#pragma pack(8)
#endif // _MSC_VER
#endif
#define WIN32_LEAN_AND_MEAN

View File

@@ -300,7 +300,7 @@ enum player_selector_control {
psc_control_count
};
static const s_psc_id[psc_control_count] = {
static const int s_psc_id[psc_control_count] = {
IDC_PLSEL_NAME_GROUP,
IDC_PLSEL_ROLE_GROUP,
IDC_PLSEL_RACE_GROUP,

View File

@@ -1333,12 +1333,18 @@ mswin_raw_print_flush()
{
if (raw_print_strbuf.str != NULL) {
int wlen = strlen(raw_print_strbuf.str) + 1;
TCHAR * wbuf = (TCHAR *) alloc(wlen * sizeof(TCHAR));
if (wbuf != NULL) {
NHMessageBox(GetNHApp()->hMainWnd,
if (strcmp(raw_print_strbuf.str, "\n") != 0
#ifdef _MSC_VER
|| IsDebuggerPresent()
#endif
) {
TCHAR * wbuf = (TCHAR *) alloc(wlen * sizeof(TCHAR));
if (wbuf != NULL) {
NHMessageBox(GetNHApp()->hMainWnd,
NH_A2W(raw_print_strbuf.str, wbuf, wlen),
MB_ICONINFORMATION | MB_OK);
free(wbuf);
free(wbuf);
}
}
strbuf_empty(&raw_print_strbuf);
}