log system color scheme changes

This commit is contained in:
Kovid Goyal 2023-04-13 13:29:03 +05:30
parent 66801b6b28
commit 2f63f24e7d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 0 deletions

View File

@ -2769,3 +2769,6 @@ class Boss:
def sanitize_url_for_dispay_to_user(self, url: str) -> str:
return sanitize_url_for_dispay_to_user(url)
def on_system_color_scheme_change(self, appearance: int) -> None:
log_error('system color theme changed:', appearance)

View File

@ -52,6 +52,11 @@ get_platform_dependent_config_values(void *glfw_window) {
}
}
static void
on_system_color_scheme_change(int appearance) {
call_boss(on_system_color_scheme_change, "i", appearance);
}
static void
strip_csi_(const char *title, char *buf, size_t bufsz) {
enum { NORMAL, IN_ESC, IN_CSI} state = NORMAL;
@ -869,6 +874,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
glfwSetCurrentSelectionCallback(get_current_selection);
glfwSetHasCurrentSelectionCallback(has_current_selection);
glfwSetIMECursorPositionCallback(get_ime_cursor_position);
glfwSetSystemColorThemeChangeCallback(on_system_color_scheme_change);
#ifdef __APPLE__
cocoa_set_activation_policy(OPT(macos_hide_from_tasks));
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, true);