[goffice] Canvas: fix gtk 3.9 redraw issues.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Canvas: fix gtk 3.9 redraw issues.
- Date: Tue, 20 Aug 2013 13:37:19 +0000 (UTC)
commit 6f9af28d070eeb777a732aab4c00a1bb0e650e60
Author: Morten Welinder <terra gnome org>
Date: Tue Aug 20 09:36:39 2013 -0400
Canvas: fix gtk 3.9 redraw issues.
From 735adfe94dc5b30a8d0c75385a9749937c3a0ab4 Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl redhat com>
Date: Tue, 20 Aug 2013 13:14:58 +0200
Subject: [PATCH] canvas: Look at cairo clip region rather than current expose
event
This fixes redraw issues with latest Gtk+ which only sends expose events
for the actual toplevel windows rather than each GdkWindow.
ChangeLog | 6 +++++
NEWS | 3 ++
goffice/canvas/goc-canvas.c | 44 ++++++++++++++----------------------------
3 files changed, 24 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c5c5980..dd2bf3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-20 Morten Welinder <terra gnome org>
+
+ * goffice/canvas/goc-canvas.c (goc_canvas_draw): Fix redraw issues
+ for gtk+ 3.9 and up. Patch from Alexander Larsson <alexl redhat com>
+ in bug 703124.
+
2013-08-19 Morten Welinder <terra gnome org>
* configure.ac: Post-release bump.
diff --git a/NEWS b/NEWS
index 1a2be1d..8401f14 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
goffice 0.10.6:
+Alexander Larsson:
+ * Fix gtk+ 3.9 redraw problems. [#703124]
+
--------------------------------------------------------------------------
goffice 0.10.5:
diff --git a/goffice/canvas/goc-canvas.c b/goffice/canvas/goc-canvas.c
index 1fd1b52..02c480f 100644
--- a/goffice/canvas/goc-canvas.c
+++ b/goffice/canvas/goc-canvas.c
@@ -48,39 +48,25 @@ goc_canvas_draw (GtkWidget *widget, cairo_t *cr)
{
double x0, y0, x1, y1;
double ax0, ay0, ax1, ay1;
+ double clip_x1, clip_y1, clip_x2, clip_y2;
GocCanvas *canvas = GOC_CANVAS (widget);
GdkEventExpose *event = (GdkEventExpose *) gtk_get_current_event ();
- if (event && event->type == GDK_EXPOSE) {
- if (event->count)
- return TRUE;
- goc_item_get_bounds (GOC_ITEM (canvas->root),&x0, &y0, &x1, &y1);
- if (canvas->direction == GOC_DIRECTION_RTL) {
- ax1 = (double) (canvas->width - event->area.x) / canvas->pixels_per_unit +
canvas->scroll_x1;
- ax0 = (double) (canvas->width - event->area.x - event->area.width) /
canvas->pixels_per_unit + canvas->scroll_x1;
- } else {
- ax0 = (double) event->area.x / canvas->pixels_per_unit + canvas->scroll_x1;
- ax1 = ((double) event->area.x + event->area.width) / canvas->pixels_per_unit +
canvas->scroll_x1;
- }
- ay0 = (double) event->area.y / canvas->pixels_per_unit + canvas->scroll_y1;
- ay1 = ((double) event->area.y + event->area.height) / canvas->pixels_per_unit +
canvas->scroll_y1;
- if (x0 <= ax1 && x1 >= ax0 && y0 <= ay1 && y1 >= ay0) {
- canvas->cur_event = (GdkEvent *) event;
- goc_item_draw_region (GOC_ITEM (canvas->root), cr, ax0, ay0, ax1, ay1);
- }
+ cairo_clip_extents (cr, &clip_x1, &clip_y1, &clip_x2, &clip_y2);
+
+ goc_item_get_bounds (GOC_ITEM (canvas->root),&x0, &y0, &x1, &y1);
+ if (canvas->direction == GOC_DIRECTION_RTL) {
+ ax1 = (double) (canvas->width - clip_x1) / canvas->pixels_per_unit + canvas->scroll_x1;
+ ax0 = (double) (canvas->width - clip_x2) / canvas->pixels_per_unit + canvas->scroll_x1;
} else {
- goc_item_get_bounds (GOC_ITEM (canvas->root),&x0, &y0, &x1, &y1);
- if (canvas->direction == GOC_DIRECTION_RTL) {
- ax1 = (double) canvas->width / canvas->pixels_per_unit + canvas->scroll_x1;
- ax0 = canvas->scroll_x1;
- } else {
- ax0 = canvas->scroll_x1;
- ax1 = (double) canvas->width / canvas->pixels_per_unit + canvas->scroll_x1;
- }
- ay0 = canvas->scroll_y1;
- ay1 = (double) canvas->height / canvas->pixels_per_unit + canvas->scroll_y1;
- if (x0 <= ax1 && x1 >= ax0 && y0 <= ay1 && y1 >= ay0)
- goc_item_draw_region (GOC_ITEM (canvas->root), cr, ax0, ay0, ax1, ay1);
+ ax0 = (double) clip_x1 / canvas->pixels_per_unit + canvas->scroll_x1;
+ ax1 = ((double) clip_x1 + event->area.width) / canvas->pixels_per_unit + canvas->scroll_x1;
+ }
+ ay0 = (double) clip_y1 / canvas->pixels_per_unit + canvas->scroll_y1;
+ ay1 = (double) clip_y2 / canvas->pixels_per_unit + canvas->scroll_y1;
+ if (x0 <= ax1 && x1 >= ax0 && y0 <= ay1 && y1 >= ay0) {
+ canvas->cur_event = (GdkEvent *) event;
+ goc_item_draw_region (GOC_ITEM (canvas->root), cr, ax0, ay0, ax1, ay1);
}
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]