mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
macOS: Fix :opt:sync_to_monitor not working on Mojave.
This commit is contained in:
@@ -64,6 +64,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- macOS: When closing a top-level window only switch focus to the previous kitty
|
- macOS: When closing a top-level window only switch focus to the previous kitty
|
||||||
window if it is on the same workspace (:iss:`1379`)
|
window if it is on the same workspace (:iss:`1379`)
|
||||||
|
|
||||||
|
- macOS: Fix :opt:`sync_to_monitor` not working on Mojave.
|
||||||
|
|
||||||
0.13.3 [2019-01-19]
|
0.13.3 [2019-01-19]
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ extern PyTypeObject Screen_Type;
|
|||||||
// Apple does not implement MSG_NOSIGNAL
|
// Apple does not implement MSG_NOSIGNAL
|
||||||
#define MSG_NOSIGNAL 0
|
#define MSG_NOSIGNAL 0
|
||||||
#endif
|
#endif
|
||||||
|
#define USE_RENDER_FRAMES (global_state.has_render_frames && OPT(sync_to_monitor))
|
||||||
|
|
||||||
static void (*parse_func)(Screen*, PyObject*, double);
|
static void (*parse_func)(Screen*, PyObject*, double);
|
||||||
|
|
||||||
@@ -638,7 +639,7 @@ render_os_window(OSWindow *os_window, double now, unsigned int active_window_id,
|
|||||||
os_window->last_active_tab = os_window->active_tab; os_window->last_num_tabs = os_window->num_tabs; os_window->last_active_window_id = active_window_id;
|
os_window->last_active_tab = os_window->active_tab; os_window->last_num_tabs = os_window->num_tabs; os_window->last_active_window_id = active_window_id;
|
||||||
os_window->focused_at_last_render = os_window->is_focused;
|
os_window->focused_at_last_render = os_window->is_focused;
|
||||||
os_window->is_damaged = false;
|
os_window->is_damaged = false;
|
||||||
if (global_state.is_wayland && OPT(sync_to_monitor)) wayland_request_frame_render(os_window);
|
if (USE_RENDER_FRAMES) request_frame_render(os_window);
|
||||||
#undef WD
|
#undef WD
|
||||||
#undef TD
|
#undef TD
|
||||||
}
|
}
|
||||||
@@ -667,8 +668,8 @@ render(double now) {
|
|||||||
update_os_window_title(w);
|
update_os_window_title(w);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (global_state.is_wayland && w->wayland_render_state != RENDER_FRAME_READY && OPT(sync_to_monitor)) {
|
if (USE_RENDER_FRAMES && w->render_state != RENDER_FRAME_READY) {
|
||||||
if (w->wayland_render_state == RENDER_FRAME_NOT_REQUESTED) wayland_request_frame_render(w);
|
if (w->render_state == RENDER_FRAME_NOT_REQUESTED) request_frame_render(w);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool needs_render = w->is_damaged;
|
bool needs_render = w->is_damaged;
|
||||||
|
|||||||
36
kitty/glfw.c
36
kitty/glfw.c
@@ -555,10 +555,11 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
|||||||
w->fonts_data = fonts_data;
|
w->fonts_data = fonts_data;
|
||||||
w->shown_once = true;
|
w->shown_once = true;
|
||||||
w->last_focused_counter = ++focus_counter;
|
w->last_focused_counter = ++focus_counter;
|
||||||
glfwSwapInterval(OPT(sync_to_monitor) && !global_state.is_wayland ? 1 : 0);
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (OPT(macos_option_as_alt)) glfwSetCocoaTextInputFilter(glfw_window, filter_option);
|
if (OPT(macos_option_as_alt)) glfwSetCocoaTextInputFilter(glfw_window, filter_option);
|
||||||
glfwSetCocoaToggleFullscreenIntercept(glfw_window, intercept_cocoa_fullscreen);
|
glfwSetCocoaToggleFullscreenIntercept(glfw_window, intercept_cocoa_fullscreen);
|
||||||
|
#else
|
||||||
|
glfwSwapInterval(OPT(sync_to_monitor) && !global_state.is_wayland ? 1 : 0);
|
||||||
#endif
|
#endif
|
||||||
send_prerendered_sprites_for_window(w);
|
send_prerendered_sprites_for_window(w);
|
||||||
if (logo.pixels && logo.width && logo.height) glfwSetWindowIcon(glfw_window, 1, &logo);
|
if (logo.pixels && logo.width && logo.height) glfwSetWindowIcon(glfw_window, 1, &logo);
|
||||||
@@ -1037,25 +1038,40 @@ void
|
|||||||
get_cocoa_key_equivalent(int key, int mods, unsigned short *cocoa_key, int *cocoa_mods) {
|
get_cocoa_key_equivalent(int key, int mods, unsigned short *cocoa_key, int *cocoa_mods) {
|
||||||
glfwGetCocoaKeyEquivalent(key, mods, cocoa_key, cocoa_mods);
|
glfwGetCocoaKeyEquivalent(key, mods, cocoa_key, cocoa_mods);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
wayland_frame_request_callback(id_type os_window_id) {
|
cocoa_frame_request_callback(GLFWwindow *window) {
|
||||||
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
||||||
if (global_state.os_windows[i].id == os_window_id) {
|
if (global_state.os_windows[i].handle == window) {
|
||||||
global_state.os_windows[i].wayland_render_state = RENDER_FRAME_READY;
|
global_state.os_windows[i].render_state = RENDER_FRAME_READY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wayland_request_frame_render(OSWindow *w) {
|
request_frame_render(OSWindow *w) {
|
||||||
glfwRequestWaylandFrameEvent(w->handle, w->id, wayland_frame_request_callback);
|
glfwCocoaRequestRenderFrame(w->handle, cocoa_frame_request_callback);
|
||||||
w->wayland_render_state = RENDER_FRAME_REQUESTED;
|
w->render_state = RENDER_FRAME_REQUESTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#else
|
||||||
|
|
||||||
|
static void
|
||||||
|
wayland_frame_request_callback(id_type os_window_id) {
|
||||||
|
for (size_t i = 0; i < global_state.num_os_windows; i++) {
|
||||||
|
if (global_state.os_windows[i].id == os_window_id) {
|
||||||
|
global_state.os_windows[i].render_state = RENDER_FRAME_READY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
request_frame_render(OSWindow *w) {
|
||||||
|
glfwRequestWaylandFrameEvent(w->handle, w->id, wayland_frame_request_callback);
|
||||||
|
w->render_state = RENDER_FRAME_REQUESTED;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dbus_notification_created_callback(unsigned long long notification_id, uint32_t new_notification_id, void* data UNUSED) {
|
dbus_notification_created_callback(unsigned long long notification_id, uint32_t new_notification_id, void* data UNUSED) {
|
||||||
|
|||||||
@@ -351,6 +351,10 @@ PYWRAP1(set_options) {
|
|||||||
int is_wayland = 0, debug_gl = 0, debug_font_fallback = 0;
|
int is_wayland = 0, debug_gl = 0, debug_font_fallback = 0;
|
||||||
PA("O|ppp", &opts, &is_wayland, &debug_gl, &debug_font_fallback);
|
PA("O|ppp", &opts, &is_wayland, &debug_gl, &debug_font_fallback);
|
||||||
global_state.is_wayland = is_wayland ? true : false;
|
global_state.is_wayland = is_wayland ? true : false;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
global_state.has_render_frames = true;
|
||||||
|
#endif
|
||||||
|
if (global_state.is_wayland) global_state.has_render_frames = true;
|
||||||
global_state.debug_gl = debug_gl ? true : false;
|
global_state.debug_gl = debug_gl ? true : false;
|
||||||
global_state.debug_font_fallback = debug_font_fallback ? true : false;
|
global_state.debug_font_fallback = debug_font_fallback ? true : false;
|
||||||
#define GA(name) ret = PyObject_GetAttrString(opts, #name); if (ret == NULL) return NULL;
|
#define GA(name) ret = PyObject_GetAttrString(opts, #name); if (ret == NULL) return NULL;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ typedef struct {
|
|||||||
bool is_set;
|
bool is_set;
|
||||||
} OSWindowGeometry;
|
} OSWindowGeometry;
|
||||||
|
|
||||||
enum WAYLAND_RENDER_STATE { RENDER_FRAME_NOT_REQUESTED, RENDER_FRAME_REQUESTED, RENDER_FRAME_READY };
|
enum RENDER_STATE { RENDER_FRAME_NOT_REQUESTED, RENDER_FRAME_REQUESTED, RENDER_FRAME_READY };
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *handle;
|
void *handle;
|
||||||
@@ -134,7 +134,7 @@ typedef struct {
|
|||||||
FONTS_DATA_HANDLE fonts_data;
|
FONTS_DATA_HANDLE fonts_data;
|
||||||
id_type temp_font_group_id;
|
id_type temp_font_group_id;
|
||||||
double pending_scroll_pixels;
|
double pending_scroll_pixels;
|
||||||
enum WAYLAND_RENDER_STATE wayland_render_state;
|
enum RENDER_STATE render_state;
|
||||||
id_type last_focused_counter;
|
id_type last_focused_counter;
|
||||||
} OSWindow;
|
} OSWindow;
|
||||||
|
|
||||||
@@ -149,6 +149,7 @@ typedef struct {
|
|||||||
OSWindow *callback_os_window;
|
OSWindow *callback_os_window;
|
||||||
bool terminate;
|
bool terminate;
|
||||||
bool is_wayland;
|
bool is_wayland;
|
||||||
|
bool has_render_frames;
|
||||||
bool debug_gl, debug_font_fallback;
|
bool debug_gl, debug_font_fallback;
|
||||||
bool has_pending_resizes;
|
bool has_pending_resizes;
|
||||||
bool in_sequence_mode;
|
bool in_sequence_mode;
|
||||||
@@ -219,4 +220,4 @@ void set_cocoa_pending_action_with_wd(CocoaPendingAction action, const char *wd)
|
|||||||
bool application_quit_requested();
|
bool application_quit_requested();
|
||||||
void request_application_quit();
|
void request_application_quit();
|
||||||
#endif
|
#endif
|
||||||
void wayland_request_frame_render(OSWindow *w);
|
void request_frame_render(OSWindow *w);
|
||||||
|
|||||||
Reference in New Issue
Block a user