macOS: Fix window shadows not being drawn for transparent windows

Re-organize the whole infrastructure for setting window chrome, doing it
in a single function that has access to all settings.

Fixes #2827
Fixes #6416
This commit is contained in:
Kovid Goyal
2023-07-04 11:59:50 +05:30
parent b9bb9248f0
commit d3f14ffbf4
16 changed files with 249 additions and 183 deletions

View File

@@ -3084,9 +3084,7 @@ egr() # }}}
# os {{{
agr('os', 'OS specific tweaks')
opt('wayland_titlebar_color', 'system',
option_type='titlebar_color',
long_text='''
opt('wayland_titlebar_color', 'system', option_type='titlebar_color', ctype='uint', long_text='''
The color of the kitty window's titlebar on Wayland systems with client
side window decorations such as GNOME. A value of :code:`system` means to use
the default system color, a value of :code:`background` means to use the
@@ -3095,9 +3093,7 @@ arbitrary color, such as :code:`#12af59` or :code:`red`.
'''
)
opt('macos_titlebar_color', 'system',
option_type='macos_titlebar_color',
long_text='''
opt('macos_titlebar_color', 'system', option_type='macos_titlebar_color', ctype='int', long_text='''
The color of the kitty window's titlebar on macOS. A value of
:code:`system` means to use the default system color, :code:`light` or
:code:`dark` can also be used to set it explicitly. A value of
@@ -3151,8 +3147,7 @@ opt('macos_window_resizable', 'yes',
option_type='to_bool', ctype='bool',
long_text='''
Disable this if you want kitty top-level OS windows to not be resizable on
macOS. Changing this option by reloading the config will only affect newly
created OS windows.
macOS.
'''
)

View File

@@ -941,6 +941,32 @@ convert_from_opts_allow_hyperlinks(PyObject *py_opts, Options *opts) {
Py_DECREF(ret);
}
static void
convert_from_python_wayland_titlebar_color(PyObject *val, Options *opts) {
opts->wayland_titlebar_color = PyLong_AsUnsignedLong(val);
}
static void
convert_from_opts_wayland_titlebar_color(PyObject *py_opts, Options *opts) {
PyObject *ret = PyObject_GetAttrString(py_opts, "wayland_titlebar_color");
if (ret == NULL) return;
convert_from_python_wayland_titlebar_color(ret, opts);
Py_DECREF(ret);
}
static void
convert_from_python_macos_titlebar_color(PyObject *val, Options *opts) {
opts->macos_titlebar_color = PyLong_AsLong(val);
}
static void
convert_from_opts_macos_titlebar_color(PyObject *py_opts, Options *opts) {
PyObject *ret = PyObject_GetAttrString(py_opts, "macos_titlebar_color");
if (ret == NULL) return;
convert_from_python_macos_titlebar_color(ret, opts);
Py_DECREF(ret);
}
static void
convert_from_python_macos_option_as_alt(PyObject *val, Options *opts) {
opts->macos_option_as_alt = PyLong_AsUnsignedLong(val);
@@ -1204,6 +1230,10 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
if (PyErr_Occurred()) return false;
convert_from_opts_allow_hyperlinks(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_wayland_titlebar_color(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_macos_titlebar_color(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_macos_option_as_alt(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_macos_hide_from_tasks(py_opts, opts);