gtk: fix some minor issues
Only allow the emulator to handle key events when the main window has the input focus Don't write anything to stdout when configuring a button using the GTK+ control config dialog.
This commit is contained in:
parent
f3eb06bde3
commit
c76d4bf20d
|
@ -58,7 +58,7 @@ int configGamepadButton(GtkButton* button, gpointer p)
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "SDL.Input.GamePad.%d", padNo);
|
snprintf(buf, sizeof(buf), "SDL.Input.GamePad.%d", padNo);
|
||||||
prefix = buf;
|
prefix = buf;
|
||||||
DWaitButton((const uint8*)"Press a button", &GamePadConfig[padNo][x], configNo);
|
DWaitButton(NULL, &GamePadConfig[padNo][x], configNo);
|
||||||
|
|
||||||
g_config->setOption(prefix + GamePadNames[x], GamePadConfig[padNo][x].ButtonNum[configNo]);
|
g_config->setOption(prefix + GamePadNames[x], GamePadConfig[padNo][x].ButtonNum[configNo]);
|
||||||
|
|
||||||
|
@ -1091,7 +1091,6 @@ const char* Authors[]= {
|
||||||
|
|
||||||
void openAbout ()
|
void openAbout ()
|
||||||
{
|
{
|
||||||
GtkWidget* aboutDialog;
|
|
||||||
GdkPixbuf* logo = gdk_pixbuf_new_from_xpm_data(icon_xpm);
|
GdkPixbuf* logo = gdk_pixbuf_new_from_xpm_data(icon_xpm);
|
||||||
|
|
||||||
gtk_show_about_dialog(GTK_WINDOW(MainWindow),
|
gtk_show_about_dialog(GTK_WINDOW(MainWindow),
|
||||||
|
@ -1102,7 +1101,7 @@ void openAbout ()
|
||||||
//"license-type", GTK_LICENSE_GPL_2_0,
|
//"license-type", GTK_LICENSE_GPL_2_0,
|
||||||
"website", "http://fceux.com",
|
"website", "http://fceux.com",
|
||||||
"authors", Authors,
|
"authors", Authors,
|
||||||
"logo", logo);
|
"logo", logo, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleSound(GtkWidget* check, gpointer data)
|
void toggleSound(GtkWidget* check, gpointer data)
|
||||||
|
@ -1837,12 +1836,17 @@ gint convertKeypress(GtkWidget *grab, GdkEventKey *event, gpointer user_data)
|
||||||
if (sdlkey != 0)
|
if (sdlkey != 0)
|
||||||
{
|
{
|
||||||
SDL_PushEvent(&sdlev);
|
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(1, 3, 0)
|
#if SDL_VERSION_ATLEAST(1, 3, 0)
|
||||||
SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(sdlkey)] = keystate;
|
SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(sdlkey)] = keystate;
|
||||||
#else
|
#else
|
||||||
SDL_GetKeyState(NULL)[sdlkey] = keystate;
|
SDL_GetKeyState(NULL)[sdlkey] = keystate;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Allow GTK+ to process this key.
|
// Allow GTK+ to process this key.
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1346,10 +1346,14 @@ DWaitButton(const uint8 *text,
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
static int32 LastAx[64][64];
|
static int32 LastAx[64][64];
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
|
if(text) {
|
||||||
std::string title = "Press a key for ";
|
std::string title = "Press a key for ";
|
||||||
title += (const char*)text;
|
title += (const char*)text;
|
||||||
SDL_WM_SetCaption(title.c_str(),0);
|
SDL_WM_SetCaption(title.c_str(),0);
|
||||||
puts((const char *)text);
|
puts((const char *)text);
|
||||||
|
}
|
||||||
|
|
||||||
for(x = 0; x < 64; x++) {
|
for(x = 0; x < 64; x++) {
|
||||||
for(y = 0; y < 64; y++) {
|
for(y = 0; y < 64; y++) {
|
||||||
LastAx[x][y]=0x100000;
|
LastAx[x][y]=0x100000;
|
||||||
|
|
Loading…
Reference in New Issue