mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 10:12:17 +02:00
Track initial color scheme preference read on Linux
This commit is contained in:
@@ -955,7 +955,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
||||
GLFWColorScheme new_appearance = glfwGetCurrentSystemColorTheme();
|
||||
if (new_appearance != appearance) {
|
||||
appearance = new_appearance;
|
||||
_glfwInputColorScheme(appearance);
|
||||
_glfwInputColorScheme(appearance, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
glfw/glfw3.h
vendored
5
glfw/glfw3.h
vendored
@@ -1429,16 +1429,17 @@ typedef void (* GLFWapplicationclosefun)(int);
|
||||
*
|
||||
* This is the function pointer type for system color theme changes.
|
||||
* @code
|
||||
* void function_name(int theme_type)
|
||||
* void function_name(GLFWColorScheme theme_type, bool is_initial_value)
|
||||
* @endcode
|
||||
*
|
||||
* @param[in] theme_type 0 for unknown, 1 for dark and 2 for light
|
||||
* @param[in] is_initial_value true if this is the initial read of the color theme on systems where it is asynchronous such as Linux
|
||||
*
|
||||
* @sa @ref glfwSetSystemColorThemeChangeCallback
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWsystemcolorthemechangefun)(GLFWColorScheme);
|
||||
typedef void (* GLFWsystemcolorthemechangefun)(GLFWColorScheme, bool);
|
||||
|
||||
|
||||
/*! @brief The function pointer type for window content refresh callbacks.
|
||||
|
||||
4
glfw/input.c
vendored
4
glfw/input.c
vendored
@@ -448,9 +448,9 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
|
||||
js->hats[hat] = value;
|
||||
}
|
||||
|
||||
void _glfwInputColorScheme(GLFWColorScheme value) {
|
||||
void _glfwInputColorScheme(GLFWColorScheme value, bool is_initial_value) {
|
||||
_glfwPlatformInputColorScheme(value);
|
||||
if (_glfw.callbacks.system_color_theme_change) _glfw.callbacks.system_color_theme_change(value);
|
||||
if (_glfw.callbacks.system_color_theme_change) _glfw.callbacks.system_color_theme_change(value, is_initial_value);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
2
glfw/internal.h
vendored
2
glfw/internal.h
vendored
@@ -814,7 +814,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
||||
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
||||
void _glfwInputCursorEnter(_GLFWwindow* window, bool entered);
|
||||
int _glfwInputDrop(_GLFWwindow* window, const char *mime, const char *text, size_t sz);
|
||||
void _glfwInputColorScheme(GLFWColorScheme);
|
||||
void _glfwInputColorScheme(GLFWColorScheme, bool);
|
||||
void _glfwPlatformInputColorScheme(GLFWColorScheme);
|
||||
void _glfwInputJoystick(_GLFWjoystick* js, int event);
|
||||
void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value);
|
||||
|
||||
3
glfw/linux_desktop_settings.c
vendored
3
glfw/linux_desktop_settings.c
vendored
@@ -43,6 +43,7 @@ process_fdo_setting(const char *key, DBusMessageIter *value) {
|
||||
dbus_message_iter_get_basic(value, &val);
|
||||
if (val > 2) val = 0;
|
||||
appearance = val;
|
||||
_glfwInputColorScheme(appearance, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +162,7 @@ on_color_scheme_change(DBusMessage *message) {
|
||||
if (val > 2) val = 0;
|
||||
if (val != appearance) {
|
||||
appearance = val;
|
||||
_glfwInputColorScheme(appearance);
|
||||
_glfwInputColorScheme(appearance, false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user