diff options
author | John Ankarström <john@ankarstrom.se> | 2022-03-31 22:43:29 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-03-31 22:43:29 +0200 |
commit | a1f686d1b4f74d414ca0909b2af73bb10e0ec597 (patch) | |
tree | 931a5b64435394adb36b33c5a145c32eca7bcc89 | |
parent | d550b8226f350ae43d873d2ccafbae0ecd4c1a42 (diff) | |
download | EpisodeBrowser-a1f686d1b4f74d414ca0909b2af73bb10e0ec597.tar.gz |
Fix child window focus on re-activation.
-rw-r--r-- | c/main.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -9,6 +9,7 @@ HFONT HfNormal; HFONT HfBold; HMENU HPopupMenu; +HWND HFocus; HWND HWnd; static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM); @@ -36,7 +37,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, tszErr = TEXT("Could not attach databases."); if (!Attach()) goto f; - /* Initialize window. */ + /* Initialize common controls, load menu and register window class. */ icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; @@ -59,6 +60,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, tszErr = TEXT("Could not register window class."); if (!RegisterClassEx(&wc)) goto f; + /* Create window. */ + hWnd = CreateWindowEx( 0, TEXT("EpisodeBrowser"), @@ -69,7 +72,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, ); tszErr = TEXT("Could not create main window."); if (!hWnd) goto f; - SetupFonts(); ShowWindow(hWnd, nCmdShow); @@ -108,10 +110,12 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } case WM_CREATE: { + extern HWND HElv; HWnd = hWnd; DlvCreate(); ElvCreate(); UpdateTheme(); + SetFocus(HElv); break; } case WM_THEMECHANGED: @@ -120,13 +124,12 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_ACTIVATE: switch (wParam) { term_t t; - extern HWND HElv; case WA_INACTIVE: + HFocus = GetFocus(); break; case WA_ACTIVE: - SetFocus(HElv); - /* FALLTHROUGH */ case WA_CLICKACTIVE: + SetFocus(HFocus); t = T(0); P("track_episodes","update_tracked_episodes",0,t); ElvRedraw(); |