When resizing and only a single window is present in the current layout, use that window's background color to fill in the blank areas.

This commit is contained in:
Kovid Goyal 2019-05-29 09:01:57 +05:30
parent 8193b2a44b
commit 020c1311ca
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 19 additions and 5 deletions

View File

@ -20,6 +20,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- macOS: Fix a regression that caused :kbd:`cmd+v` to double up in the dvorak
keyboard layout (:iss:`1652`)
- When resizing and only a single window is present in the current layout,
use that window's background color to fill in the blank areas.
0.14.0 [2019-05-24]
---------------------

View File

@ -103,7 +103,18 @@ static int min_width = 100, min_height = 100;
void
blank_os_window(OSWindow *w) {
blank_canvas(w->is_semi_transparent ? w->background_opacity : 1.0f);
color_type color = OPT(background);
if (w->num_tabs > 0) {
Tab *t = w->tabs + w->active_tab;
if (t->num_windows == 1) {
Window *w = t->windows + t->active_window;
Screen *s = w->render_data.screen;
if (s) {
color = colorprofile_to_color(s->color_profile, s->color_profile->overridden.default_bg, s->color_profile->configured.default_bg);
}
}
}
blank_canvas(w->is_semi_transparent ? w->background_opacity : 1.0f, color);
}
static void
@ -513,7 +524,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
bool is_semi_transparent = glfwGetWindowAttrib(glfw_window, GLFW_TRANSPARENT_FRAMEBUFFER);
// blank the window once so that there is no initial flash of color
// changing, in case the background color is not black
blank_canvas(is_semi_transparent ? OPT(background_opacity) : 1.0f);
blank_canvas(is_semi_transparent ? OPT(background_opacity) : 1.0f, OPT(background));
#ifndef __APPLE__
if (is_first_window) glfwSwapInterval(OPT(sync_to_monitor) && !global_state.is_wayland ? 1 : 0);
#endif

View File

@ -476,8 +476,8 @@ set_cell_uniforms(float current_inactive_text_alpha) {
}
void
blank_canvas(float background_opacity) {
#define C(shift) (((GLfloat)((OPT(background) >> shift) & 0xFF)) / 255.0f)
blank_canvas(float background_opacity, color_type color) {
#define C(shift) (((GLfloat)((color >> shift) & 0xFF)) / 255.0f)
glClearColor(C(16), C(8), C(0), background_opacity);
#undef C
glClear(GL_COLOR_BUFFER_BIT);

View File

@ -214,7 +214,7 @@ void update_surface_size(int, int, uint32_t);
void free_texture(uint32_t*);
void send_image_to_gpu(uint32_t*, const void*, int32_t, int32_t, bool, bool);
void send_sprite_to_gpu(FONTS_DATA_HANDLE fg, unsigned int, unsigned int, unsigned int, pixel*);
void blank_canvas(float);
void blank_canvas(float, color_type);
void blank_os_window(OSWindow *);
void set_titlebar_color(OSWindow *w, color_type color);
FONTS_DATA_HANDLE load_fonts_data(double, double, double);