lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.8k stars 885 forks source link

form: abuse DPI handling for icon scaling better #636

Closed zx2c4 closed 4 years ago

zx2c4 commented 4 years ago

Since Windows 7 and Windows 8 assume that the second parameter to GetSystemMetricsForDpi is always DPI(), it's wrong to pass it a constant

  1. So instead we abuse the DPI handling a bit differently, determining the scale based on the output.

CC @rozmansi

zx2c4 commented 4 years ago

image --> image

zx2c4 commented 4 years ago

Note: the last remaining use of GetSystemMetricsForDpi(something, CONSTANT_VALUE) is:

// defaultIconSize returns default small icon size in 1/92" units.
func defaultIconSize() Size {
        return Size{int(win.GetSystemMetricsForDpi(win.SM_CXSMICON, 96)), int(win.GetSystemMetricsForDpi(win.SM_CYSMICON, 96))}
}

This should probably be eliminated somehow.

rozmansi commented 4 years ago

Note: the last remaining use of GetSystemMetricsForDpi(something, CONSTANT_VALUE) is: ... This should probably be eliminated somehow.

Can a user change 16x16 icon size without changing the Windows zoom level? If SM_CXSMICON is fixed to 16 on 100% zoom, this function could safely return Size{16, 16}.

zx2c4 commented 4 years ago

Unless Microsoft changes the value of SM_CXSMICON later.