This commit is contained in:
StapleButter 2017-03-28 23:21:56 +02:00
parent d6bab52baa
commit e2cc3f1a72

View File

@ -20,6 +20,12 @@
#include "InputConfig.h" #include "InputConfig.h"
#include "../Config.h" #include "../Config.h"
#ifdef __WXGTK__
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <X11/X.h>
#endif // __WXGTK__
wxBEGIN_EVENT_TABLE(InputConfigDialog, wxDialog) wxBEGIN_EVENT_TABLE(InputConfigDialog, wxDialog)
EVT_COMMAND(1001, wxEVT_BUTTON, InputConfigDialog::OnOk) EVT_COMMAND(1001, wxEVT_BUTTON, InputConfigDialog::OnOk)
@ -168,8 +174,13 @@ InputConfigDialog::InputConfigDialog(wxWindow* parent)
polltimer = new wxTimer(this); polltimer = new wxTimer(this);
pollid = 0; pollid = 0;
// TODO: GTK compatibility #ifdef __WXGTK__
GtkWidget* widget = keycatcher->GetHandle();
gtk_widget_realize(widget);
sdlwin = SDL_CreateWindowFrom(GDK_WINDOW_XID(gtk_widget_get_window(widget)));
#else
sdlwin = SDL_CreateWindowFrom(keycatcher->GetHandle()); sdlwin = SDL_CreateWindowFrom(keycatcher->GetHandle());
#endif
keystate = SDL_GetKeyboardState(&nkeys); keystate = SDL_GetKeyboardState(&nkeys);
@ -183,7 +194,7 @@ InputConfigDialog::~InputConfigDialog()
if (njoys) SDL_JoystickClose(0); if (njoys) SDL_JoystickClose(0);
SDL_DestroyWindow(sdlwin); //SDL_DestroyWindow(sdlwin);
} }
void InputConfigDialog::OnOk(wxCommandEvent& event) void InputConfigDialog::OnOk(wxCommandEvent& event)
@ -242,8 +253,12 @@ void InputConfigDialog::OnPoll(wxTimerEvent& event)
{ {
if (pollid < 100) return; if (pollid < 100) return;
keycatcher->SetFocus(); //keycatcher->SetFocus();
//SDL_SetWindowInputFocus(sdlwin);
//SDL_RaiseWindow(sdlwin);
SDL_PumpEvents(); SDL_PumpEvents();
keycatcher->SetFocus();
SDL_RaiseWindow(sdlwin);
if (keystate[SDL_SCANCODE_ESCAPE]) if (keystate[SDL_SCANCODE_ESCAPE])
{ {