qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later
@ 2016-12-23 14:50 OGAWA Hirofumi
  2017-01-04  8:48 ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: OGAWA Hirofumi @ 2016-12-23 14:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

On 3.4.0 or later, send GDK_SCROLL_SMOOTH event, instead of
GDK_SCROLL_UP/DOWN.

This fixes it by converting any smooth scroll to up/down.
(I.e. without smooth support)

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 ui/gtk.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff -puN ui/gtk.c~mouse-wheel-fix ui/gtk.c
--- qemu/ui/gtk.c~mouse-wheel-fix	2016-12-23 23:39:24.419659012 +0900
+++ qemu-hirofumi/ui/gtk.c	2016-12-23 23:39:37.540735673 +0900
@@ -1015,6 +1015,16 @@ static gboolean gd_scroll_event(GtkWidge
         btn = INPUT_BUTTON_WHEEL_UP;
     } else if (scroll->direction == GDK_SCROLL_DOWN) {
         btn = INPUT_BUTTON_WHEEL_DOWN;
+#if GTK_CHECK_VERSION(3, 4, 0)
+    } else if (scroll->direction == GDK_SCROLL_SMOOTH) {
+        gdouble delta_x, delta_y;
+        if (!gdk_event_get_scroll_deltas((GdkEvent*)scroll, &delta_x, &delta_y))
+            return TRUE;
+        if (delta_y > 0)
+            btn = INPUT_BUTTON_WHEEL_DOWN;
+        else
+            btn = INPUT_BUTTON_WHEEL_UP;
+#endif
     } else {
         return TRUE;
     }
_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later
  2016-12-23 14:50 [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later OGAWA Hirofumi
@ 2017-01-04  8:48 ` Gerd Hoffmann
  2017-01-04 20:39   ` OGAWA Hirofumi
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2017-01-04  8:48 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: qemu-devel

> +#if GTK_CHECK_VERSION(3, 4, 0)
> +    } else if (scroll->direction == GDK_SCROLL_SMOOTH) {
> +        gdouble delta_x, delta_y;
> +        if (!gdk_event_get_scroll_deltas((GdkEvent*)scroll, &delta_x, &delta_y))
> +            return TRUE;
> +        if (delta_y > 0)
> +            btn = INPUT_BUTTON_WHEEL_DOWN;
> +        else
> +            btn = INPUT_BUTTON_WHEEL_UP;
> +#endif

Patch looks good, except for some codestyle issues:

=== checkpatch complains ===
ERROR: "(foo*)" should be "(foo *)"
#13: FILE: ui/gtk.c:1024:
+        if (!gdk_event_get_scroll_deltas((GdkEvent*)scroll, &delta_x,
&delta_y))

ERROR: braces {} are necessary for all arms of this statement
#13: FILE: ui/gtk.c:1024:
+        if (!gdk_event_get_scroll_deltas((GdkEvent*)scroll, &delta_x,
&delta_y))
[...]

ERROR: braces {} are necessary for all arms of this statement
#15: FILE: ui/gtk.c:1026:
+        if (delta_y > 0)
[...]
+        else
[...]

total: 3 errors, 0 warnings, 16 lines checked

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later
  2017-01-04  8:48 ` Gerd Hoffmann
@ 2017-01-04 20:39   ` OGAWA Hirofumi
  2017-01-04 20:41     ` [Qemu-devel] [PATCH v2] " OGAWA Hirofumi
  0 siblings, 1 reply; 5+ messages in thread
From: OGAWA Hirofumi @ 2017-01-04 20:39 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

Gerd Hoffmann <kraxel@redhat.com> writes:

>> +#if GTK_CHECK_VERSION(3, 4, 0)
>> +    } else if (scroll->direction == GDK_SCROLL_SMOOTH) {
>> +        gdouble delta_x, delta_y;
>> +        if (!gdk_event_get_scroll_deltas((GdkEvent*)scroll, &delta_x, &delta_y))
>> +            return TRUE;
>> +        if (delta_y > 0)
>> +            btn = INPUT_BUTTON_WHEEL_DOWN;
>> +        else
>> +            btn = INPUT_BUTTON_WHEEL_UP;
>> +#endif
>
> Patch looks good, except for some codestyle issues:

will fix

> === checkpatch complains ===
> ERROR: "(foo*)" should be "(foo *)"
> #13: FILE: ui/gtk.c:1024:
> +        if (!gdk_event_get_scroll_deltas((GdkEvent*)scroll, &delta_x,
> &delta_y))
>
> ERROR: braces {} are necessary for all arms of this statement
> #13: FILE: ui/gtk.c:1024:
> +        if (!gdk_event_get_scroll_deltas((GdkEvent*)scroll, &delta_x,
> &delta_y))
> [...]
>
> ERROR: braces {} are necessary for all arms of this statement
> #15: FILE: ui/gtk.c:1026:
> +        if (delta_y > 0)
> [...]
> +        else
> [...]
>
> total: 3 errors, 0 warnings, 16 lines checked
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH v2] ui/gtk: Fix mouse wheel on 3.4.0 or later
  2017-01-04 20:39   ` OGAWA Hirofumi
@ 2017-01-04 20:41     ` OGAWA Hirofumi
  2017-01-10 11:43       ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: OGAWA Hirofumi @ 2017-01-04 20:41 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel


On 3.4.0 or later, send GDK_SCROLL_SMOOTH event, instead of
GDK_SCROLL_UP/DOWN.

This fixes it by converting any smooth scroll to up/down.
(I.e. without smooth support)

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 ui/gtk.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff -puN ui/gtk.c~mouse-wheel-fix ui/gtk.c
--- qemu/ui/gtk.c~mouse-wheel-fix	2016-12-28 04:52:07.848682967 +0900
+++ qemu-hirofumi/ui/gtk.c	2017-01-05 05:38:24.200601498 +0900
@@ -1015,6 +1015,19 @@ static gboolean gd_scroll_event(GtkWidge
         btn = INPUT_BUTTON_WHEEL_UP;
     } else if (scroll->direction == GDK_SCROLL_DOWN) {
         btn = INPUT_BUTTON_WHEEL_DOWN;
+#if GTK_CHECK_VERSION(3, 4, 0)
+    } else if (scroll->direction == GDK_SCROLL_SMOOTH) {
+        gdouble delta_x, delta_y;
+        if (!gdk_event_get_scroll_deltas((GdkEvent *)scroll,
+                                         &delta_x, &delta_y)) {
+            return TRUE;
+        }
+        if (delta_y > 0) {
+            btn = INPUT_BUTTON_WHEEL_DOWN;
+        } else {
+            btn = INPUT_BUTTON_WHEEL_UP;
+        }
+#endif
     } else {
         return TRUE;
     }
_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v2] ui/gtk: Fix mouse wheel on 3.4.0 or later
  2017-01-04 20:41     ` [Qemu-devel] [PATCH v2] " OGAWA Hirofumi
@ 2017-01-10 11:43       ` Gerd Hoffmann
  0 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-01-10 11:43 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: qemu-devel

On Do, 2017-01-05 at 05:41 +0900, OGAWA Hirofumi wrote:
> On 3.4.0 or later, send GDK_SCROLL_SMOOTH event, instead of
> GDK_SCROLL_UP/DOWN.
> 
> This fixes it by converting any smooth scroll to up/down.
> (I.e. without smooth support)
> 
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Added to ui queue.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-10 11:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-23 14:50 [Qemu-devel] [PATCH] ui/gtk: Fix mouse wheel on 3.4.0 or later OGAWA Hirofumi
2017-01-04  8:48 ` Gerd Hoffmann
2017-01-04 20:39   ` OGAWA Hirofumi
2017-01-04 20:41     ` [Qemu-devel] [PATCH v2] " OGAWA Hirofumi
2017-01-10 11:43       ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).