index b780927d8c472144380329e182a5cf2e1cddb694..3d63d7cdd1d2e5736ac9658b9adb21f7d9235f9c 100644 (file)
#include "display/rendermode.h"
#include "libnr/nr-blit.h"
#include "display/inkscape-cairo.h"
+#include "debug/gdk-event-latency-tracker.h"
+
+using Inkscape::Debug::GdkEventLatencyTracker;
// GTK_CHECK_VERSION returns false on failure
#define HAS_GDK_EVENT_REQUEST_MOTIONS GTK_CHECK_VERSION(2, 12, 0)
// gtk_check_version returns non-NULL on failure
static bool const HAS_BROKEN_MOTION_HINTS =
- gtk_check_version(2, 12, 0) != NULL || !HAS_GDK_EVENT_REQUEST_MOTIONS;
+ true || gtk_check_version(2, 12, 0) != NULL || !HAS_GDK_EVENT_REQUEST_MOTIONS;
// Define this to visualize the regions to be redrawn
//#define DEBUG_REDRAW 1;
static void sp_canvas_request_update (SPCanvas *canvas);
+static void track_latency(GdkEvent const *event);
static void sp_canvas_item_class_init (SPCanvasItemClass *klass);
static void sp_canvas_item_init (SPCanvasItem *item);
static void sp_canvas_item_dispose (GObject *object);
(* GTK_OBJECT_CLASS (canvas_parent_class)->destroy) (object);
}
+static void track_latency(GdkEvent const *event) {
+ GdkEventLatencyTracker &tracker = GdkEventLatencyTracker::default_tracker();
+ boost::optional<double> latency = tracker.process(event);
+ if (latency && *latency > 2.0) {
+ g_warning("Event latency reached %f sec", *latency);
+ }
+}
+
/**
* Returns new canvas as widget.
*/
return emit_event (SP_CANVAS (widget), (GdkEvent *) event);
}
+static inline void request_motions(GdkWindow *w, GdkEventMotion *event) {
+ gdk_window_get_pointer(w, NULL, NULL, NULL);
#if HAS_GDK_EVENT_REQUEST_MOTIONS
-static inline void request_motions(GdkWindow *, GdkEventMotion *event) {
gdk_event_request_motions(event);
-}
-#else
-static inline void request_motions(GdkWindow *w, GdkEventMotion *) {
- gdk_window_get_pointer(w, NULL, NULL, NULL);
-}
#endif
+}
/**
* Motion event handler for the canvas.
int status;
SPCanvas *canvas = SP_CANVAS (widget);
+ track_latency((GdkEvent *)event);
+
if (event->window != SP_CANVAS_WINDOW (canvas))
return FALSE;