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