mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
remove point.Viewport
This commit is contained in:
@ -172,7 +172,7 @@ const Mouse = struct {
|
|||||||
left_click_time: std.time.Instant = undefined,
|
left_click_time: std.time.Instant = undefined,
|
||||||
|
|
||||||
/// The last x/y sent for mouse reports.
|
/// The last x/y sent for mouse reports.
|
||||||
event_point: ?terminal.point.Viewport = null,
|
event_point: ?terminal.point.Coordinate = null,
|
||||||
|
|
||||||
/// Pending scroll amounts for high-precision scrolls
|
/// Pending scroll amounts for high-precision scrolls
|
||||||
pending_scroll_x: f64 = 0,
|
pending_scroll_x: f64 = 0,
|
||||||
@ -186,7 +186,7 @@ const Mouse = struct {
|
|||||||
|
|
||||||
/// The last x/y in the cursor position for links. We use this to
|
/// The last x/y in the cursor position for links. We use this to
|
||||||
/// only process link hover events when the mouse actually moves cells.
|
/// only process link hover events when the mouse actually moves cells.
|
||||||
link_point: ?terminal.point.Viewport = null,
|
link_point: ?terminal.point.Coordinate = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The configuration that a surface has, this is copied from the main
|
/// The configuration that a surface has, this is copied from the main
|
||||||
@ -2886,7 +2886,7 @@ pub fn colorSchemeCallback(self: *Surface, scheme: apprt.ColorScheme) !void {
|
|||||||
if (report) try self.reportColorScheme();
|
if (report) try self.reportColorScheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn posToViewport(self: Surface, xpos: f64, ypos: f64) terminal.point.Viewport {
|
fn posToViewport(self: Surface, xpos: f64, ypos: f64) terminal.point.Coordinate {
|
||||||
// xpos/ypos need to be adjusted for window padding
|
// xpos/ypos need to be adjusted for window padding
|
||||||
// (i.e. "window-padding-*" settings.
|
// (i.e. "window-padding-*" settings.
|
||||||
const pad = if (self.config.window_padding_balance)
|
const pad = if (self.config.window_padding_balance)
|
||||||
|
@ -34,7 +34,7 @@ pub const Mouse = struct {
|
|||||||
/// The point on the viewport where the mouse currently is. We use
|
/// The point on the viewport where the mouse currently is. We use
|
||||||
/// viewport points to avoid the complexity of mapping the mouse to
|
/// viewport points to avoid the complexity of mapping the mouse to
|
||||||
/// the renderer state.
|
/// the renderer state.
|
||||||
point: ?terminal.point.Viewport = null,
|
point: ?terminal.point.Coordinate = null,
|
||||||
|
|
||||||
/// The mods that are currently active for the last mouse event.
|
/// The mods that are currently active for the last mouse event.
|
||||||
/// This could really just be mods in general and we probably will
|
/// This could really just be mods in general and we probably will
|
||||||
|
@ -1621,7 +1621,7 @@ pub fn pointFromPin(self: *const PageList, tag: point.Tag, p: Pin) ?point.Point
|
|||||||
const tl = self.getTopLeft(tag);
|
const tl = self.getTopLeft(tag);
|
||||||
|
|
||||||
// Count our first page which is special because it may be partial.
|
// Count our first page which is special because it may be partial.
|
||||||
var coord: point.Point.Coordinate = .{ .x = p.x };
|
var coord: point.Coordinate = .{ .x = p.x };
|
||||||
if (p.page == tl.page) {
|
if (p.page == tl.page) {
|
||||||
// If our top-left is after our y then we're outside the range.
|
// If our top-left is after our y then we're outside the range.
|
||||||
if (tl.y > p.y) return null;
|
if (tl.y > p.y) return null;
|
||||||
|
@ -53,11 +53,6 @@ pub const Point = union(Tag) {
|
|||||||
screen: Coordinate,
|
screen: Coordinate,
|
||||||
history: Coordinate,
|
history: Coordinate,
|
||||||
|
|
||||||
pub const Coordinate = struct {
|
|
||||||
x: usize = 0,
|
|
||||||
y: usize = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn coord(self: Point) Coordinate {
|
pub fn coord(self: Point) Coordinate {
|
||||||
return switch (self) {
|
return switch (self) {
|
||||||
.active,
|
.active,
|
||||||
@ -69,13 +64,11 @@ pub const Point = union(Tag) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A point in the terminal that is always in the viewport area.
|
pub const Coordinate = struct {
|
||||||
/// TODO(paged-terminal): remove
|
|
||||||
pub const Viewport = struct {
|
|
||||||
x: usize = 0,
|
x: usize = 0,
|
||||||
y: usize = 0,
|
y: usize = 0,
|
||||||
|
|
||||||
pub fn eql(self: Viewport, other: Viewport) bool {
|
pub fn eql(self: Coordinate, other: Coordinate) bool {
|
||||||
return self.x == other.x and self.y == other.y;
|
return self.x == other.x and self.y == other.y;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user