Window with WS_CHILD does not need to change Z order when SetWindowPos param hwndInsertAfter is HWND_TOPMOST or HWND_NOTOPMOST. Solve the problems mentioned in the previous patch, and Remove todo_wine on test_child_topmost_zorder.
v2:
Add git log information
v3:
Move the path to fixup_flags function, only used to fix SetWindowPos function problem.
v4:
Divide a path into two pathes, better explain the prolem. and add notopmost verification
v5:
Add todo_wine to test patch[PATCH v5 1/2], and optimize fixup_flags[PATCH v5 2/2].
Signed-off-by: Jiajin Cui <cuijiajin(a)uniontech.com>
GetSystemMetrics returns the "full name" of the font, which
is not necessarily what appears in the font picker, causing
it to default to the first entry in the list.
See for example the family "Renner*", which calls its Regular
version "Renner* Book".
Signed-off-by: Mark Harmstone <mark(a)harmstone.com>
---
programs/winecfg/theme.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c
index b38b2ff26d..1f004c7e0e 100644
--- a/programs/winecfg/theme.c
+++ b/programs/winecfg/theme.c
@@ -1151,20 +1151,43 @@ static void on_draw_item(HWND hDlg, WPARAM wParam, LPARAM lParam)
}
}
+static INT CALLBACK fontname_proc(const LOGFONTW *lf, const TEXTMETRICW *ntm, DWORD type, LPARAM lparam)
+{
+ LOGFONTW *orig_lf = (LOGFONTW *)lparam;
+
+ memcpy(orig_lf->lfFaceName, lf->lfFaceName, sizeof(lf->lfFaceName));
+
+ return 0;
+}
+
static void on_select_font(HWND hDlg)
{
CHOOSEFONTW cf;
+ LOGFONTW lf;
+ HDC hdc;
+
int index = SendDlgItemMessageW(hDlg, IDC_SYSPARAM_COMBO, CB_GETCURSEL, 0, 0);
index = SendDlgItemMessageW(hDlg, IDC_SYSPARAM_COMBO, CB_GETITEMDATA, index, 0);
+ memcpy(&lf, &metrics[index].lf, sizeof(LOGFONTW));
+
+ /* GetSystemMetrics returns the "full name" of the font - run it through
+ * EnumFontFamiliesExW in order to get the family name, which is what
+ * appears in the font chooser list. */
+ hdc = GetDC(hDlg);
+ EnumFontFamiliesExW(hdc, &lf, fontname_proc, (LPARAM)&lf, 0);
+ ReleaseDC(hDlg, hdc);
+
ZeroMemory(&cf, sizeof(cf));
cf.lStructSize = sizeof(CHOOSEFONTW);
cf.hwndOwner = hDlg;
- cf.lpLogFont = &(metrics[index].lf);
+ cf.lpLogFont = &lf;
cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_NOSCRIPTSEL | CF_NOVERTFONTS;
- if (ChooseFontW(&cf))
+ if (ChooseFontW(&cf)) {
+ memcpy(&(metrics[index].lf), &lf, sizeof(LOGFONTW));
SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ }
}
static void init_mime_types(HWND hDlg)
--
2.26.2