mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
macOS: Fix resizing semi-transparent windows causing the windows to be invisible during the resize
Fixes #941 Workaround for https://github.com/glfw/glfw/issues/1251
This commit is contained in:
parent
8f7139d48f
commit
21d586cc86
@ -43,6 +43,8 @@ Changelog
|
||||
- Fix kitty @set-colors not working for tab backgrounds when using the `fade` tabbar style
|
||||
(:iss:`937`)
|
||||
|
||||
- macOS: Fix resizing semi-transparent windows causing the windows to be
|
||||
invisible during the resize (:iss:`941`)
|
||||
|
||||
0.12.1 [2018-09-08]
|
||||
------------------------------
|
||||
|
11
kitty/glfw.c
11
kitty/glfw.c
@ -106,6 +106,17 @@ framebuffer_size_callback(GLFWwindow *w, int width, int height) {
|
||||
window->has_pending_resizes = true; global_state.has_pending_resizes = true;
|
||||
window->last_resize_event_at = monotonic();
|
||||
unjam_event_loop();
|
||||
#ifdef __APPLE__
|
||||
// Cocoa starts a sub-loop inside wait events which means main_loop
|
||||
// stays stuck and no rendering happens. This causes the window to be
|
||||
// blank. This is particularly bad for semi-transparent windows since
|
||||
// they are rendered as invisible, so for that case we manually render.
|
||||
if (global_state.callback_os_window->is_semi_transparent) {
|
||||
make_os_window_context_current(global_state.callback_os_window);
|
||||
blank_os_window(global_state.callback_os_window);
|
||||
swap_window_buffers(global_state.callback_os_window);
|
||||
}
|
||||
#endif
|
||||
} else log_error("Ignoring resize request for tiny size: %dx%d", width, height);
|
||||
global_state.callback_os_window = NULL;
|
||||
}
|
||||
|
@ -426,15 +426,20 @@ set_cell_uniforms(float current_inactive_text_alpha) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
blank_os_window(OSWindow *os_window) {
|
||||
#define C(shift) (((GLfloat)((OPT(background) >> shift) & 0xFF)) / 255.0f)
|
||||
glClearColor(C(16), C(8), C(0), os_window->is_semi_transparent ? os_window->background_opacity : 1.0f);
|
||||
#undef C
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
bool
|
||||
send_cell_data_to_gpu(ssize_t vao_idx, ssize_t gvao_idx, GLfloat xstart, GLfloat ystart, GLfloat dx, GLfloat dy, Screen *screen, OSWindow *os_window) {
|
||||
bool changed = false;
|
||||
if (os_window->clear_count < 2) {
|
||||
os_window->clear_count++;
|
||||
#define C(shift) (((GLfloat)((OPT(background) >> shift) & 0xFF)) / 255.0f)
|
||||
glClearColor(C(16), C(8), C(0), os_window->is_semi_transparent ? os_window->background_opacity : 1.0f);
|
||||
#undef C
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
blank_os_window(os_window);
|
||||
changed = true;
|
||||
}
|
||||
if (os_window->fonts_data) {
|
||||
|
@ -189,6 +189,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_os_window(OSWindow *);
|
||||
void set_titlebar_color(OSWindow *w, color_type color);
|
||||
FONTS_DATA_HANDLE load_fonts_data(double, double, double);
|
||||
void send_prerendered_sprites_for_window(OSWindow *w);
|
||||
|
Loading…
Reference in New Issue
Block a user