From f60fc9ef5d612f8225bc9e425916c3568afe4f49 Mon Sep 17 00:00:00 2001 From: johncoswell Date: Sun, 23 Jul 2006 03:32:23 +0000 Subject: [PATCH] Forced redraw of canvas upon document commit to work around event starvation issue at high zoom levels --- ChangeLog | 8 ++++++++ src/desktop.cpp | 8 +++++++- src/desktop.h | 1 + src/document-private.h | 1 + src/document-undo.cpp | 2 ++ src/document.cpp | 6 ++++++ src/document.h | 2 ++ 7 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a3a4a352d..2a200a61d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-07-22 John Bintz + + * src/desktop.cpp, src/desktop.h, src/document-undo.cpp, + src/document.h, src/document-private.h, src/document.cpp: + + forced redraw of canvas upon document commit to work + around event starvation issue at high zoom levels + 2006-07-21 MenTaLguY * src/splivarot.cpp: diff --git a/src/desktop.cpp b/src/desktop.cpp index 49a43bc37..cbd5ffa60 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -248,7 +248,9 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) _reconstruction_finish_connection = document->connectReconstructionFinish(sigc::bind(sigc::ptr_fun(_reconstruction_finish), this)); _reconstruction_old_layer_id = NULL; - + + _commit_connection = document->connectCommit(sigc::bind(sigc::ptr_fun(&sp_canvas_update_now), this->canvas)); + // ? // sp_active_desktop_set (desktop); _inkscape = INKSCAPE; @@ -1048,6 +1050,7 @@ SPDesktop::onRedrawRequested () /** * Associate document with desktop. */ +/// \todo fixme: refactor SPDesktop::init to use setDocument void SPDesktop::setDocument (SPDocument *doc) { @@ -1066,6 +1069,9 @@ SPDesktop::setDocument (SPDocument *doc) _layer_hierarchy->connectChanged(sigc::bind(sigc::ptr_fun(_layer_hierarchy_changed), this)); _layer_hierarchy->setTop(SP_DOCUMENT_ROOT(doc)); + _commit_connection.disconnect(); + _commit_connection = doc->connectCommit(sigc::bind(sigc::ptr_fun(&sp_canvas_update_now), this->canvas)); + /// \todo fixme: This condition exists to make sure the code /// inside is called only once on initialization. But there /// are surely more safe methods to accomplish this. diff --git a/src/desktop.h b/src/desktop.h index 0a2d932f8..dde2962a7 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -264,6 +264,7 @@ private: sigc::connection _sel_changed_connection; sigc::connection _reconstruction_start_connection; sigc::connection _reconstruction_finish_connection; + sigc::connection _commit_connection; virtual void onPositionSet (double, double); virtual void onResized (double, double); diff --git a/src/document-private.h b/src/document-private.h index 18d35f446..cb83c9376 100644 --- a/src/document-private.h +++ b/src/document-private.h @@ -56,6 +56,7 @@ struct SPDocumentPrivate { SPDocument::ResizedSignal resized_signal; SPDocument::ReconstructionStart _reconstruction_start_signal; SPDocument::ReconstructionFinish _reconstruction_finish_signal; + SPDocument::CommitSignal commit_signal; /* Undo/Redo state */ guint sensitive: 1; /* If we save actions to undo stack */ diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 35b35c888..09bb4e857 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -162,6 +162,8 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev } sp_repr_begin_transaction (doc->rdoc); + + doc->priv->commit_signal.emit(); } void diff --git a/src/document.cpp b/src/document.cpp index 3077198cf..20bbeb73e 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -611,6 +611,12 @@ SPDocument::emitReconstructionFinish(void) return; } +sigc::connection SPDocument::connectCommit(SPDocument::CommitSignal::slot_type slot) +{ + return priv->commit_signal.connect(slot); +} + + void SPDocument::_emitModified() { static guint const flags = SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG; diff --git a/src/document.h b/src/document.h index cf2194a95..b0afba5ec 100644 --- a/src/document.h +++ b/src/document.h @@ -64,6 +64,7 @@ struct SPDocument : public Inkscape::GC::Managed<>, typedef sigc::signal ResizedSignal; typedef sigc::signal ReconstructionStart; typedef sigc::signal ReconstructionFinish; + typedef sigc::signal CommitSignal; SPDocument(); ~SPDocument(); @@ -93,6 +94,7 @@ struct SPDocument : public Inkscape::GC::Managed<>, sigc::connection connectModified(ModifiedSignal::slot_type slot); sigc::connection connectURISet(URISetSignal::slot_type slot); sigc::connection connectResized(ResizedSignal::slot_type slot); + sigc::connection connectCommit(CommitSignal::slot_type slot); void bindObjectToId(gchar const *id, SPObject *object); SPObject *getObjectById(gchar const *id); -- 2.30.2