eclipse/eclipse-bug-484729.patch
Roland Grunberg 47041fe349 Backport Neon patches regarding background colour and CPU usage.
- [GTK3.16+] gtk_widget_override_background_color is deprecated.
- [GTK3] Eclipse IDE consumes CPU when idle
- [GTK] Empty repositories view links have white backgrounds
- Resolves: rhbz#1294697, rhbz#1269892
- ebz#483096, ebz#484696, ebz#484729
2016-01-05 11:57:15 -05:00

48 lines
2.1 KiB
Diff

From 34e5c7b13772787f8eadaec8a3936b78d0831f23 Mon Sep 17 00:00:00 2001
From: Eric Williams <ericwill@redhat.com>
Date: Mon, 4 Jan 2016 16:08:15 -0500
Subject: [PATCH] Bug 484729: [GTK3] Eclipse IDE consumes CPU when idle
Bug 479998 introduced a call to getClientArea() in Composite.gtk_draw().
This calls forceResize() in both the Composite and the parent Control,
which causes unnecessary overhead. It also causes a paint loop in
CTabFolder, with never ending calls to
gdk_cairo_region_create_from_surface(). The looped system calls to GDK
cause high CPU usage.
To remedy this we can use a GtkAllocation instead of calling
getClientArea(): this is far more efficient and does not trigger any
additional SWT machinery.
Tested on GTK3.18.6, 3.14, and 2.24. AllNonBrowser JUnit tests pass on
GTK3 and GTK2.
Change-Id: Ib1e5900e5c9339e9c0555a9436e8b2a9949b6372
Signed-off-by: Eric Williams <ericwill@redhat.com>
---
.../Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 4aef32c..80c396c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -355,9 +355,12 @@ void createHandle (int index, boolean fixed, boolean scrolled) {
@Override
long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- Rectangle area = getClientArea();
long /*int*/ context = OS.gtk_widget_get_style_context(widget);
- OS.gtk_render_background(context, cairo, area.x, area.y, area.width, area.height);
+ GtkAllocation allocation = new GtkAllocation();
+ OS.gtk_widget_get_allocation (widget, allocation);
+ int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
+ int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
+ OS.gtk_render_background(context, cairo, 0, 0, width, height);
}
return super.gtk_draw(widget, cairo);
}
--
2.5.0