aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2020-11-21 16:36:13 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2020-11-21 16:36:32 +0100
commit70412b520b2fdba84574206ba4fce69bb50e9eea (patch)
treeea9731e3c8e83f724614b2dca472f5f837d5fd21 /src
parentbdaddea29ad7e5395358d735756f6e4ec7bbd11b (diff)
downloadlite-xl-70412b520b2fdba84574206ba4fce69bb50e9eea.tar.gz
lite-xl-70412b520b2fdba84574206ba4fce69bb50e9eea.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/api/system.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/system.c b/src/api/system.c
index 0028f290..c7243442 100644
--- a/src/api/system.c
+++ b/src/api/system.c
@@ -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 */