mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Move processing of coca_pending_actions() into its own function
Makes process_global_state less crowded and easier to grok
This commit is contained in:
@@ -971,35 +971,9 @@ set_cocoa_pending_action(CocoaPendingAction action, const char *wd) {
|
||||
// Unjam it so the pending action is processed right now.
|
||||
wakeup_main_loop();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void process_global_state(void *data);
|
||||
|
||||
static void
|
||||
do_state_check(id_type timer_id UNUSED, void *data) {
|
||||
EVDBG("State check timer fired");
|
||||
process_global_state(data);
|
||||
}
|
||||
|
||||
static id_type state_check_timer = 0;
|
||||
|
||||
static void
|
||||
process_global_state(void *data) {
|
||||
EVDBG("Processing global state");
|
||||
ChildMonitor *self = data;
|
||||
maximum_wait = -1;
|
||||
bool state_check_timer_enabled = false;
|
||||
bool input_read = false;
|
||||
|
||||
monotonic_t now = monotonic();
|
||||
if (global_state.has_pending_resizes) {
|
||||
process_pending_resizes(now);
|
||||
input_read = true;
|
||||
}
|
||||
if (parse_input(self)) input_read = true;
|
||||
render(now, input_read);
|
||||
#ifdef __APPLE__
|
||||
if (has_cocoa_pending_actions) {
|
||||
process_cocoa_pending_actions(void) {
|
||||
if (cocoa_pending_actions[PREFERENCES_WINDOW]) { call_boss(edit_config_file, NULL); }
|
||||
if (cocoa_pending_actions[NEW_OS_WINDOW]) { call_boss(new_os_window, NULL); }
|
||||
if (cocoa_pending_actions[CLOSE_OS_WINDOW]) { call_boss(close_os_window, NULL); }
|
||||
@@ -1030,6 +1004,38 @@ process_global_state(void *data) {
|
||||
}
|
||||
memset(cocoa_pending_actions, 0, sizeof(cocoa_pending_actions));
|
||||
has_cocoa_pending_actions = false;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static void process_global_state(void *data);
|
||||
|
||||
static void
|
||||
do_state_check(id_type timer_id UNUSED, void *data) {
|
||||
EVDBG("State check timer fired");
|
||||
process_global_state(data);
|
||||
}
|
||||
|
||||
static id_type state_check_timer = 0;
|
||||
|
||||
static void
|
||||
process_global_state(void *data) {
|
||||
EVDBG("Processing global state");
|
||||
ChildMonitor *self = data;
|
||||
maximum_wait = -1;
|
||||
bool state_check_timer_enabled = false;
|
||||
bool input_read = false;
|
||||
|
||||
monotonic_t now = monotonic();
|
||||
if (global_state.has_pending_resizes) {
|
||||
process_pending_resizes(now);
|
||||
input_read = true;
|
||||
}
|
||||
if (parse_input(self)) input_read = true;
|
||||
render(now, input_read);
|
||||
#ifdef __APPLE__
|
||||
if (has_cocoa_pending_actions) {
|
||||
process_cocoa_pending_actions();
|
||||
maximum_wait = 0; // ensure loop ticks again so that the actions side effects are performed immediately
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user