diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index 705d9642..253413de 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -1223,8 +1223,7 @@ EVT_HANDLER(AllowKeyboardBackgroundInput, "Allow keyboard background input (togg config::OptionID::kUIAllowKeyboardBackgroundInput); disableKeyboardBackgroundInput(); - if (OPTION(kUIAllowKeyboardBackgroundInput) || - (OPTION(kSDLRenderer) == wxString("direct3d"))) { + if (OPTION(kUIAllowKeyboardBackgroundInput)) { if (panel && panel->panel) { enableKeyboardBackgroundInput(panel->panel->GetWindow()->GetEventHandler()); } diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index f2a90acf..db34c410 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -938,6 +938,21 @@ void GameArea::ResetPanel() { void GameArea::ShowFullScreen(bool full) { + if (OPTION(kSDLRenderer) == wxString("direct3d")) { + if (panel == NULL) + return; + + if (panel->d3dframe == NULL) + return; + + if (panel->d3dframe->IsFullScreen() == false) + panel->d3dframe->ShowFullScreen(true); + else + panel->d3dframe->ShowFullScreen(false); + + return; + } + if (full == fullscreen) { // in case the tlw somehow lost its mind, force it to proper mode if (wxGetApp().frame->IsFullScreen() != fullscreen) @@ -1235,7 +1250,12 @@ void GameArea::OnIdle(wxIdleEvent& event) return; } - wxWindow* w = panel->GetWindow(); + wxWindow* w = NULL; + + w = panel->GetWindow(); + + if (panel->d3dframe != NULL) + panel->d3dframe->Bind(VBAM_EVT_USER_INPUT, &GameArea::OnUserInput, this); // set up event handlers w->Bind(VBAM_EVT_USER_INPUT, &GameArea::OnUserInput, this); @@ -1260,8 +1280,7 @@ void GameArea::OnIdle(wxIdleEvent& event) w->SetSize(wxSize(basic_width, basic_height)); // Allow input while on background - if (OPTION(kUIAllowKeyboardBackgroundInput) || - (OPTION(kSDLRenderer) == wxString("direct3d"))) { + if (OPTION(kUIAllowKeyboardBackgroundInput)) { enableKeyboardBackgroundInput(w->GetEventHandler()); } @@ -2290,6 +2309,9 @@ SDLDrawingPanel::~SDLDrawingPanel() { if (did_init) { + if (d3dframe != NULL) + delete d3dframe; + if (sdlwindow != NULL) SDL_DestroyWindow(sdlwindow); @@ -2409,13 +2431,14 @@ void SDLDrawingPanel::DrawingPanelInit() if (SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER, wxGetApp().frame->GetPanel()->GetHandle()) == false) #elif defined(__WXMSW__) if (OPTION(kSDLRenderer) == wxString("direct3d")) { - const char *title = "visualboyadvance-m SDL DX9"; + d3dframe = new wxFrame(GetWindow(), wxID_ANY, "visualboyadvance-m SDL DX9", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, "SDL_DX9"); + d3dframe->Show(); - 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, (void *)title); + if (SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER, d3dframe->GetHandle()) == false) + { + systemScreenMessage(_("Failed to set DX9 window")); + return; + } } 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) diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp index 96d4d308..4654965b 100644 --- a/src/wx/wxvbam.cpp +++ b/src/wx/wxvbam.cpp @@ -881,8 +881,7 @@ wxEvtHandler* wxvbamApp::event_handler() { return nullptr; } - if (OPTION(kUIAllowJoystickBackgroundInput) || OPTION(kUIAllowKeyboardBackgroundInput) || - (OPTION(kSDLRenderer) == wxString("direct3d"))) { + if (OPTION(kUIAllowJoystickBackgroundInput) || OPTION(kUIAllowKeyboardBackgroundInput)) { // Use the game panel, if the background polling option is enabled. return panel->panel->GetWindow()->GetEventHandler(); } diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index 88464392..999219d0 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -609,6 +609,8 @@ public: virtual void OnSize(wxSizeEvent& ev); wxWindow* GetWindow() { return dynamic_cast(this); } virtual bool Destroy() { return GetWindow()->Destroy(); } + wxFrame *d3dframe = NULL; + protected: virtual void DrawArea(wxWindowDC&) = 0; virtual void DrawOSD(wxWindowDC&);