Code

Split SPCanvasItem and SPCanvasGroup to individual .h files. Removed forward header.
[inkscape.git] / src / widgets / desktop-widget.cpp
index 7a3e337ded52557484b94d5f626b51bbe21ae2f3..be2caa5ee0a3723a0e162bd99bd97d38e8467775 100644 (file)
@@ -33,6 +33,7 @@
 #include "desktop-events.h"
 #include "desktop-handles.h"
 #include "desktop-widget.h"
+#include "display/sp-canvas.h"
 #include "display/canvas-arena.h"
 #include "display/nr-arena.h"
 #include "document.h"
@@ -56,6 +57,7 @@
 #include "ui/widget/layer-selector.h"
 #include "ui/widget/selected-style.h"
 #include "ui/uxmanager.h"
+#include "util/ege-appear-time-tracker.h"
 
 // We're in the "widgets" directory, so no need to explicitly prefix these:
 #include "button.h"
@@ -73,6 +75,7 @@ using Inkscape::round;
 using Inkscape::UnitTracker;
 using Inkscape::UI::UXManager;
 using Inkscape::UI::ToolboxFactory;
+using ege::AppearTimeTracker;
 
 #ifdef WITH_INKBOARD
 #endif
@@ -243,6 +246,8 @@ SPDesktopWidget::window_get_pointer()
     return Geom::Point(x,y);
 }
 
+static GTimer *overallTimer = 0;
+
 /**
  * Registers SPDesktopWidget class and returns its type number.
  */
@@ -263,6 +268,8 @@ GType SPDesktopWidget::getType(void)
             0 // value_table
         };
         type = g_type_register_static(SP_TYPE_VIEW_WIDGET, "SPDesktopWidget", &info, static_cast<GTypeFlags>(0));
+        // Begin a timer to watch for the first desktop to appear on-screen
+        overallTimer = g_timer_new();
     }
     return type;
 }
@@ -564,6 +571,18 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
     gtk_widget_show_all (dtw->vbox);
 
     gtk_widget_grab_focus (GTK_WIDGET(dtw->canvas));
+
+    // If this is the first desktop created, report the time it takes to show up
+    if ( overallTimer ) {
+        if ( prefs->getBool("/dialogs/debug/trackAppear", false) ) {
+            // Time tracker takes ownership of the timer.
+            AppearTimeTracker *tracker = new AppearTimeTracker(overallTimer, GTK_WIDGET(dtw), "first SPDesktopWidget");
+            tracker->setAutodelete(true);
+        } else {
+            g_timer_destroy(overallTimer);
+        }
+        overallTimer = 0;
+    }
 }
 
 /**