mirror of
https://github.com/xemu-project/xemu.git
synced 2026-11-13 01:29:03 +01:00
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:
commit
093de72b9c
1 file changed
+17
-2
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user