[PATCH 0/5] MR1105: comctl32: preparation for HPROPSHEETPAGE structure layout changes
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/comctl32/propsheet.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 62374a96ae9..3f004dfe294 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -416,6 +416,11 @@ static HICON HPSP_get_icon(HPROPSHEETPAGE hpsp) return ret; } +static LRESULT HPSP_get_template(HPROPSHEETPAGE hpsp) +{ + return (LRESULT)hpsp->psp.u.pszTemplate; +} + static HWND HPSP_create_page(HPROPSHEETPAGE hpsp, DLGTEMPLATE *template, HWND parent) { HWND hwnd; @@ -517,7 +522,7 @@ static INT PROPSHEET_FindPageByResId(const PropSheetInfo * psInfo, LRESULT resId for (i = 0; i < psInfo->nPages; i++) { /* Fixme: if resource ID is a string shall we use strcmp ??? */ - if (psInfo->proppage[i].hpage->psp.u.pszTemplate == (LPVOID)resId) + if (HPSP_get_template(psInfo->proppage[i].hpage) == resId) break; } @@ -2624,7 +2629,7 @@ static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId) PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("(%p, %d)\n", hwndDlg, iPageId); for (index = 0; index < psInfo->nPages; index++) { - if (psInfo->proppage[index].hpage->psp.u.pszTemplate == MAKEINTRESOURCEW(iPageId)) + if (HPSP_get_template(psInfo->proppage[index].hpage) == iPageId) return index; } @@ -2637,17 +2642,20 @@ static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId) static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex) { PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); - LPCPROPSHEETPAGEW psp; + HPROPSHEETPAGE hpsp; + LRESULT template; + TRACE("(%p, %d)\n", hwndDlg, iPageIndex); + if (iPageIndex<0 || iPageIndex>=psInfo->nPages) { WARN("%d out of range.\n", iPageIndex); return 0; } - psp = &psInfo->proppage[iPageIndex].hpage->psp; - if (psp->dwFlags & PSP_DLGINDIRECT || !IS_INTRESOURCE(psp->u.pszTemplate)) { + hpsp = psInfo->proppage[iPageIndex].hpage; + template = HPSP_get_template(hpsp); + if (HPSP_get_flags(hpsp) & PSP_DLGINDIRECT || !IS_INTRESOURCE(template)) return 0; - } - return (LRESULT)psp->u.pszTemplate; + return template; } /****************************************************************************** -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1105
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/comctl32/propsheet.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index a6c1df11d63..62374a96ae9 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -416,6 +416,24 @@ static HICON HPSP_get_icon(HPROPSHEETPAGE hpsp) return ret; } +static HWND HPSP_create_page(HPROPSHEETPAGE hpsp, DLGTEMPLATE *template, HWND parent) +{ + HWND hwnd; + + if(hpsp->psp.dwFlags & PSP_INTERNAL_UNICODE) + { + hwnd = CreateDialogIndirectParamW(hpsp->psp.hInstance, template, + parent, hpsp->psp.pfnDlgProc, (LPARAM)&hpsp->psp); + } + else + { + hwnd = CreateDialogIndirectParamA(hpsp->psp.hInstance, template, + parent, hpsp->psp.pfnDlgProc, (LPARAM)&hpsp->psp); + } + + return hwnd; +} + #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** * PROPSHEET_UnImplementedFlags @@ -1429,19 +1447,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, } HPSP_call_callback(hpsp, PSPCB_CREATE); - - if(HPSP_get_flags(hpsp) & PSP_INTERNAL_UNICODE) - hwndPage = CreateDialogIndirectParamW(hpsp->psp.hInstance, - pTemplateCopy, - hwndParent, - hpsp->psp.pfnDlgProc, - (LPARAM)&hpsp->psp); - else - hwndPage = CreateDialogIndirectParamA(hpsp->psp.hInstance, - pTemplateCopy, - hwndParent, - hpsp->psp.pfnDlgProc, - (LPARAM)&hpsp->psp); + hwndPage = HPSP_create_page(hpsp, pTemplateCopy, hwndParent); /* Free a no more needed copy */ Free(pTemplateCopy); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1105
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/comctl32/propsheet.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 3f004dfe294..48b6625c53e 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -439,6 +439,16 @@ static HWND HPSP_create_page(HPROPSHEETPAGE hpsp, DLGTEMPLATE *template, HWND pa return hwnd; } +static void HPSP_set_header_title(HPROPSHEETPAGE hpsp, const WCHAR *title) +{ + if (!IS_INTRESOURCE(hpsp->psp.pszHeaderTitle)) + Free((void *)hpsp->psp.pszHeaderTitle); + + hpsp->psp.pszHeaderTitle = heap_strdupW(title); + hpsp->psp.dwFlags |= PSP_USEHEADERTITLE; +} + + #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** * PROPSHEET_UnImplementedFlags @@ -2495,20 +2505,13 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) static void PROPSHEET_SetHeaderTitleW(HWND hwndDlg, UINT page_index, const WCHAR *title) { PropSheetInfo *psInfo = GetPropW(hwndDlg, PropSheetInfoStr); - PROPSHEETPAGEW *page; TRACE("(%p, %u, %s)\n", hwndDlg, page_index, debugstr_w(title)); if (page_index >= psInfo->nPages) return; - page = &psInfo->proppage[page_index].hpage->psp; - - if (!IS_INTRESOURCE(page->pszHeaderTitle)) - Free((void *)page->pszHeaderTitle); - - page->pszHeaderTitle = heap_strdupW(title); - page->dwFlags |= PSP_USEHEADERTITLE; + HPSP_set_header_title(psInfo->proppage[page_index].hpage, title); } /****************************************************************************** -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1105
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/comctl32/propsheet.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 48b6625c53e..d713385eec1 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -448,6 +448,14 @@ static void HPSP_set_header_title(HPROPSHEETPAGE hpsp, const WCHAR *title) hpsp->psp.dwFlags |= PSP_USEHEADERTITLE; } +static void HPSP_set_header_subtitle(HPROPSHEETPAGE hpsp, const WCHAR *subtitle) +{ + if (!IS_INTRESOURCE(hpsp->psp.pszHeaderTitle)) + Free((void *)hpsp->psp.pszHeaderTitle); + + hpsp->psp.pszHeaderTitle = heap_strdupW(subtitle); + hpsp->psp.dwFlags |= PSP_USEHEADERSUBTITLE; +} #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** @@ -2534,20 +2542,13 @@ static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, UINT page_index, const char static void PROPSHEET_SetHeaderSubTitleW(HWND hwndDlg, UINT page_index, const WCHAR *subtitle) { PropSheetInfo *psInfo = GetPropW(hwndDlg, PropSheetInfoStr); - PROPSHEETPAGEW *page; TRACE("(%p, %u, %s)\n", hwndDlg, page_index, debugstr_w(subtitle)); if (page_index >= psInfo->nPages) return; - page = &psInfo->proppage[page_index].hpage->psp; - - if (!IS_INTRESOURCE(page->pszHeaderSubTitle)) - Free((void *)page->pszHeaderSubTitle); - - page->pszHeaderSubTitle = heap_strdupW(subtitle); - page->dwFlags |= PSP_USEHEADERSUBTITLE; + HPSP_set_header_subtitle(psInfo->proppage[page_index].hpage, subtitle); } /****************************************************************************** -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1105
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/comctl32/propsheet.c | 53 ++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index d713385eec1..e043e34a6cd 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -457,6 +457,22 @@ static void HPSP_set_header_subtitle(HPROPSHEETPAGE hpsp, const WCHAR *subtitle) hpsp->psp.dwFlags |= PSP_USEHEADERSUBTITLE; } +static void HPSP_draw_text(HPROPSHEETPAGE hpsp, HDC hdc, BOOL title, RECT *r, UINT format) +{ + const WCHAR *text = title ? hpsp->psp.pszHeaderTitle : hpsp->psp.pszHeaderSubTitle; + WCHAR buf[256]; + INT len; + + if (!IS_INTRESOURCE(text)) + DrawTextW(hdc, text, -1, r, format); + else + { + len = LoadStringW(hpsp->psp.hInstance, (UINT_PTR)text, buf, ARRAY_SIZE(buf)); + if (len != 0) + DrawTextW(hdc, buf, len, r, format); + } +} + #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} /****************************************************************************** * PROPSHEET_UnImplementedFlags @@ -3252,8 +3268,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) HBRUSH hbr; RECT r, rzone; HPROPSHEETPAGE hpsp; - WCHAR szBuffer[256]; - int nLength; + DWORD flags; hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps); if (!hdc) return 1; @@ -3267,13 +3282,13 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) hpsp = NULL; else hpsp = psInfo->proppage[psInfo->active_page].hpage; + flags = HPSP_get_flags(hpsp); - if ( hpsp && !(HPSP_get_flags(hpsp) & PSP_HIDEHEADER) && + if ( hpsp && !(flags & PSP_HIDEHEADER) && (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && (psInfo->ppshheader.dwFlags & PSH_HEADER) ) { HWND hwndLineHeader = GetDlgItem(hwnd, IDC_SUNKEN_LINEHEADER); - LPCPROPSHEETPAGEW ppshpage = &hpsp->psp; HFONT hOldFont; COLORREF clrOld = 0; int oldBkMode = 0; @@ -3341,35 +3356,15 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) clrOld = SetTextColor (hdc, 0x00000000); oldBkMode = SetBkMode (hdc, TRANSPARENT); - if (ppshpage->dwFlags & PSP_USEHEADERTITLE) { + if (flags & PSP_USEHEADERTITLE) { SetRect(&r, 20, 10, 0, 0); - if (!IS_INTRESOURCE(ppshpage->pszHeaderTitle)) - DrawTextW(hdc, ppshpage->pszHeaderTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - else - { - nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderTitle, - szBuffer, 256); - if (nLength != 0) - { - DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - } - } + HPSP_draw_text(hpsp, hdc, TRUE, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); } - if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) { + if (flags & PSP_USEHEADERSUBTITLE) { SelectObject(hdc, psInfo->hFont); SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom); - if (!IS_INTRESOURCE(ppshpage->pszHeaderSubTitle)) - DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK); - else - { - nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderSubTitle, - szBuffer, 256); - if (nLength != 0) - { - DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_WORDBREAK); - } - } + HPSP_draw_text(hpsp, hdc, FALSE, &r, DT_LEFT | DT_WORDBREAK); } offsety = rzone.bottom + 2; @@ -3379,7 +3374,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) SelectObject(hdc, hOldFont); } - if ( (HPSP_get_flags(hpsp) & PSP_HIDEHEADER) && + if ( (flags & PSP_HIDEHEADER) && (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && (psInfo->ppshheader.dwFlags & PSH_WATERMARK) ) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1105
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125214 Your paranoid android. === build (build log) === error: patch failed: dlls/comctl32/propsheet.c:416 error: patch failed: dlls/comctl32/propsheet.c:416 error: patch failed: dlls/comctl32/propsheet.c:457 Task: Patch failed to apply === debian11 (build log) === error: patch failed: dlls/comctl32/propsheet.c:416 error: patch failed: dlls/comctl32/propsheet.c:416 error: patch failed: dlls/comctl32/propsheet.c:457 Task: Patch failed to apply === debian11 (build log) === error: patch failed: dlls/comctl32/propsheet.c:416 error: patch failed: dlls/comctl32/propsheet.c:416 error: patch failed: dlls/comctl32/propsheet.c:457 Task: Patch failed to apply
This merge request was approved by Nikolay Sivov. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1105
This merge request was approved by Zhiyi Zhang. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1105
participants (5)
-
Marvin -
Nikolay Sivov (@nsivov) -
Piotr Caban -
Piotr Caban (@piotr) -
Zhiyi Zhang (@zhiyi)