Implement maximize/restore controls
Remove also resize from top and right of the window
This commit is contained in:
+12
-2
@@ -3,10 +3,18 @@ local common = require "core.common"
|
||||
local style = require "core.style"
|
||||
local View = require "core.view"
|
||||
|
||||
local restore_command = {
|
||||
symbol = "w", action = function() system.set_window_mode("normal") end
|
||||
}
|
||||
|
||||
local maximize_command = {
|
||||
symbol = "W", action = function() system.set_window_mode("maximized") end
|
||||
}
|
||||
|
||||
local title_commands = {
|
||||
{symbol = "_", action = function() system.set_window_mode("minimized") end},
|
||||
{symbol = "w", action = function() system.set_window_mode("maximized") end},
|
||||
{symbol = "W", action = function() core.quit() end},
|
||||
maximize_command,
|
||||
{symbol = "X", action = function() core.quit() end},
|
||||
}
|
||||
|
||||
local TitleView = View:extend()
|
||||
@@ -28,6 +36,8 @@ function TitleView:update()
|
||||
self.size.y = 0
|
||||
end
|
||||
TitleView.super.update(self)
|
||||
local window_mode = system.get_window_mode()
|
||||
title_commands[2] = window_mode == "maximized" and restore_command or maximize_command
|
||||
local title_height = self.size.y
|
||||
if core.window_borderless and title_height ~= core.hit_test_title_height then
|
||||
local icon_w = style.icon_font:get_width("_")
|
||||
|
||||
Reference in New Issue
Block a user