diff options
author | Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> | 2021-10-07 07:57:30 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeffrey.armstrong@approximatrix.com> | 2021-10-07 07:57:30 -0400 |
commit | db80aa329a98983b1f767003ba45090346f8beb3 (patch) | |
tree | cd9f07d2a4d1db25019a0b2c44e046cf7a5e00da /RadTerminal.cpp | |
parent | b3676102a2ca1578220ef585d933732825ac196e (diff) | |
download | RadTerminal-db80aa329a98983b1f767003ba45090346f8beb3.tar.gz RadTerminal-db80aa329a98983b1f767003ba45090346f8beb3.zip |
Terminal now issues focus notifications to parent window when built as a DLL
Diffstat (limited to 'RadTerminal.cpp')
-rw-r--r-- | RadTerminal.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/RadTerminal.cpp b/RadTerminal.cpp index 57842c5..afed179 100644 --- a/RadTerminal.cpp +++ b/RadTerminal.cpp @@ -313,7 +313,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR pCmdLine, int nCmdSho CHECK(GetRadTerminalAtom(hInstance), EXIT_FAILURE); - if (bMDI) + if (FALSE && bMDI) { hWnd = CreateRadTerminalFrame(hInstance); CHECK(hWnd, EXIT_FAILURE); @@ -1252,15 +1252,34 @@ void RadTerminalWindowOnSysKeyDown(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, int RadTerminalWindowOnMouseActivate(HWND hWnd, HWND hwndTopLevel, UINT codeHitTest, UINT msg) { int result = FORWARD_WM_MOUSEACTIVATE(hWnd, hwndTopLevel, codeHitTest, msg, MyDefWindowProc); +#ifndef BUILD_AS_DLL 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) { -#ifndef BUILD_AS_DLL + s_hWnd = hWnd; -#endif + SetFocus(hWnd); return MA_ACTIVATEANDEAT; } + else if (result == MA_NOACTIVATE) + { + s_hWnd = NULL; + } +#else + if (result == MA_ACTIVATE && codeHitTest == HTCLIENT) { + NMHDR hdr; + if (hWnd != GetFocus()) { + SetFocus(hWnd); + + hdr.hwndFrom = hWnd; + hdr.idFrom = result; + hdr.code = NM_SETFOCUS; + SendMessage(GetParent(hWnd), WM_NOTIFY, (WPARAM)0, (LPARAM)&hdr); + result = MA_ACTIVATEANDEAT; + } + } +#endif return result; } @@ -1280,14 +1299,19 @@ void RadTerminalWindowOnLButtonDown(HWND hWnd, BOOL fDoubleClick, int x, int y, { FORWARD_WM_LBUTTONDOWN(hWnd, fDoubleClick, x, y, keyFlags, MyDefWindowProc); const RadTerminalData* const data = (RadTerminalData*) GetWindowLongPtr(hWnd, GWLP_USERDATA); + +#ifndef BUILD_AS_DLL if (MyGetActiveWnd(hWnd) == hWnd) { +#endif // TODO Handle fDoubleClick to select word SetCapture(hWnd); COORD pos = GetCellPos(&data->draw_info, { x, y }); tsm_screen_selection_start(data->screen, pos.X, pos.Y); InvalidateRect(hWnd, nullptr, TRUE); +#ifndef BUILD_AS_DLL } +#endif } void RadTerminalWindowOnLButtonUp(HWND hWnd, int x, int y, UINT keyFlags) @@ -1544,6 +1568,11 @@ LRESULT CALLBACK RadTerminalWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR HANDLE_STD_MSG(hWnd, WM_WATCH, RadTerminalWindowOnWatch); HANDLE_STD_MSG(hWnd, WM_READ, RadTerminalWindowOnRead); + //case WM_PASTE: + // ActionPasteFromClipboard(hWnd); + // return TRUE; + case WM_COPY: + return ActionCopyToClipboard(hWnd); case RADTERM_SETFORECOLOR: RadTerminalWindowOnSetForeColor(hWnd, (COLORREF)wParam); return TRUE; |