Fixed the Windows 7 progressbar animation dumbness.

This commit is contained in:
Pietro Gagliardi 2014-06-07 23:27:38 -04:00
parent d9a8cf07b9
commit ef3adffd54
4 changed files with 27 additions and 12 deletions

View File

@ -606,17 +606,32 @@ func (s *sysData) setProgress(percent int) {
}
s.isMarquee = false
}
send := func(msg uintptr, n int, l _LPARAM) {
uitask <- &uimsg{
call: _sendMessage,
p: []uintptr{
uintptr(s.hwnd),
uintptr(_PBM_SETPOS),
uintptr(_WPARAM(percent)),
uintptr(0),
msg,
uintptr(_WPARAM(n)),
uintptr(l),
},
ret: ret,
}
<-ret
}
// Windows 7 has a non-disableable slowly-animating progress bar increment
// there isn't one for decrement, so we'll work around by going one higher and then lower again
// for the case where percent == 100, we need to increase the range temporarily
// this kind of thing is why I want to move away from uimsg and toward having uitask take func()s like on the other platforms
// sources: http://social.msdn.microsoft.com/Forums/en-US/61350dc7-6584-4c4e-91b0-69d642c03dae/progressbar-disable-smooth-animation http://stackoverflow.com/questions/2217688/windows-7-aero-theme-progress-bar-bug http://discuss.joelonsoftware.com/default.asp?dotnet.12.600456.2 http://stackoverflow.com/questions/22469876/progressbar-lag-when-setting-position-with-pbm-setpos http://stackoverflow.com/questions/6128287/tprogressbar-never-fills-up-all-the-way-seems-to-be-updating-too-fast
if percent == 100 {
send(_PBM_SETRANGE32, 0, 101)
}
send(_PBM_SETPOS, percent + 1, 0)
send(_PBM_SETPOS, percent, 0)
if percent == 100 {
send(_PBM_SETRANGE32, 0, 100)
}
}
func (s *sysData) len() int {

View File

@ -9,8 +9,6 @@ WINDOWS:
- the windows build appears to be unstable:
- 64-bit crashes in malloc in wine with heap corruption warnings aplenty during DLL loading; in windows 7 it works fine
- redrawing controls after a window resize on Windows does not work properly
- on windows 7, progress bars seem to animate from 0 -> pos when you turn off marquee mode and set pos; see if that's documented or if I'm doing something wrong
- intentional: http://social.msdn.microsoft.com/Forums/en-US/61350dc7-6584-4c4e-91b0-69d642c03dae/progressbar-disable-smooth-animation http://stackoverflow.com/questions/2217688/windows-7-aero-theme-progress-bar-bug http://discuss.joelonsoftware.com/default.asp?dotnet.12.600456.2 http://stackoverflow.com/questions/22469876/progressbar-lag-when-setting-position-with-pbm-setpos http://stackoverflow.com/questions/6128287/tprogressbar-never-fills-up-all-the-way-seems-to-be-updating-too-fast - these links have workarounds but blah; more proof that progressbars were programmatically intended to be incremented in steps
- check all uses of RECT.right/.bottom in Windows that don't have an accompanying -RECT.left/.top to make sure they're correct
- when adding IsDialogMessage() find out if that make sthe area in the area bounds test automatically focused

View File

@ -61,6 +61,7 @@ const _MK_XBUTTON1 = 32
const _MK_XBUTTON2 = 64
const _PBM_SETMARQUEE = 1034
const _PBM_SETPOS = 1026
const _PBM_SETRANGE32 = 1030
const _PBS_MARQUEE = 8
const _PBS_SMOOTH = 1
const _SB_HORZ = 0

View File

@ -61,6 +61,7 @@ const _MK_XBUTTON1 = 32
const _MK_XBUTTON2 = 64
const _PBM_SETMARQUEE = 1034
const _PBM_SETPOS = 1026
const _PBM_SETRANGE32 = 1030
const _PBS_MARQUEE = 8
const _PBS_SMOOTH = 1
const _SB_HORZ = 0