feat(win32 gui): send terminal background updates to gui
This commit is contained in:
parent
388943e33c
commit
4c73948068
2 changed files with 7 additions and 6 deletions
|
@ -331,12 +331,7 @@ fn set_terminal_title_internal(self: *Self) void {
|
|||
|
||||
pub fn set_terminal_style(self: *Self, style_: Style) void {
|
||||
_ = self;
|
||||
_ = style_;
|
||||
std.log.warn("TODO: implement set_terminal_style", .{});
|
||||
//if (style_.fg) |color|
|
||||
//self.vx.setTerminalForegroundColor(self.tty.anyWriter(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
|
||||
//if (style_.bg) |color|
|
||||
//self.vx.setTerminalBackgroundColor(self.tty.anyWriter(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
|
||||
if (style_.bg) |color| gui.set_window_background(@intCast(color.color));
|
||||
}
|
||||
|
||||
pub fn set_terminal_cursor_color(self: *Self, color: Color) void {
|
||||
|
|
|
@ -17,6 +17,7 @@ const windowmsg = @import("windowmsg.zig");
|
|||
const HResultError = ddui.HResultError;
|
||||
|
||||
const WM_APP_EXIT = win32.WM_APP + 1;
|
||||
const WM_APP_SET_BACKGROUND = win32.WM_APP + 2;
|
||||
|
||||
pub const DropWriter = struct {
|
||||
pub const WriteError = error{};
|
||||
|
@ -500,6 +501,11 @@ pub fn set_window_title(title: [*:0]const u16) error{ NoWindow, Win32 }!void {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_window_background(color: u32) void {
|
||||
const hwnd = global.hwnd orelse return;
|
||||
_ = win32.SendMessageW(hwnd, WM_APP_SET_BACKGROUND, color, 0);
|
||||
}
|
||||
|
||||
// returns false if there is no hwnd
|
||||
pub fn updateScreen(screen: *const vaxis.Screen) bool {
|
||||
global.mutex.lock();
|
||||
|
|
Loading…
Add table
Reference in a new issue