Fix some issues with browser/view switching

This commit is contained in:
2021-11-20 13:03:30 +01:00
parent 75994cd85a
commit 2b8350eceb
2 changed files with 14 additions and 16 deletions

View File

@@ -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);