From 2b8350ecebec5cca5edd25951bdb3f0c0b8ee4b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sat, 20 Nov 2021 13:03:30 +0100 Subject: Fix some issues with browser/view switching --- fastiv-view.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'fastiv-view.c') diff --git a/fastiv-view.c b/fastiv-view.c index 602e4e5..35b19fa 100644 --- a/fastiv-view.c +++ b/fastiv-view.c @@ -198,7 +198,6 @@ fastiv_view_realize(GtkWidget *widget) #ifdef GDK_WINDOWING_X11 // FIXME: This causes some flicker while scrolling, because it disables // double buffering, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2560 - // FIXME: It also breaks Tab-switching at the start of program. // // If GTK+'s OpenGL integration fails to deliver, we need to use the window // directly, sidestepping the toolkit entirely. @@ -214,16 +213,18 @@ fastiv_view_realize(GtkWidget *widget) static gboolean fastiv_view_draw(GtkWidget *widget, cairo_t *cr) { - FastivView *self = FASTIV_VIEW(widget); - if (!self->surface || - !gtk_cairo_should_draw_window(cr, gtk_widget_get_window(widget))) - return TRUE; - + // Placed here due to our using a native GdkWindow on X11, + // which makes the widget have no double buffering or default background. GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); gtk_render_background(gtk_widget_get_style_context(widget), cr, 0, 0, allocation.width, allocation.height); + FastivView *self = FASTIV_VIEW(widget); + if (!self->surface || + !gtk_cairo_should_draw_window(cr, gtk_widget_get_window(widget))) + return TRUE; + int w, h; get_display_dimensions(self, &w, &h); -- cgit v1.2.3