aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/c/main.c b/c/main.c
index 09227b9..b7986c1 100644
--- a/c/main.c
+++ b/c/main.c
@@ -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();