Skip to content

Commit acb6987

Browse files
committed
win32: Use peerPtr in event processing
1 parent daa252a commit acb6987

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/backends/win32/backend.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,6 @@ pub const Window = struct {
328328
} else {
329329
self.menu_item_callbacks.clearAndFree();
330330
}
331-
332-
// Ensure menu item callbacks can be accessed during event processing.
333-
getEventUserData(self.hwnd).classUserdata = @intFromPtr(self);
334331
}
335332

336333
pub fn setSourceDpi(self: *Window, dpi: u32) void {
@@ -402,7 +399,7 @@ pub fn Events(comptime T: type) type {
402399
// For menubar item events, HIWORD(wp) and lp are set to 0.
403400
else if (code == 0) {
404401
const data = getEventUserData(hwnd);
405-
const window_ptr: ?*Window = @ptrFromInt(data.classUserdata);
402+
const window_ptr: ?*Window = @ptrCast(@alignCast(data.peerPtr));
406403
const id: u16 = @intCast(wp & 0xFFFF);
407404

408405
if (window_ptr) |window| {

0 commit comments

Comments
 (0)