aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadAd <adamgates84+github@gmail.com>2019-07-15 10:57:33 +1000
committerRadAd <adamgates84+github@gmail.com>2019-07-15 10:57:33 +1000
commit18d6af8d54bce0d270e495013370e76910713617 (patch)
tree1d332937d7926a128ca2e9cc240de0ff3e890e8c
parentff198de91521e9c048670a18ec3df717b9dc7495 (diff)
downloadRadTerminal-18d6af8d54bce0d270e495013370e76910713617.tar.gz
RadTerminal-18d6af8d54bce0d270e495013370e76910713617.zip
Fix for WM_MOUSEACTIVATE with MDI child windows
-rw-r--r--RadTerminal.cpp13
-rw-r--r--RadTerminal.vcxproj4
-rw-r--r--RadTerminalFrame.cpp2
3 files changed, 14 insertions, 5 deletions
diff --git a/RadTerminal.cpp b/RadTerminal.cpp
index 012888e..05ebfd5 100644
--- a/RadTerminal.cpp
+++ b/RadTerminal.cpp
@@ -169,7 +169,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR pCmdLine, int nCmdSho
HWND hWnd = NULL;
HWND hWndMDIClient = NULL;
HACCEL hAccel = NULL;
- bool bMDI = true;
+ bool bMDI = false;
CHECK(GetRadTerminalAtom(hInstance), EXIT_FAILURE);
@@ -190,7 +190,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR pCmdLine, int nCmdSho
CHECK(UnadjustWindowRectEx(&r, GetWindowStyle(hChildWnd), GetMenu(hChildWnd) != NULL, GetWindowExStyle(hChildWnd)), EXIT_FAILURE);
CHECK(AdjustWindowRectEx(&r, GetWindowStyle(hWnd), GetMenu(hWnd) != NULL, GetWindowExStyle(hWnd)), EXIT_FAILURE);
CHECK(SetWindowPos(hWnd, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOMOVE | SWP_NOZORDER), EXIT_FAILURE);
- CHECK(ShowWindow(hChildWnd, SW_MAXIMIZE), EXIT_FAILURE);
+ ShowWindow(hChildWnd, SW_MAXIMIZE);
}
}
else
@@ -210,10 +210,9 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR pCmdLine, int nCmdSho
);
CHECK(hWnd, EXIT_FAILURE);
- CHECK(ShowWindow(hWnd, nCmdShow), EXIT_FAILURE);
+ ShowWindow(hWnd, nCmdShow);
}
-
MSG msg = {};
while (GetMessage(&msg, (HWND) NULL, 0, 0))
{
@@ -1023,8 +1022,12 @@ void RadTerminalWindowOnKeyDown(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UIN
int RadTerminalWindowOnMouseActivate(HWND hWnd, HWND hwndTopLevel, UINT codeHitTest, UINT msg)
{
int result = FORWARD_WM_MOUSEACTIVATE(hWnd, hwndTopLevel, codeHitTest, msg, MyDefWindowProc);
- if (result == MA_ACTIVATE && codeHitTest == HTCLIENT)
+ static HWND s_hWnd = NULL; // MDI Windows get a WM_MOUSE_ACTIVATE on every mouse click, not just the first to make it active
+ if (s_hWnd != hWnd && result == MA_ACTIVATE && codeHitTest == HTCLIENT)
+ {
+ s_hWnd = hWnd;
return MA_ACTIVATEANDEAT;
+ }
return result;
}
diff --git a/RadTerminal.vcxproj b/RadTerminal.vcxproj
index 9b27af0..b5f092b 100644
--- a/RadTerminal.vcxproj
+++ b/RadTerminal.vcxproj
@@ -78,6 +78,8 @@
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">kernel32.lib;user32.lib;gdi32.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">kernel32.lib;user32.lib;gdi32.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
@@ -91,6 +93,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">kernel32.lib;user32.lib;gdi32.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">kernel32.lib;user32.lib;gdi32.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
diff --git a/RadTerminalFrame.cpp b/RadTerminalFrame.cpp
index defcd0e..9ed7ebf 100644
--- a/RadTerminalFrame.cpp
+++ b/RadTerminalFrame.cpp
@@ -59,6 +59,8 @@ BOOL RadTerminalFrameOnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
HWND hWndMDIClient = CreateWindow(TEXT("MDICLIENT"), (LPCTSTR) NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
0, 0, 0, 0, hWnd, (HMENU) 0, hInst, (LPSTR) &ccs);
+ if (hWndMDIClient == NULL)
+ return FALSE;
ShowWindow(hWndMDIClient, SW_SHOW);