From a34fe03eef9cfd5311230a67fd45d821ab4999ff Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 11 Apr 2015 12:40:09 -0400 Subject: [PATCH] Decided to disable the initial parent window on Windows. If this causes problems, I can re-enable it later. More TODOs. --- new/init_windows.c | 2 ++ new/initparent_windows.c | 6 ++++-- new/main_windows.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/new/init_windows.c b/new/init_windows.c index 2b24e0a..ed0bf6a 100644 --- a/new/init_windows.c +++ b/new/init_windows.c @@ -40,6 +40,8 @@ static const char *loadLastError(const char *message) wmessage = toUTF16(message); n = _scwprintf(initErrorFormat, initErrorArgs); wstr = (WCHAR *) uiAlloc((n + 1) * sizeof (WCHAR), "WCHAR[]"); + // TODO this requires -lmsvcr100; find out if that runs on XP RTM/SP1 + // TODO find replacement swprintf_s(wstr, n + 1, initErrorFormat, initErrorArgs); str = toUTF8(wstr); uiFree(wstr); diff --git a/new/initparent_windows.c b/new/initparent_windows.c index 9f115c1..dc7524b 100644 --- a/new/initparent_windows.c +++ b/new/initparent_windows.c @@ -2,7 +2,7 @@ #include "uipriv_windows.h" // for maximum safety, all controls that don't have a parent are made children of this, the "initial parent" -// it behaves like other containers due to bugs described in container_windows.c, but is never seen and cannot be interacted with by end users +// it behaves like other containers due to bugs described in container_windows.c, but is never seen, is disabled, and cannot be interacted with by end users // despite being called the initial parent, it is used whenever a control has no parent, even if it loses its parent at some later point during the execution of the program #define uiInitialParentClass L"uiInitialParentClass" @@ -41,6 +41,8 @@ const char *initInitialParent(HICON hDefaultIcon, HCURSOR hDefaultCursor) if (initialParent == NULL) return "creating initial parent window"; - // TODO disable? + // just to be safe, disable the initial parent so it can't be interacted with accidentally + // if this causes issues for our controls, we can remove it + EnableWindow(initialParent, FALSE); return NULL; } diff --git a/new/main_windows.c b/new/main_windows.c index bd973b7..0b6b407 100644 --- a/new/main_windows.c +++ b/new/main_windows.c @@ -1,7 +1,7 @@ // 6 april 2015 #include "uipriv_windows.h" -// #qo LDFLAGS: -luser32 -lkernel32 -lgdi32 -luxtheme -lmsimg32 -lcomdlg32 -lole32 -loleaut32 -loleacc -luuid +// #qo LDFLAGS: -luser32 -lkernel32 -lgdi32 -luxtheme -lmsimg32 -lcomdlg32 -lole32 -loleaut32 -loleacc -luuid -lmsvcr100 static void uimsgloop_else(MSG *msg) {