summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a88e9b3)
raw | patch | inline | side by side (parent: a88e9b3)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Sun, 25 Feb 2007 05:46:48 +0000 (05:46 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Sun, 25 Feb 2007 05:46:48 +0000 (05:46 +0000) |
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 5590633b8bf9cecbbf920df0245f977ec88739d0..e1cc23083eb72ddeb7ded49ec179719b006783a5 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
* Scroll canvas by specific coordinate amount.
*/
void
-SPDesktop::scroll_world (double dx, double dy)
+SPDesktop::scroll_world (double dx, double dy, bool is_scrolling)
{
g_assert(_widget);
NR::Rect const viewbox = canvas->getViewbox();
- sp_canvas_scroll_to(canvas, viewbox.min()[NR::X] - dx, viewbox.min()[NR::Y] - dy, FALSE);
+ sp_canvas_scroll_to(canvas, viewbox.min()[NR::X] - dx, viewbox.min()[NR::Y] - dy, FALSE, is_scrolling);
_widget->updateRulers();
_widget->updateScrollbars(expansion(_d2w));
diff --git a/src/desktop.h b/src/desktop.h
index 42e059db20a0e3bd1305f401d7aacc6d82de7c46..9f3d7752076f34d021df00c841538df9be4a5b52 100644 (file)
--- a/src/desktop.h
+++ b/src/desktop.h
void next_zoom();
bool scroll_to_point (NR::Point const *s_dt, gdouble autoscrollspeed = 0);
- void scroll_world (double dx, double dy);
- void scroll_world (NR::Point const scroll)
+ void scroll_world (double dx, double dy, bool is_scrolling = false);
+ void scroll_world (NR::Point const scroll, bool is_scrolling = false)
{
using NR::X;
- using NR::Y;
- scroll_world(scroll[X], scroll[Y]);
+ using NR::Y;
+ scroll_world(scroll[X], scroll[Y], is_scrolling);
}
void getWindowGeometry (gint &x, gint &y, gint &w, gint &h);
index b10af7f6aecc7f097d947b36b17210c3cfe40573..f716d383a26bb21dfe3a2d6cfde502dd52b699b0 100644 (file)
canvas->forced_redraw_limit = -1;
canvas->slowest_buffer = 0;
+
+ canvas->is_scrolling = false;
+
}
/**
@@ -1590,8 +1593,6 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
}
}
-static int is_scrolling = 0;
-
/* Paint the given rect, while updating canvas->redraw_aborted and running iterations after each
* buffer; make sure canvas->redraw_aborted never goes past aborted_limit (used for 2-rect
* optimized repaint)
@@ -1707,11 +1708,11 @@ sp_canvas_paint_rect_internal (SPCanvas *canvas, NRRectL *rect, NR::ICoord *x_ab
// OPTIMIZATION IDEA: if drawing is really slow (as measured by canvas->slowest
// buffer), do the same - process some events even before we paint any buffers
- if (is_scrolling) {
- is_scrolling = 0;
+ if (canvas->is_scrolling) {
while (Gtk::Main::events_pending()) { // process any events
Gtk::Main::iteration(false);
}
+ canvas->is_scrolling = false;
if (this_count != canvas->redraw_count) { // if there was redraw,
return 1; // interrupt this one
}
* Scrolls canvas to specific position.
*/
void
-sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear)
+sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear, bool is_scrolling)
{
g_return_if_fail (canvas != NULL);
g_return_if_fail (SP_IS_CANVAS (canvas));
@@ -2174,7 +2175,7 @@ sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear)
if (!clear) {
// scrolling without zoom; redraw only the newly exposed areas
if ((dx != 0) || (dy != 0)) {
- is_scrolling = 1;
+ canvas->is_scrolling = is_scrolling;
if (GTK_WIDGET_REALIZED (canvas)) {
gdk_window_scroll (SP_CANVAS_WINDOW (canvas), -dx, -dy);
}
index 39a7ae1f82e15093a401ceb3ae19c5e13fd70633..bc5f835f12c1757f9539031b8737d28d9ea80811 100644 (file)
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
bool gen_all_enter_events;
int rendermode;
+
+ bool is_scrolling;
NR::Rect getViewbox() const;
};
SPCanvasGroup *sp_canvas_root(SPCanvas *canvas);
-void sp_canvas_scroll_to(SPCanvas *canvas, double cx, double cy, unsigned int clear);
+void sp_canvas_scroll_to(SPCanvas *canvas, double cx, double cy, unsigned int clear, bool is_scrolling = false);
void sp_canvas_update_now(SPCanvas *canvas);
void sp_canvas_request_redraw(SPCanvas *canvas, int x1, int y1, int x2, int y2);
diff --git a/src/event-context.cpp b/src/event-context.cpp
index f3a402eebe9f42f833290f432d37f40116190c7c..99dc5ac20492cdbc225e2a9771faf8e49581e4f2 100644 (file)
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
@@ -405,7 +405,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
NR::Point const motion_w(event->motion.x, event->motion.y);
NR::Point const moved_w( motion_w - button_w );
- event_context->desktop->scroll_world(moved_w);
+ event_context->desktop->scroll_world(moved_w, true); // we're still scrolling, do not redraw
ret = TRUE;
}
} else if (zoom_rb) {