* [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes
@ 2014-04-07 8:56 Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 1/4] gtk: Use gtk generic event signal instead of motion-notify-event Gerd Hoffmann
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-04-07 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Last minute pointer fixes for gtk. And a MAINTAINERS update
to help ui patches being picked up more timely in the future.
please pull,
Gerd
The following changes since commit 466e6e9d13d56bbb6da1d2396d7d6347df483af0:
target-i386: reorder fields in cpu/msr_hyperv_hypercall subsection (2014-04-05 10:49:05 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-gtk-4
for you to fetch changes up to 25eccc37ff91254efdd123f5dafb37526a83a990:
ui: Update MAINTAINERS entry. (2014-04-07 10:50:30 +0200)
----------------------------------------------------------------
gtk: pointer fixes from Takashi Iwai.
----------------------------------------------------------------
Gerd Hoffmann (1):
ui: Update MAINTAINERS entry.
Takashi Iwai (3):
gtk: Use gtk generic event signal instead of motion-notify-event
gtk: Fix the relative pointer tracking mode
gtk: Remember the last grabbed pointer position
MAINTAINERS | 3 ++-
ui/gtk.c | 46 +++++++++++++++++++++++++++++++++-------------
2 files changed, 35 insertions(+), 14 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/4] gtk: Use gtk generic event signal instead of motion-notify-event
2014-04-07 8:56 [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Gerd Hoffmann
@ 2014-04-07 8:56 ` Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 2/4] gtk: Fix the relative pointer tracking mode Gerd Hoffmann
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-04-07 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Takashi Iwai, Gerd Hoffmann, Anthony Liguori
From: Takashi Iwai <tiwai@suse.de>
The GDK motion-notify-event isn't generated when the pointer goes out
of the target window even if the pointer is grabbed, which essentially
means to lose the pointer tracking in gtk-ui.
Meanwhile the generic "event" signal is sent when the pointer is
grabbed, so we can use this and pick the motion notify events manually
there instead.
Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587
Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index f056e40..c9f6d24 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -765,6 +765,14 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
return TRUE;
}
+static gboolean gd_event(GtkWidget *widget, GdkEvent *event, void *opaque)
+{
+ if (event->type == GDK_MOTION_NOTIFY) {
+ return gd_motion_event(widget, &event->motion, opaque);
+ }
+ return FALSE;
+}
+
/** Window Menu Actions **/
static void gd_menu_pause(GtkMenuItem *item, void *opaque)
@@ -1267,8 +1275,8 @@ static void gd_connect_signals(GtkDisplayState *s)
g_signal_connect(s->drawing_area, "expose-event",
G_CALLBACK(gd_expose_event), s);
#endif
- g_signal_connect(s->drawing_area, "motion-notify-event",
- G_CALLBACK(gd_motion_event), s);
+ g_signal_connect(s->drawing_area, "event",
+ G_CALLBACK(gd_event), s);
g_signal_connect(s->drawing_area, "button-press-event",
G_CALLBACK(gd_button_event), s);
g_signal_connect(s->drawing_area, "button-release-event",
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/4] gtk: Fix the relative pointer tracking mode
2014-04-07 8:56 [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 1/4] gtk: Use gtk generic event signal instead of motion-notify-event Gerd Hoffmann
@ 2014-04-07 8:56 ` Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 3/4] gtk: Remember the last grabbed pointer position Gerd Hoffmann
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-04-07 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Takashi Iwai, Gerd Hoffmann, Anthony Liguori
From: Takashi Iwai <tiwai@suse.de>
The relative pointer tracking mode was still buggy even after the
previous fix of the motion-notify-event since the events are filtered
out when the pointer moves outside the drawing window due to the
boundary check for the absolute mode.
This patch fixes the issue by moving the unnecessary boundary check
into the if block of absolute mode, and keep the coordinate in the
relative mode even if it's outside the drawing area. But this makes
the coordinate (last_x, last_y) possibly pointing to (-1,-1),
introduce a new flag to indicate the last coordinate has been
updated.
Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587
Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index c9f6d24..913cc3f 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -156,6 +156,7 @@ typedef struct GtkDisplayState
DisplayChangeListener dcl;
DisplaySurface *ds;
int button_mask;
+ gboolean last_set;
int last_x;
int last_y;
@@ -616,25 +617,25 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
x = (motion->x - mx) / s->scale_x;
y = (motion->y - my) / s->scale_y;
- if (x < 0 || y < 0 ||
- x >= surface_width(s->ds) ||
- y >= surface_height(s->ds)) {
- return TRUE;
- }
-
if (qemu_input_is_absolute()) {
+ if (x < 0 || y < 0 ||
+ x >= surface_width(s->ds) ||
+ y >= surface_height(s->ds)) {
+ return TRUE;
+ }
qemu_input_queue_abs(s->dcl.con, INPUT_AXIS_X, x,
surface_width(s->ds));
qemu_input_queue_abs(s->dcl.con, INPUT_AXIS_Y, y,
surface_height(s->ds));
qemu_input_event_sync();
- } else if (s->last_x != -1 && s->last_y != -1 && gd_is_grab_active(s)) {
+ } else if (s->last_set && gd_is_grab_active(s)) {
qemu_input_queue_rel(s->dcl.con, INPUT_AXIS_X, x - s->last_x);
qemu_input_queue_rel(s->dcl.con, INPUT_AXIS_Y, y - s->last_y);
qemu_input_event_sync();
}
s->last_x = x;
s->last_y = y;
+ s->last_set = TRUE;
if (!qemu_input_is_absolute() && gd_is_grab_active(s)) {
GdkScreen *screen = gtk_widget_get_screen(s->drawing_area);
@@ -669,8 +670,7 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
GdkDisplay *display = gtk_widget_get_display(widget);
gdk_display_warp_pointer(display, screen, x, y);
#endif
- s->last_x = -1;
- s->last_y = -1;
+ s->last_set = FALSE;
return FALSE;
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 3/4] gtk: Remember the last grabbed pointer position
2014-04-07 8:56 [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 1/4] gtk: Use gtk generic event signal instead of motion-notify-event Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 2/4] gtk: Fix the relative pointer tracking mode Gerd Hoffmann
@ 2014-04-07 8:56 ` Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 4/4] ui: Update MAINTAINERS entry Gerd Hoffmann
2014-04-07 11:50 ` [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-04-07 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Takashi Iwai, Gerd Hoffmann, Anthony Liguori
From: Takashi Iwai <tiwai@suse.de>
It's pretty annoying that the pointer reappears at a random place once
after grabbing and ungrabbing the input. Better to restore to the
original position where the pointer was grabbed.
Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587
Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 913cc3f..6668bd8 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -159,6 +159,8 @@ typedef struct GtkDisplayState
gboolean last_set;
int last_x;
int last_y;
+ int grab_x_root;
+ int grab_y_root;
double scale_x;
double scale_y;
@@ -971,8 +973,8 @@ static void gd_ungrab_keyboard(GtkDisplayState *s)
static void gd_grab_pointer(GtkDisplayState *s)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkDisplay *display = gtk_widget_get_display(s->drawing_area);
+#if GTK_CHECK_VERSION(3, 0, 0)
GdkDeviceManager *mgr = gdk_display_get_device_manager(display);
GList *devices = gdk_device_manager_list_devices(mgr,
GDK_DEVICE_TYPE_MASTER);
@@ -996,6 +998,8 @@ static void gd_grab_pointer(GtkDisplayState *s)
tmp = tmp->next;
}
g_list_free(devices);
+ gdk_device_get_position(gdk_device_manager_get_client_pointer(mgr),
+ NULL, &s->grab_x_root, &s->grab_y_root);
#else
gdk_pointer_grab(gtk_widget_get_window(s->drawing_area),
FALSE, /* All events to come to our window directly */
@@ -1007,13 +1011,15 @@ static void gd_grab_pointer(GtkDisplayState *s)
NULL, /* Allow cursor to move over entire desktop */
s->null_cursor,
GDK_CURRENT_TIME);
+ gdk_display_get_pointer(display, NULL,
+ &s->grab_x_root, &s->grab_y_root, NULL);
#endif
}
static void gd_ungrab_pointer(GtkDisplayState *s)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkDisplay *display = gtk_widget_get_display(s->drawing_area);
+#if GTK_CHECK_VERSION(3, 0, 0)
GdkDeviceManager *mgr = gdk_display_get_device_manager(display);
GList *devices = gdk_device_manager_list_devices(mgr,
GDK_DEVICE_TYPE_MASTER);
@@ -1027,8 +1033,14 @@ static void gd_ungrab_pointer(GtkDisplayState *s)
tmp = tmp->next;
}
g_list_free(devices);
+ gdk_device_warp(gdk_device_manager_get_client_pointer(mgr),
+ gtk_widget_get_screen(s->drawing_area),
+ s->grab_x_root, s->grab_y_root);
#else
gdk_pointer_ungrab(GDK_CURRENT_TIME);
+ gdk_display_warp_pointer(display,
+ gtk_widget_get_screen(s->drawing_area),
+ s->grab_x_root, s->grab_y_root);
#endif
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 4/4] ui: Update MAINTAINERS entry.
2014-04-07 8:56 [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Gerd Hoffmann
` (2 preceding siblings ...)
2014-04-07 8:56 ` [Qemu-devel] [PULL 3/4] gtk: Remember the last grabbed pointer position Gerd Hoffmann
@ 2014-04-07 8:56 ` Gerd Hoffmann
2014-04-07 11:50 ` [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2014-04-07 8:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
With Amazon eating Anthonys time status "Maintained" certainly isn't
true any more. Update entry accordingly.
Also add myself, so scripts/get_maintainer.pl will Cc: me, to reduce
the chance ui patches fall through the cracks on our pretty loaded
qemu-devel mailing list.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
MAINTAINERS | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 34b8c3f..c66946f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -717,7 +717,8 @@ F: hw/display/qxl*
Graphics
M: Anthony Liguori <aliguori@amazon.com>
-S: Maintained
+M: Gerd Hoffmann <kraxel@redhat.com>
+S: Odd Fixes
F: ui/
Cocoa graphics
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes
2014-04-07 8:56 [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Gerd Hoffmann
` (3 preceding siblings ...)
2014-04-07 8:56 ` [Qemu-devel] [PULL 4/4] ui: Update MAINTAINERS entry Gerd Hoffmann
@ 2014-04-07 11:50 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2014-04-07 11:50 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 7 April 2014 09:56, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Last minute pointer fixes for gtk. And a MAINTAINERS update
> to help ui patches being picked up more timely in the future.
>
> please pull,
> Gerd
>
> The following changes since commit 466e6e9d13d56bbb6da1d2396d7d6347df483af0:
>
> target-i386: reorder fields in cpu/msr_hyperv_hypercall subsection (2014-04-05 10:49:05 +0100)
>
> are available in the git repository at:
>
> git://git.kraxel.org/qemu tags/pull-gtk-4
>
> for you to fetch changes up to 25eccc37ff91254efdd123f5dafb37526a83a990:
>
> ui: Update MAINTAINERS entry. (2014-04-07 10:50:30 +0200)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-04-07 11:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-07 8:56 [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 1/4] gtk: Use gtk generic event signal instead of motion-notify-event Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 2/4] gtk: Fix the relative pointer tracking mode Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 3/4] gtk: Remember the last grabbed pointer position Gerd Hoffmann
2014-04-07 8:56 ` [Qemu-devel] [PULL 4/4] ui: Update MAINTAINERS entry Gerd Hoffmann
2014-04-07 11:50 ` [Qemu-devel] [PULL for-2.0 0/4] gtk: pointer fixes Peter Maydell
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).