Preliminary implementation of border-less mode

Not yet functional but most ingredients are there
This commit is contained in:
Francesco Abbate
2021-04-10 19:35:57 +02:00
parent d6f2f1f0a4
commit 7531a0ddc8
6 changed files with 119 additions and 3 deletions
+1
View File
@@ -22,6 +22,7 @@ config.transitions = true
config.animation_rate = 1.0
config.blink_period = 0.8
config.draw_whitespace = false
config.borderless = true
-- Disable plugin loading setting to false the config entry
-- of the same name.
+12 -2
View File
@@ -6,6 +6,7 @@ local command
local keymap
local RootView
local StatusView
local TitleView
local CommandView
local NagView
local DocView
@@ -358,6 +359,7 @@ function core.init()
keymap = require "core.keymap"
RootView = require "core.rootview"
StatusView = require "core.statusview"
TitleView = require "core.titleview"
CommandView = require "core.commandview"
NagView = require "core.nagview"
DocView = require "core.docview"
@@ -398,6 +400,11 @@ function core.init()
end
end
if config.borderless then
system.set_window_bordered(false)
system.set_window_hit_test()
end
core.frame_start = 0
core.clip_rect_stack = {{ 0,0,0,0 }}
core.log_items = {}
@@ -430,9 +437,12 @@ function core.init()
core.command_view = CommandView()
core.status_view = StatusView()
core.nag_view = NagView()
core.title_view = TitleView()
local cur_node = core.root_view.root_node
cur_node.is_primary_node = true
cur_node:split("up", core.title_view, {y = true})
cur_node = cur_node.b
cur_node:split("up", core.nag_view, {y = true})
cur_node = cur_node.b
cur_node = cur_node:split("down", core.command_view, {y = true})
@@ -828,7 +838,7 @@ local function get_title_filename(view)
end
local function compose_window_title(title)
function core.compose_window_title(title)
return title == "" and "Lite XL" or title .. " - Lite XL"
end
@@ -877,7 +887,7 @@ function core.step()
-- update window title
local current_title = get_title_filename(core.active_view)
if current_title ~= core.window_title then
system.set_window_title(compose_window_title(current_title))
system.set_window_title(core.compose_window_title(current_title))
core.window_title = current_title
end
+30
View File
@@ -0,0 +1,30 @@
local core = require "core"
local style = require "core.style"
local StatusView = require "core.statusview"
local TitleView = StatusView:extend()
TitleView.separator = " "
function TitleView:new()
TitleView.super.new(self)
end
function TitleView:on_mouse_pressed()
core.set_active_view(core.last_active_view)
end
function TitleView:get_items()
local title = core.compose_window_title(core.window_title)
return {
style.text, style.icon_font, "g ", style.font, title,
}, {
style.text, style.icon_font, "_", TitleView.separator, "w", TitleView.separator, "W",
}
end
return TitleView
Binary file not shown.