chore: removed setInitialWindowPosition from gtk and renamed window-position-{x,y} to start-position-{x,y} for clarity

This commit is contained in:
Adam Wolf
2024-12-29 21:33:44 -06:00
committed by Mitchell Hashimoto
parent 7195bda7a2
commit 568f1f9d72
4 changed files with 7 additions and 25 deletions

View File

@ -621,8 +621,8 @@ pub fn init(
const width = @max(config.@"window-width" * cell_size.width, 640);
const width_f32: f32 = @floatFromInt(width);
const height_f32: f32 = @floatFromInt(height);
const position_x = config.@"window-position-x";
const position_y = config.@"window-position-y";
const position_x = config.@"start-position-x";
const position_y = config.@"start-position-y";
// The final values are affected by content scale and we need to
// account for the padding so we get the exact correct grid size.

View File

@ -474,7 +474,6 @@ pub fn performAction(
.pwd => try self.setPwd(target, value),
.present_terminal => self.presentTerminal(target),
.initial_size => try self.setInitialSize(target, value),
.initial_position => self.setInitialPosition(target, value),
.mouse_visibility => self.setMouseVisibility(target, value),
.mouse_shape => try self.setMouseShape(target, value),
.mouse_over_link => self.setMouseOverLink(target, value),
@ -788,20 +787,6 @@ fn setInitialSize(
}
}
fn setInitialPosition(
_: *App,
target: apprt.Target,
value: apprt.action.InitialPosition,
) void {
switch (target) {
.app => {},
.surface => |v| try v.rt_surface.setInitialWindowPosition(
value.x,
value.y,
),
}
}
fn showDesktopNotification(
self: *App,
target: apprt.Target,

View File

@ -840,12 +840,6 @@ pub fn setInitialWindowSize(self: *const Surface, width: u32, height: u32) !void
);
}
pub fn setInitialWindowPosition(self: *const Surface, x: i32, y: i32) !void {
// We need the surface's window to set the position.
const window = self.container.window() orelse return;
c.gtk_window_move(@ptrCast(window.window), x, y);
}
pub fn grabFocus(self: *Surface) void {
if (self.container.tab()) |tab| {
// If any other surface was focused and zoomed in, set it to non zoomed in

View File

@ -1117,9 +1117,12 @@ keybind: Keybinds = .{},
/// to be a certain position to fit within the grid. There is nothing Ghostty
/// will do about this, but it will make an effort.
///
/// Important note: Setting this value will only work on macOs and glfw builds
/// on Linux. GTK 4.0 does not support setting the window position.
///
/// This will default to the top-left corner of the screen if not set (0, 0).
@"window-position-x": i32 = 0,
@"window-position-y": i32 = 0,
@"start-position-x": i32 = 0,
@"start-position-y": i32 = 0,
/// Whether to enable saving and restoring window state. Window state includes
/// their position, size, tabs, splits, etc. Some window state requires shell