diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index 253413de..705d9642 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -1223,7 +1223,8 @@ EVT_HANDLER(AllowKeyboardBackgroundInput, "Allow keyboard background input (togg config::OptionID::kUIAllowKeyboardBackgroundInput); disableKeyboardBackgroundInput(); - if (OPTION(kUIAllowKeyboardBackgroundInput)) { + if (OPTION(kUIAllowKeyboardBackgroundInput) || + (OPTION(kSDLRenderer) == wxString("direct3d"))) { if (panel && panel->panel) { enableKeyboardBackgroundInput(panel->panel->GetWindow()->GetEventHandler()); } diff --git a/src/wx/drawing.h b/src/wx/drawing.h index 659da519..d1ccd169 100644 --- a/src/wx/drawing.h +++ b/src/wx/drawing.h @@ -69,7 +69,9 @@ private: SDL_Window *sdlwindow = NULL; SDL_Texture *texture = NULL; SDL_Renderer *renderer = NULL; - wxString renderername = wxEmptyString; + wxString renderername = wxEmptyString; + + DECLARE_EVENT_TABLE() }; #if defined(__WXMSW__) && !defined(NO_D3D) diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index f6f825ec..6a99bfc2 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -1260,7 +1260,8 @@ void GameArea::OnIdle(wxIdleEvent& event) w->SetSize(wxSize(basic_width, basic_height)); // Allow input while on background - if (OPTION(kUIAllowKeyboardBackgroundInput)) { + if (OPTION(kUIAllowKeyboardBackgroundInput) || + (OPTION(kSDLRenderer) == wxString("direct3d"))) { enableKeyboardBackgroundInput(w->GetEventHandler()); } @@ -2264,6 +2265,11 @@ DrawingPanelBase::~DrawingPanelBase() disableKeyboardBackgroundInput(); } + +BEGIN_EVENT_TABLE(SDLDrawingPanel, wxPanel) +EVT_PAINT(SDLDrawingPanel::PaintEv) +END_EVENT_TABLE() + SDLDrawingPanel::SDLDrawingPanel(wxWindow* parent, int _width, int _height) : DrawingPanel(parent, _width, _height) { @@ -2401,6 +2407,14 @@ void SDLDrawingPanel::DrawingPanelInit() if (SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER, xid) == false) #elif defined(__WXMAC__) if (SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER, wxGetApp().frame->GetPanel()->GetHandle()) == false) +#elif defined(__WXMSW__) + if (OPTION(kSDLRenderer) == wxString("direct3d")) { + SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, height * scale); + SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, width * scale); + SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN, true); + SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, true); + SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, "visualboyadvance-m SDL DX9"); + } else if (SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER, GetHandle()) == false) #else if (SDL_SetPointerProperty(props, "sdl2-compat.external_window", GetWindow()->GetHandle()) == false) #endif @@ -2418,7 +2432,7 @@ void SDLDrawingPanel::DrawingPanelInit() } sdlwindow = SDL_CreateWindowWithProperties(props); - + if (sdlwindow == NULL) { systemScreenMessage(_("Failed to create SDL window")); return; @@ -2426,7 +2440,7 @@ void SDLDrawingPanel::DrawingPanelInit() if (props != NULL) SDL_DestroyProperties(props); - + if (OPTION(kSDLRenderer) == wxString("default")) { renderer = SDL_CreateRenderer(sdlwindow, NULL); } else { diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp index 4654965b..96d4d308 100644 --- a/src/wx/wxvbam.cpp +++ b/src/wx/wxvbam.cpp @@ -881,7 +881,8 @@ wxEvtHandler* wxvbamApp::event_handler() { return nullptr; } - if (OPTION(kUIAllowJoystickBackgroundInput) || OPTION(kUIAllowKeyboardBackgroundInput)) { + if (OPTION(kUIAllowJoystickBackgroundInput) || OPTION(kUIAllowKeyboardBackgroundInput) || + (OPTION(kSDLRenderer) == wxString("direct3d"))) { // Use the game panel, if the background polling option is enabled. return panel->panel->GetWindow()->GetEventHandler(); }