qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes
@ 2014-03-13 10:46 Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 1/7] gtk: Allow to activate grab-on-hover from the command line Gerd Hoffmann
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Looks like I've became the default victim for gtk patches, with anthony
being busy and /me recently picking up the gtk mouse wheel patch.

So here is a collection of gtk patches hitting my inbox over the last
few days.  Not strictly bugfixes-only, but the cleanups are simple
enouth that I think they are fine for 2.0.

please pull,
  Gerd

The following changes since commit 239618707637ec87eba8c452d2b2f75dc5ca20c7:

  Merge remote-tracking branch 'remotes/kvm/uq/master' into staging (2014-03-11 19:39:17 +0000)

are available in the git repository at:


  git://git.kraxel.org/qemu tags/pull-gtk-1

for you to fetch changes up to 1962744467ec5624bfecb55bf5a2c321744da253:

  gtk: Don't warp absolute pointer (2014-03-13 10:12:47 +0100)

----------------------------------------------------------------
gtk cleanups and fixes.

----------------------------------------------------------------
Cole Robinson (6):
      gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic
      gtk: Don't use deprecated vte_terminal_get_adjustment
      gtk: Remove use of deprecated stock items
      gtk: Use ctrl+alt+q for quit accelerator
      gtk: Fix mouse warping with gtk3
      gtk: Don't warp absolute pointer

Jan Kiszka (1):
      gtk: Allow to activate grab-on-hover from the command line

 include/ui/console.h |  2 +-
 qemu-options.hx      |  5 +++++
 ui/gtk.c             | 39 ++++++++++++++++++++++++++-------------
 vl.c                 | 22 +++++++++++++++++++++-
 4 files changed, 53 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PULL 1/7] gtk: Allow to activate grab-on-hover from the command line
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
@ 2014-03-13 10:46 ` Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 2/7] gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic Gerd Hoffmann
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Gerd Hoffmann, Anthony Liguori

From: Jan Kiszka <jan.kiszka@siemens.com>

As long as we have no persistent GTK configuration, this allows to
enable the useful grab-on-hover feature already when starting the VM.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h |  2 +-
 qemu-options.hx      |  5 +++++
 ui/gtk.c             |  5 ++++-
 vl.c                 | 22 +++++++++++++++++++++-
 4 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 08a38ea..8a86617 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -345,6 +345,6 @@ int index_from_key(const char *key);
 
 /* gtk.c */
 void early_gtk_display_init(void);
-void gtk_display_init(DisplayState *ds, bool full_screen);
+void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover);
 
 #endif
diff --git a/qemu-options.hx b/qemu-options.hx
index 068da2d..ee5437b 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -810,6 +810,7 @@ ETEXI
 DEF("display", HAS_ARG, QEMU_OPTION_display,
     "-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]\n"
     "            [,window_close=on|off]|curses|none|\n"
+    "            gtk[,grab_on_hover=on|off]|\n"
     "            vnc=<display>[,<optargs>]\n"
     "                select display type\n", QEMU_ARCH_ALL)
 STEXI
@@ -833,6 +834,10 @@ graphics card, but its output will not be displayed to the QEMU
 user. This option differs from the -nographic option in that it
 only affects what is done with video output; -nographic also changes
 the destination of the serial and parallel port data.
+@item gtk
+Display video output in a GTK window. This interface provides drop-down
+menus and other UI elements to configure and control the VM during
+runtime.
 @item vnc
 Start a VNC server on display <arg>
 @end table
diff --git a/ui/gtk.c b/ui/gtk.c
index 1851495..992f7d7 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1415,7 +1415,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_cursor_define = gd_cursor_define,
 };
 
-void gtk_display_init(DisplayState *ds, bool full_screen)
+void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
 {
     GtkDisplayState *s = g_malloc0(sizeof(*s));
     char *filename;
@@ -1494,6 +1494,9 @@ void gtk_display_init(DisplayState *ds, bool full_screen)
     if (full_screen) {
         gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
     }
+    if (grab_on_hover) {
+        gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item));
+    }
 
     register_displaychangelistener(&s->dcl);
 
diff --git a/vl.c b/vl.c
index bca5c95..b73744d 100644
--- a/vl.c
+++ b/vl.c
@@ -143,6 +143,7 @@ int vga_interface_type = VGA_NONE;
 static int full_screen = 0;
 static int no_frame = 0;
 int no_quit = 0;
+static bool grab_on_hover;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
 CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
@@ -2241,6 +2242,25 @@ static DisplayType select_display(const char *p)
     } else if (strstart(p, "gtk", &opts)) {
 #ifdef CONFIG_GTK
         display = DT_GTK;
+        while (*opts) {
+            const char *nextopt;
+
+            if (strstart(opts, ",grab_on_hover=", &nextopt)) {
+                opts = nextopt;
+                if (strstart(opts, "on", &nextopt)) {
+                    grab_on_hover = true;
+                } else if (strstart(opts, "off", &nextopt)) {
+                    grab_on_hover = false;
+                } else {
+                    goto invalid_gtk_args;
+                }
+            } else {
+            invalid_gtk_args:
+                fprintf(stderr, "Invalid GTK option string: %s\n", p);
+                exit(1);
+            }
+            opts = nextopt;
+        }
 #else
         fprintf(stderr, "GTK support is disabled\n");
         exit(1);
@@ -4351,7 +4371,7 @@ int main(int argc, char **argv, char **envp)
 #endif
 #if defined(CONFIG_GTK)
     case DT_GTK:
-        gtk_display_init(ds, full_screen);
+        gtk_display_init(ds, full_screen, grab_on_hover);
         break;
 #endif
     default:
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PULL 2/7] gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 1/7] gtk: Allow to activate grab-on-hover from the command line Gerd Hoffmann
@ 2014-03-13 10:46 ` Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 3/7] gtk: Don't use deprecated vte_terminal_get_adjustment Gerd Hoffmann
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

In these cases we weren't using an image in the menu item anyways, so
just do as the suggestion says. Should be fine for all qemu supported
gtk versions.

ui/gtk.c: In function ‘gd_create_menu_machine’:
ui/gtk.c:1284:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations]
     s->reset_item = gtk_image_menu_item_new_with_mnemonic(_("_Reset"));
     ^
ui/gtk.c:1287:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations]
     s->powerdown_item = gtk_image_menu_item_new_with_mnemonic(_("Power _Down"));

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 992f7d7..107860c 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1281,10 +1281,10 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s, GtkAccelGroup *acce
     separator = gtk_separator_menu_item_new();
     gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), separator);
 
-    s->reset_item = gtk_image_menu_item_new_with_mnemonic(_("_Reset"));
+    s->reset_item = gtk_menu_item_new_with_mnemonic(_("_Reset"));
     gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), s->reset_item);
 
-    s->powerdown_item = gtk_image_menu_item_new_with_mnemonic(_("Power _Down"));
+    s->powerdown_item = gtk_menu_item_new_with_mnemonic(_("Power _Down"));
     gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), s->powerdown_item);
 
     separator = gtk_separator_menu_item_new();
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PULL 3/7] gtk: Don't use deprecated vte_terminal_get_adjustment
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 1/7] gtk: Allow to activate grab-on-hover from the command line Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 2/7] gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic Gerd Hoffmann
@ 2014-03-13 10:46 ` Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 4/7] gtk: Remove use of deprecated stock items Gerd Hoffmann
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

Guard this with a VTE version check, since I'm not sure if this is backwards
compatible.

ui/gtk.c: In function ‘gd_vc_init’:
ui/gtk.c:1176:5: error: ‘vte_terminal_get_adjustment’ is deprecated (declared at /usr/include/vte-2.90/vte/vtedeprecated.h:101) [-Werror=deprecated-declarations]

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 107860c..3f2e5f2 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1173,7 +1173,11 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL
 
     vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->terminal), -1);
 
+#if VTE_CHECK_VERSION(0, 28, 0)
+    vadjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(vc->terminal));
+#else
     vadjustment = vte_terminal_get_adjustment(VTE_TERMINAL(vc->terminal));
+#endif
 
     scrolled_window = gtk_scrolled_window_new(NULL, vadjustment);
     gtk_container_add(GTK_CONTAINER(scrolled_window), vc->terminal);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PULL 4/7] gtk: Remove use of deprecated stock items
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2014-03-13 10:46 ` [Qemu-devel] [PULL 3/7] gtk: Don't use deprecated vte_terminal_get_adjustment Gerd Hoffmann
@ 2014-03-13 10:46 ` Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 5/7] gtk: Use ctrl+alt+q for quit accelerator Gerd Hoffmann
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

Stock items are deprecated. As are ImageMenuItems. Convert everything to
text only MenuItems, with the same text content as mentioned in the
conversion guide:

https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html

gtk2 users lose their menu icons as well, but I don't think that's enough
of a problem to warrant keeping around back compat code.

Example error:

ui/gtk.c:1328:5: error: ‘GtkStock’ is deprecated [-Werror=deprecated-declarations]
ui/gtk.c:1335:5: error: ‘gtk_image_menu_item_new_from_stock’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:78): Use 'gtk_menu_item_new' instead [-Werror=deprecated-declarations]
     s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 3f2e5f2..ba4f6e2 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1274,7 +1274,6 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s, GtkAccelGroup *acce
 {
     GtkWidget *machine_menu;
     GtkWidget *separator;
-    GtkStockItem item;
 
     machine_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(machine_menu), accel_group);
@@ -1294,11 +1293,11 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s, GtkAccelGroup *acce
     separator = gtk_separator_menu_item_new();
     gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), separator);
 
-    s->quit_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
-    gtk_stock_lookup(GTK_STOCK_QUIT, &item);
+    s->quit_item = gtk_menu_item_new_with_mnemonic(_("_Quit"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->quit_item),
                                  "<QEMU>/Machine/Quit");
-    gtk_accel_map_add_entry("<QEMU>/Machine/Quit", item.keyval, item.modifier);
+    gtk_accel_map_add_entry("<QEMU>/Machine/Quit",
+                            GDK_KEY_q, GDK_CONTROL_MASK);
     gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), s->quit_item);
 
     return machine_menu;
@@ -1314,8 +1313,7 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
     view_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
 
-    s->full_screen_item =
-        gtk_image_menu_item_new_from_stock(GTK_STOCK_FULLSCREEN, NULL);
+    s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
                                  "<QEMU>/View/Full Screen");
     gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f,
@@ -1325,21 +1323,21 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
     separator = gtk_separator_menu_item_new();
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), separator);
 
-    s->zoom_in_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_IN, NULL);
+    s->zoom_in_item = gtk_menu_item_new_with_mnemonic(_("Zoom _In"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_in_item),
                                  "<QEMU>/View/Zoom In");
     gtk_accel_map_add_entry("<QEMU>/View/Zoom In", GDK_KEY_plus,
                             HOTKEY_MODIFIERS);
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->zoom_in_item);
 
-    s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);
+    s->zoom_out_item = gtk_menu_item_new_with_mnemonic(_("Zoom _Out"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_out_item),
                                  "<QEMU>/View/Zoom Out");
     gtk_accel_map_add_entry("<QEMU>/View/Zoom Out", GDK_KEY_minus,
                             HOTKEY_MODIFIERS);
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->zoom_out_item);
 
-    s->zoom_fixed_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_100, NULL);
+    s->zoom_fixed_item = gtk_menu_item_new_with_mnemonic(_("Best _Fit"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_fixed_item),
                                  "<QEMU>/View/Zoom Fixed");
     gtk_accel_map_add_entry("<QEMU>/View/Zoom Fixed", GDK_KEY_0,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PULL 5/7] gtk: Use ctrl+alt+q for quit accelerator
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2014-03-13 10:46 ` [Qemu-devel] [PULL 4/7] gtk: Remove use of deprecated stock items Gerd Hoffmann
@ 2014-03-13 10:46 ` Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 6/7] gtk: Fix mouse warping with gtk3 Gerd Hoffmann
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

Using the standard ctrl+q makes it too easy to kill the whole VM. Using
ctrl+alt+FOO is consistent with our other accelerators.

https://bugzilla.redhat.com/show_bug.cgi?id=1062393
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index ba4f6e2..79babc9 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1297,7 +1297,7 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s, GtkAccelGroup *acce
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->quit_item),
                                  "<QEMU>/Machine/Quit");
     gtk_accel_map_add_entry("<QEMU>/Machine/Quit",
-                            GDK_KEY_q, GDK_CONTROL_MASK);
+                            GDK_KEY_q, HOTKEY_MODIFIERS);
     gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), s->quit_item);
 
     return machine_menu;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PULL 6/7] gtk: Fix mouse warping with gtk3
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2014-03-13 10:46 ` [Qemu-devel] [PULL 5/7] gtk: Use ctrl+alt+q for quit accelerator Gerd Hoffmann
@ 2014-03-13 10:46 ` Gerd Hoffmann
  2014-03-13 10:46 ` [Qemu-devel] [PULL 7/7] gtk: Don't warp absolute pointer Gerd Hoffmann
  2014-03-13 18:55 ` [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Peter Maydell
  7 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

We were using the wrong coordinates, this fixes things to match the
original gtk2 implementation.

You can see this error in action by using -vga qxl, however even after this
patch the mouse warps in small increments up and to the left, -7x and -3y
pixels at a time, until the pointer is warped off the widget. I think it's
a qxl bug, but the next patch covers it up.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 79babc9..330dc13 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -346,7 +346,7 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
                                x, y, &x_root, &y_root);
     gdk_device_warp(gdk_device_manager_get_client_pointer(mgr),
                     gtk_widget_get_screen(s->drawing_area),
-                    x, y);
+                    x_root, y_root);
 }
 #else
 static void gd_mouse_set(DisplayChangeListener *dcl,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PULL 7/7] gtk: Don't warp absolute pointer
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2014-03-13 10:46 ` [Qemu-devel] [PULL 6/7] gtk: Fix mouse warping with gtk3 Gerd Hoffmann
@ 2014-03-13 10:46 ` Gerd Hoffmann
  2014-03-17  4:12   ` Dave Airlie
  2014-03-13 18:55 ` [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Peter Maydell
  7 siblings, 1 reply; 11+ messages in thread
From: Gerd Hoffmann @ 2014-03-13 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori, Cole Robinson

From: Cole Robinson <crobinso@redhat.com>

This matches the behavior of SDL, and makes the mouse usable when
using -display gtk -vga qxl

https://bugzilla.redhat.com/show_bug.cgi?id=1051724
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 330dc13..ef7cb47 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -340,6 +340,10 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
     GdkDeviceManager *mgr;
     gint x_root, y_root;
 
+    if (qemu_input_is_absolute()) {
+        return;
+    }
+
     dpy = gtk_widget_get_display(s->drawing_area);
     mgr = gdk_display_get_device_manager(dpy);
     gdk_window_get_root_coords(gtk_widget_get_window(s->drawing_area),
@@ -355,6 +359,10 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
     GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl);
     gint x_root, y_root;
 
+    if (qemu_input_is_absolute()) {
+        return;
+    }
+
     gdk_window_get_root_coords(gtk_widget_get_window(s->drawing_area),
                                x, y, &x_root, &y_root);
     gdk_display_warp_pointer(gtk_widget_get_display(s->drawing_area),
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes
  2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2014-03-13 10:46 ` [Qemu-devel] [PULL 7/7] gtk: Don't warp absolute pointer Gerd Hoffmann
@ 2014-03-13 18:55 ` Peter Maydell
  2014-03-13 19:05   ` Cole Robinson
  7 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2014-03-13 18:55 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 13 March 2014 10:46, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Looks like I've became the default victim for gtk patches, with anthony
> being busy and /me recently picking up the gtk mouse wheel patch.
>
> So here is a collection of gtk patches hitting my inbox over the last
> few days.  Not strictly bugfixes-only, but the cleanups are simple
> enouth that I think they are fine for 2.0.
>
> please pull,
>   Gerd
>
> The following changes since commit 239618707637ec87eba8c452d2b2f75dc5ca20c7:
>
>   Merge remote-tracking branch 'remotes/kvm/uq/master' into staging (2014-03-11 19:39:17 +0000)
>
> are available in the git repository at:
>
>
>   git://git.kraxel.org/qemu tags/pull-gtk-1
>
> for you to fetch changes up to 1962744467ec5624bfecb55bf5a2c321744da253:
>
>   gtk: Don't warp absolute pointer (2014-03-13 10:12:47 +0100)

Doesn't build, sorry:

/home/petmay01/linaro/qemu-for-merges/ui/gtk.c: In function ‘gd_vc_init’:
/home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: implicit
declaration of function ‘gtk_scrollable_get_vadjustment’
[-Werror=implicit-function-declaration]
/home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: nested
extern declaration of ‘gtk_scrollable_get_vadjustment’
[-Werror=nested-externs]
/home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: implicit
declaration of function ‘GTK_SCROLLABLE’
[-Werror=implicit-function-declaration]
/home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: nested
extern declaration of ‘GTK_SCROLLABLE’ [-Werror=nested-externs]
/home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:17: error:
assignment makes pointer from integer without a cast [-Werror]
cc1: all warnings being treated as errors
make: *** [ui/gtk.o] Error 1

thanks
-- PMM

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes
  2014-03-13 18:55 ` [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Peter Maydell
@ 2014-03-13 19:05   ` Cole Robinson
  0 siblings, 0 replies; 11+ messages in thread
From: Cole Robinson @ 2014-03-13 19:05 UTC (permalink / raw)
  To: Peter Maydell, Gerd Hoffmann; +Cc: QEMU Developers

On 03/13/2014 02:55 PM, Peter Maydell wrote:
> On 13 March 2014 10:46, Gerd Hoffmann <kraxel@redhat.com> wrote:
>>   Hi,
>>
>> Looks like I've became the default victim for gtk patches, with anthony
>> being busy and /me recently picking up the gtk mouse wheel patch.
>>
>> So here is a collection of gtk patches hitting my inbox over the last
>> few days.  Not strictly bugfixes-only, but the cleanups are simple
>> enouth that I think they are fine for 2.0.
>>
>> please pull,
>>   Gerd
>>
>> The following changes since commit 239618707637ec87eba8c452d2b2f75dc5ca20c7:
>>
>>   Merge remote-tracking branch 'remotes/kvm/uq/master' into staging (2014-03-11 19:39:17 +0000)
>>
>> are available in the git repository at:
>>
>>
>>   git://git.kraxel.org/qemu tags/pull-gtk-1
>>
>> for you to fetch changes up to 1962744467ec5624bfecb55bf5a2c321744da253:
>>
>>   gtk: Don't warp absolute pointer (2014-03-13 10:12:47 +0100)
> 
> Doesn't build, sorry:
> 
> /home/petmay01/linaro/qemu-for-merges/ui/gtk.c: In function ‘gd_vc_init’:
> /home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: implicit
> declaration of function ‘gtk_scrollable_get_vadjustment’
> [-Werror=implicit-function-declaration]
> /home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: nested
> extern declaration of ‘gtk_scrollable_get_vadjustment’
> [-Werror=nested-externs]
> /home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: implicit
> declaration of function ‘GTK_SCROLLABLE’
> [-Werror=implicit-function-declaration]
> /home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:5: error: nested
> extern declaration of ‘GTK_SCROLLABLE’ [-Werror=nested-externs]
> /home/petmay01/linaro/qemu-for-merges/ui/gtk.c:1206:17: error:
> assignment makes pointer from integer without a cast [-Werror]
> cc1: all warnings being treated as errors
> make: *** [ui/gtk.o] Error 1
> 

Hmm, gtkscrollable is gtk3 only, I'll test building against gtk2 and respin.
Sorry for the run around.

- Cole

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PULL 7/7] gtk: Don't warp absolute pointer
  2014-03-13 10:46 ` [Qemu-devel] [PULL 7/7] gtk: Don't warp absolute pointer Gerd Hoffmann
@ 2014-03-17  4:12   ` Dave Airlie
  0 siblings, 0 replies; 11+ messages in thread
From: Dave Airlie @ 2014-03-17  4:12 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel@nongnu.org, Anthony Liguori, Cole Robinson

On Thu, Mar 13, 2014 at 8:46 PM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> From: Cole Robinson <crobinso@redhat.com>

Wierd I wrote and submitted these months ago, and they were promptly ignored,

Glad you had to find bugs all over again an reinvent the wheel,

Dave.

>
> This matches the behavior of SDL, and makes the mouse usable when
> using -display gtk -vga qxl
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1051724
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  ui/gtk.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 330dc13..ef7cb47 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -340,6 +340,10 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
>      GdkDeviceManager *mgr;
>      gint x_root, y_root;
>
> +    if (qemu_input_is_absolute()) {
> +        return;
> +    }
> +
>      dpy = gtk_widget_get_display(s->drawing_area);
>      mgr = gdk_display_get_device_manager(dpy);
>      gdk_window_get_root_coords(gtk_widget_get_window(s->drawing_area),
> @@ -355,6 +359,10 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
>      GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl);
>      gint x_root, y_root;
>
> +    if (qemu_input_is_absolute()) {
> +        return;
> +    }
> +
>      gdk_window_get_root_coords(gtk_widget_get_window(s->drawing_area),
>                                 x, y, &x_root, &y_root);
>      gdk_display_warp_pointer(gtk_widget_get_display(s->drawing_area),
> --
> 1.8.3.1
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-03-17  4:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-13 10:46 [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Gerd Hoffmann
2014-03-13 10:46 ` [Qemu-devel] [PULL 1/7] gtk: Allow to activate grab-on-hover from the command line Gerd Hoffmann
2014-03-13 10:46 ` [Qemu-devel] [PULL 2/7] gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic Gerd Hoffmann
2014-03-13 10:46 ` [Qemu-devel] [PULL 3/7] gtk: Don't use deprecated vte_terminal_get_adjustment Gerd Hoffmann
2014-03-13 10:46 ` [Qemu-devel] [PULL 4/7] gtk: Remove use of deprecated stock items Gerd Hoffmann
2014-03-13 10:46 ` [Qemu-devel] [PULL 5/7] gtk: Use ctrl+alt+q for quit accelerator Gerd Hoffmann
2014-03-13 10:46 ` [Qemu-devel] [PULL 6/7] gtk: Fix mouse warping with gtk3 Gerd Hoffmann
2014-03-13 10:46 ` [Qemu-devel] [PULL 7/7] gtk: Don't warp absolute pointer Gerd Hoffmann
2014-03-17  4:12   ` Dave Airlie
2014-03-13 18:55 ` [Qemu-devel] [PULL 0/7] gtk: cleanups and fixes Peter Maydell
2014-03-13 19:05   ` Cole Robinson

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).