From: Owen Smith <owen.smith@citrix.com>
To: qemu-devel@nongnu.org
Cc: anthony.perard@citrix.com, sstabellini@kernel.org,
kraxel@redhat.com, Owen Smith <owen.smith@citrix.com>,
xen-devel@lists.xen.org
Subject: [PATCH 2/2 v2] xenfb: Allow vkbd to connect without a DisplayState
Date: Mon, 3 Jul 2017 13:17:41 +0000 [thread overview]
Message-ID: <1499087861-2132-3-git-send-email-owen.smith@citrix.com> (raw)
In-Reply-To: <1499087861-2132-1-git-send-email-owen.smith@citrix.com>
If the vkbd device model is registered and the vfb device model
is not registered, the backend will not transition to connected.
If there is no DisplayState, then the absolute coordinates cannot
be scaled, and will remain in the range [0, 0x7fff].
Backend writes "feature-raw-pointer" to indicate that the backend
supports reporting absolute position without rescaling.
The frontend uses "request-raw-pointer" to request raw unscaled
pointer values. If there is no DisplayState, the absolute values
are always raw unscaled values.
Signed-off-by: Owen Smith <owen.smith@citrix.com>
---
hw/display/xenfb.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 88815df..d40af6e 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -53,6 +53,7 @@ struct common {
struct XenInput {
struct common c;
int abs_pointer_wanted; /* Whether guest supports absolute pointer */
+ int raw_pointer_wanted; /* Whether guest supports unscaled pointer */
int button_state; /* Last seen pointer button state */
int extended;
/* kbd */
@@ -329,18 +330,22 @@ static void xenfb_mouse_event(void *opaque,
int dx, int dy, int dz, int button_state)
{
struct XenInput *xenfb = opaque;
- DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
- int dw = surface_width(surface);
- int dh = surface_height(surface);
- int i;
+ int i, x, y;
+ if (xenfb->c.con && xenfb->raw_pointer_wanted != 1) {
+ DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
+ int dw = surface_width(surface);
+ int dh = surface_height(surface);
+ x = dx * (dw - 1) / 0x7fff;
+ y = dy * (dh - 1) / 0x7fff;
+ } else {
+ x = dx;
+ y = dy;
+ }
trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state,
xenfb->abs_pointer_wanted);
if (xenfb->abs_pointer_wanted)
- xenfb_send_position(xenfb,
- dx * (dw - 1) / 0x7fff,
- dy * (dh - 1) / 0x7fff,
- dz);
+ xenfb_send_position(xenfb, x, y, dz);
else
xenfb_send_motion(xenfb, dx, dy, dz);
@@ -423,6 +428,7 @@ static void xenfb_legacy_mouse_sync(DeviceState *dev)
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;
}
@@ -432,8 +438,14 @@ static int input_initialise(struct XenDevice *xendev)
int rc;
if (!in->c.con) {
- xen_pv_printf(xendev, 1, "ds not set (yet)\n");
- return -1;
+ char *vfb = xenstore_read_str(NULL, "device/vfb");
+ if (vfb == NULL) {
+ /* there is no vfb, run vkbd on its own */
+ } else {
+ free(vfb);
+ xen_pv_printf(xendev, 1, "ds not set (yet)\n");
+ return -1;
+ }
}
rc = common_bind(&in->c);
@@ -451,6 +463,10 @@ 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->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
next prev parent reply other threads:[~2017-07-03 13:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 13:17 [PATCH 0/2 v2] xenfb: Fix protocol for HVM guests Owen Smith
2017-07-03 13:17 ` [PATCH 1/2 v2] xenfb: Use qemu_input_handler_* calls directly Owen Smith
2017-07-05 23:42 ` Stefano Stabellini
2017-07-03 13:17 ` Owen Smith [this message]
2017-07-04 9:30 ` [PATCH 2/2 v2] xenfb: Allow vkbd to connect without a DisplayState Oleksandr Grytsov
2017-07-05 23:54 ` 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=1499087861-2132-3-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.xen.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).