diff mbox series

[v2,1/2] ui/gtk: Add gd_motion_event trace event

Message ID 20240512111435.30121-2-hikalium@hikalium.com (mailing list archive)
State New, archived
Headers show
Series ui/gtk: Fix motion event scaling issue | expand

Commit Message

hikalium May 12, 2024, 11:14 a.m. UTC
Add gd_motion_event trace event for making it easy to debug
gd_motion_event related issues.

Signed-off-by: hikalium <hikalium@hikalium.com>
---
 ui/gtk.c        | 2 ++
 ui/trace-events | 1 +
 2 files changed, 3 insertions(+)

Comments

Marc-André Lureau May 13, 2024, 8:17 a.m. UTC | #1
On Sun, May 12, 2024 at 3:16 PM hikalium <hikalium@hikalium.com> wrote:
>
> Add gd_motion_event trace event for making it easy to debug
> gd_motion_event related issues.
>
> Signed-off-by: hikalium <hikalium@hikalium.com>

Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  ui/gtk.c        | 2 ++
>  ui/trace-events | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 810d7fc796..ebae888d4f 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -911,6 +911,8 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
>      x = (motion->x - mx) / vc->gfx.scale_x * ws;
>      y = (motion->y - my) / vc->gfx.scale_y * ws;
>
> +    trace_gd_motion_event(ww, wh, gtk_widget_get_scale_factor(widget), x, y);
> +
>      if (qemu_input_is_absolute(vc->gfx.dcl.con)) {
>          if (x < 0 || y < 0 ||
>              x >= surface_width(vc->gfx.ds) ||
> diff --git a/ui/trace-events b/ui/trace-events
> index e6a2894303..69ff22955d 100644
> --- a/ui/trace-events
> +++ b/ui/trace-events
> @@ -28,6 +28,7 @@ gd_ungrab(const char *tab, const char *device) "tab=%s, dev=%s"
>  gd_keymap_windowing(const char *name) "backend=%s"
>  gd_gl_area_create_context(void *ctx, int major, int minor) "ctx=%p, major=%d, minor=%d"
>  gd_gl_area_destroy_context(void *ctx, void *current_ctx) "ctx=%p, current_ctx=%p"
> +gd_motion_event(int ww, int wh, int ws, int x, int y) "ww=%d, wh=%d, ws=%d, x=%d, y=%d"
>
>  # vnc-auth-sasl.c
>  # vnc-auth-vencrypt.c
> --
> 2.39.2
>
>
diff mbox series

Patch

diff --git a/ui/gtk.c b/ui/gtk.c
index 810d7fc796..ebae888d4f 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -911,6 +911,8 @@  static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
     x = (motion->x - mx) / vc->gfx.scale_x * ws;
     y = (motion->y - my) / vc->gfx.scale_y * ws;
 
+    trace_gd_motion_event(ww, wh, gtk_widget_get_scale_factor(widget), x, y);
+
     if (qemu_input_is_absolute(vc->gfx.dcl.con)) {
         if (x < 0 || y < 0 ||
             x >= surface_width(vc->gfx.ds) ||
diff --git a/ui/trace-events b/ui/trace-events
index e6a2894303..69ff22955d 100644
--- a/ui/trace-events
+++ b/ui/trace-events
@@ -28,6 +28,7 @@  gd_ungrab(const char *tab, const char *device) "tab=%s, dev=%s"
 gd_keymap_windowing(const char *name) "backend=%s"
 gd_gl_area_create_context(void *ctx, int major, int minor) "ctx=%p, major=%d, minor=%d"
 gd_gl_area_destroy_context(void *ctx, void *current_ctx) "ctx=%p, current_ctx=%p"
+gd_motion_event(int ww, int wh, int ws, int x, int y) "ww=%d, wh=%d, ws=%d, x=%d, y=%d"
 
 # vnc-auth-sasl.c
 # vnc-auth-vencrypt.c