apprt/gtk-ng: "cancel" should be default close response for dialog (#8427)
Fixes #8424 This is the response that will be sent when "escape" is pressed. This also fixes a null ptr deref that was possible when this fix wasn't in.pull/8442/head
commit
7106d71a42
|
|
@ -499,7 +499,15 @@ pub const Application = extern struct {
|
||||||
const parent: ?*gtk.Widget = parent: {
|
const parent: ?*gtk.Widget = parent: {
|
||||||
const list = gtk.Window.listToplevels();
|
const list = gtk.Window.listToplevels();
|
||||||
defer list.free();
|
defer list.free();
|
||||||
const focused = list.findCustom(null, findActiveWindow);
|
const focused = @as(?*glib.List, list.findCustom(
|
||||||
|
null,
|
||||||
|
findActiveWindow,
|
||||||
|
)) orelse {
|
||||||
|
// If we have an active surface then we should have
|
||||||
|
// a window available but in the rare case we don't we
|
||||||
|
// should exit so we don't crash.
|
||||||
|
break :parent null;
|
||||||
|
};
|
||||||
break :parent @ptrCast(@alignCast(focused.f_data));
|
break :parent @ptrCast(@alignCast(focused.f_data));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const Common = @import("../class.zig").Common;
|
||||||
const Config = @import("config.zig").Config;
|
const Config = @import("config.zig").Config;
|
||||||
const Dialog = @import("dialog.zig").Dialog;
|
const Dialog = @import("dialog.zig").Dialog;
|
||||||
|
|
||||||
const log = std.log.scoped(.gtk_ghostty_config_errors_dialog);
|
const log = std.log.scoped(.gtk_ghostty_close_confirmation_dialog);
|
||||||
|
|
||||||
pub const CloseConfirmationDialog = extern struct {
|
pub const CloseConfirmationDialog = extern struct {
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ const gresource = @import("../build/gresource.zig");
|
||||||
const Common = @import("../class.zig").Common;
|
const Common = @import("../class.zig").Common;
|
||||||
const Config = @import("config.zig").Config;
|
const Config = @import("config.zig").Config;
|
||||||
const Application = @import("application.zig").Application;
|
const Application = @import("application.zig").Application;
|
||||||
const CloseConfirmationDialog = @import("close_confirmation_dialog.zig").CloseConfirmationDialog;
|
|
||||||
const SplitTree = @import("split_tree.zig").SplitTree;
|
const SplitTree = @import("split_tree.zig").SplitTree;
|
||||||
const Surface = @import("surface.zig").Surface;
|
const Surface = @import("surface.zig").Surface;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,6 @@ template $GhosttyCloseConfirmationDialog: $GhosttyDialog {
|
||||||
cancel: _("Cancel"),
|
cancel: _("Cancel"),
|
||||||
close: _("Close") destructive,
|
close: _("Close") destructive,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
close-response: "cancel";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue