From: "Daniel P. Berrange" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, Cole Robinson <crobinso@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] ui: use evdev keymap when running under wayland
Date: Thu, 1 Dec 2016 11:28:23 +0000 [thread overview]
Message-ID: <20161201112823.GE9191@redhat.com> (raw)
In-Reply-To: <CAJSP0QXANUwM5S_oARwestjUAbQpUcLEf6V9C4GbyVuTgog85g@mail.gmail.com>
On Thu, Dec 01, 2016 at 11:26:59AM +0000, Stefan Hajnoczi wrote:
> On Thu, Dec 1, 2016 at 11:25 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> > On Thu, Dec 1, 2016 at 11:20 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> >> On Thu, Dec 1, 2016 at 9:41 AM, Daniel P. Berrange <berrange@redhat.com> wrote:
> >>> Wayland always uses evdev as its input source, so QEMU
> >>> can use the existing evdev keymap data
> >>>
> >>> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> >>> ---
> >>>
> >>> Changed in v2
> >>>
> >>> - Actually add all changed files to commit - gtk.h :-)
> >>>
> >>> include/ui/gtk.h | 4 ++++
> >>> ui/gtk.c | 7 +++++++
> >>> 2 files changed, 11 insertions(+)
> >>>
> >>> diff --git a/include/ui/gtk.h b/include/ui/gtk.h
> >>> index 42ca0fe..b3b5005 100644
> >>> --- a/include/ui/gtk.h
> >>> +++ b/include/ui/gtk.h
> >>> @@ -18,6 +18,10 @@
> >>> #include <X11/XKBlib.h>
> >>> #endif
> >>>
> >>> +#ifdef GDK_WINDOWING_WAYLAND
> >>> +#include <gdk/gdkwayland.h>
> >>> +#endif
> >>> +
> >>> #if defined(CONFIG_OPENGL)
> >>> #include "ui/egl-helpers.h"
> >>> #include "ui/egl-context.h"
> >>> diff --git a/ui/gtk.c b/ui/gtk.c
> >>> index e816428..81dba57 100644
> >>> --- a/ui/gtk.c
> >>> +++ b/ui/gtk.c
> >>> @@ -90,6 +90,9 @@
> >>> #ifndef GDK_IS_X11_DISPLAY
> >>> #define GDK_IS_X11_DISPLAY(dpy) (dpy == dpy)
> >>> #endif
> >>> +#ifndef GDK_IS_WAYLAND_DISPLAY
> >>> +#define GDK_IS_WAYLAND_DISPLAY(dpy) (dpy == dpy)
> >>> +#endif
> >>> #ifndef GDK_IS_WIN32_DISPLAY
> >>> #define GDK_IS_WIN32_DISPLAY(dpy) (dpy == dpy)
> >>> #endif
> >>> @@ -1054,6 +1057,10 @@ static int gd_map_keycode(GtkDisplayState *s, GdkDisplay *dpy, int gdk_keycode)
> >>> qemu_keycode = translate_xfree86_keycode(gdk_keycode - 97);
> >>> }
> >>> #endif
> >>> +#ifdef GDK_WINDOWING_WAYLAND
> >>> + } else if (GDK_IS_WAYLAND_DISPLAY(dpy) && gdk_keycode < 158) {
> >>> + qemu_keycode = translate_evdev_keycode(gdk_keycode - 97);
> >>> +#endif
> >>> } else if (gdk_keycode == 208) { /* Hiragana_Katakana */
> >>> qemu_keycode = 0x70;
> >>> } else if (gdk_keycode == 211) { /* backslash */
> >>> --
> >>> 2.9.3
> >>>
> >>
> >> Great, you've fixed Wayland!
> >>
> >> This is GTK3-only so I used ./configure --with-gtkabi=3.0 on my system
> >> that has both GTK2 and GTK3 headers installed. ./configure will
> >> select GTK2 by default and I'm not sure if that is a good idea
> >> nowadays.
> >>
> >> Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
>
> Sorry, Cole. I pressed Send too quickly :). I meant to add:
>
> This patch is especially relevant for Fedora 25 where Wayland is the
> default. Without the GTK UI will not handle cursor and other keys
> correctly.
>
> Dan: Come to think of it, ui/sdl.c also has X11 keycode mangling.
> Perhaps that is broken too... :(
SDL doesn't have native Wayland support, so it will be running
via Xwayland, which will use regulard Xorg evdev mapping, so that
should be fine still.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
next prev parent reply other threads:[~2016-12-01 11:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 9:41 [Qemu-devel] [PATCH v2] ui: use evdev keymap when running under wayland Daniel P. Berrange
2016-12-01 11:20 ` Stefan Hajnoczi
2016-12-01 11:25 ` Stefan Hajnoczi
2016-12-01 11:26 ` Stefan Hajnoczi
2016-12-01 11:28 ` Daniel P. Berrange [this message]
2016-12-04 21:28 ` Cole Robinson
2016-12-01 11:29 ` Daniel P. Berrange
2017-01-03 12:55 ` 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=20161201112823.GE9191@redhat.com \
--to=berrange@redhat.com \
--cc=crobinso@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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).