apprt/gtk-ng: hook up bell ringing (#8065)
For now, this just emits a signal that an embedding widget will react to to do something like flashing the window. I think we should implement the audio bell in the actual surface view but I don't currently have audio drivers hooked up in my Linux VM and I'm away from my desktop PC. :) cc @jcollie if you're interested, pretty tightly scoped.pull/8067/head
commit
787960e56d
|
|
@ -485,6 +485,8 @@ pub const Application = extern struct {
|
||||||
|
|
||||||
.render => Action.render(self, target),
|
.render => Action.render(self, target),
|
||||||
|
|
||||||
|
.ring_bell => Action.ringBell(target),
|
||||||
|
|
||||||
.set_title => Action.setTitle(target, value),
|
.set_title => Action.setTitle(target, value),
|
||||||
|
|
||||||
.show_child_exited => return Action.showChildExited(target, value),
|
.show_child_exited => return Action.showChildExited(target, value),
|
||||||
|
|
@ -515,7 +517,6 @@ pub const Application = extern struct {
|
||||||
.toggle_window_decorations,
|
.toggle_window_decorations,
|
||||||
.prompt_title,
|
.prompt_title,
|
||||||
.toggle_quick_terminal,
|
.toggle_quick_terminal,
|
||||||
.ring_bell,
|
|
||||||
.toggle_command_palette,
|
.toggle_command_palette,
|
||||||
.open_url,
|
.open_url,
|
||||||
.close_all_windows,
|
.close_all_windows,
|
||||||
|
|
@ -1138,6 +1139,13 @@ const Action = struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ringBell(target: apprt.Target) void {
|
||||||
|
switch (target) {
|
||||||
|
.app => {},
|
||||||
|
.surface => |v| v.rt_surface.surface.ringBell(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn setTitle(
|
pub fn setTitle(
|
||||||
target: apprt.Target,
|
target: apprt.Target,
|
||||||
value: apprt.action.SetTitle,
|
value: apprt.action.SetTitle,
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,21 @@ pub const Surface = extern struct {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// The bell is rung.
|
||||||
|
///
|
||||||
|
/// The surface view handles the audio bell feature but none of the
|
||||||
|
/// others so it is up to the embedding widget to react to this.
|
||||||
|
pub const bell = struct {
|
||||||
|
pub const name = "bell";
|
||||||
|
pub const connect = impl.connect;
|
||||||
|
const impl = gobject.ext.defineSignal(
|
||||||
|
name,
|
||||||
|
Self,
|
||||||
|
&.{},
|
||||||
|
void,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/// Emitted whenever the clipboard has been written.
|
/// Emitted whenever the clipboard has been written.
|
||||||
pub const @"clipboard-write" = struct {
|
pub const @"clipboard-write" = struct {
|
||||||
pub const name = "clipboard-write";
|
pub const name = "clipboard-write";
|
||||||
|
|
@ -343,6 +358,18 @@ pub const Surface = extern struct {
|
||||||
priv.gl_area.queueRender();
|
priv.gl_area.queueRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ring the bell.
|
||||||
|
pub fn ringBell(self: *Self) void {
|
||||||
|
// TODO: Audio feature
|
||||||
|
|
||||||
|
signals.bell.impl.emit(
|
||||||
|
self,
|
||||||
|
null,
|
||||||
|
.{},
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Set the current progress report state.
|
/// Set the current progress report state.
|
||||||
pub fn setProgressReport(
|
pub fn setProgressReport(
|
||||||
self: *Self,
|
self: *Self,
|
||||||
|
|
@ -1979,6 +2006,7 @@ pub const Surface = extern struct {
|
||||||
|
|
||||||
// Signals
|
// Signals
|
||||||
signals.@"close-request".impl.register(.{});
|
signals.@"close-request".impl.register(.{});
|
||||||
|
signals.bell.impl.register(.{});
|
||||||
signals.@"clipboard-read".impl.register(.{});
|
signals.@"clipboard-read".impl.register(.{});
|
||||||
signals.@"clipboard-write".impl.register(.{});
|
signals.@"clipboard-write".impl.register(.{});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue