mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-29 03:47:54 +00:00
rename more stuff
This commit is contained in:
50
src/apprt/surface.zig
Normal file
50
src/apprt/surface.zig
Normal file
@@ -0,0 +1,50 @@
|
||||
const App = @import("../App.zig");
|
||||
const Surface = @import("../Surface.zig");
|
||||
const renderer = @import("../renderer.zig");
|
||||
const termio = @import("../termio.zig");
|
||||
|
||||
/// The message types that can be sent to a single surface.
|
||||
pub const Message = union(enum) {
|
||||
/// Represents a write request. Magic number comes from the max size
|
||||
/// we want this union to be.
|
||||
pub const WriteReq = termio.MessageData(u8, 256);
|
||||
|
||||
/// Set the title of the surface.
|
||||
/// TODO: we should change this to a "WriteReq" style structure in
|
||||
/// the termio message so that we can more efficiently send strings
|
||||
/// of any length
|
||||
set_title: [256]u8,
|
||||
|
||||
/// Change the cell size.
|
||||
cell_size: renderer.CellSize,
|
||||
|
||||
/// Read the clipboard and write to the pty.
|
||||
clipboard_read: u8,
|
||||
|
||||
/// Write the clipboard contents.
|
||||
clipboard_write: WriteReq,
|
||||
};
|
||||
|
||||
/// A surface mailbox.
|
||||
pub const Mailbox = struct {
|
||||
surface: *Surface,
|
||||
app: *App.Mailbox,
|
||||
|
||||
/// Send a message to the surface.
|
||||
pub fn push(self: Mailbox, msg: Message, timeout: App.Mailbox.Timeout) App.Mailbox.Size {
|
||||
// Surface message sending is actually implemented on the app
|
||||
// thread, so we have to rewrap the message with our surface
|
||||
// pointer and send it to the app thread.
|
||||
const result = self.app.push(.{
|
||||
.surface_message = .{
|
||||
.surface = self.surface,
|
||||
.message = msg,
|
||||
},
|
||||
}, timeout);
|
||||
|
||||
// Wake up our app loop
|
||||
self.surface.app.wakeup();
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user