Fix cursor blinking problem

The problem was that when the editor had no events the cursor was not
blinking because the event loop was blocking on wait_event.

Now we no longer calls wait_event without a timeout if the windows has
the focus. When the window has the focus the timeout is set to 1 / fps
so that the cursor can blinks.

In addition we react to the "focus lost" event to ensure the documents
are redrawn without the cursor.
This commit is contained in:
Francesco Abbate
2020-11-21 16:36:32 +01:00
parent bdaddea29a
commit 70412b520b
3 changed files with 17 additions and 1 deletions
+4
View File
@@ -61,6 +61,10 @@ top:
lua_pushstring(L, "exposed");
return 1;
}
if (e.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
lua_pushstring(L, "focuslost");
return 1;
}
/* on some systems, when alt-tabbing to the window SDL will queue up
** several KEYDOWN events for the `tab` key; we flush all keydown
** events on focus so these are discarded */