qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Owen Smith <owen.smith@citrix.com>
To: sstabellini@kernel.org, anthony.perard@citrix.com, kraxel@redhat.com
Cc: xen-devel@lists.xenproject.org, qemu-devel@nongnu.org,
	Owen Smith <owen.smith@citrix.com>
Subject: [Qemu-devel] [PATCH 3/3 v4] xenfb: Add [feature|request]-raw-pointer
Date: Tue, 26 Sep 2017 14:43:39 +0000	[thread overview]
Message-ID: <1506437019-17946-4-git-send-email-owen.smith@citrix.com> (raw)
In-Reply-To: <1506437019-17946-1-git-send-email-owen.smith@citrix.com>

Writes "feature-raw-pointer" during init to indicate the backend
can pass raw unscaled values for absolute axes to the frontend.
Frontends set "request-raw-pointer" to indicate the backend should
not attempt to scale absolute values to console size.
"request-raw-pointer" is only valid if "request-abs-pointer" is
also set. Raw unscaled pointer values are in the range [0, 0x7fff]

Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
 hw/display/xenfb.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 33361b4..29428ae 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -52,6 +52,7 @@ struct common {
 struct XenInput {
     struct common c;
     int abs_pointer_wanted; /* Whether guest supports absolute pointer */
+    int raw_pointer_wanted; /* Whether guest supports raw (unscaled) pointer */
     QemuInputHandlerState *qkbd;
     QemuInputHandlerState *qmou;
     int mouse_axes[INPUT_AXIS__MAX];
@@ -264,21 +265,23 @@ static void xenfb_mouse_sync(DeviceState *dev)
                             in->abs_pointer_wanted);
 
     if (in->abs_pointer_wanted) {
-        QemuConsole *con = qemu_console_lookup_by_index(0);
-        DisplaySurface *surface;
-        int dw, dh;
-
-        if (!con) {
-            xen_pv_printf(&in->c.xendev, 0, "No QEMU console available");
-            return;
-        }
+        if (!in->raw_pointer_wanted) {
+            QemuConsole *con = qemu_console_lookup_by_index(0);
+            DisplaySurface *surface;
+            int dw, dh;
+
+            if (!con) {
+                xen_pv_printf(&in->c.xendev, 0, "No QEMU console available");
+                return;
+            }
 
-        surface = qemu_console_surface(con);
-        dw = surface_width(surface);
-        dh = surface_height(surface);
+            surface = qemu_console_surface(con);
+            dw = surface_width(surface);
+            dh = surface_height(surface);
 
-        dx = dx * (dw - 1) / 0x7fff;
-        dy = dy * (dh - 1) / 0x7fff;
+            dx = dx * (dw - 1) / 0x7fff;
+            dy = dy * (dh - 1) / 0x7fff;
+        }
 
         xenfb_send_position(in, dx, dy, dz);
     } else {
@@ -312,6 +315,7 @@ static QemuInputHandler xenfb_rel_mouse = {
 static int input_init(struct XenDevice *xendev)
 {
     xenstore_write_be_int(xendev, "feature-abs-pointer", 1);
+    xenstore_write_be_int(xendev, "feature-raw-pointer", 1);
     return 0;
 }
 
@@ -335,6 +339,13 @@ static void input_connected(struct XenDevice *xendev)
                              &in->abs_pointer_wanted) == -1) {
         in->abs_pointer_wanted = 0;
     }
+    if (xenstore_read_fe_int(xendev, "request-raw-pointer",
+                             &in->raw_pointer_wanted) == -1) {
+        in->raw_pointer_wanted = 0;
+    }
+    if (in->raw_pointer_wanted && !in->abs_pointer_wanted) {
+        xen_pv_printf(xendev, 0, "raw pointer set without absolute pointer.");
+    }
 
     if (in->qkbd) {
         qemu_input_handler_unregister(in->qkbd);
-- 
2.1.4

  parent reply	other threads:[~2017-09-26 14:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26 14:43 [Qemu-devel] [PATCH 0/3 v4] xenfb: Enablement for Windows PV HID frontend Owen Smith
2017-09-26 14:43 ` [Qemu-devel] [PATCH 1/3 v4] ui/input: add qemu_input_qcode_to_linux Owen Smith
2017-09-26 14:43 ` [Qemu-devel] [PATCH 2/3 v4] xenfb: Use Input Handlers directly Owen Smith
2017-10-02 17:33   ` Anthony PERARD
2017-09-26 14:43 ` Owen Smith [this message]
2017-10-02 17:01   ` [Qemu-devel] [PATCH 3/3 v4] xenfb: Add [feature|request]-raw-pointer Anthony PERARD
2017-10-10 23:52     ` Stefano Stabellini
2017-10-11 15:47       ` Anthony PERARD
2017-10-11 20:19         ` Stefano Stabellini
2017-10-12  7:58           ` [Qemu-devel] [Xen-devel] " Paul Durrant
2017-10-12  9:26             ` Gerd Hoffmann
2017-10-12  9:39               ` Paul Durrant
2017-10-12 17:27                 ` Stefano Stabellini
2017-10-19  9:00                   ` Owen Smith
2017-10-12 10:38           ` [Qemu-devel] " Anthony PERARD
2017-09-29 10:26 ` [Qemu-devel] [PATCH 0/3 v4] xenfb: Enablement for Windows PV HID frontend Gerd Hoffmann
2017-09-29 10:33   ` Daniel P. Berrange

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=1506437019-17946-4-git-send-email-owen.smith@citrix.com \
    --to=owen.smith@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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 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).