rename key2callback to keycallback

This commit is contained in:
Mitchell Hashimoto
2023-08-16 13:40:57 -07:00
parent 4e8f5d3997
commit 33bef28850
4 changed files with 10 additions and 7 deletions

View File

@ -987,7 +987,10 @@ pub fn preeditCallback(self: *Surface, preedit: ?u21) !void {
try self.queueRender();
}
pub fn key2Callback(
/// Called for any key events. This handles keybindings, encoding and
/// sending to the termianl, etc. The return value is true if the key
/// was handled and false if it was not.
pub fn keyCallback(
self: *Surface,
event: input.KeyEvent,
) !bool {

View File

@ -509,7 +509,7 @@ pub const Surface = struct {
} else .invalid;
// Invoke the core Ghostty logic to handle this input.
const consumed = self.core_surface.key2Callback(.{
const consumed = self.core_surface.keyCallback(.{
.action = action,
.key = key,
.physical_key = physical_key,
@ -541,7 +541,7 @@ pub const Surface = struct {
// For a char callback we just construct a key event with invalid
// keys but with text. This should result in the text being sent
// as-is.
_ = self.core_surface.key2Callback(.{
_ = self.core_surface.keyCallback(.{
.action = .press,
.key = .invalid,
.physical_key = .invalid,

View File

@ -606,7 +606,7 @@ pub const Surface = struct {
};
key_event.utf8 = buf[0..len];
_ = core_win.key2Callback(key_event) catch |err| {
_ = core_win.keyCallback(key_event) catch |err| {
log.err("error in key callback err={}", .{err});
return;
};
@ -773,7 +773,7 @@ pub const Surface = struct {
.utf8 = "",
};
const consumed = core_win.key2Callback(key_event) catch |err| {
const consumed = core_win.keyCallback(key_event) catch |err| {
log.err("error in key callback err={}", .{err});
return;
};

View File

@ -1309,7 +1309,7 @@ pub const Surface = struct {
}
// Invoke the core Ghostty logic to handle this input.
const consumed = self.core_surface.key2Callback(.{
const consumed = self.core_surface.keyCallback(.{
.action = action,
.key = key,
.physical_key = physical_key,
@ -1402,7 +1402,7 @@ pub const Surface = struct {
// We're not in a keypress, so this was sent from an on-screen emoji
// keyboard or someting like that. Send the characters directly to
// the surface.
_ = self.core_surface.key2Callback(.{
_ = self.core_surface.keyCallback(.{
.action = .press,
.key = .invalid,
.physical_key = .invalid,