Customized fork of github.com/rxi/lite

Added system.set_fullscreen() and core:toggle-fullscreen command

rxi efed38d5 1e9c3bef

Changed files
+18
data
core
commands
src
api
+7
data/core/commands/core.lua
··· 7 7 local LogView = require "core.logview" 8 8 9 9 10 + local fullscreen = false 11 + 10 12 command.add(nil, { 11 13 ["core:quit"] = function() 12 14 core.quit() ··· 14 16 15 17 ["core:force-quit"] = function() 16 18 core.quit(true) 19 + end, 20 + 21 + ["core:toggle-fullscreen"] = function() 22 + fullscreen = not fullscreen 23 + system.set_fullscreen(fullscreen) 17 24 end, 18 25 19 26 ["core:reload-module"] = function()
+1
data/core/keymap.lua
··· 88 88 ["ctrl+p"] = "core:open-project-file", 89 89 ["ctrl+o"] = "core:open-file", 90 90 ["ctrl+n"] = "core:new-doc", 91 + ["alt+return"] = "core:toggle-fullscreen", 91 92 92 93 ["alt+shift+j"] = "root:split-left", 93 94 ["alt+shift+l"] = "root:split-right",
+10
src/api/system.c
··· 1 1 #include <SDL2/SDL.h> 2 2 #include <ctype.h> 3 3 #include <dirent.h> 4 + #include <stdbool.h> 4 5 #include <sys/stat.h> 5 6 #include "api.h" 6 7 #ifdef _WIN32 ··· 160 161 } 161 162 162 163 164 + static int f_set_fullscreen(lua_State *L) { 165 + luaL_checkany(L, 1); 166 + bool b = lua_toboolean(L, 1); 167 + SDL_SetWindowFullscreen(window, b ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); 168 + return 0; 169 + } 170 + 171 + 163 172 static int f_window_has_focus(lua_State *L) { 164 173 unsigned flags = SDL_GetWindowFlags(window); 165 174 lua_pushboolean(L, flags & SDL_WINDOW_INPUT_FOCUS); ··· 318 327 { "poll_event", f_poll_event }, 319 328 { "set_cursor", f_set_cursor }, 320 329 { "set_window_title", f_set_window_title }, 330 + { "set_fullscreen", f_set_fullscreen }, 321 331 { "window_has_focus", f_window_has_focus }, 322 332 { "show_confirm_dialog", f_show_confirm_dialog }, 323 333 { "list_dir", f_list_dir },