mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-28 22:22:41 +03:00
Handle all pending events before redrawing
If new events happen while handling events, take care of those new events as well before redrawing.
This commit is contained in:
parent
75eb293f98
commit
fcce76ba57
@ -69,7 +69,7 @@ EventManager::~EventManager()
|
||||
kak_assert(m_timers.empty());
|
||||
}
|
||||
|
||||
void EventManager::handle_next_events(EventMode mode, sigset_t* sigmask, bool block)
|
||||
bool EventManager::handle_next_events(EventMode mode, sigset_t* sigmask, bool block)
|
||||
{
|
||||
int max_fd = 0;
|
||||
fd_set rfds, wfds, efds;
|
||||
@ -140,6 +140,8 @@ void EventManager::handle_next_events(EventMode mode, sigset_t* sigmask, bool bl
|
||||
if (contains(m_timers, timer) and timer->next_date() <= now)
|
||||
timer->run(mode);
|
||||
}
|
||||
|
||||
return res > 0;
|
||||
}
|
||||
|
||||
void EventManager::force_signal(int fd)
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
EventManager();
|
||||
~EventManager();
|
||||
|
||||
void handle_next_events(EventMode mode, sigset_t* sigmask = nullptr, bool block = true);
|
||||
bool handle_next_events(EventMode mode, sigset_t* sigmask = nullptr, bool block = true);
|
||||
|
||||
// force the watchers associated with fd to be executed
|
||||
// on next handle_next_events call.
|
||||
|
11
src/main.cc
11
src/main.cc
@ -680,9 +680,14 @@ int run_server(StringView session, StringView server_init,
|
||||
(flags & ServerFlags::Daemon)))
|
||||
{
|
||||
client_manager.redraw_clients();
|
||||
event_manager.handle_next_events(EventMode::Normal, nullptr,
|
||||
not client_manager.has_pending_inputs());
|
||||
client_manager.process_pending_inputs();
|
||||
|
||||
// Loop a
|
||||
bool allow_blocking = not client_manager.has_pending_inputs();
|
||||
while (event_manager.handle_next_events(EventMode::Normal, nullptr, allow_blocking))
|
||||
{
|
||||
client_manager.process_pending_inputs();
|
||||
allow_blocking = false;
|
||||
}
|
||||
client_manager.clear_client_trash();
|
||||
client_manager.clear_window_trash();
|
||||
buffer_manager.clear_buffer_trash();
|
||||
|
Loading…
Reference in New Issue
Block a user