Re: [PATCH spice-gtk] vncdisplaykeymap: Add support for Xwayland keymap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 18, 2015 at 09:59:05AM -0500, Marc-André Lureau wrote:
> 
> 
> ----- Original Message -----
> > On Wed, Feb 18, 2015 at 09:47:55AM -0500, Marc-André Lureau wrote:
> > > 
> > > 
> > > ----- Original Message -----
> > > > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> > > > 
> > > > Both Wayland and Xwayland use the evdev + 8 map for keycodes,
> > > > just as regular Xorg with evdev does.
> > > > 
> > > > This code is copied from gtk-vnc.
> > > > 
> > > > Fixes https://bugs.freedesktop.org/show_bug.cgi?id=89105
> > > > ---
> > > >  gtk/vncdisplaykeymap.c | 16 ++++++++++++++++
> > > >  1 file changed, 16 insertions(+)
> > > > 
> > > > diff --git a/gtk/vncdisplaykeymap.c b/gtk/vncdisplaykeymap.c
> > > > index 340a86f..32fdac5 100644
> > > > --- a/gtk/vncdisplaykeymap.c
> > > > +++ b/gtk/vncdisplaykeymap.c
> > > > @@ -12,6 +12,7 @@
> > > >  #include <gtk/gtk.h>
> > > >  #include <gdk/gdk.h>
> > > >  #include <gdk/gdkkeysyms.h>
> > > > +#include <stdlib.h>
> > > >  #include "gtk-compat.h"
> > > >  #include "vncdisplaykeymap.h"
> > > >  
> > > > @@ -156,6 +157,17 @@ static gboolean check_for_xquartz(GdkDisplay *dpy)
> > > >  
> > > >  	return match;
> > > >  }
> > > > +
> > > > +static gboolean check_for_xwayland(GdkDisplay *dpy G_GNUC_UNUSED)
> > > > +{
> > > > +	/* There is no obvious extension name or root window property
> > > > +	 * that identifies as Xwayland. It also does not report any
> > > > +	 * XKB info. So this env var check is least-worst option left
> > > > +	 */
> > > > +	char *dpystr = getenv("WAYLAND_DISPLAY");
> > > > +
> > > > +	return dpystr != NULL;
> > > > +}
> > > >  #endif
> > > >  
> > > >  const guint16 *vnc_display_keymap_gdk2xtkbd_table(GdkWindow *window,
> > > > @@ -195,6 +207,10 @@ const guint16
> > > > *vnc_display_keymap_gdk2xtkbd_table(GdkWindow *window,
> > > >  			VNC_DEBUG("Using xquartz keycode mapping");
> > > >  			*maplen = G_N_ELEMENTS(keymap_xorgxquartz2xtkbd);
> > > >  			return keymap_xorgxquartz2xtkbd;
> > > > +		} else if (check_for_xwayland(dpy)) {
> > > > +			VNC_DEBUG("Using wayland evdec keycode mapping");
> > > > +			*maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd);
> > > > +			return keymap_xorgevdev2xtkbd;
> > > >  		} else if (keycodes && STRPREFIX(keycodes, "evdev_")) {
> > > >  			VNC_DEBUG("Using evdev keycode mapping");
> > > >  			*maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd);
> > > > --
> > > > 2.3.0
> > > 
> > > We already have wayland input support since:
> > > 
> > > commit 577263aaf4cffe260e31d19eb4b8bca1c253eff3
> > > Author: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> > > Date:   Mon May 13 01:11:07 2013 +0200
> > > 
> > >     vncdisplaykeymap: add wayland support
> > >     
> > >     The Wayland keycode are just Linux evdev, but the Gdk backend
> > >     add the +8 offset used by Xorg evdev.
> > > 
> > > 
> > > Not sure about XWayland, but I would assume this was enough,
> > > and didn't rely on a not so reliable environment variable.
> > 
> > Your change only works when the GTK application is running as a
> > native Wayland client.  This fix works when the GTK application
> > is runing as an X11 client on Xwayland.
> > 
> > The use of the env variable is certainly sucky, but I've not
> > found any other way to identify that the X server is the
> > Xwayland one :-( It doesn't report any XKB keyboard info,
> > the server vendor string is completely generic and there's no
> > wayland specific extension present.
> 
> Why didn't you consider this a XWayland bug instead? Sounds wrong
> to me that X apps under XWayland have to be modified.

Every new X server we come across needs different heuristics - that's
just a fact of life trying to figure out the keyboad mappings for X,
since there's no standardization. So I don't think its really surprising
that we need a new check for Xwayland that is different from what we
used for traditional Xorg.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]