Re: Accuracy of motion events



On Mon, 2014-09-01 at 23:29 +0200, ax487 wrote:
Just as an illustration: http://picpaste.com/event-DmCNqCHZ.png
It does make a difference :)

Yes -- so my assumption was that you get events with better time
resolution than 10 ms without compression.

So I hacked together a small test in plain C.
But again, I can not see a difference for my Box.
(Linux AMD64, Gtk3.12, Gnome3, X11, AMDX2 CPU, nvidia-drivers ...)

Here is the C code and the output, event time delta is general 12 ms
with few exceptions, no matter if compression is enabled or disabled.

/* http://zetcode.com/tutorials/gtktutorial/firstprograms/ */
#include <gtk/gtk.h>

void print_event(GtkWidget *widget, GdkEventMotion *event, gpointer p)
{
  printf("%.0f, %.0f: %d\n", event->x, event->y, event->time);
}

int main( int argc, char *argv[])
{
  GtkWidget *window;
        GdkWindow *gdkwin;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size(GTK_WINDOW(window), 800, 800);
        
  gtk_widget_set_events(window, GDK_POINTER_MOTION_MASK);
        
  gtk_widget_show(window);

  g_signal_connect(window, "motion_notify_event",
      G_CALLBACK (print_event), NULL);

  g_signal_connect_swapped(G_OBJECT(window), "destroy",
      G_CALLBACK(gtk_main_quit), NULL);

  gdkwin = gtk_widget_get_window(window);

  // gdk_window_set_event_compression(gdkwin, FALSE);
  gdk_window_set_event_compression(gdkwin, TRUE);

  gtk_main();

  return 0;
}

36, 422: 42037389
36, 426: 42037401
48, 438: 42037413
62, 451: 42037432
79, 464: 42037437
102, 475: 42037455
129, 486: 42037465
150, 493: 42037477
179, 500: 42037489
206, 502: 42037501
233, 502: 42037513
262, 502: 42037525
285, 491: 42037537
314, 480: 42037549
343, 469: 42037566
372, 460: 42037577
391, 447: 42037589
406, 430: 42037601
421, 413: 42037613
436, 396: 42037631
447, 377: 42037637



 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]