Wayland: Redraw titlebar title on font size change

Fixes #6945
This commit is contained in:
Kovid Goyal 2023-12-25 17:20:52 +05:30
parent 1e5d14c834
commit c76db4bfb4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 20 additions and 0 deletions

View File

@ -262,6 +262,7 @@ def generate_wrappers(glfw_header: str) -> None:
void glfwWaylandActivateWindow(GLFWwindow *handle, const char *activation_token)
void glfwWaylandRunWithActivationToken(GLFWwindow *handle, GLFWactivationcallback cb, void *cb_data)
bool glfwWaylandSetTitlebarColor(GLFWwindow *handle, uint32_t color, bool use_system_color)
void glfwWaylandRedrawCSDWindowTitle(GLFWwindow *handle)
unsigned long long glfwDBusUserNotify(const char *app_name, const char* icon, const char *summary, const char *body, \
const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callback, void *data)
void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler)

5
glfw/wl_window.c vendored
View File

@ -2332,3 +2332,8 @@ GLFWAPI bool glfwWaylandSetTitlebarColor(GLFWwindow *handle, uint32_t color, boo
}
return false;
}
GLFWAPI void glfwWaylandRedrawCSDWindowTitle(GLFWwindow *handle) {
_GLFWwindow* window = (_GLFWwindow*) handle;
change_csd_title(window);
}

3
kitty/glfw-wrapper.c generated
View File

@ -479,6 +479,9 @@ load_glfw(const char* path) {
*(void **) (&glfwWaylandSetTitlebarColor_impl) = dlsym(handle, "glfwWaylandSetTitlebarColor");
if (glfwWaylandSetTitlebarColor_impl == NULL) dlerror(); // clear error indicator
*(void **) (&glfwWaylandRedrawCSDWindowTitle_impl) = dlsym(handle, "glfwWaylandRedrawCSDWindowTitle");
if (glfwWaylandRedrawCSDWindowTitle_impl == NULL) dlerror(); // clear error indicator
*(void **) (&glfwDBusUserNotify_impl) = dlsym(handle, "glfwDBusUserNotify");
if (glfwDBusUserNotify_impl == NULL) dlerror(); // clear error indicator

4
kitty/glfw-wrapper.h generated
View File

@ -2291,6 +2291,10 @@ typedef bool (*glfwWaylandSetTitlebarColor_func)(GLFWwindow*, uint32_t, bool);
GFW_EXTERN glfwWaylandSetTitlebarColor_func glfwWaylandSetTitlebarColor_impl;
#define glfwWaylandSetTitlebarColor glfwWaylandSetTitlebarColor_impl
typedef void (*glfwWaylandRedrawCSDWindowTitle_func)(GLFWwindow*);
GFW_EXTERN glfwWaylandRedrawCSDWindowTitle_func glfwWaylandRedrawCSDWindowTitle_impl;
#define glfwWaylandRedrawCSDWindowTitle glfwWaylandRedrawCSDWindowTitle_impl
typedef unsigned long long (*glfwDBusUserNotify_func)(const char*, const char*, const char*, const char*, const char*, int32_t, GLFWDBusnotificationcreatedfun, void*);
GFW_EXTERN glfwDBusUserNotify_func glfwDBusUserNotify_impl;
#define glfwDBusUserNotify glfwDBusUserNotify_impl

View File

@ -1686,6 +1686,10 @@ request_window_attention(id_type kitty_window_id, bool audio_bell) {
void
set_os_window_title(OSWindow *w, const char *title) {
if (!title) {
if (global_state.is_wayland) glfwWaylandRedrawCSDWindowTitle(w->handle);
return;
}
static char buf[2048];
strip_csi_(title, buf, arraysz(buf));
glfwSetWindowTitle(w->handle, buf);

View File

@ -1035,6 +1035,9 @@ PYWRAP1(os_window_font_size) {
}
}
os_window_update_size_increments(os_window);
// On Wayland with CSD title needs to be re-rendered in a different font size
if (os_window->window_title && global_state.is_wayland) set_os_window_title(os_window, NULL);
}
return Py_BuildValue("d", os_window->font_sz_in_pts);
END_WITH_OS_WINDOW