mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
core: mouse reports should always send on release even if outside
Fixes #481
This commit is contained in:
@ -1305,25 +1305,27 @@ fn mouseReport(
|
|||||||
.any => {},
|
.any => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// The maximum pos values so we can determine if we're outside the window.
|
// Handle scenarios where the mouse position is outside the viewport.
|
||||||
// If we're outside the window, we do not report mouse events.
|
// We always report release events no matter where they happen.
|
||||||
const pos_out_viewport = pos_out_viewport: {
|
if (action != .release) {
|
||||||
const max_x: f32 = @floatFromInt(self.screen_size.width);
|
const pos_out_viewport = pos_out_viewport: {
|
||||||
const max_y: f32 = @floatFromInt(self.screen_size.height);
|
const max_x: f32 = @floatFromInt(self.screen_size.width);
|
||||||
break :pos_out_viewport pos.x < 0 or pos.y < 0 or
|
const max_y: f32 = @floatFromInt(self.screen_size.height);
|
||||||
pos.x > max_x or pos.y > max_y;
|
break :pos_out_viewport pos.x < 0 or pos.y < 0 or
|
||||||
};
|
pos.x > max_x or pos.y > max_y;
|
||||||
if (pos_out_viewport) outside_viewport: {
|
};
|
||||||
// If we don't have a motion-tracking event mode, do nothing.
|
if (pos_out_viewport) outside_viewport: {
|
||||||
if (!self.io.terminal.flags.mouse_event.motion()) return;
|
// If we don't have a motion-tracking event mode, do nothing.
|
||||||
|
if (!self.io.terminal.flags.mouse_event.motion()) return;
|
||||||
|
|
||||||
// If any button is pressed, we still do the report. Otherwise,
|
// If any button is pressed, we still do the report. Otherwise,
|
||||||
// we do not do the report.
|
// we do not do the report.
|
||||||
for (self.mouse.click_state) |state| {
|
for (self.mouse.click_state) |state| {
|
||||||
if (state != .release) break :outside_viewport;
|
if (state != .release) break :outside_viewport;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This format reports X/Y
|
// This format reports X/Y
|
||||||
|
Reference in New Issue
Block a user