mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
gtk: update tab's window upon switching notebook
This commit is contained in:
@ -313,14 +313,21 @@ fn gtkTabNewClick(_: *c.GtkButton, ud: ?*anyopaque) callconv(.C) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn gtkPageAdded(
|
fn gtkPageAdded(
|
||||||
_: *c.GtkNotebook,
|
notebook: *c.GtkNotebook,
|
||||||
child: *c.GtkWidget,
|
_: *c.GtkWidget,
|
||||||
_: c.guint,
|
page_idx: c.guint,
|
||||||
ud: ?*anyopaque,
|
ud: ?*anyopaque,
|
||||||
) callconv(.C) void {
|
) callconv(.C) void {
|
||||||
_ = child;
|
|
||||||
const self = userdataSelf(ud.?);
|
const self = userdataSelf(ud.?);
|
||||||
|
|
||||||
|
// The added page can come from another window with drag and drop, thus we migrate the tab
|
||||||
|
// window to be self.
|
||||||
|
const page = c.gtk_notebook_get_nth_page(notebook, @intCast(page_idx));
|
||||||
|
const tab: *Tab = @ptrCast(@alignCast(
|
||||||
|
c.g_object_get_data(@ptrCast(page), Tab.GHOSTTY_TAB) orelse return,
|
||||||
|
));
|
||||||
|
tab.window = self;
|
||||||
|
|
||||||
// Whenever a new page is added, we always grab focus of the
|
// Whenever a new page is added, we always grab focus of the
|
||||||
// currently selected page. This was added specifically so that when
|
// currently selected page. This was added specifically so that when
|
||||||
// we drag a tab out to create a new window ("create-window" event)
|
// we drag a tab out to create a new window ("create-window" event)
|
||||||
|
Reference in New Issue
Block a user