All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/10] ui patch queue
@ 2017-01-31 13:41 Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 01/10] qapi: add support for mice with extra/side buttons Gerd Hoffmann
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Here comes the ui patch queue.  Nothing outstanding here.  Bugfixes and
small improvements all user interfaces.

please pull,
  Gerd

The following changes since commit a0def594286d9110a6035e02eef558cf3cf5d847:

  Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-01-30 10:23:20 +0000)

are available in the git repository at:


  git://git.kraxel.org/qemu tags/pull-ui-20170131-1

for you to fetch changes up to 9f533e705dd140ea725747e8fd9bbab7f1e84a8b:

  gtk: Hardcode LC_CTYPE as C.utf-8 (2017-01-31 14:02:28 +0100)

----------------------------------------------------------------
ui: bugfixes and small improvements all over the place.

----------------------------------------------------------------
Fabian Lesniak (3):
      qapi: add support for mice with extra/side buttons
      ps2: add support for mice with extra/side buttons
      ui: add support for mice with extra/side buttons

Gerd Hoffmann (1):
      vnc: fix overflow in vnc_update_stats

Kevin Wolf (1):
      gtk: Hardcode LC_CTYPE as C.utf-8

Marc-André Lureau (1):
      spice: wakeup QXL worker to pick up mouse changes

OGAWA Hirofumi (1):
      ui/gtk: Fix mouse wheel on 3.4.0 or later

Pierre Ossman (1):
      vnc: track LED state separately

Rami Rosen (1):
      ui: fix format specfier in vnc to avoid break in build.

Ziyue Yang (1):
      ui/gtk.c: add ctrl-alt-= support for zoom in acceleration

 hw/input/ps2.c         |  8 +++---
 include/hw/input/ps2.h |  6 +++++
 qapi-schema.json       |  7 +++++-
 ui/gtk.c               | 32 +++++++++++++++++++++++-
 ui/input-linux.c       |  6 +++++
 ui/spice-display.c     |  2 ++
 ui/vnc.c               | 67 ++++++++++++++++----------------------------------
 ui/vnc.h               |  3 ++-
 8 files changed, 79 insertions(+), 52 deletions(-)

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

* [Qemu-devel] [PULL 01/10] qapi: add support for mice with extra/side buttons
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 02/10] ps2: " Gerd Hoffmann
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fabian Lesniak, Gerd Hoffmann, Eric Blake, Markus Armbruster

From: Fabian Lesniak <fabian@lesniak-it.de>

Adds "side" and "extra" values to enum InputButton. The naming was borrowed
from evdev since it is more descriptive than "button4" and "button5".

Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de>
Message-id: 20161206190007.7539-2-fabian@lesniak-it.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qapi-schema.json | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index 82fabc6..cbdffdd 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -5390,10 +5390,15 @@
 #
 # Button of a pointer input device (mouse, tablet).
 #
+# @side: front side button of a 5-button mouse (since 2.9)
+#
+# @extra: rear side button of a 5-button mouse (since 2.9)
+#
 # Since: 2.0
 ##
 { 'enum'  : 'InputButton',
-  'data'  : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down' ] }
+  'data'  : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down', 'side',
+  'extra' ] }
 
 ##
 # @InputAxis:
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 02/10] ps2: add support for mice with extra/side buttons
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 01/10] qapi: add support for mice with extra/side buttons Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 03/10] ui: " Gerd Hoffmann
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fabian Lesniak, Gerd Hoffmann

From: Fabian Lesniak <fabian@lesniak-it.de>

This enables the ps2 controller to process mouse events for buttons 4 and 5.
Additionally, distinct definitions for the ps2 mouse button state are
introduced. The legacy definitions from console.h are not used anymore.

Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de>
Message-id: 20161206190007.7539-3-fabian@lesniak-it.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/input/ps2.c         | 8 +++++---
 include/hw/input/ps2.h | 6 ++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 8485a4e..1d3a440 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -881,9 +881,11 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src,
                             InputEvent *evt)
 {
     static const int bmap[INPUT_BUTTON__MAX] = {
-        [INPUT_BUTTON_LEFT]   = MOUSE_EVENT_LBUTTON,
-        [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON,
-        [INPUT_BUTTON_RIGHT]  = MOUSE_EVENT_RBUTTON,
+        [INPUT_BUTTON_LEFT]   = PS2_MOUSE_BUTTON_LEFT,
+        [INPUT_BUTTON_MIDDLE] = PS2_MOUSE_BUTTON_MIDDLE,
+        [INPUT_BUTTON_RIGHT]  = PS2_MOUSE_BUTTON_RIGHT,
+        [INPUT_BUTTON_SIDE]   = PS2_MOUSE_BUTTON_SIDE,
+        [INPUT_BUTTON_EXTRA]  = PS2_MOUSE_BUTTON_EXTRA,
     };
     PS2MouseState *s = (PS2MouseState *)dev;
     InputMoveEvent *move;
diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h
index b9ceee4..0fec91c 100644
--- a/include/hw/input/ps2.h
+++ b/include/hw/input/ps2.h
@@ -25,6 +25,12 @@
 #ifndef HW_PS2_H
 #define HW_PS2_H
 
+#define PS2_MOUSE_BUTTON_LEFT   0x01
+#define PS2_MOUSE_BUTTON_MIDDLE 0x02
+#define PS2_MOUSE_BUTTON_RIGHT  0x04
+#define PS2_MOUSE_BUTTON_SIDE   0x08
+#define PS2_MOUSE_BUTTON_EXTRA  0x10
+
 /* ps2.c */
 void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg);
 void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg);
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 03/10] ui: add support for mice with extra/side buttons
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 01/10] qapi: add support for mice with extra/side buttons Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 02/10] ps2: " Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 04/10] vnc: track LED state separately Gerd Hoffmann
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fabian Lesniak, Gerd Hoffmann

From: Fabian Lesniak <fabian@lesniak-it.de>

Adds input event generation for BTN_SIDE and BTN_EXTRA events to gtk and
input-linux methods.

Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de>
Message-id: 20161206190007.7539-4-fabian@lesniak-it.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c         | 4 ++++
 ui/input-linux.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index bdd831c..3f67a34 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1007,6 +1007,10 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button,
         btn = INPUT_BUTTON_MIDDLE;
     } else if (button->button == 3) {
         btn = INPUT_BUTTON_RIGHT;
+    } else if (button->button == 8) {
+        btn = INPUT_BUTTON_SIDE;
+    } else if (button->button == 9) {
+        btn = INPUT_BUTTON_EXTRA;
     } else {
         return TRUE;
     }
diff --git a/ui/input-linux.c b/ui/input-linux.c
index f345317..ac31f47 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -291,6 +291,12 @@ static void input_linux_handle_mouse(InputLinux *il, struct input_event *event)
             qemu_input_queue_btn(NULL, INPUT_BUTTON_WHEEL_DOWN,
                                  event->value);
             break;
+        case BTN_SIDE:
+            qemu_input_queue_btn(NULL, INPUT_BUTTON_SIDE, event->value);
+            break;
+        case BTN_EXTRA:
+            qemu_input_queue_btn(NULL, INPUT_BUTTON_EXTRA, event->value);
+            break;
         };
         break;
     case EV_REL:
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 04/10] vnc: track LED state separately
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 03/10] ui: " Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 05/10] ui/gtk: Fix mouse wheel on 3.4.0 or later Gerd Hoffmann
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Pierre Ossman, Gerd Hoffmann

From: Pierre Ossman <ossman@cendio.se>

Piggy-backing on the modifier state array made it difficult to send
out updates at the proper times.

Signed-off-by: Pierre Ossman <ossman@cendio.se>
Message-id: 5aa28297d665cee24ddab26bbf4633e4252f97b6.1483978442.git.ossman@cendio.se
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c | 59 ++++++++++++++++-------------------------------------------
 ui/vnc.h |  3 ++-
 2 files changed, 18 insertions(+), 44 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 29aa9c4..cf9b597 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1231,8 +1231,6 @@ void vnc_disconnect_finish(VncState *vs)
         vnc_update_server_surface(vs->vd);
     }
 
-    if (vs->vd->lock_key_sync)
-        qemu_remove_led_event_handler(vs->led);
     vnc_unlock_output(vs);
 
     qemu_mutex_destroy(&vs->output_mutex);
@@ -1665,69 +1663,39 @@ static void press_key(VncState *vs, int keysym)
     qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
 }
 
-static int current_led_state(VncState *vs)
-{
-    int ledstate = 0;
-
-    if (vs->modifiers_state[0x46]) {
-        ledstate |= QEMU_SCROLL_LOCK_LED;
-    }
-    if (vs->modifiers_state[0x45]) {
-        ledstate |= QEMU_NUM_LOCK_LED;
-    }
-    if (vs->modifiers_state[0x3a]) {
-        ledstate |= QEMU_CAPS_LOCK_LED;
-    }
-
-    return ledstate;
-}
-
 static void vnc_led_state_change(VncState *vs)
 {
-    int ledstate = 0;
-
     if (!vnc_has_feature(vs, VNC_FEATURE_LED_STATE)) {
         return;
     }
 
-    ledstate = current_led_state(vs);
     vnc_lock_output(vs);
     vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
     vnc_write_u8(vs, 0);
     vnc_write_u16(vs, 1);
     vnc_framebuffer_update(vs, 0, 0, 1, 1, VNC_ENCODING_LED_STATE);
-    vnc_write_u8(vs, ledstate);
+    vnc_write_u8(vs, vs->vd->ledstate);
     vnc_unlock_output(vs);
     vnc_flush(vs);
 }
 
 static void kbd_leds(void *opaque, int ledstate)
 {
-    VncState *vs = opaque;
-    int caps, num, scr;
-    bool has_changed = (ledstate != current_led_state(vs));
+    VncDisplay *vd = opaque;
+    VncState *client;
 
     trace_vnc_key_guest_leds((ledstate & QEMU_CAPS_LOCK_LED),
                              (ledstate & QEMU_NUM_LOCK_LED),
                              (ledstate & QEMU_SCROLL_LOCK_LED));
 
-    caps = ledstate & QEMU_CAPS_LOCK_LED ? 1 : 0;
-    num  = ledstate & QEMU_NUM_LOCK_LED  ? 1 : 0;
-    scr  = ledstate & QEMU_SCROLL_LOCK_LED ? 1 : 0;
-
-    if (vs->modifiers_state[0x3a] != caps) {
-        vs->modifiers_state[0x3a] = caps;
-    }
-    if (vs->modifiers_state[0x45] != num) {
-        vs->modifiers_state[0x45] = num;
-    }
-    if (vs->modifiers_state[0x46] != scr) {
-        vs->modifiers_state[0x46] = scr;
+    if (ledstate == vd->ledstate) {
+        return;
     }
 
-    /* Sending the current led state message to the client */
-    if (has_changed) {
-        vnc_led_state_change(vs);
+    vd->ledstate = ledstate;
+
+    QTAILQ_FOREACH(client, &vd->clients, next) {
+        vnc_led_state_change(client);
     }
 }
 
@@ -3087,8 +3055,6 @@ void vnc_start_protocol(VncState *vs)
     vnc_write(vs, "RFB 003.008\n", 12);
     vnc_flush(vs);
     vnc_read_when(vs, protocol_version, 12);
-    if (vs->vd->lock_key_sync)
-        vs->led = qemu_add_led_event_handler(kbd_leds, vs);
 
     vs->mouse_mode_notifier.notify = check_pointer_type_change;
     qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
@@ -3195,6 +3161,9 @@ static void vnc_display_close(VncDisplay *vd)
     }
     g_free(vd->tlsaclname);
     vd->tlsaclname = NULL;
+    if (vd->lock_key_sync) {
+        qemu_remove_led_event_handler(vd->led);
+    }
 }
 
 int vnc_display_password(const char *id, const char *password)
@@ -3762,6 +3731,10 @@ void vnc_display_open(const char *id, Error **errp)
     }
 #endif
     vd->lock_key_sync = lock_key_sync;
+    if (lock_key_sync) {
+        vd->led = qemu_add_led_event_handler(kbd_leds, vd);
+    }
+    vd->ledstate = 0;
     vd->key_delay_ms = key_delay_ms;
 
     device_id = qemu_opt_get(opts, "display");
diff --git a/ui/vnc.h b/ui/vnc.h
index d20b154..d8c9de5 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -154,6 +154,8 @@ struct VncDisplay
     DisplayChangeListener dcl;
     kbd_layout_t *kbd_layout;
     int lock_key_sync;
+    QEMUPutLEDEntry *led;
+    int ledstate;
     int key_delay_ms;
     QemuMutex mutex;
 
@@ -304,7 +306,6 @@ struct VncState
     size_t read_handler_expect;
     /* input */
     uint8_t modifiers_state[256];
-    QEMUPutLEDEntry *led;
 
     bool abort;
     QemuMutex output_mutex;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 05/10] ui/gtk: Fix mouse wheel on 3.4.0 or later
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 04/10] vnc: track LED state separately Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 06/10] ui: fix format specfier in vnc to avoid break in build Gerd Hoffmann
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: OGAWA Hirofumi, Gerd Hoffmann

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

On 3.4.0 or later, send GDK_SCROLL_SMOOTH event, instead of
GDK_SCROLL_UP/DOWN.

This fixes it by converting any smooth scroll to up/down.
(I.e. without smooth support)

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 3f67a34..2f81863 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1031,6 +1031,19 @@ static gboolean gd_scroll_event(GtkWidget *widget, GdkEventScroll *scroll,
         btn = INPUT_BUTTON_WHEEL_UP;
     } else if (scroll->direction == GDK_SCROLL_DOWN) {
         btn = INPUT_BUTTON_WHEEL_DOWN;
+#if GTK_CHECK_VERSION(3, 4, 0)
+    } else if (scroll->direction == GDK_SCROLL_SMOOTH) {
+        gdouble delta_x, delta_y;
+        if (!gdk_event_get_scroll_deltas((GdkEvent *)scroll,
+                                         &delta_x, &delta_y)) {
+            return TRUE;
+        }
+        if (delta_y > 0) {
+            btn = INPUT_BUTTON_WHEEL_DOWN;
+        } else {
+            btn = INPUT_BUTTON_WHEEL_UP;
+        }
+#endif
     } else {
         return TRUE;
     }
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 06/10] ui: fix format specfier in vnc to avoid break in build.
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 05/10] ui/gtk: Fix mouse wheel on 3.4.0 or later Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 07/10] ui/gtk.c: add ctrl-alt-= support for zoom in acceleration Gerd Hoffmann
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Rami Rosen, Gerd Hoffmann

From: Rami Rosen <rami.rosen@intel.com>

When building qemu after setting _VNC_DEBUG to 1 (see ui/vnc.h),
we get the following error and the build breaks:
...
ui/vnc.c: In function ‘vnc_client_io_error’:
ui/vnc.c:1262:13: error: format ‘%d’ expects argument of type ‘int’, but
             VNC_DEBUG("Closing down client sock: ret %d (%s)\n",
             ^
cc1: all warnings being treated as errors
make: *** [ui/vnc.o] Error 1
...

This patch solves this issue by fixing the print format specifier
in vnc_client_io_error() to be %zd, which corresponds to the type
of the "ret" variable.

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
Message-id: 1484039965-25907-1-git-send-email-rami.rosen@intel.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index cf9b597..6854fdb 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1257,7 +1257,7 @@ ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp)
         if (ret == 0) {
             VNC_DEBUG("Closing down client sock: EOF\n");
         } else if (ret != QIO_CHANNEL_ERR_BLOCK) {
-            VNC_DEBUG("Closing down client sock: ret %d (%s)\n",
+            VNC_DEBUG("Closing down client sock: ret %zd (%s)\n",
                       ret, errp ? error_get_pretty(*errp) : "Unknown");
         }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 07/10] ui/gtk.c: add ctrl-alt-= support for zoom in acceleration
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 06/10] ui: fix format specfier in vnc to avoid break in build Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 08/10] spice: wakeup QXL worker to pick up mouse changes Gerd Hoffmann
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ziyue Yang, Ziyue Yang, Gerd Hoffmann

From: Ziyue Yang <yzylivezh@hotmail.com>

Solving wishlist item at
https://bugs.launchpad.net/qemu/+bug/1656710
by accepting Ctrl-Alt-= as an additional zoom-in acceleration.

Using gtk_accel_group_connect to support multiple accelerations
triggering a single menu item since that gtk_accel_map_add_entry
seems to support only one acceleration. A wrapper function
gd_accel_zoom_in is added to support gtk_accel_group_connect's
callback activities.

Signed-off-by: Ziyue Yang <skiver.cloud.yzy@gmail.com>
Message-id: 1485826335-15686-1-git-send-email-skiver.cloud.yzy@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 2f81863..b734c0b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -105,6 +105,7 @@
 #define GDK_KEY_g GDK_g
 #define GDK_KEY_q GDK_q
 #define GDK_KEY_plus GDK_plus
+#define GDK_KEY_equal GDK_equal
 #define GDK_KEY_minus GDK_minus
 #define GDK_KEY_Pause GDK_Pause
 #define GDK_KEY_Delete GDK_Delete
@@ -1342,6 +1343,12 @@ static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque)
     gd_update_windowsize(vc);
 }
 
+static void gd_accel_zoom_in(void *opaque)
+{
+    GtkDisplayState *s = opaque;
+    gtk_menu_item_activate(GTK_MENU_ITEM(s->zoom_in_item));
+}
+
 static void gd_menu_zoom_out(GtkMenuItem *item, void *opaque)
 {
     GtkDisplayState *s = opaque;
@@ -2109,6 +2116,8 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s)
                                  "<QEMU>/View/Zoom In");
     gtk_accel_map_add_entry("<QEMU>/View/Zoom In", GDK_KEY_plus,
                             HOTKEY_MODIFIERS);
+    gtk_accel_group_connect(s->accel_group, GDK_KEY_equal, HOTKEY_MODIFIERS, 0,
+            g_cclosure_new_swap(G_CALLBACK(gd_accel_zoom_in), s, NULL));
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->zoom_in_item);
 
     s->zoom_out_item = gtk_menu_item_new_with_mnemonic(_("Zoom _Out"));
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 08/10] spice: wakeup QXL worker to pick up mouse changes
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 07/10] ui/gtk.c: add ctrl-alt-= support for zoom in acceleration Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 09/10] vnc: fix overflow in vnc_update_stats Gerd Hoffmann
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Gerd Hoffmann

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Without it, server-mode mouse is "slow" to update position: QXL will
wait until new display commands come. This is very visible with
virtio-gpu.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20170130104540.14660-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ui/spice-display.c b/ui/spice-display.c
index 5e6f78a..64e472e 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -769,6 +769,7 @@ static void display_mouse_set(DisplayChangeListener *dcl,
     g_free(ssd->ptr_move);
     ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL, on);
     qemu_mutex_unlock(&ssd->lock);
+    qemu_spice_wakeup(ssd);
 }
 
 static void display_mouse_define(DisplayChangeListener *dcl,
@@ -787,6 +788,7 @@ static void display_mouse_define(DisplayChangeListener *dcl,
     g_free(ssd->ptr_define);
     ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, 0);
     qemu_mutex_unlock(&ssd->lock);
+    qemu_spice_wakeup(ssd);
 }
 
 static const DisplayChangeListenerOps display_listener_ops = {
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 09/10] vnc: fix overflow in vnc_update_stats
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (7 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 08/10] spice: wakeup QXL worker to pick up mouse changes Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 13:41 ` [Qemu-devel] [PULL 10/10] gtk: Hardcode LC_CTYPE as C.utf-8 Gerd Hoffmann
  2017-01-31 14:00 ` [Qemu-devel] [PULL 00/10] ui patch queue Eric Blake
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Marc-André Lureau

Commit "bea60dd ui/vnc: fix potential memory corruption issues" is
incomplete.  vnc_update_stats must calculate width and height the same
way vnc_refresh_server_surface does it, to make sure we don't use width
and height values larger than the qemu vnc server can handle.

Commit "e22492d ui/vnc: disable adaptive update calculations if not
needed" masks the issue in the default configuration.  It triggers only
in case the "lossy" option is set to "on" (default is "off").

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1485248428-575-1-git-send-email-kraxel@redhat.com
---
 ui/vnc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 6854fdb..cdeb79c 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2724,8 +2724,10 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)
 
 static int vnc_update_stats(VncDisplay *vd,  struct timeval * tv)
 {
-    int width = pixman_image_get_width(vd->guest.fb);
-    int height = pixman_image_get_height(vd->guest.fb);
+    int width = MIN(pixman_image_get_width(vd->guest.fb),
+                    pixman_image_get_width(vd->server));
+    int height = MIN(pixman_image_get_height(vd->guest.fb),
+                     pixman_image_get_height(vd->server));
     int x, y;
     struct timeval res;
     int has_dirty = 0;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 10/10] gtk: Hardcode LC_CTYPE as C.utf-8
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (8 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 09/10] vnc: fix overflow in vnc_update_stats Gerd Hoffmann
@ 2017-01-31 13:41 ` Gerd Hoffmann
  2017-01-31 14:00 ` [Qemu-devel] [PULL 00/10] ui patch queue Eric Blake
  10 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2017-01-31 13:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Gerd Hoffmann

From: Kevin Wolf <kwolf@redhat.com>

Commit 2cb5d2a4 removed setlocale() for everything except LC_MESSAGES in
order to avoid unwanted side effects such as using the wrong decimal
separator in generated JSON objects. However, the problem that unsetting
LC_CTYPE caused is that non-ASCII characters are considered
non-printable now and therefore the GTK menus display question marks for
accented letters, Chinese characters etc.

A first attempt to fix this [1] was rejected because even just setting
LC_CTYPE to the user's locale (and thereby modifying the semantics of
the ctype.h functions) could have unwanted effects that we're not aware
of yet.

Recently, however, glibc introduced a new locale "C.utf-8" that just
uses UTF-8 as its charset, but otherwise leaves the semantics alone.
Just setting the right character set is enough for our use case, so we
can just hardcode this one without having to be afraid of nasty side
effects.

Older systems that don't have the new locale will continue displaying
question marks, but this should fix the problem for most users.

[1] https://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03591.html
    ('Re: gtk: use setlocale() for LC_MESSAGES only')

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20170131100945.8189-1-kwolf@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index b734c0b..3c415d2 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2258,8 +2258,12 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
 
     s->free_scale = FALSE;
 
-    /* LC_MESSAGES only. See early_gtk_display_init() for details */
+    /* Mostly LC_MESSAGES only. See early_gtk_display_init() for details. For
+     * LC_CTYPE, we need to make sure that non-ASCII characters are considered
+     * printable, but without changing any of the character classes to make
+     * sure that we don't accidentally break implicit assumptions.  */
     setlocale(LC_MESSAGES, "");
+    setlocale(LC_CTYPE, "C.utf-8");
     bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
     textdomain("qemu");
 
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL 00/10] ui patch queue
  2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
                   ` (9 preceding siblings ...)
  2017-01-31 13:41 ` [Qemu-devel] [PULL 10/10] gtk: Hardcode LC_CTYPE as C.utf-8 Gerd Hoffmann
@ 2017-01-31 14:00 ` Eric Blake
  10 siblings, 0 replies; 12+ messages in thread
From: Eric Blake @ 2017-01-31 14:00 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

On 01/31/2017 07:41 AM, Gerd Hoffmann wrote:
>   Hi,
> 
> Here comes the ui patch queue.  Nothing outstanding here.  Bugfixes and
> small improvements all user interfaces.
> 
> please pull,
>   Gerd

You probably want a v2;

> 
> Kevin Wolf (1):
>       gtk: Hardcode LC_CTYPE as C.utf-8
> 

Reviewers pointed out that this should be C.UTF-8.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

end of thread, other threads:[~2017-01-31 14:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31 13:41 [Qemu-devel] [PULL 00/10] ui patch queue Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 01/10] qapi: add support for mice with extra/side buttons Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 02/10] ps2: " Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 03/10] ui: " Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 04/10] vnc: track LED state separately Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 05/10] ui/gtk: Fix mouse wheel on 3.4.0 or later Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 06/10] ui: fix format specfier in vnc to avoid break in build Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 07/10] ui/gtk.c: add ctrl-alt-= support for zoom in acceleration Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 08/10] spice: wakeup QXL worker to pick up mouse changes Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 09/10] vnc: fix overflow in vnc_update_stats Gerd Hoffmann
2017-01-31 13:41 ` [Qemu-devel] [PULL 10/10] gtk: Hardcode LC_CTYPE as C.utf-8 Gerd Hoffmann
2017-01-31 14:00 ` [Qemu-devel] [PULL 00/10] ui patch queue Eric Blake

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.