Skip to content

Commit 1a4f820

Browse files
committed
fix: compilation issues with win32 (win32.ScrollView)
1 parent d97e1ad commit 1a4f820

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.github/workflows/coverage.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
uses: goto-bus-stop/setup-zig@v2
1919
with:
2020
version: 0.14.0-dev.2577+271452d22
21+
2122
- name: Test Coverage Capy for native
2223
run: xvfb-run -a zig build coverage
2324
env:

src/backends/win32/backend.zig

+6-6
Original file line numberDiff line numberDiff line change
@@ -1526,10 +1526,10 @@ pub const ScrollView = struct {
15261526
const child = win32.GetWindow(hwnd, win32.GW_CHILD);
15271527
_ = win32.MoveWindow(
15281528
child,
1529-
@max(rect.left - parent.left, @min(0, -(@as(c_int, @intCast(preferred.width)) - width))),
1530-
@max(rect.top - parent.top, @min(0, -(@as(c_int, @intCast(preferred.height)) - height))),
1531-
@as(c_int, @intCast(preferred.width)),
1532-
@as(c_int, @intCast(preferred.height)),
1529+
@max(rect.left - parent.left, @min(0, -(@as(c_int, @intFromFloat(preferred.width)) - width))),
1530+
@max(rect.top - parent.top, @min(0, -(@as(c_int, @intFromFloat(preferred.height)) - height))),
1531+
@as(c_int, @intFromFloat(preferred.width)),
1532+
@as(c_int, @intFromFloat(preferred.height)),
15331533
1,
15341534
);
15351535

@@ -1538,7 +1538,7 @@ pub const ScrollView = struct {
15381538
.cbSize = @sizeOf(win32.SCROLLINFO),
15391539
.fMask = @as(win32.SCROLLINFO_MASK, @enumFromInt(@intFromEnum(win32.SIF_RANGE) | @intFromEnum(win32.SIF_PAGE))),
15401540
.nMin = 0,
1541-
.nMax = @as(c_int, @intCast(preferred.width)),
1541+
.nMax = @as(c_int, @intFromFloat(preferred.width)),
15421542
.nPage = @as(c_uint, @intCast(width)),
15431543
.nPos = 0,
15441544
.nTrackPos = 0,
@@ -1549,7 +1549,7 @@ pub const ScrollView = struct {
15491549
.cbSize = @sizeOf(win32.SCROLLINFO),
15501550
.fMask = @as(win32.SCROLLINFO_MASK, @enumFromInt(@intFromEnum(win32.SIF_RANGE) | @intFromEnum(win32.SIF_PAGE))),
15511551
.nMin = 0,
1552-
.nMax = @as(c_int, @intCast(preferred.height)),
1552+
.nMax = @as(c_int, @intFromFloat(preferred.height)),
15531553
.nPage = @as(c_uint, @intCast(height)),
15541554
.nPos = 0,
15551555
.nTrackPos = 0,

0 commit comments

Comments
 (0)