xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Owen Smith <owen.smith@citrix.com>
To: qemu-devel@nongnu.org
Cc: anthony.perard@citrix.com, xen-devel@lists.xenproject.org,
	sstabellini@kernel.org, Owen Smith <owen.smith@citrix.com>
Subject: [PATCH 2/2 v3] xenfb: Add [feature|request]-raw-pointer
Date: Wed, 26 Jul 2017 15:10:31 +0000	[thread overview]
Message-ID: <1501081831-9587-3-git-send-email-owen.smith@citrix.com> (raw)
In-Reply-To: <1501081831-9587-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]

"feature-raw-pointer" and "request-raw-pointer" added to Xen
header in commit 7868654ff7fe5e4a2eeae2b277644fa884a5031e

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 e412753..f397f9a 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -50,6 +50,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];
@@ -380,21 +381,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 {
@@ -428,6 +431,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;
 }
 
@@ -451,6 +455,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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-07-26 15:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 15:10 [PATCH 0/2 v3] xenfb: rework xen vkbd backend Owen Smith
2017-07-26 15:10 ` [PATCH 1/2 v3] xenfb: Use Input Handlers directly Owen Smith
2017-08-21 23:12   ` Stefano Stabellini
2017-08-23  9:11     ` Owen Smith
2017-09-07 14:56     ` Anthony PERARD
2017-09-20 17:15       ` Stefano Stabellini
2017-07-26 15:10 ` Owen Smith [this message]
2017-08-21 23:13   ` [PATCH 2/2 v3] xenfb: Add [feature|request]-raw-pointer Stefano Stabellini

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=1501081831-9587-3-git-send-email-owen.smith@citrix.com \
    --to=owen.smith@citrix.com \
    --cc=anthony.perard@citrix.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).