Code

Forced redraw of canvas upon document commit to work around event starvation issue...
authorjohncoswell <johncoswell@users.sourceforge.net>
Sun, 23 Jul 2006 03:32:23 +0000 (03:32 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Sun, 23 Jul 2006 03:32:23 +0000 (03:32 +0000)
ChangeLog
src/desktop.cpp
src/desktop.h
src/document-private.h
src/document-undo.cpp
src/document.cpp
src/document.h

index a3a4a352d12e79391d46ed06128a4be721ce4919..2a200a61d32f04d87ce50880c14646b91fc16860 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-07-22  John Bintz  <jcoswell@coswellproductions.org>
+
+  * 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  <mental@rydia.net>
 
        * src/splivarot.cpp:
index 49a43bc37b53e98bdfbb7064fe0c7d53cd649aaa..cbd5ffa6021cdd8926137218edba9d740548636f 100644 (file)
@@ -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.
index 0a2d932f8628c709d17eef930efeb2cb80b2e18b..dde2962a7e812ea157ea99d6aa804dd926a233f9 100644 (file)
@@ -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);
index 18d35f446a7f3d7ac5592d0ffb1b1d2521ec9633..cb83c9376eb268feca56338333a7be8e9076c489 100644 (file)
@@ -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 */
index 35b35c88830baa97421d6a3cc66e445328dda681..09bb4e85729da13d2927cbdc5ce37bde63e5841c 100644 (file)
@@ -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
index 3077198cf149a0b327efb470d0998ab1f17c2c7f..20bbeb73e10d9ea9f5eb82f2ccac2e236933499d 100644 (file)
@@ -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;
index cf2194a952a64ba67a6ba55ad4f8f9bf218a741d..b0afba5ec50e05e7b914eb0cf64ad5845f8a33ae 100644 (file)
@@ -64,6 +64,7 @@ struct SPDocument : public Inkscape::GC::Managed<>,
        typedef sigc::signal<void, double, double> ResizedSignal;
        typedef sigc::signal<void> ReconstructionStart;
        typedef sigc::signal<void> ReconstructionFinish;
+  typedef sigc::signal<void> 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);