Fixes #1312
This commit is contained in:
Kovid Goyal 2019-01-18 22:23:12 +05:30
commit 9005fc359d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 21 additions and 10 deletions

View File

@ -32,6 +32,10 @@ Changelog
- Fix :opt:`background_opacity` not working with pure white backgrounds
(:iss:`1285`)
- macOS: Fix "New OS Window" dock action not working when kitty is not focused
(:iss:`1312`)
0.13.2 [2019-01-04]
------------------------------

View File

@ -771,6 +771,9 @@ static unsigned int cocoa_pending_actions = 0;
void
set_cocoa_pending_action(CocoaPendingAction action) {
cocoa_pending_actions |= action;
// The main loop may be blocking on the event queue, if e.g. unfocused.
// Unjam it so the pending action is processed right now.
unjam_event_loop();
}
#endif

View File

@ -57,6 +57,19 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
}
}
// On Cocoa, glfwWaitEvents() can block indefinitely because of the way Cocoa
// works. See https://github.com/glfw/glfw/issues/1251. I have noticed this
// happening in particular with window resize events, when waiting with no
// timeout. See https://github.com/kovidgoyal/kitty/issues/458
// So we use an unlovely hack to workaround that case
void
unjam_event_loop() {
#ifdef __APPLE__
if (event_loop_blocking_with_no_timeout)
wakeup_main_loop();
#endif
}
// callbacks {{{
@ -98,16 +111,6 @@ show_mouse_cursor(GLFWwindow *w) {
}
static int min_width = 100, min_height = 100;
// On Cocoa, glfwWaitEvents() can block indefinitely because of the way Cocoa
// works. See https://github.com/glfw/glfw/issues/1251. I have noticed this
// happening in particular with window resize events, when waiting with no
// timeout. See https://github.com/kovidgoyal/kitty/issues/458
// So we use an unlovely hack to workaround that case
#ifdef __APPLE__
#define unjam_event_loop() { if (event_loop_blocking_with_no_timeout) wakeup_main_loop(); }
#else
#define unjam_event_loop()
#endif
static void
framebuffer_size_callback(GLFWwindow *w, int width, int height) {

View File

@ -172,6 +172,7 @@ void make_os_window_context_current(OSWindow *w);
void update_os_window_references();
void mark_os_window_for_close(OSWindow* w, bool yes);
void update_os_window_viewport(OSWindow *window, bool);
void unjam_event_loop();
bool should_os_window_close(OSWindow* w);
bool should_os_window_be_rendered(OSWindow* w);
void wakeup_main_loop();