Eric Pouech : winhelp: Get rid of the WM_USER message.
Alexandre Julliard
julliard at winehq.org
Mon Apr 21 07:46:20 CDT 2008
Module: wine
Branch: master
Commit: d58ab515dfef1406fbf746665101b3a1d9a6370d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d58ab515dfef1406fbf746665101b3a1d9a6370d
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Fri Apr 18 21:33:51 2008 +0200
winhelp: Get rid of the WM_USER message.
---
programs/winhelp/macro.c | 4 +-
programs/winhelp/winhelp.c | 48 ++++++++++++++++++++++++-------------------
programs/winhelp/winhelp.h | 1 +
3 files changed, 30 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 65c7e20..92c1e79 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -449,6 +449,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
*
@@ -478,7 +501,7 @@ static BOOL WINHELP_ReuseWindow(WINHELP_WINDOW* win, WINHELP_WINDOW* oldwin,
WINHELP_SetupText(win->hTextWnd);
InvalidateRect(win->hTextWnd, NULL, TRUE);
- SendMessage(win->hMainWnd, WM_USER, 0, 0);
+ WINHELP_LayoutMainWindow(win);
ShowWindow(win->hMainWnd, nCmdShow);
UpdateWindow(win->hTextWnd);
@@ -692,8 +715,8 @@ 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, curPos, min, max, dy, keyDelta;
+ RECT rect;
+ INT curPos, min, max, dy, keyDelta;
WINHELP_CheckPopup(msg);
@@ -716,25 +739,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
0, 0, 0, 0, hWnd, 0, Globals.hInstance, win);
/* Fall through */
- case WM_USER:
case WM_WINDOWPOSCHANGED:
- win = (WINHELP_WINDOW*) GetWindowLongPtr(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*) GetWindowLongPtr(hWnd, 0));
break;
case WM_COMMAND:
diff --git a/programs/winhelp/winhelp.h b/programs/winhelp/winhelp.h
index abe68ea..0628c7d 100644
--- a/programs/winhelp/winhelp.h
+++ b/programs/winhelp/winhelp.h
@@ -180,6 +180,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-cvs
mailing list