Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions data/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ function core.step()
end
core.redraw = true
end

if not core.redraw and not system.window_has_focus() then return false end

if mouse_moved then
core.try(core.on_event, "mousemoved", mouse.x, mouse.y, mouse.dx, mouse.dy)
end
Expand Down Expand Up @@ -453,9 +456,6 @@ function core.run()
core.frame_start = system.get_time()
local did_redraw = core.step()
run_threads()
if not did_redraw and not system.window_has_focus() then
system.wait_event(0.25)
end
local elapsed = system.get_time() - core.frame_start
system.sleep(math.max(0, 1 / config.fps - elapsed))
end
Expand Down
8 changes: 0 additions & 8 deletions src/api/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ static int f_poll_event(lua_State *L) {
}


static int f_wait_event(lua_State *L) {
double n = luaL_checknumber(L, 1);
lua_pushboolean(L, SDL_WaitEventTimeout(NULL, n * 1000));
return 1;
}


static SDL_Cursor* cursor_cache[SDL_SYSTEM_CURSOR_HAND + 1];

static const char *cursor_opts[] = {
Expand Down Expand Up @@ -381,7 +374,6 @@ static int f_fuzzy_match(lua_State *L) {

static const luaL_Reg lib[] = {
{ "poll_event", f_poll_event },
{ "wait_event", f_wait_event },
{ "set_cursor", f_set_cursor },
{ "set_window_title", f_set_window_title },
{ "set_window_mode", f_set_window_mode },
Expand Down