Fix hich CPU usage when selecting text.

reported by mpi@
This commit is contained in:
ajacoutot 2015-10-12 06:09:31 +00:00
parent 3c79027815
commit 8f8eb322e8
2 changed files with 47 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.131 2015/08/17 19:10:12 sthen Exp $
# $OpenBSD: Makefile,v 1.132 2015/10/12 06:09:31 ajacoutot Exp $
SHARED_ONLY= Yes
@ -6,7 +6,7 @@ COMMENT= GNOME document viewer
GNOME_PROJECT= evince
GNOME_VERSION= 3.16.1
REVISION= 1
REVISION= 2
MAJ_V= 3.0
SUBST_VARS= MAJ_V

View File

@ -0,0 +1,45 @@
$OpenBSD: patch-libview_ev-view_c,v 1.1 2015/10/12 06:09:31 ajacoutot Exp $
From 1987f04ea36329b1bd61d053a19d9e341e0454ce Mon Sep 17 00:00:00 2001
From: Sebastian Keller <sebastian-keller@gmx.de>
Date: Tue, 22 Sep 2015 23:25:34 +0200
Subject: libview: Save/restore context when getting colors for a different state
--- libview/ev-view.c.orig Wed May 27 12:02:51 2015
+++ libview/ev-view.c Mon Oct 12 07:59:59 2015
@@ -4125,7 +4125,9 @@ get_cursor_color (GtkStyleContext *context,
gdk_color_free (style_color);
} else {
+ gtk_style_context_save (context);
gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, color);
+ gtk_style_context_restore (context);
}
}
@@ -6102,7 +6104,9 @@ draw_rubberband (EvView *view,
GdkRGBA color;
context = gtk_widget_get_style_context (GTK_WIDGET (view));
+ gtk_style_context_save (context);
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &color);
+ gtk_style_context_restore (context);
cairo_save (cr);
cairo_set_source_rgba (cr, color.red, color.green, color.blue, alpha);
@@ -6223,12 +6227,15 @@ _ev_view_get_selection_colors (EvView *view,
state = gtk_widget_has_focus (widget) ? GTK_STATE_FLAG_SELECTED : GTK_STATE_FLAG_ACTIVE;
context = gtk_widget_get_style_context (widget);
+ gtk_style_context_save (context);
if (bg_color)
gtk_style_context_get_background_color (context, state, bg_color);
if (fg_color)
gtk_style_context_get_color (context, state, fg_color);
+
+ gtk_style_context_restore (context);
}
static void