fix: fullscreen on new windows

This commit is contained in:
Raiden1411
2023-11-06 11:59:16 +00:00
parent 7fa712ab2b
commit 232527c9dc
2 changed files with 11 additions and 0 deletions

View File

@ -155,6 +155,7 @@ const DerivedConfig = struct {
window_padding_y: u32, window_padding_y: u32,
window_padding_balance: bool, window_padding_balance: bool,
title: ?[:0]const u8, title: ?[:0]const u8,
fullscreen: bool,
pub fn init(alloc_gpa: Allocator, config: *const configpkg.Config) !DerivedConfig { pub fn init(alloc_gpa: Allocator, config: *const configpkg.Config) !DerivedConfig {
var arena = ArenaAllocator.init(alloc_gpa); var arena = ArenaAllocator.init(alloc_gpa);
@ -180,6 +181,7 @@ const DerivedConfig = struct {
.window_padding_y = config.@"window-padding-y", .window_padding_y = config.@"window-padding-y",
.window_padding_balance = config.@"window-padding-balance", .window_padding_balance = config.@"window-padding-balance",
.title = config.title, .title = config.title,
.fullscreen = config.fullscreen,
// Assignments happen sequentially so we have to do this last // Assignments happen sequentially so we have to do this last
// so that the memory is captured from allocs above. // so that the memory is captured from allocs above.

View File

@ -325,6 +325,15 @@ pub fn redrawInspector(self: *App, surface: *Surface) void {
pub fn newWindow(self: *App, parent_: ?*CoreSurface) !void { pub fn newWindow(self: *App, parent_: ?*CoreSurface) !void {
const alloc = self.core_app.alloc; const alloc = self.core_app.alloc;
// If we are in fullscreen mode and have a parent surface we force the disable of this setting.
// This prevents that new windows get created in fullscreen mode.
// This also prevents that the settings always gets set to false everytime a new window is created.
if (self.config.fullscreen) {
if (parent_) |_| {
self.config.fullscreen = false;
}
}
// Allocate a fixed pointer for our window. We try to minimize // Allocate a fixed pointer for our window. We try to minimize
// allocations but windows and other GUI requirements are so minimal // allocations but windows and other GUI requirements are so minimal
// compared to the steady-state terminal operation so we use heap // compared to the steady-state terminal operation so we use heap