diff options
-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; |