[PATCH 1/2] winefile: Fix horizontal scrolling.
Lauri Kenttä
lauri.kentta at gmail.com
Mon May 30 12:42:53 CDT 2016
The problem is that the code updates column width permanently when
scrolling causes a change in the width. This is fixed by adding
another array of widths to track the actually shown width and by
using that value where applicable.
This fixes bug 11808.
Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
---
programs/winefile/winefile.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/programs/winefile/winefile.c b/programs/winefile/winefile.c
index f8247a7..5709c8e 100644
--- a/programs/winefile/winefile.c
+++ b/programs/winefile/winefile.c
@@ -118,6 +118,7 @@ typedef struct {
#define COLUMNS 10
int widths[COLUMNS];
+ int widths_shown[COLUMNS];
int positions[COLUMNS+1];
BOOL treePane;
@@ -2355,6 +2356,7 @@ static HWND create_header(HWND parent, Pane* pane, UINT id)
hdi.pszText = g_pos_names[idx];
hdi.fmt = HDF_STRING | g_pos_align[idx];
hdi.cxy = pane->widths[idx];
+ pane->widths_shown[idx] = hdi.cxy;
SendMessageW(hwnd, HDM_INSERTITEMW, idx, (LPARAM)&hdi);
}
@@ -3168,17 +3170,20 @@ static void set_header(Pane* pane)
for(; (i < COLUMNS) && (x+pane->widths[i] < scroll_pos); i++) {
x += pane->widths[i];
+ pane->widths_shown[i] = item.cxy;
SendMessageW(pane->hwndHeader, HDM_SETITEMW, i, (LPARAM)&item);
}
if (i < COLUMNS) {
x += pane->widths[i];
item.cxy = x - scroll_pos;
+ pane->widths_shown[i] = item.cxy;
SendMessageW(pane->hwndHeader, HDM_SETITEMW, i++, (LPARAM)&item);
for(; i < COLUMNS; i++) {
item.cxy = pane->widths[i];
x += pane->widths[i];
+ pane->widths_shown[i] = item.cxy;
SendMessageW(pane->hwndHeader, HDM_SETITEMW, i, (LPARAM)&item);
}
}
@@ -3190,13 +3195,14 @@ static LRESULT pane_notify(Pane* pane, NMHDR* pnmh)
case HDN_ITEMCHANGEDW: {
LPNMHEADERW phdn = (LPNMHEADERW)pnmh;
int idx = phdn->iItem;
- int dx = phdn->pitem->cxy - pane->widths[idx];
+ int dx = phdn->pitem->cxy - pane->widths_shown[idx];
int i;
RECT clnt;
GetClientRect(pane->hwnd, &clnt);
pane->widths[idx] += dx;
+ pane->widths_shown[idx] += dx;
for(i=idx; ++i<=COLUMNS; )
pane->positions[i] += dx;
--
2.8.3
More information about the wine-patches
mailing list