mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
apprt/gtk: small comments
This commit is contained in:
@ -178,15 +178,6 @@ pub fn focusedSurface(self: *const App) ?*Surface {
|
|||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this the last focused surface. This is only valid while on the main
|
|
||||||
/// thread before tick is called.
|
|
||||||
pub fn isFocused(self: *const App, surface: *const Surface) bool {
|
|
||||||
if (!self.hasSurface(surface)) return false;
|
|
||||||
const focused = self.focused_surface orelse return false;
|
|
||||||
if (!self.hasSurface(focused)) return false;
|
|
||||||
return surface == focused;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if confirmation is needed to quit the app. It is up to
|
/// Returns true if confirmation is needed to quit the app. It is up to
|
||||||
/// the apprt to call this.
|
/// the apprt to call this.
|
||||||
pub fn needsConfirmQuit(self: *const App) bool {
|
pub fn needsConfirmQuit(self: *const App) bool {
|
||||||
|
@ -861,11 +861,17 @@ fn gtkActionPresentSurface(
|
|||||||
/// This is called to setup the action map that this application supports.
|
/// This is called to setup the action map that this application supports.
|
||||||
/// This should be called only once on startup.
|
/// This should be called only once on startup.
|
||||||
fn initActions(self: *App) void {
|
fn initActions(self: *App) void {
|
||||||
|
// The set of actions. Each action has (in order):
|
||||||
|
// [0] The action name
|
||||||
|
// [1] The callback function
|
||||||
|
// [2] The GVariantType of the parameter
|
||||||
|
//
|
||||||
|
// For action names:
|
||||||
|
// https://docs.gtk.org/gio/type_func.Action.name_is_valid.html
|
||||||
const actions = .{
|
const actions = .{
|
||||||
.{ "quit", >kActionQuit, null },
|
.{ "quit", >kActionQuit, null },
|
||||||
.{ "open_config", >kActionOpenConfig, null },
|
.{ "open_config", >kActionOpenConfig, null },
|
||||||
.{ "reload_config", >kActionReloadConfig, null },
|
.{ "reload_config", >kActionReloadConfig, null },
|
||||||
// https://docs.gtk.org/gio/type_func.Action.name_is_valid.html
|
|
||||||
.{ "present-surface", >kActionPresentSurface, c.G_VARIANT_TYPE("t") },
|
.{ "present-surface", >kActionPresentSurface, c.G_VARIANT_TYPE("t") },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1146,12 +1146,10 @@ pub fn showDesktopNotification(
|
|||||||
|
|
||||||
const notification = c.g_notification_new(t.ptr);
|
const notification = c.g_notification_new(t.ptr);
|
||||||
defer c.g_object_unref(notification);
|
defer c.g_object_unref(notification);
|
||||||
|
|
||||||
c.g_notification_set_body(notification, body.ptr);
|
c.g_notification_set_body(notification, body.ptr);
|
||||||
|
|
||||||
const icon = c.g_themed_icon_new("com.mitchellh.ghostty");
|
const icon = c.g_themed_icon_new("com.mitchellh.ghostty");
|
||||||
defer c.g_object_unref(icon);
|
defer c.g_object_unref(icon);
|
||||||
|
|
||||||
c.g_notification_set_icon(notification, icon);
|
c.g_notification_set_icon(notification, icon);
|
||||||
|
|
||||||
const pointer = c.g_variant_new_uint64(@intFromPtr(&self.core_surface));
|
const pointer = c.g_variant_new_uint64(@intFromPtr(&self.core_surface));
|
||||||
|
Reference in New Issue
Block a user