mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-04 19:04:53 +00:00
tweaks to window position
This commit is contained in:
@@ -149,14 +149,10 @@ pub const App = struct {
|
||||
value: apprt.Action.Value(action),
|
||||
) !void {
|
||||
switch (action) {
|
||||
.new_window => {
|
||||
var surface = try self.newSurface(switch (target) {
|
||||
.app => null,
|
||||
.surface => |v| v,
|
||||
});
|
||||
|
||||
try surface.setInitialWindowPosition(self.config.@"window-initial-position-x", self.config.@"window-initial-position-y");
|
||||
},
|
||||
.new_window => _ = try self.newSurface(switch (target) {
|
||||
.app => null,
|
||||
.surface => |v| v,
|
||||
}),
|
||||
|
||||
.new_tab => try self.newTab(switch (target) {
|
||||
.app => null,
|
||||
@@ -514,6 +510,13 @@ pub const Surface = struct {
|
||||
) orelse return glfw.mustGetErrorCode();
|
||||
errdefer win.destroy();
|
||||
|
||||
// Setup our
|
||||
setInitialWindowPosition(
|
||||
win,
|
||||
app.config.@"window-position-x",
|
||||
app.config.@"window-position-y",
|
||||
);
|
||||
|
||||
// Get our physical DPI - debug only because we don't have a use for
|
||||
// this but the logging of it may be useful
|
||||
if (builtin.mode == .Debug) {
|
||||
@@ -670,12 +673,12 @@ pub const Surface = struct {
|
||||
/// Set the initial window position. This is called exactly once at
|
||||
/// surface initialization time. This may be called before "self"
|
||||
/// is fully initialized.
|
||||
fn setInitialWindowPosition(self: *const Surface, x: ?i16, y: ?i16) !void {
|
||||
fn setInitialWindowPosition(win: glfw.Window, x: ?i16, y: ?i16) void {
|
||||
const start_position_x = x orelse return;
|
||||
const start_position_y = y orelse return;
|
||||
|
||||
log.debug("setting initial window position ({},{})", .{ start_position_x, start_position_y });
|
||||
self.window.setPos(.{ .x = start_position_x, .y = start_position_y });
|
||||
win.setPos(.{ .x = start_position_x, .y = start_position_y });
|
||||
}
|
||||
|
||||
/// Set the size limits of the window.
|
||||
|
||||
Reference in New Issue
Block a user