qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 4/4] gtk: Add "Grab On Click" option


From: Cole Robinson
Subject: Re: [Qemu-devel] [PATCH v2 4/4] gtk: Add "Grab On Click" option
Date: Wed, 02 Apr 2014 09:28:54 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/02/2014 08:32 AM, Takashi Iwai wrote:
> I simply like it better, you don't? :)
> 

In fact, relative mouse mode is a pain without this feature, you need to
manually initiate a grab with ctrl+alt+g before mouse movement will even work.
Compare to our sdl front end, or virt-viewer, vinagre, virt-manager, where
grab-on-click is the default (there isn't even an option to disable that
behavior).

I don't know what the original intention of the code was, but I think this
behavior should be the default. Anthony, Gerd, thoughts?

- Cole

> Signed-off-by: Takashi Iwai <address@hidden>
> ---
>  ui/gtk.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 9b8df1224fdb..ffaf91ea453a 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -141,6 +141,7 @@ typedef struct GtkDisplayState
>      GtkWidget *zoom_fit_item;
>      GtkWidget *grab_item;
>      GtkWidget *grab_on_hover_item;
> +    GtkWidget *grab_on_click_item;
>      GtkWidget *vga_item;
>  
>      int nb_vcs;
> @@ -189,6 +190,11 @@ static bool gd_grab_on_hover(GtkDisplayState *s)
>      return 
> gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s->grab_on_hover_item));
>  }
>  
> +static bool gd_grab_on_click(GtkDisplayState *s)
> +{
> +    return 
> gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s->grab_on_click_item));
> +}
> +
>  static bool gd_on_vga(GtkDisplayState *s)
>  {
>      return gtk_notebook_get_current_page(GTK_NOTEBOOK(s->notebook)) == 0;
> @@ -685,6 +691,12 @@ static gboolean gd_button_event(GtkWidget *widget, 
> GdkEventButton *button,
>      GtkDisplayState *s = opaque;
>      InputButton btn;
>  
> +    if (button->button == 1 && button->type == GDK_BUTTON_PRESS &&
> +     !gd_is_grab_active(s) && gd_grab_on_click(s) && button->button == 1) {
> +        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) {
> @@ -1416,6 +1428,9 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState 
> *s, GtkAccelGroup *accel_g
>      s->grab_on_hover_item = gtk_check_menu_item_new_with_mnemonic(_("Grab On 
> _Hover"));
>      gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->grab_on_hover_item);
>  
> +    s->grab_on_click_item = gtk_check_menu_item_new_with_mnemonic(_("Grab On 
> _Click"));
> +    gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->grab_on_click_item);
> +
>      s->grab_item = gtk_check_menu_item_new_with_mnemonic(_("_Grab Input"));
>      gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->grab_item),
>                                   "<QEMU>/View/Grab Input");
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]