All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Anthony Liguori <aliguori@amazon.com>,
	Cole Robinson <crobinso@redhat.com>
Subject: [Qemu-devel] [PATCH v3 4/4] gtk: Add "Grab On Click" option
Date: Fri,  4 Apr 2014 12:41:24 +0200	[thread overview]
Message-ID: <1396608084-26986-5-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1396608084-26986-1-git-send-email-tiwai@suse.de>

I simply like it better, you don't? :)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 ui/gtk.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 6668bd8226d5..4427d9f6c1e9 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)) {
+        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) {
@@ -1417,6 +1429,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");
-- 
1.9.1

  parent reply	other threads:[~2014-04-04 10:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 10:41 [Qemu-devel] [PATCH v3 0/4] Fix relative pointer tracking on Gtk UI Takashi Iwai
2014-04-04 10:41 ` [Qemu-devel] [PATCH v3 1/4] gtk: Use gtk generic event signal instead of motion-notify-event Takashi Iwai
2014-04-04 10:41 ` [Qemu-devel] [PATCH v3 2/4] gtk: Fix the relative pointer tracking mode Takashi Iwai
2014-04-04 10:41 ` [Qemu-devel] [PATCH v3 3/4] gtk: Remember the last grabbed pointer position Takashi Iwai
2014-04-04 10:41 ` Takashi Iwai [this message]
2014-04-07  8:07   ` [Qemu-devel] [PATCH v3 4/4] gtk: Add "Grab On Click" option Gerd Hoffmann
2014-04-07  8:21     ` Takashi Iwai
2014-04-07 20:38     ` Michael S. Tsirkin
2014-04-08  6:25       ` Gerd Hoffmann
2014-04-08  8:11         ` Michael S. Tsirkin
2014-04-08  8:49           ` Gerd Hoffmann
2014-04-08  8:57             ` Michael S. Tsirkin
2014-04-08  9:23               ` Takashi Iwai
2014-04-04 23:08 ` [Qemu-devel] [PATCH v3 0/4] Fix relative pointer tracking on Gtk UI Brian Jackson
2014-04-06 10:36 ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396608084-26986-5-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=aliguori@amazon.com \
    --cc=crobinso@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.