Skip to content

Commit

Permalink
Win32: Work around listview selectbounds being wider than column.
Browse files Browse the repository at this point in the history
  • Loading branch information
madewokherd committed Nov 25, 2024
1 parent 10a64e7 commit 3b58290
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions xalia/Win32/HwndListViewCellProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xalia.Gudl;
using Xalia.UiDom;
Expand Down Expand Up @@ -87,23 +88,32 @@ public override UiDomValue EvaluateIdentifier(UiDomElement element, string ident
return UiDomBoolean.True;
case "win32_x":
case "win32_width":
if (Column == 0)
{
if (identifier == "win32_x")
if (Column == 0 && identifier == "win32_x")
{
return Row.Element.EvaluateIdentifier("win32_selectbounds_x", Root, depends_on);
else
return Row.Element.EvaluateIdentifier("win32_selectbounds_width", Root, depends_on);
}
if (!(HeaderProvider is null))
{
depends_on.Add((HeaderControl, new IdentifierExpression("children")));
var header = ColumnHeader;
if (!(header is null))
}
UiDomValue result = UiDomUndefined.Instance;
if (!(HeaderProvider is null))
{
depends_on.Add((HeaderControl, new IdentifierExpression("children")));
var header = ColumnHeader;
if (!(header is null))
{
result = header.EvaluateIdentifier(identifier, Root, depends_on);
}
}
if (result is UiDomInt && Column == 0) // identifier == "win32_width"
{
return header.EvaluateIdentifier(identifier, Root, depends_on);
// Sometimes selectbounds spans multiple columns (wine bug?)
Row.Element.EvaluateIdentifier("win32_selectbounds_x", Root, depends_on).TryToInt(out var sb_x);
Row.Element.EvaluateIdentifier("win32_selectbounds_width", Root, depends_on).TryToInt(out var sb_width);
ColumnHeader.EvaluateIdentifier("win32_x", Root, depends_on).TryToInt(out var header_x);
ColumnHeader.EvaluateIdentifier("win32_width", Root, depends_on).TryToInt(out var header_width);
return new UiDomInt(Math.Min(header_x + header_width - sb_x, sb_width));
}
return result;
}
break;
case "win32_y":
return Row.Element.EvaluateIdentifier("win32_selectbounds_y", Root, depends_on);
case "win32_height":
Expand Down

0 comments on commit 3b58290

Please sign in to comment.