diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2021-03-10 14:53:08 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-03-11 10:40:00 +1000 |
commit | e99f59422c67bcd6102e437d8aa3de0b33cde5ba (patch) | |
tree | aa629157246453fc6dd4df9b8417116959461a26 | |
parent | c71fa066070b84dd9bb96d41cef5324eab704ce9 (diff) | |
download | libinput-e99f59422c67bcd6102e437d8aa3de0b33cde5ba.tar.gz |
tools/debug-gui: move the pointer position into a struct point
No functional change
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tools/libinput-debug-gui.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/libinput-debug-gui.c b/tools/libinput-debug-gui.c index 2de93750..4c346499 100644 --- a/tools/libinput-debug-gui.c +++ b/tools/libinput-debug-gui.c @@ -87,7 +87,7 @@ struct window { int width, height; /* of window */ /* sprite position */ - double x, y; + struct point pointer; /* these are for the delta coordinates, but they're not * deltas, they are converted into abs positions */ @@ -645,7 +645,7 @@ draw_pointer(struct window *w, cairo_t *cr) /* draw pointer sprite */ cairo_set_source_rgb(cr, 0, 0, 0); cairo_save(cr); - cairo_move_to(cr, w->x, w->y); + cairo_move_to(cr, w->pointer.x, w->pointer.y); cairo_rel_line_to(cr, 10, 15); cairo_rel_line_to(cr, -10, 0); cairo_rel_line_to(cr, 0, -15); @@ -763,10 +763,10 @@ map_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) gtk_window_get_size(GTK_WINDOW(widget), &w->width, &w->height); - w->x = w->width/2; - w->y = w->height/2; - w->deltas[0].x = w->x; - w->deltas[0].y = w->y; + w->pointer.x = w->width/2; + w->pointer.y = w->height/2; + w->deltas[0].x = w->pointer.x; + w->deltas[0].y = w->pointer.y; w->scroll.vx = w->width/2; w->scroll.vy = w->height/2; @@ -1075,10 +1075,10 @@ handle_event_motion(struct libinput_event *ev, struct window *w) const int mask = ARRAY_LENGTH(w->deltas); size_t idx; - w->x += dx; - w->y += dy; - w->x = clip(w->x, 0.0, w->width); - w->y = clip(w->y, 0.0, w->height); + w->pointer.x += dx; + w->pointer.y += dy; + w->pointer.x = clip(w->pointer.x, 0.0, w->width); + w->pointer.y = clip(w->pointer.y, 0.0, w->height); idx = w->ndeltas % mask; point = w->deltas[idx]; |