From: joncruz Date: Sat, 26 Jul 2008 08:08:33 +0000 (+0000) Subject: Added compensation factor for time-skew with event latency. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=35873afc9911efb8148e0ed4d18cd1782e2f5b54;p=inkscape.git Added compensation factor for time-skew with event latency. --- diff --git a/src/debug/gdk-event-latency-tracker.cpp b/src/debug/gdk-event-latency-tracker.cpp index 8e34d2fc2..6a8a48eb3 100644 --- a/src/debug/gdk-event-latency-tracker.cpp +++ b/src/debug/gdk-event-latency-tracker.cpp @@ -10,12 +10,13 @@ */ #include "debug/gdk-event-latency-tracker.h" +#include "prefs-utils.h" namespace Inkscape { namespace Debug { GdkEventLatencyTracker::GdkEventLatencyTracker() -: start_seconds(0.0), max_latency(0.0) + : start_seconds(0.0), max_latency(0.0), skew(1.0) { elapsed.stop(); elapsed.reset(); @@ -31,9 +32,10 @@ boost::optional GdkEventLatencyTracker::process(GdkEvent const *event) { if (start_seconds == 0.0) { elapsed.start(); start_seconds = timestamp_seconds; + skew = prefs_get_double_attribute_limited("debug.latency", "skew", 1.0, 0.5, 2.0); return boost::optional(0.0); } else { - double const current_seconds = elapsed.elapsed() + start_seconds; + double const current_seconds = (elapsed.elapsed() * skew) + start_seconds; double delta = current_seconds - timestamp_seconds; if (delta < 0.0) { start_seconds += -delta; diff --git a/src/debug/gdk-event-latency-tracker.h b/src/debug/gdk-event-latency-tracker.h index 8a22fec82..cb04ee035 100644 --- a/src/debug/gdk-event-latency-tracker.h +++ b/src/debug/gdk-event-latency-tracker.h @@ -33,6 +33,7 @@ private: double start_seconds; double max_latency; + double skew; Glib::Timer elapsed; }; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 9670a4da5..7b762f834 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -388,6 +388,9 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" +" \n" +" \n" +" \n" "\n" "\n"; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 455908a06..1f9ef051e 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1049,6 +1049,11 @@ void InkscapePreferences::initPageMisc() _page_misc.add_line( false, _("Simplification threshold:"), _misc_simpl, "", _("How strong is the Simplify command by default. If you invoke this command several times in quick succession, it will act more and more aggressively; invoking it again after a pause restores the default threshold."), false); + _misc_latency_skew.init("debug.latency", "skew", 0.5, 2.0, 0.01, 0.10, 1.0, false, false); + _page_misc.add_line( false, _("Latency skew:"), _misc_latency_skew, _("(requires restart)"), + _("Factor by which the event clock is skewed from the actual time (0.9766 on some systems)."), false); + + this->AddPage(_page_misc, _("Misc"), PREFS_PAGE_MISC); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index f81ff75d0..3a0a300a2 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -164,6 +164,7 @@ protected: PrefCheckButton _sel_layer_deselects; PrefSpinButton _importexport_export, _misc_recent, _misc_simpl; + PrefSpinButton _misc_latency_skew; PrefCheckButton _misc_comment, _misc_forkvectors, _misc_scripts; PrefCombo _misc_small_toolbar; PrefCombo _misc_small_secondary;