From 0da5c78ec1b13044d3b6e6211c4e74e0599eb9fe Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 22 Mar 2022 10:53:08 -0700 Subject: gtk_fb: when creating page surfaces don't inherit scaling When calling gdk_window_create_similar_image_surface() I was supplying '0' for the scaling factor which is just a blind "inherit scaling from the window" request. This is fine when the window isn't being scaled; everything is just 1:1. But when the window is scaled, and our output has been sized according to the widget allocation (unscaled), these scaling factors can't be the same if we intend for the page contents to fill the scaled output. Specify a scale of 1 instead, as that's how the allocation size coordinates should be viewed, like normalized units. The window scale is how many times those units the window coordinates are in. This should fix highdpi/GDK_SCALE=2 usage. --- src/gtk_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gtk_fb.c') diff --git a/src/gtk_fb.c b/src/gtk_fb.c index 7a6c12b..5328d05 100644 --- a/src/gtk_fb.c +++ b/src/gtk_fb.c @@ -176,7 +176,7 @@ static void * gtk_fb_page_alloc(til_fb_t *fb, void *context, til_fb_page_t *res_ * potential optimizations like XSHM use on the xlib cairo backend. */ gdk_window = gtk_widget_get_window(c->window); - p->surface = gdk_window_create_similar_image_surface(gdk_window, CAIRO_FORMAT_RGB24, c->width, c->height, 0); + p->surface = gdk_window_create_similar_image_surface(gdk_window, CAIRO_FORMAT_RGB24, c->width, c->height, 1); res_page->fragment.buf = (uint32_t *)cairo_image_surface_get_data(p->surface); res_page->fragment.width = c->width; -- cgit v1.2.3