[PATCH 03/45] [WinHelp]: get rid of the WM_USER message
Eric Pouech
eric.pouech at orange.fr
Sun Mar 23 04:17:12 CDT 2008
A+
---
programs/winhelp/macro.c | 4 ++--
programs/winhelp/winhelp.c | 46 ++++++++++++++++++++++++--------------------
programs/winhelp/winhelp.h | 1 +
3 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/programs/winhelp/macro.c b/programs/winhelp/macro.c
index 68863bf..1f824f8 100644
--- a/programs/winhelp/macro.c
+++ b/programs/winhelp/macro.c
@@ -300,7 +300,7 @@ void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
*b = button;
- SendMessage(win->hMainWnd, WM_USER, 0, 0);
+ WINHELP_LayoutMainWindow(win);
}
void CALLBACK MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
@@ -407,7 +407,7 @@ void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
button->wParam = max(button->wParam, (*b)->wParam + 1);
*b = button;
- SendMessage(win->hMainWnd, WM_USER, 0, 0);
+ WINHELP_LayoutMainWindow(win);
}
void CALLBACK MACRO_DeleteItem(LPCSTR str)
diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index dac880c..2c42f48 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -413,6 +413,29 @@ static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, LPARAM lParam)
return 1;
}
+void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win)
+{
+ RECT rect, button_box_rect;
+ INT text_top;
+
+ GetClientRect(win->hMainWnd, &rect);
+
+ /* Update button box and text Window */
+ SetWindowPos(win->hButtonBoxWnd, HWND_TOP,
+ rect.left, rect.top,
+ rect.right - rect.left,
+ rect.bottom - rect.top, 0);
+
+ GetWindowRect(win->hButtonBoxWnd, &button_box_rect);
+ text_top = rect.top + button_box_rect.bottom - button_box_rect.top;
+
+ SetWindowPos(win->hTextWnd, HWND_TOP,
+ rect.left, text_top,
+ rect.right - rect.left,
+ rect.bottom - text_top, 0);
+
+}
+
/******************************************************************
* WINHELP_ReuseWindow
*
@@ -439,7 +462,7 @@ static BOOL WINHELP_ReuseWindow(WINHELP_WINDOW* win, WINHELP_WINDOW* oldwin,
SetWindowText(win->hMainWnd, page->file->lpszTitle);
InvalidateRect(win->hTextWnd, NULL, TRUE);
- SendMessage(win->hMainWnd, WM_USER, 0, 0);
+ WINHELP_LayoutMainWindow(win);
ShowWindow(win->hMainWnd, nCmdShow);
UpdateWindow(win->hTextWnd);
@@ -654,8 +677,6 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
{
WINHELP_WINDOW *win;
WINHELP_BUTTON *button;
- RECT rect, button_box_rect;
- INT text_top;
WINHELP_CheckPopup(msg);
@@ -680,25 +701,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
0, 0, 0, 0, hWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
/* Fall through */
- case WM_USER:
case WM_WINDOWPOSCHANGED:
- win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
- GetClientRect(hWnd, &rect);
-
- /* Update button box and text Window */
- SetWindowPos(win->hButtonBoxWnd, HWND_TOP,
- rect.left, rect.top,
- rect.right - rect.left,
- rect.bottom - rect.top, 0);
-
- GetWindowRect(win->hButtonBoxWnd, &button_box_rect);
- text_top = rect.top + button_box_rect.bottom - button_box_rect.top;
-
- SetWindowPos(win->hTextWnd, HWND_TOP,
- rect.left, text_top,
- rect.right - rect.left,
- rect.bottom - text_top, 0);
-
+ WINHELP_LayoutMainWindow((WINHELP_WINDOW*) GetWindowLong(hWnd, 0));
break;
case WM_COMMAND:
diff --git a/programs/winhelp/winhelp.h b/programs/winhelp/winhelp.h
index f1ae31f..30ee277 100644
--- a/programs/winhelp/winhelp.h
+++ b/programs/winhelp/winhelp.h
@@ -141,6 +141,7 @@ INT WINHELP_MessageBoxIDS(UINT, UINT, WORD);
INT WINHELP_MessageBoxIDS_s(UINT, LPCSTR, UINT, WORD);
HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
+void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
extern const char MAIN_WIN_CLASS_NAME[];
extern const char BUTTON_BOX_WIN_CLASS_NAME[];
More information about the wine-patches
mailing list