All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: Dustin Kirkland <kirkland@canonical.com>
Subject: Re: [Qemu-devel] [PATCH] evdev_keycode_map
Date: Wed, 10 Dec 2008 11:28:45 +0000	[thread overview]
Message-ID: <20081210112845.GC22446@redhat.com> (raw)
In-Reply-To: <20081209224235.GA12529@kos.to>

On Wed, Dec 10, 2008 at 12:42:35AM +0200, Riku Voipio wrote:
> On Wed, Sep 24, 2008 at 06:10:27PM -0500, Dustin Kirkland wrote:
> > I'm attaching a patch that we have applied to the qemu implementation
> > inside of the kvm package in Ubuntu.
> 
> Anyone know why this patch is still lingering?
> 
> > --- kvm-72+dfsg/qemu/configure	2008-07-27 08:20:10.000000000 -0500
> > +++ kvm-72+dfsg/qemu/configure	2008-09-24 16:04:28.036791147 -0500
> > @@ -1198,9 +1198,9 @@ if test "$sdl1" = "yes" ; then
> >    echo "#define CONFIG_SDL 1" >> $config_h
> >    echo "CONFIG_SDL=yes" >> $config_mak
> >    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
> > -    echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
> > +    echo "SDL_LIBS=-lX11 $sdl_static_libs" >> $config_mak
> >    else
> > -    echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
> > +    echo "SDL_LIBS=-lX11 `$sdl_config --libs`" >> $config_mak
> >    fi
> 
> These changes make the SDL code dependant on X ? This
> would make compiling windows less trivial..

It ought to be possible to just #ifdef out the bit of the code which 
checks for evdev on non-Linux, and just default to the existing 
mapping QEMU had.

> > +uint8_t _translate_keycode(int keycode)
> >  {
> > -	return x_keycode_to_pc_keycode[key];
> > +    if (keycode < 9)
> > +        keycode = 0;
> > +    else if (keycode < 97)
> > +        keycode -= 8; /* just an offset */
> > +    else if (keycode < 158) {
> > +        if (check_for_evdev())
> > +            keycode = evdev_keycode_to_pc_keycode[keycode - 97];
> > +        else
> > +            keycode = x_keycode_to_pc_keycode[keycode - 97];
> 
> This is suboptimal, for every keycode translation we have several
> rountrips to Xserver and back. Consider someone using a remote X
> server. save the result of check_for_evdev() and use it in subsequent
> calls.

Sub-optimal is an understatement :-) Easiest would be to  declare
another "static uint8_t *keymap", and at startup check for evdev
and initialize this to point to either the PC or evdev key table.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

  parent reply	other threads:[~2008-12-10 11:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-24 23:10 [Qemu-devel] [PATCH] evdev_keycode_map Dustin Kirkland
2008-12-09 22:42 ` Riku Voipio
2008-12-10  8:37   ` Dustin Kirkland
2008-12-10  9:05     ` Riku Voipio
2008-12-10 11:28   ` Daniel P. Berrange [this message]
2008-12-10 14:44     ` Anthony Liguori
2008-12-25 23:17       ` andrzej zaborowski
2008-12-26 18:53         ` Anthony Liguori

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=20081210112845.GC22446@redhat.com \
    --to=berrange@redhat.com \
    --cc=kirkland@canonical.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.