diff --git a/src/drivers/sdl/gui.cpp b/src/drivers/sdl/gui.cpp
index ccf53e0d..c4abaa09 100644
--- a/src/drivers/sdl/gui.cpp
+++ b/src/drivers/sdl/gui.cpp
@@ -553,11 +553,7 @@ static void hotKeyWindowRefresh (void)
g_config->getOption (optionName.c_str (), &keycode);
gtk_tree_store_set (hotkey_store, &iter,
0, optionName.c_str (), 1,
-#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_GetKeyName (keycode),
-#else
- SDL_GetKeyName ((SDLKey) keycode),
-#endif
-1);
gtk_tree_store_append (hotkey_store, &iter, NULL); // acquire child iterator
}
@@ -602,11 +598,8 @@ static gint hotKeyPressCB (GtkTreeView * tree, GdkEventKey * event,
hotKeyName.append ( getHotkeyString(indexArray[0]) );
// Convert this keypress from GDK to SDL.
-#if SDL_VERSION_ATLEAST(2, 0, 0)
sdlkey = GDKToSDLKeyval (event->keyval);
-#else
- sdlkey = (SDLKey) GDKToSDLKeyval (event->keyval);
-#endif
+
printf ("HotKey Index: %i '%s' %i %i \n",
indexArray[0], hotKeyName.c_str (),
event->keyval, sdlkey);
@@ -706,16 +699,9 @@ void updateGamepadConfig (GtkWidget * w, gpointer p)
if (GamePadConfig[padNo][i].ButtType[configNo] ==
BUTTC_KEYBOARD)
{
-#if SDL_VERSION_ATLEAST(2, 0, 0)
snprintf (strBuf, sizeof (strBuf), "%s",
SDL_GetKeyName (GamePadConfig[padNo][i].
ButtonNum[configNo]));
-#else
- snprintf (strBuf, sizeof (strBuf), "%s",
- SDL_GetKeyName ((SDLKey)
- GamePadConfig[padNo][i].
- ButtonNum[configNo]));
-#endif
}
else
sprintf (strBuf, "%s", ButtonName( &GamePadConfig[padNo][i], configNo ) );
@@ -2208,28 +2194,15 @@ static void changeState (GtkRadioMenuItem * radiomenuitem, gpointer user_data)
FCEUI_SelectState ((long) user_data, 1);
}
-#if SDL_VERSION_ATLEAST(2, 0, 0)
// SDL 1.2/2.0 compatibility macros
#define SDLK_SCROLLOCK SDLK_SCROLLLOCK
#define SDLK_PRINT SDLK_PRINTSCREEN
#define SDLK_BREAK 0
#define SDLK_COMPOSE 0
#define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR
-#define SDLK_KP0 SDLK_KP_0
-#define SDLK_KP1 SDLK_KP_1
-#define SDLK_KP2 SDLK_KP_2
-#define SDLK_KP3 SDLK_KP_3
-#define SDLK_KP4 SDLK_KP_4
-#define SDLK_KP5 SDLK_KP_5
-#define SDLK_KP6 SDLK_KP_6
-#define SDLK_KP7 SDLK_KP_7
-#define SDLK_KP8 SDLK_KP_8
-#define SDLK_KP9 SDLK_KP_9
-#define SDLK_LSUPER SDLK_LGUI
-#define SDLK_RSUPER SDLK_RGUI
#define SDLK_LMETA 0
#define SDLK_RMETA 0
-#endif
+
// Adapted from Gens/GS. Converts a GDK key value into an SDL key value.
unsigned int GDKToSDLKeyval (int gdk_key)
{
@@ -2308,16 +2281,16 @@ unsigned int GDKToSDLKeyval (int gdk_key)
0x0000, 0x0000, SDLK_MODE, SDLK_NUMLOCK,
// 0x80 - 0x8F [mostly unused, except for some numeric keypad keys]
- SDLK_KP5, 0x0000, 0x0000, 0x0000,
+ SDLK_KP_5, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000,
0x0000, SDLK_KP_ENTER, 0x0000, 0x0000,
// 0x90 - 0x9F
0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, SDLK_KP7, SDLK_KP4, SDLK_KP8,
- SDLK_KP6, SDLK_KP2, SDLK_KP9, SDLK_KP3,
- SDLK_KP1, SDLK_KP5, SDLK_KP0, SDLK_KP_PERIOD,
+ 0x0000, SDLK_KP_7, SDLK_KP_4, SDLK_KP_8,
+ SDLK_KP_6, SDLK_KP_2, SDLK_KP_9, SDLK_KP_3,
+ SDLK_KP_1, SDLK_KP_5, SDLK_KP_0, SDLK_KP_PERIOD,
// 0xA0 - 0xAF
0x0000, 0x0000, 0x0000, 0x0000,
@@ -2326,9 +2299,9 @@ unsigned int GDKToSDLKeyval (int gdk_key)
0x0000, SDLK_KP_MINUS, SDLK_KP_PERIOD, SDLK_KP_DIVIDE,
// 0xB0 - 0xBF
- SDLK_KP0, SDLK_KP1, SDLK_KP2, SDLK_KP3,
- SDLK_KP4, SDLK_KP5, SDLK_KP6, SDLK_KP7,
- SDLK_KP8, SDLK_KP9, 0x0000, 0x0000,
+ SDLK_KP_0, SDLK_KP_1, SDLK_KP_2, SDLK_KP_3,
+ SDLK_KP_4, SDLK_KP_5, SDLK_KP_6, SDLK_KP_7,
+ SDLK_KP_8, SDLK_KP_9, 0x0000, 0x0000,
0x0000, SDLK_KP_EQUALS, SDLK_F1, SDLK_F2,
// 0xC0 - 0xCF
@@ -2346,8 +2319,8 @@ unsigned int GDKToSDLKeyval (int gdk_key)
// 0xE0 - 0xEF
0x0000, SDLK_LSHIFT, SDLK_RSHIFT, SDLK_LCTRL,
SDLK_RCTRL, SDLK_CAPSLOCK, 0x0000, SDLK_LMETA,
- SDLK_RMETA, SDLK_LALT, SDLK_RALT, SDLK_LSUPER,
- SDLK_RSUPER, 0x0000, 0x0000, 0x0000,
+ SDLK_RMETA, SDLK_LALT, SDLK_RALT, SDLK_LGUI,
+ SDLK_RGUI, 0x0000, 0x0000, 0x0000,
// 0xF0 - 0xFF [mostly unused, except for Delete]
0x0000, 0x0000, 0x0000, 0x0000,
@@ -2381,24 +2354,18 @@ static gboolean convertKeypress (GtkWidget * grab, GdkEventKey * event,
gpointer user_data)
{
SDL_Event sdlev;
- int keystate;
-#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_Keycode sdlkey;
-#else
- SDLKey sdlkey;
-#endif
+
switch (event->type)
{
case GDK_KEY_PRESS:
sdlev.type = SDL_KEYDOWN;
sdlev.key.state = SDL_PRESSED;
- keystate = 1;
break;
case GDK_KEY_RELEASE:
sdlev.type = SDL_KEYUP;
sdlev.key.state = SDL_RELEASED;
- keystate = 0;
break;
default:
@@ -2408,11 +2375,7 @@ static gboolean convertKeypress (GtkWidget * grab, GdkEventKey * event,
}
// Convert this keypress from GDK to SDL.
-#if SDL_VERSION_ATLEAST(2, 0, 0)
sdlkey = GDKToSDLKeyval (event->keyval);
-#else
- sdlkey = (SDLKey) GDKToSDLKeyval (event->keyval);
-#endif
// Create an SDL event from the keypress.
sdlev.key.keysym.scancode = SDL_GetScancodeFromKey(sdlkey);
@@ -2448,19 +2411,6 @@ static gboolean convertKeypress (GtkWidget * grab, GdkEventKey * event,
if (sdlkey != 0)
{
SDL_PushEvent (&sdlev);
-
- // Only let the emulator handle the key event if this window has the input focus.
- //if (keystate == 0
- // || gtk_window_is_active (GTK_WINDOW (MainWindow)))
- //{
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- // Not sure how to do this yet with SDL 2.0
- // TODO - SDL 2.0
- //SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(sdlkey)] = keystate;
-#else
- SDL_GetKeyState (NULL)[sdlkey] = keystate;
-#endif
- //}
}
// Allow GTK+ to process this key.
@@ -3268,52 +3218,52 @@ int guiClearSurface(void)
return 0;
}
-static void loadPixelTestPattern(void)
-{
- uint32_t *p;
- int i,x,y,width,height,w2,h2;
-
- width = 256;
- height = 256;
- p = (uint32_t*)glx_shm->pixbuf;
-
- w2 = width / 2;
- h2 = height / 2;
-
- //printf("W:%i H:%i W/2:%i H/2:%i\n", width, height, w2, h2 );
-
- i=0;
- for (y=0; ypixbuf;
+//
+// w2 = width / 2;
+// h2 = height / 2;
+//
+// //printf("W:%i H:%i W/2:%i H/2:%i\n", width, height, w2, h2 );
+//
+// i=0;
+// for (y=0; y