Skip to contentSkip to conversation

[6678] Fix SDL on evdev hosts (Anthony Liguori)

Qemu-devel Anthony Liguori 1 participant 1 message Mar 3, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6678

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6678
Author:   aliguori
Date:     2009-03-03 17:37:21 +0000 (Tue, 03 Mar 2009)

Log Message:
-----------
Fix SDL on evdev hosts (Anthony Liguori)

This patch corrects SDL support on X11 hosts using evdev. It's losely based on the previous patch by Dustin Kirkland and the evdev support code in gtk-vnc written by Daniel Berrange.

Modified Paths:
--------------
trunk/configure
trunk/console.h
trunk/sdl.c
trunk/x_keymap.c

Added Paths:
-----------
trunk/x_keymap.h

Modified: trunk/configure
===================================================================

configure +18 -0
@@ -187,6 +187,7 @@
 aix="no"
 blobs="yes"
 fdt="yes"
+sdl_x11="no"
 
 # OS specific
 if check_define __linux__ ; then
@@ -805,6 +806,21 @@
     fi
 fi # -z $sdl
 
+if test "$sdl" = "yes" ; then
+cat > $TMPC <<EOF
+#include <SDL.h>
+#if defined(SDL_VIDEO_DRIVER_X11)
+#include <X11/XKBlib.h>
+#else
+#error No x11 support
+#endif
+int main(void) { return 0; }
+EOF
+    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
+	sdl_x11="yes"
+    fi
+fi
+
 ##########################################
 # VNC TLS detection
 if test "$vnc_tls" = "yes" ; then
@@ -1393,6 +1409,8 @@
   echo "CONFIG_SDL=yes" >> $config_mak
   if test "$target_softmmu" = "no" -o "$static" = "yes"; then
     echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
+  elif test "$sdl_x11" = "yes" ; then
+    echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
   else
     echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
   fi

Modified: trunk/console.h
===================================================================

console.h +0 -3
@@ -292,9 +292,6 @@
 /* curses.c */
 void curses_display_init(DisplayState *ds, int full_screen);
 
-/* x_keymap.c */
-extern uint8_t _translate_keycode(const int key);
-
 /* FIXME: term_printf et al should probably go elsewhere so everything
    does not need to include console.h  */
 /* monitor.c */

Modified: trunk/sdl.c
===================================================================

sdl.c +56 -2

83 lines not on this page · raw message

Modified: trunk/x_keymap.c
===================================================================

x_keymap.c +77 -21

111 lines not on this page · raw message

Added: trunk/x_keymap.h
===================================================================

x_keymap.h +32 -0
@@ -0,0 +1,32 @@
+/*
+ * QEMU SDL display driver
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef QEMU_X_KEYMAP_H
+#define QEMU_X_KEYMAP_H
+
+extern uint8_t translate_xfree86_keycode(const int key);
+
+extern uint8_t translate_evdev_keycode(const int key);
+
+#endif