From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpP8B-0004rK-IC for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:35 -0500 Received: from [199.232.76.173] (port=58953 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpP8A-0004qj-NS for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:34 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NpP89-0001Yi-Mk for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:34 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:50826) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NpP89-0001YU-9b for qemu-devel@nongnu.org; Wed, 10 Mar 2010 11:51:33 -0500 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e33.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o2AGlxTh013204 for ; Wed, 10 Mar 2010 09:47:59 -0700 Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2AGpEIH061542 for ; Wed, 10 Mar 2010 09:51:17 -0700 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2AGrdt0004918 for ; Wed, 10 Mar 2010 09:53:39 -0700 From: Anthony Liguori Date: Wed, 10 Mar 2010 10:51:08 -0600 Message-Id: <1268239869-16058-6-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> References: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 6/7] input: make vnc use mouse mode notifiers List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Gerd Hoffman , Luiz Capitulino When we switch to absolute mode, we send out a notification (if the client supports it). Today, we only send this notification when the client sends us a mouse event and we're in the wrong mode. Signed-off-by: Anthony Liguori --- vnc.c | 13 ++++++++----- vnc.h | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/vnc.c b/vnc.c index 7ce73dc..f4d7f12 100644 --- a/vnc.c +++ b/vnc.c @@ -1110,6 +1110,7 @@ static void vnc_disconnect_finish(VncState *vs) dcl->idle = 1; } + qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier); vnc_remove_timer(vs->vd); qemu_remove_led_event_handler(vs->led); qemu_free(vs); @@ -1427,8 +1428,11 @@ static void client_cut_text(VncState *vs, size_t len, uint8_t *text) { } -static void check_pointer_type_change(VncState *vs, int absolute) +static void check_pointer_type_change(QEMUNotifier *notifier) { + VncState *vs = container_of(notifier, VncState, mouse_mode_notifier); + int absolute = kbd_mouse_is_absolute(); + if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE) && vs->absolute != absolute) { vnc_write_u8(vs, 0); vnc_write_u8(vs, 0); @@ -1474,8 +1478,6 @@ static void pointer_event(VncState *vs, int button_mask, int x, int y) vs->last_x = x; vs->last_y = y; } - - check_pointer_type_change(vs, kbd_mouse_is_absolute()); } static void reset_keys(VncState *vs) @@ -1814,8 +1816,6 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) break; } } - - check_pointer_type_change(vs, kbd_mouse_is_absolute()); } static void set_pixel_conversion(VncState *vs) @@ -2431,6 +2431,9 @@ static void vnc_connect(VncDisplay *vd, int csock) reset_keys(vs); 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); + vnc_init_timer(vd); /* vs might be free()ed here */ diff --git a/vnc.h b/vnc.h index 0fc89bd..e1d764a 100644 --- a/vnc.h +++ b/vnc.h @@ -167,6 +167,8 @@ struct VncState Buffer zlib_tmp; z_stream zlib_stream[4]; + QEMUNotifier mouse_mode_notifier; + QTAILQ_ENTRY(VncState) next; }; -- 1.6.5.2