Commit 5b8fdb97 authored by Alexandre Julliard's avatar Alexandre Julliard

winecfg: Keep metrics in DPI-relative format when saving the theme.

parent 5f494bfe
...@@ -1011,35 +1011,42 @@ static void read_sysparams(HWND hDlg) ...@@ -1011,35 +1011,42 @@ static void read_sysparams(HWND hDlg)
static void apply_sysparams(void) static void apply_sysparams(void)
{ {
NONCLIENTMETRICSW nonclient_metrics; NONCLIENTMETRICSW ncm;
int i, cnt = 0; int i, cnt = 0;
int colors_idx[sizeof(metrics) / sizeof(metrics[0])]; int colors_idx[sizeof(metrics) / sizeof(metrics[0])];
COLORREF colors[sizeof(metrics) / sizeof(metrics[0])]; COLORREF colors[sizeof(metrics) / sizeof(metrics[0])];
HDC hdc;
nonclient_metrics.cbSize = sizeof(nonclient_metrics); int dpi;
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(nonclient_metrics), &nonclient_metrics, 0);
hdc = GetDC( 0 );
nonclient_metrics.iMenuWidth = nonclient_metrics.iMenuHeight = dpi = GetDeviceCaps( hdc, LOGPIXELSY );
metrics[IDC_SYSPARAMS_MENU - IDC_SYSPARAMS_BUTTON].size; ReleaseDC( 0, hdc );
nonclient_metrics.iCaptionWidth = nonclient_metrics.iCaptionHeight =
metrics[IDC_SYSPARAMS_ACTIVE_TITLE - IDC_SYSPARAMS_BUTTON].size; ncm.cbSize = sizeof(ncm);
nonclient_metrics.iScrollWidth = nonclient_metrics.iScrollHeight = SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
metrics[IDC_SYSPARAMS_SCROLLBAR - IDC_SYSPARAMS_BUTTON].size;
/* convert metrics back to twips */
memcpy(&(nonclient_metrics.lfMenuFont), ncm.iMenuWidth = ncm.iMenuHeight =
&(metrics[IDC_SYSPARAMS_MENU_TEXT - IDC_SYSPARAMS_BUTTON].lf), MulDiv( metrics[IDC_SYSPARAMS_MENU - IDC_SYSPARAMS_BUTTON].size, -1440, dpi );
sizeof(LOGFONTW)); ncm.iCaptionWidth = ncm.iCaptionHeight =
memcpy(&(nonclient_metrics.lfCaptionFont), MulDiv( metrics[IDC_SYSPARAMS_ACTIVE_TITLE - IDC_SYSPARAMS_BUTTON].size, -1440, dpi );
&(metrics[IDC_SYSPARAMS_ACTIVE_TITLE_TEXT - IDC_SYSPARAMS_BUTTON].lf), ncm.iScrollWidth = ncm.iScrollHeight =
sizeof(LOGFONTW)); MulDiv( metrics[IDC_SYSPARAMS_SCROLLBAR - IDC_SYSPARAMS_BUTTON].size, -1440, dpi );
memcpy(&(nonclient_metrics.lfStatusFont), ncm.iSmCaptionWidth = MulDiv( ncm.iSmCaptionWidth, -1440, dpi );
&(metrics[IDC_SYSPARAMS_TOOLTIP_TEXT - IDC_SYSPARAMS_BUTTON].lf), ncm.iSmCaptionHeight = MulDiv( ncm.iSmCaptionHeight, -1440, dpi );
sizeof(LOGFONTW));
memcpy(&(nonclient_metrics.lfMessageFont), ncm.lfMenuFont = metrics[IDC_SYSPARAMS_MENU_TEXT - IDC_SYSPARAMS_BUTTON].lf;
&(metrics[IDC_SYSPARAMS_MSGBOX_TEXT - IDC_SYSPARAMS_BUTTON].lf), ncm.lfCaptionFont = metrics[IDC_SYSPARAMS_ACTIVE_TITLE_TEXT - IDC_SYSPARAMS_BUTTON].lf;
sizeof(LOGFONTW)); ncm.lfStatusFont = metrics[IDC_SYSPARAMS_TOOLTIP_TEXT - IDC_SYSPARAMS_BUTTON].lf;
ncm.lfMessageFont = metrics[IDC_SYSPARAMS_MSGBOX_TEXT - IDC_SYSPARAMS_BUTTON].lf;
SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(nonclient_metrics), &nonclient_metrics,
ncm.lfMenuFont.lfHeight = MulDiv( ncm.lfMenuFont.lfHeight, -72, dpi );
ncm.lfCaptionFont.lfHeight = MulDiv( ncm.lfCaptionFont.lfHeight, -72, dpi );
ncm.lfStatusFont.lfHeight = MulDiv( ncm.lfStatusFont.lfHeight, -72, dpi );
ncm.lfMessageFont.lfHeight = MulDiv( ncm.lfMessageFont.lfHeight, -72, dpi );
ncm.lfSmCaptionFont.lfHeight = MulDiv( ncm.lfSmCaptionFont.lfHeight, -72, dpi );
SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(ncm), &ncm,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
for (i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++) for (i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++)
......
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