Use the OPT() macro where possible

This commit is contained in:
Luflosi 2019-09-11 20:34:56 +02:00
parent b337d4d9d5
commit 8e96a27d51
No known key found for this signature in database
GPG Key ID: 14140F703B7D8362
4 changed files with 5 additions and 5 deletions

View File

@ -601,7 +601,7 @@ render_os_window(OSWindow *os_window, double now, unsigned int active_window_id,
bool is_active_window = i == tab->active_window;
draw_cells(WD.vao_idx, WD.gvao_idx, WD.xstart, WD.ystart, WD.dx * x_ratio, WD.dy * y_ratio, WD.screen, os_window, is_active_window, true);
if (WD.screen->start_visual_bell_at != 0) {
double bell_left = global_state.opts.visual_bell_duration - (now - WD.screen->start_visual_bell_at);
double bell_left = OPT(visual_bell_duration) - (now - WD.screen->start_visual_bell_at);
set_maximum_wait(bell_left);
}
w->cursor_visible_at_last_render = WD.screen->cursor_render_info.is_visible; w->last_cursor_x = WD.screen->cursor_render_info.x; w->last_cursor_y = WD.screen->cursor_render_info.y; w->last_cursor_shape = WD.screen->cursor_render_info.shape;

View File

@ -437,7 +437,7 @@ render_glyphs(CTFontRef font, unsigned int width, unsigned int height, unsigned
CGContextSetShouldSmoothFonts(render_ctx, true);
CGContextSetGrayFillColor(render_ctx, 1, 1); // white glyphs
CGContextSetGrayStrokeColor(render_ctx, 1, 1);
CGContextSetLineWidth(render_ctx, global_state.opts.macos_thicken_font);
CGContextSetLineWidth(render_ctx, OPT(macos_thicken_font));
CGContextSetTextDrawingMode(render_ctx, kCGTextFillStroke);
CGContextSetTextMatrix(render_ctx, CGAffineTransformIdentity);
CGContextSetTextPosition(render_ctx, 0, height - baseline);

View File

@ -781,7 +781,7 @@ glfw_init(PyObject UNUSED *self, PyObject *args) {
// Joysticks cause slow startup on some linux systems, see
// https://github.com/kovidgoyal/kitty/issues/830
glfwInitHint(GLFW_ENABLE_JOYSTICKS, 0);
global_state.opts.debug_keyboard = debug_keyboard != 0;
OPT(debug_keyboard) = debug_keyboard != 0;
#ifdef __APPLE__
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, 0);
glfwInitHint(GLFW_COCOA_MENUBAR, 0);

View File

@ -387,7 +387,7 @@ PYWRAP1(set_options) {
global_state.debug_font_fallback = debug_font_fallback ? true : false;
#define GA(name) ret = PyObject_GetAttrString(opts, #name); if (ret == NULL) return NULL;
#define SS(name, dest, convert) { GA(name); dest = convert(ret); Py_DECREF(ret); if (PyErr_Occurred()) return NULL; }
#define S(name, convert) SS(name, global_state.opts.name, convert)
#define S(name, convert) SS(name, OPT(name), convert)
SS(kitty_mod, kitty_mod, PyLong_AsLong);
S(hide_window_decorations, PyObject_IsTrue);
S(visual_bell_duration, PyFloat_AsDouble);
@ -724,7 +724,7 @@ PYWRAP1(patch_global_colors) {
#define P(name) { \
PyObject *val = PyDict_GetItemString(spec, #name); \
if (val) { \
global_state.opts.name = PyLong_AsLong(val); \
OPT(name) = PyLong_AsLong(val); \
} \
}
P(active_border_color); P(inactive_border_color); P(bell_border_color);