Add unix-like behaviour on macOS
Closes https://github.com/lite-xl/lite-xl/issues/398
This commit is contained in:
parent
419cd58c8f
commit
2d088256b1
|
@ -5,7 +5,7 @@ keymap.modkeys = {}
|
||||||
keymap.map = {}
|
keymap.map = {}
|
||||||
keymap.reverse_map = {}
|
keymap.reverse_map = {}
|
||||||
|
|
||||||
local macos = rawget(_G, "MACOS_RESOURCES")
|
local macos = rawget(_G, "MACOS")
|
||||||
|
|
||||||
-- Thanks to mathewmariani, taken from his lite-macos github repository.
|
-- Thanks to mathewmariani, taken from his lite-macos github repository.
|
||||||
local modkeys_os = require("core.modkeys-" .. (macos and "macos" or "generic"))
|
local modkeys_os = require("core.modkeys-" .. (macos and "macos" or "generic"))
|
||||||
|
|
|
@ -86,7 +86,8 @@ if get_option('portable') or host_machine.system() == 'windows'
|
||||||
lite_bindir = '/'
|
lite_bindir = '/'
|
||||||
lite_docdir = '/doc'
|
lite_docdir = '/doc'
|
||||||
lite_datadir = '/data'
|
lite_datadir = '/data'
|
||||||
elif host_machine.system() == 'darwin'
|
elif get_option('bundle') and host_machine.system() == 'darwin'
|
||||||
|
lite_cargs += '-DMACOS_USE_BUNDLE'
|
||||||
lite_bindir = 'Contents/MacOS'
|
lite_bindir = 'Contents/MacOS'
|
||||||
lite_docdir = 'Contents/Resources'
|
lite_docdir = 'Contents/Resources'
|
||||||
lite_datadir = 'Contents/Resources'
|
lite_datadir = 'Contents/Resources'
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
option('bundle', type : 'boolean', value : true, description: 'Build a macOS bundle')
|
||||||
option('portable', type : 'boolean', value : false, description: 'Portable install')
|
option('portable', type : 'boolean', value : false, description: 'Portable install')
|
||||||
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')
|
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')
|
||||||
|
|
10
src/main.c
10
src/main.c
|
@ -74,8 +74,10 @@ static void init_window_icon(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
void set_macos_bundle_resources(lua_State *L);
|
|
||||||
void enable_momentum_scroll();
|
void enable_momentum_scroll();
|
||||||
|
#ifdef MACOS_USE_BUNDLE
|
||||||
|
void set_macos_bundle_resources(lua_State *L);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
@ -134,8 +136,12 @@ init_lua:
|
||||||
lua_setglobal(L, "EXEFILE");
|
lua_setglobal(L, "EXEFILE");
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
set_macos_bundle_resources(L);
|
lua_pushboolean(L, true);
|
||||||
|
lua_setglobal(L, "MACOS");
|
||||||
enable_momentum_scroll();
|
enable_momentum_scroll();
|
||||||
|
#ifdef MACOS_USE_BUNDLE
|
||||||
|
set_macos_bundle_resources(L);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *init_lite_code = \
|
const char *init_lite_code = \
|
||||||
|
|
Loading…
Reference in New Issue