* [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix @ 2014-04-08 12:06 Gerd Hoffmann 2014-04-08 12:06 ` [Qemu-devel] [PULL 1/1] gtk: Implement grab-on-click behavior in relative mode Gerd Hoffmann 2014-04-08 13:01 ` [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix Peter Maydell 0 siblings, 2 replies; 3+ messages in thread From: Gerd Hoffmann @ 2014-04-08 12:06 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann Hi, Finally sorted things, with this patch the gtk ui behavior in relative mouse mode is consistent with everybody else (sdl, virt-viewer, ...). please pull, Gerd The following changes since commit 55519a4b244e4822774b593e36647ecf7598286b: Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-2.0' into staging (2014-04-07 17:57:23 +0100) are available in the git repository at: git://git.kraxel.org/qemu tags/pull-gtk-5 for you to fetch changes up to 800b0e814bef7cd14ae2bce149c09d70676e93fb: gtk: Implement grab-on-click behavior in relative mode (2014-04-08 13:57:34 +0200) ---------------------------------------------------------------- gtk: Implement grab-on-click behavior in relative mode ---------------------------------------------------------------- Takashi Iwai (1): gtk: Implement grab-on-click behavior in relative mode ui/gtk.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PULL 1/1] gtk: Implement grab-on-click behavior in relative mode 2014-04-08 12:06 [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix Gerd Hoffmann @ 2014-04-08 12:06 ` Gerd Hoffmann 2014-04-08 13:01 ` [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix Peter Maydell 1 sibling, 0 replies; 3+ messages in thread From: Gerd Hoffmann @ 2014-04-08 12:06 UTC (permalink / raw) To: qemu-devel; +Cc: Takashi Iwai, Gerd Hoffmann, Anthony Liguori From: Takashi Iwai <tiwai@suse.de> This patch changes the behavior in the relative mode to be compatible with other UIs, namely, grabbing the input at the first left click. It improves the usability a lot; otherwise you have to press ctl-alt-G or select from menu at each time you want to move the pointer. Also, the input grab is cleared when the current mode is switched to the absolute mode. The automatic reset of the implicit grabbing is needed since the switching to the absolute mode happens always after the click even on Gtk. That is, we cannot check whether the absolute mode is already available at the first click time even though it should have been switched in X11 input driver side. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- ui/gtk.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 6668bd8..00fbbcc 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -476,8 +476,15 @@ static void gd_change_runstate(void *opaque, int running, RunState state) static void gd_mouse_mode_change(Notifier *notify, void *data) { - gd_update_cursor(container_of(notify, GtkDisplayState, mouse_mode_notifier), - FALSE); + GtkDisplayState *s; + + s = container_of(notify, GtkDisplayState, mouse_mode_notifier); + /* release the grab at switching to absolute mode */ + if (qemu_input_is_absolute() && gd_is_grab_active(s)) { + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), + FALSE); + } + gd_update_cursor(s, FALSE); } /** GTK Events **/ @@ -685,6 +692,14 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button, GtkDisplayState *s = opaque; InputButton btn; + /* implicitly grab the input at the first click in the relative mode */ + if (button->button == 1 && button->type == GDK_BUTTON_PRESS && + !qemu_input_is_absolute() && !gd_is_grab_active(s)) { + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item), + TRUE); + return TRUE; + } + if (button->button == 1) { btn = INPUT_BUTTON_LEFT; } else if (button->button == 2) { -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix 2014-04-08 12:06 [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix Gerd Hoffmann 2014-04-08 12:06 ` [Qemu-devel] [PULL 1/1] gtk: Implement grab-on-click behavior in relative mode Gerd Hoffmann @ 2014-04-08 13:01 ` Peter Maydell 1 sibling, 0 replies; 3+ messages in thread From: Peter Maydell @ 2014-04-08 13:01 UTC (permalink / raw) To: Gerd Hoffmann; +Cc: QEMU Developers On 8 April 2014 13:06, Gerd Hoffmann <kraxel@redhat.com> wrote: > Hi, > > Finally sorted things, with this patch the gtk ui behavior > in relative mouse mode is consistent with everybody else > (sdl, virt-viewer, ...). > > please pull, > Gerd > > The following changes since commit 55519a4b244e4822774b593e36647ecf7598286b: > > Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-2.0' into staging (2014-04-07 17:57:23 +0100) > > are available in the git repository at: > > > git://git.kraxel.org/qemu tags/pull-gtk-5 > > for you to fetch changes up to 800b0e814bef7cd14ae2bce149c09d70676e93fb: > > gtk: Implement grab-on-click behavior in relative mode (2014-04-08 13:57:34 +0200) Applied, thanks. -- PMM ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-08 13:02 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-04-08 12:06 [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix Gerd Hoffmann 2014-04-08 12:06 ` [Qemu-devel] [PULL 1/1] gtk: Implement grab-on-click behavior in relative mode Gerd Hoffmann 2014-04-08 13:01 ` [Qemu-devel] [PULL for-2.0 0/1] gtk: one more usability fix 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).