Merge remote-tracking branch 'basinbaby/set-window-opacity'

Implement the suggestion and close #125.

Initial suggestion and implementation from

https://github.com/rxi/lite/pull/17
This commit is contained in:
Francesco Abbate 2021-03-23 07:08:10 +01:00
commit 4b3b8f430a
2 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,10 @@ Lite XL is following closely [rxi/lite](https://github.com/rxi/lite) but with so
This files document the changes done in Lite XL for each release. This files document the changes done in Lite XL for each release.
### next release
Add `system.set_window_opacity` function.
### 1.16.5 ### 1.16.5
Hotfix for Github's issue https://github.com/franko/lite-xl/issues/122 Hotfix for Github's issue https://github.com/franko/lite-xl/issues/122

View File

@ -454,6 +454,13 @@ static int f_fuzzy_match(lua_State *L) {
return 1; return 1;
} }
static int f_set_window_opacity(lua_State *L) {
double n = luaL_checknumber(L, 1);
int r = SDL_SetWindowOpacity(window, n);
lua_pushboolean(L, r > -1);
return 1;
}
static const luaL_Reg lib[] = { static const luaL_Reg lib[] = {
{ "poll_event", f_poll_event }, { "poll_event", f_poll_event },
@ -477,6 +484,7 @@ static const luaL_Reg lib[] = {
{ "sleep", f_sleep }, { "sleep", f_sleep },
{ "exec", f_exec }, { "exec", f_exec },
{ "fuzzy_match", f_fuzzy_match }, { "fuzzy_match", f_fuzzy_match },
{ "set_window_opacity", f_set_window_opacity },
{ NULL, NULL } { NULL, NULL }
}; };