diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-29 11:56:59 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-29 11:56:59 -0400 |
| commit | 3e047ba17441c85fcbad8a74fc86d086e173ebc6 (patch) | |
| tree | b4eac49629c44c82952d4fbf4aeac30f75919898 | |
| parent | 8813788c1401dbc52ff06fe7adb1bb13ea368f56 (diff) | |
Fixed Area scrollbars on Windows sometimes stopping a pixel shy of the actual end of the scrollbar.
| -rw-r--r-- | area_windows.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/area_windows.go b/area_windows.go index 9db8091..be31c80 100644 --- a/area_windows.go +++ b/area_windows.go @@ -382,8 +382,6 @@ func scrollArea(s *sysData, wparam _WPARAM, which uintptr) { if r1 == 0 { // failure panic(fmt.Errorf("error updating Area after scrolling: %v", err)) } - - // TODO in some cases wine will show a thumb one pixel away from the advance arrow button if going to the end; the values are correct though... weirdness in wine or something I never noticed about Windows? } func adjustAreaScrollbars(s *sysData) { @@ -400,7 +398,7 @@ func adjustAreaScrollbars(s *sysData) { si.cbSize = uint32(unsafe.Sizeof(si)) si.fMask = _SIF_RANGE | _SIF_PAGE si.nMin = 0 - si.nMax = int32(s.areawidth) + si.nMax = int32(s.areawidth - 1) // the max point is inclusive, so we have to pass in the last valid value, not the first invalid one (see http://blogs.msdn.com/b/oldnewthing/archive/2003/07/31/54601.aspx); if we don't, we get weird things like the scrollbar sometimes showing one extra scroll position at the end that you can never scroll to si.nPage = uint32(cwid) _setScrollInfo.Call( uintptr(s.hwnd), @@ -411,7 +409,7 @@ func adjustAreaScrollbars(s *sysData) { si.cbSize = uint32(unsafe.Sizeof(si)) // MSDN sample code does this a second time; let's do it too to be safe si.fMask = _SIF_RANGE | _SIF_PAGE si.nMin = 0 - si.nMax = int32(s.areaheight) + si.nMax = int32(s.areaheight - 1) si.nPage = uint32(cht) _setScrollInfo.Call( uintptr(s.hwnd), |
