[goffice] Implement canvas native scrolling. [#741394]



commit 803a0296f361ac3f12637cbcc477b92e4672d594
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed Jan 7 15:42:09 2015 +0100

    Implement canvas native scrolling. [#741394]

 ChangeLog                   |    5 +++++
 NEWS                        |    1 +
 goffice/canvas/goc-canvas.c |    5 ++++-
 3 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f2c4399..3297154 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-07  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/canvas/goc-canvas.c (goc_canvas_draw): implement native scrolling.
+       [#741394]
+
 2015-01-06  Morten Welinder  <terra gnome org>
 
        * goffice/canvas/goc-widget.c (goc_offscreen_box_realize): Only
diff --git a/NEWS b/NEWS
index 8f8fd4d..12e843a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ goffice 0.10.19:
 Jean:
        * Allow rotation of axis line labels. [#740198]
        * Move the title with its axis parent. [#684777]
+       * Implement canvas native scrolling. [#741394]
 
 Morten:
        * Dead kitten salvage.
diff --git a/goffice/canvas/goc-canvas.c b/goffice/canvas/goc-canvas.c
index 6fc0ca7..992fcbf 100644
--- a/goffice/canvas/goc-canvas.c
+++ b/goffice/canvas/goc-canvas.c
@@ -59,7 +59,7 @@ goc_canvas_draw (GtkWidget *widget, cairo_t *cr)
        GdkEventExpose *event = (GdkEventExpose *) gtk_get_current_event ();
        GocCanvasPrivate *priv = (GocCanvasPrivate *) canvas->priv;
        cairo_rectangle_list_t *l = cairo_copy_clip_rectangle_list (cr);
-       int i;
+       int i, x, y;
 
        if (GOC_IS_ITEM (priv->invalidated_item) && priv->invalid_region) {
                /* evaluate the cairo clipped region and compare with the saved one */
@@ -91,6 +91,9 @@ goc_canvas_draw (GtkWidget *widget, cairo_t *cr)
                cairo_region_destroy (region);
        }
 
+       x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)));
+       y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)));
+       cairo_translate (cr, -x, -y);
        goc_item_get_bounds (GOC_ITEM (canvas->root),&x0, &y0, &x1, &y1);
        for (i= 0; i  < l->num_rectangles; i++) {
                clip_x1 = l->rectangles[i].x;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]