Commit 6cd9b1a3 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winhelp: Store reference to the popup (if any) as a WINHELP_WINDOW pointer.

parent 3f1b62f2
...@@ -56,7 +56,7 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW*); ...@@ -56,7 +56,7 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW*);
static void WINHELP_SetupText(HWND hWnd, ULONG relative); static void WINHELP_SetupText(HWND hWnd, ULONG relative);
static WINHELP_LINE_PART* WINHELP_IsOverLink(WINHELP_WINDOW*, WPARAM, LPARAM); static WINHELP_LINE_PART* WINHELP_IsOverLink(WINHELP_WINDOW*, WPARAM, LPARAM);
WINHELP_GLOBALS Globals = {3, NULL, NULL, TRUE, NULL, NULL, NULL, NULL, {{{NULL,NULL}},0}}; WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL,NULL}},0}};
#define CTL_ID_BUTTON 0x700 #define CTL_ID_BUTTON 0x700
#define CTL_ID_TEXT 0x701 #define CTL_ID_TEXT 0x701
...@@ -593,7 +593,9 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe ...@@ -593,7 +593,9 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
WINHELP_RememberPage(win, wpage); WINHELP_RememberPage(win, wpage);
} }
if (!bPopup) if (bPopup)
Globals.active_popup = win;
else
Globals.active_win = win; Globals.active_win = win;
/* Initialize default pushbuttons */ /* Initialize default pushbuttons */
...@@ -649,7 +651,6 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe ...@@ -649,7 +651,6 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
} }
WINHELP_LayoutMainWindow(win); WINHELP_LayoutMainWindow(win);
if (bPopup) Globals.hPopupWnd = win->hMainWnd;
ShowWindow(win->hMainWnd, nCmdShow); ShowWindow(win->hMainWnd, nCmdShow);
UpdateWindow(win->hMainWnd); UpdateWindow(win->hMainWnd);
...@@ -736,9 +737,9 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -736,9 +737,9 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
break; break;
} }
break; break;
case WM_DESTROY: /* EPP case WM_DESTROY: */
if (Globals.hPopupWnd) DestroyWindow(Globals.hPopupWnd); /* EPP if (Globals.hPopupWnd) DestroyWindow(Globals.hPopupWnd); */
break; /* EPP break; */
case WM_COPYDATA: case WM_COPYDATA:
return WINHELP_HandleCommand((HWND)wParam, lParam); return WINHELP_HandleCommand((HWND)wParam, lParam);
...@@ -789,7 +790,6 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -789,7 +790,6 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
{ {
BOOL bExit; BOOL bExit;
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
if (hWnd == Globals.hPopupWnd) Globals.hPopupWnd = 0;
bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->lpszName, "main")); bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->lpszName, "main"));
WINHELP_DeleteWindow(win); WINHELP_DeleteWindow(win);
...@@ -1172,8 +1172,12 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -1172,8 +1172,12 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
hPopupWnd = Globals.hPopupWnd; if (Globals.active_popup)
Globals.hPopupWnd = 0; {
hPopupWnd = Globals.active_popup->hMainWnd;
Globals.active_popup = NULL;
}
else hPopupWnd = NULL;
part = WINHELP_IsOverLink(win, wParam, lParam); part = WINHELP_IsOverLink(win, wParam, lParam);
if (part) if (part)
...@@ -1739,7 +1743,9 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize) ...@@ -1739,7 +1743,9 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
*/ */
static void WINHELP_CheckPopup(UINT msg) static void WINHELP_CheckPopup(UINT msg)
{ {
if (!Globals.hPopupWnd) return; HWND hPopup;
if (!Globals.active_popup) return;
switch (msg) switch (msg)
{ {
...@@ -1750,8 +1756,9 @@ static void WINHELP_CheckPopup(UINT msg) ...@@ -1750,8 +1756,9 @@ static void WINHELP_CheckPopup(UINT msg)
case WM_NCLBUTTONDOWN: case WM_NCLBUTTONDOWN:
case WM_NCMBUTTONDOWN: case WM_NCMBUTTONDOWN:
case WM_NCRBUTTONDOWN: case WM_NCRBUTTONDOWN:
DestroyWindow(Globals.hPopupWnd); hPopup = Globals.active_popup->hMainWnd;
Globals.hPopupWnd = 0; Globals.active_popup = NULL;
DestroyWindow(hPopup);
} }
} }
...@@ -1834,6 +1841,9 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win) ...@@ -1834,6 +1841,9 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
SetActiveWindow(Globals.win_list->hMainWnd); SetActiveWindow(Globals.win_list->hMainWnd);
} }
if (win == Globals.active_popup)
Globals.active_popup = NULL;
WINHELP_DeleteButtons(win); WINHELP_DeleteButtons(win);
if (win->hShadowWnd) DestroyWindow(win->hShadowWnd); if (win->hShadowWnd) DestroyWindow(win->hShadowWnd);
......
...@@ -166,9 +166,9 @@ typedef struct ...@@ -166,9 +166,9 @@ typedef struct
{ {
UINT wVersion; UINT wVersion;
HANDLE hInstance; HANDLE hInstance;
HWND hPopupWnd;
BOOL isBook; BOOL isBook;
WINHELP_WINDOW* active_win; WINHELP_WINDOW* active_win;
WINHELP_WINDOW* active_popup;
WINHELP_WINDOW* win_list; WINHELP_WINDOW* win_list;
WNDPROC button_proc; WNDPROC button_proc;
WINHELP_DLL* dlls; WINHELP_DLL* dlls;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment