gtk-ng: fix setting/unsetting of urgency
- Don't set urgency on windows that are the topmost window. - Turn off urgency on windows that become the topmost window. Fixes #8373pull/8376/head
parent
400576f0b0
commit
8a14f21325
|
|
@ -987,6 +987,22 @@ pub const Window = extern struct {
|
|||
};
|
||||
}
|
||||
|
||||
fn propIsActive(
|
||||
_: *gtk.Window,
|
||||
_: *gobject.ParamSpec,
|
||||
self: *Self,
|
||||
) callconv(.c) void {
|
||||
// Don't change urgency if we're not the active window.
|
||||
if (self.as(gtk.Window).isActive() == 0) return;
|
||||
|
||||
self.winproto().setUrgent(false) catch |err| {
|
||||
log.warn(
|
||||
"winproto failed to reset urgency={}",
|
||||
.{err},
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
fn propGdkSurfaceWidth(
|
||||
_: *gdk.Surface,
|
||||
_: *gobject.ParamSpec,
|
||||
|
|
@ -1765,10 +1781,13 @@ pub const Window = extern struct {
|
|||
native.beep();
|
||||
}
|
||||
|
||||
if (config.@"bell-features".attention) {
|
||||
if (config.@"bell-features".attention) attention: {
|
||||
// Dont set urgency if the window is already active.
|
||||
if (self.as(gtk.Window).isActive() != 0) break :attention;
|
||||
|
||||
// Request user attention
|
||||
self.winproto().setUrgent(true) catch |err| {
|
||||
log.warn("failed to request user attention={}", .{err});
|
||||
log.warn("winproto failed to set urgency={}", .{err});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1912,6 +1931,7 @@ pub const Window = extern struct {
|
|||
class.bindTemplateCallback("notify_selected_page", &tabViewSelectedPage);
|
||||
class.bindTemplateCallback("notify_config", &propConfig);
|
||||
class.bindTemplateCallback("notify_fullscreened", &propFullscreened);
|
||||
class.bindTemplateCallback("notify_is_active", &propIsActive);
|
||||
class.bindTemplateCallback("notify_maximized", &propMaximized);
|
||||
class.bindTemplateCallback("notify_menu_active", &propMenuActive);
|
||||
class.bindTemplateCallback("notify_quick_terminal", &propQuickTerminal);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ template $GhosttyWindow: Adw.ApplicationWindow {
|
|||
realize => $realize();
|
||||
notify::config => $notify_config();
|
||||
notify::fullscreened => $notify_fullscreened();
|
||||
notify::is-active => $notify_is_active();
|
||||
notify::maximized => $notify_maximized();
|
||||
notify::quick-terminal => $notify_quick_terminal();
|
||||
notify::scale-factor => $notify_scale_factor();
|
||||
|
|
|
|||
Loading…
Reference in New Issue