summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2019-10-29 12:01:51 +0100
committerAlexander Neumann <alexander.neumann@picos-software.com>2019-10-29 12:01:51 +0100
commitc9d61f7162c9b419bc2fca1cb709ce4dcdb30688 (patch)
tree875d87848b45d35dcc206e31f100a90bfc2c47b3
parentTableView: Implement width calculation of StretchLastColumn ourselves (diff)
downloadwireguard-windows-c9d61f7162c9b419bc2fca1cb709ce4dcdb30688.tar.xz
wireguard-windows-c9d61f7162c9b419bc2fca1cb709ce4dcdb30688.zip
TableView: Fix StretchLastColumn regressions
-rw-r--r--tableview.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/tableview.go b/tableview.go
index 41c5fa74..ef83ccf9 100644
--- a/tableview.go
+++ b/tableview.go
@@ -118,7 +118,7 @@ type TableView struct {
inSetCurrentIndex bool
inMouseEvent bool
hasFrozenColumn bool
- inEraseBkgnd bool
+ busyStretchingLastColumn bool
focused bool
ignoreNowhere bool
updateLVSizesNeedsSpecialCare bool
@@ -1415,7 +1415,7 @@ func (tv *TableView) StretchLastColumn() error {
}
var hwnd win.HWND
- if tv.visibleColumnCount()-tv.visibleFrozenColumnCount() == 0 {
+ if colCount-tv.visibleFrozenColumnCount() == 0 {
hwnd = tv.hwndFrozenLV
} else {
hwnd = tv.hwndNormalLV
@@ -1425,7 +1425,7 @@ func (tv *TableView) StretchLastColumn() error {
lastIndexInLV := -1
var lastIndexInLVWidth int
for _, tvc := range tv.columns.items {
- colWidth := tvc.Width()
+ colWidth := tv.IntFrom96DPI(tvc.Width())
if index := tvc.indexInListView(); int(index) > lastIndexInLV {
lastIndexInLV = int(index)
lastIndexInLVWidth = colWidth
@@ -1824,15 +1824,16 @@ func (tv *TableView) lvWndProc(origWndProcPtr uintptr, hwnd win.HWND, msg uint32
hwndOther = tv.hwndFrozenLV
}
+ if tv.lastColumnStretched && !tv.busyStretchingLastColumn && tv.visibleColumnCount()-tv.visibleFrozenColumnCount() > 0 == (hwnd == tv.hwndNormalLV) {
+ tv.busyStretchingLastColumn = true
+ defer func() {
+ tv.busyStretchingLastColumn = false
+ }()
+ tv.StretchLastColumn()
+ }
+
switch msg {
case win.WM_ERASEBKGND:
- if tv.lastColumnStretched && !tv.inEraseBkgnd {
- tv.inEraseBkgnd = true
- defer func() {
- tv.inEraseBkgnd = false
- }()
- tv.StretchLastColumn()
- }
return 1
case win.WM_GETDLGCODE: