gtk: Implement grab-on-click behavior in relative mode

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTQ+R5AAoJEEy22O7T6HE42wEP/R8bnGPEOphI7LykjFbK9aSo
 x4RKcYoaOe3r5TjlVmBG8xYnWL+7fCHc70WGQvtkWy7Ytqru6SUMR5siKJuZ2DMS
 wRwQFir6n8L8Oaaa+MVbueld8Q6zsWQCS1XND7aHUn/IA+vrGPzseyLFjcd04CVI
 Q0/7jMcPR9dEfA/T2ZsjXPsHU4b1/sPqHFO/nB34mzNXsFHSoDLhk4/AeQTifOE9
 zZ/TFUajd5YjG1TadrYBXpyahNbjSUFBz+BM2Fas4GXhHNoAe1fY9vo0LIQmp+/a
 nVLl0t+EkpV7gvOmmBb+8nL9UQ8KfCO9mQDm3xEvBaVjfWldauXOB6SE1RJz3hBt
 YT7ZCZcjQ8vxpbp+3275wqD+weyzLluG3jijE8Vy0q9oGPgOBFo6u5iDzmcTDFyi
 ULI1X24KtH1oliPuP3sINsTz1jgtD1ZNZgzeqZvxWPjG6DGjQAVX5smUXENLqpKz
 kJ6tBryGjrm2cShtxOaRJn4AcfNbLw7Rd7ETdcfhXwFMLdi2ov+McpdsrDz3ES12
 tew3U0M0vooGOMI9KHEAznPA7D1je2GaxI7D1UWg5AjVBqdUl8Lv9zqGzU5xxT6E
 uxSnIfGWGgJw68kOQpc1BioKO2CtZHGF2n2sIjsHoWsjkx7gg/LtcuKxeCsZ1WoA
 CkmbK40wfOInRzBk5Cri
 =xK+3
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-5' into staging

gtk: Implement grab-on-click behavior in relative mode

# gpg: Signature made Tue 08 Apr 2014 12:58:49 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-gtk-5:
  gtk: Implement grab-on-click behavior in relative mode

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-04-08 13:05:25 +01:00
commit 093de72b9c
1 changed files with 17 additions and 2 deletions

View File

@ -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) {