From 98f22fc6de4aedd20366881822a80bb83a4bfcf6 Mon Sep 17 00:00:00 2001 From: Brad Hughes Date: Thu, 17 Nov 2016 00:32:26 -0500 Subject: [PATCH] Change window handle storage to template instead of void* (nw) (#1725) * Change window handle storage to template instead of void* (nw) --- src/osd/modules/debugger/debugwin.cpp | 2 +- src/osd/modules/debugger/win/debugwininfo.cpp | 2 +- src/osd/modules/input/input_dinput.h | 2 +- src/osd/modules/input/input_rawinput.cpp | 2 +- src/osd/modules/input/input_sdlcommon.cpp | 2 +- src/osd/modules/input/input_uwp.cpp | 8 +- src/osd/modules/input/input_win32.cpp | 12 +-- src/osd/modules/monitor/monitor_dxgi.cpp | 2 +- src/osd/modules/monitor/monitor_sdl.cpp | 3 +- src/osd/modules/monitor/monitor_win32.cpp | 2 +- src/osd/modules/osdwindow.h | 33 +++++--- src/osd/modules/render/draw13.cpp | 4 +- src/osd/modules/render/drawbgfx.cpp | 23 ++--- src/osd/modules/render/drawd3d.cpp | 12 +-- src/osd/modules/render/drawgdi.cpp | 4 +- src/osd/modules/render/drawnone.cpp | 4 +- src/osd/modules/render/drawogl.cpp | 4 +- src/osd/modules/render/drawsdl.cpp | 8 +- src/osd/modules/sound/direct_sound.cpp | 4 +- src/osd/sdl/window.cpp | 38 ++++----- src/osd/sdl/window.h | 2 +- src/osd/uwp/video.cpp | 2 +- src/osd/uwp/window.cpp | 19 ++--- src/osd/uwp/window.h | 15 +--- src/osd/windows/video.cpp | 2 +- src/osd/windows/window.cpp | 84 +++++++++---------- src/osd/windows/window.h | 6 +- src/osd/windows/winmain.cpp | 4 +- 28 files changed, 154 insertions(+), 151 deletions(-) diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index c66a54e6d30..bbebe36abd4 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -243,7 +243,7 @@ void debugger_windows::show_all() void debugger_windows::hide_all() { - SetForegroundWindow(osd_common_t::s_window_list.front()->platform_window()); + SetForegroundWindow(std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window()); for (auto &info : m_window_list) info->hide(); } diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp index 3b2e9ed9689..062c9b11c2b 100644 --- a/src/osd/modules/debugger/win/debugwininfo.cpp +++ b/src/osd/modules/debugger/win/debugwininfo.cpp @@ -36,7 +36,7 @@ debugwin_info::debugwin_info(debugger_windows_interface &debugger, bool is_main_ register_window_class(); m_wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE, - 0, 0, 100, 100, osd_common_t::s_window_list.front()->platform_window(), create_standard_menubar(), GetModuleHandleUni(), this); + 0, 0, 100, 100, std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window(), create_standard_menubar(), GetModuleHandleUni(), this); if (m_wnd == nullptr) return; diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h index 87e25a3a1ab..9d38d925a00 100644 --- a/src/osd/modules/input/input_dinput.h +++ b/src/osd/modules/input/input_dinput.h @@ -121,7 +121,7 @@ public: } // set the cooperative level - result = devinfo->dinput.device->SetCooperativeLevel(osd_common_t::s_window_list.front()->platform_window(), cooperative_level); + result = devinfo->dinput.device->SetCooperativeLevel(std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window(), cooperative_level); if (result != DI_OK) goto error; diff --git a/src/osd/modules/input/input_rawinput.cpp b/src/osd/modules/input/input_rawinput.cpp index 287ff9b6a45..3f5274c6eba 100644 --- a/src/osd/modules/input/input_rawinput.cpp +++ b/src/osd/modules/input/input_rawinput.cpp @@ -529,7 +529,7 @@ public: registration.usUsagePage = usagepage(); registration.usUsage = usage(); registration.dwFlags = m_global_inputs_enabled ? 0x00000100 : 0; - registration.hwndTarget = osd_common_t::s_window_list.front()->platform_window(); + registration.hwndTarget = std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window(); // register the device (*register_rawinput_devices)(®istration, 1, sizeof(registration)); diff --git a/src/osd/modules/input/input_sdlcommon.cpp b/src/osd/modules/input/input_sdlcommon.cpp index 163fc874e23..e016b40ee49 100644 --- a/src/osd/modules/input/input_sdlcommon.cpp +++ b/src/osd/modules/input/input_sdlcommon.cpp @@ -43,7 +43,7 @@ static std::shared_ptr window_from_id(Uint32 windowID) auto& windows = osd_common_t::s_window_list; auto window = std::find_if(windows.begin(), windows.end(), [sdl_window](std::shared_ptr w) { - return w->platform_window() == sdl_window; + return std::static_pointer_cast(w)->platform_window() == sdl_window; }); if (window == windows.end()) diff --git a/src/osd/modules/input/input_uwp.cpp b/src/osd/modules/input/input_uwp.cpp index d82a2f09de2..0c63e53fb1d 100644 --- a/src/osd/modules/input/input_uwp.cpp +++ b/src/osd/modules/input/input_uwp.cpp @@ -217,7 +217,7 @@ private: Platform::Agile m_coreWindow; internal: - UwpKeyboardDevice(CoreWindow ^coreWindow, running_machine& machine, char *name, const char *id, input_module &module) + UwpKeyboardDevice(Platform::Agile coreWindow, running_machine& machine, char *name, const char *id, input_module &module) : UwpInputDevice(machine, name, id, DEVICE_CLASS_KEYBOARD, module), keyboard({{0}}), m_coreWindow(coreWindow) @@ -292,16 +292,14 @@ internal: void input_init(running_machine &machine) override { auto first_window = std::static_pointer_cast(osd_common_t::s_window_list.front()); - CoreWindow ^coreWindow = first_window->uwp_window(); - - uwp_input_device *devinfo; + auto coreWindow = first_window->platform_window(); // allocate the UWP implementation of the device object UwpKeyboardDevice ^refdevice = ref new UwpKeyboardDevice(coreWindow, machine, "UWP Keyboard 1", "UWP Keyboard 1", *this->NativeModule); // Allocate the wrapper and add it to the list auto created_devinfo = std::make_unique(refdevice); - devinfo = NativeModule->devicelist()->add_device(machine, std::move(created_devinfo)); + uwp_input_device *devinfo = NativeModule->devicelist()->add_device(machine, std::move(created_devinfo)); // Give the UWP implementation a handle to the input_device refdevice->InputDevice = devinfo->device(); diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp index 232bbc2c4af..edd378be25d 100644 --- a/src/osd/modules/input/input_win32.cpp +++ b/src/osd/modules/input/input_win32.cpp @@ -157,7 +157,7 @@ public: mouse.lY = (cursor_info.ptScreenPos.y - win32_mouse.last_point.y) * INPUT_RELATIVE_PER_PIXEL; RECT window_pos = {0}; - GetWindowRect(osd_common_t::s_window_list.front()->platform_window(), &window_pos); + GetWindowRect(std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window(), &window_pos); // We reset the cursor position to the middle of the window each frame win32_mouse.last_point.x = window_pos.left + (window_pos.right - window_pos.left) / 2; @@ -291,8 +291,9 @@ public: RECT client_rect; // get the position relative to the window - GetClientRect(osd_common_t::s_window_list.front()->platform_window(), &client_rect); - ScreenToClient(osd_common_t::s_window_list.front()->platform_window(), &mousepos); + HWND hwnd = std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window(); + GetClientRect(hwnd, &client_rect); + ScreenToClient(hwnd, &mousepos); // convert to absolute coordinates xpos = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right); @@ -352,10 +353,11 @@ private: POINT mousepos; // get the position relative to the window - GetClientRect(osd_common_t::s_window_list.front()->platform_window(), &client_rect); + HWND hwnd = std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window(); + GetClientRect(hwnd, &client_rect); mousepos.x = args.xpos; mousepos.y = args.ypos; - ScreenToClient(osd_common_t::s_window_list.front()->platform_window(), &mousepos); + ScreenToClient(hwnd, &mousepos); // convert to absolute coordinates mouse.lX = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right); diff --git a/src/osd/modules/monitor/monitor_dxgi.cpp b/src/osd/modules/monitor/monitor_dxgi.cpp index 9fbc32a25bc..33360922764 100644 --- a/src/osd/modules/monitor/monitor_dxgi.cpp +++ b/src/osd/modules/monitor/monitor_dxgi.cpp @@ -113,7 +113,7 @@ public: return nullptr; #if defined(OSD_WINDOWS) - auto nearest = monitor_from_handle(reinterpret_cast(MonitorFromWindow(window.platform_window(), MONITOR_DEFAULTTONEAREST))); + auto nearest = monitor_from_handle(reinterpret_cast(MonitorFromWindow(static_cast(window).platform_window(), MONITOR_DEFAULTTONEAREST))); assert(nearest != nullptr); return nearest; #elif defined(OSD_UWP) diff --git a/src/osd/modules/monitor/monitor_sdl.cpp b/src/osd/modules/monitor/monitor_sdl.cpp index 19c8537165f..eb2a1bc2713 100644 --- a/src/osd/modules/monitor/monitor_sdl.cpp +++ b/src/osd/modules/monitor/monitor_sdl.cpp @@ -15,6 +15,7 @@ #include "modules/osdwindow.h" #include "monitor_common.h" +#include "window.h" inline osd_rect SDL_Rect_to_osd_rect(const SDL_Rect &r) { @@ -95,7 +96,7 @@ public: if (!m_initialized) return nullptr; - std::uint64_t display = SDL_GetWindowDisplayIndex(window.platform_window()); + std::uint64_t display = SDL_GetWindowDisplayIndex(static_cast(window).platform_window()); return monitor_from_handle(display); } diff --git a/src/osd/modules/monitor/monitor_win32.cpp b/src/osd/modules/monitor/monitor_win32.cpp index 8352d7c5a2f..60917b2adbd 100644 --- a/src/osd/modules/monitor/monitor_win32.cpp +++ b/src/osd/modules/monitor/monitor_win32.cpp @@ -83,7 +83,7 @@ public: if (!m_initialized) return nullptr; - auto nearest = monitor_from_handle(reinterpret_cast(MonitorFromWindow(window.platform_window(), MONITOR_DEFAULTTONEAREST))); + auto nearest = monitor_from_handle(reinterpret_cast(MonitorFromWindow(static_cast(window).platform_window(), MONITOR_DEFAULTTONEAREST))); assert(nearest != nullptr); return nearest; } diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index 9a38918671c..a77371668c8 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -78,7 +78,6 @@ public: m_win_config(config), m_index(0), m_prescale(1), - m_platform_window(nullptr), m_renderer(nullptr), m_main(nullptr) {} @@ -114,15 +113,6 @@ public: virtual osd_monitor_info *monitor() const = 0; - template - TWindow platform_window() const { return static_cast(m_platform_window); } - - void set_platform_window(void *window) - { - assert(window == nullptr || m_platform_window == nullptr); - m_platform_window = window; - } - std::shared_ptr main_window() const { return m_main; } void set_main_window(std::shared_ptr main) { m_main = main; } @@ -152,11 +142,32 @@ public: protected: int m_prescale; private: - void *m_platform_window; std::unique_ptr m_renderer; std::shared_ptr m_main; }; +template +class osd_window_t : public osd_window +{ +private: + TWindowHandle m_platform_window; +public: + osd_window_t(const osd_window_config &config) + : osd_window(config), + m_platform_window(nullptr) + { + } + + TWindowHandle platform_window() const { return m_platform_window; } + + void set_platform_window(TWindowHandle window) + { + assert(window == nullptr || m_platform_window == nullptr); + m_platform_window = window; + } +}; + + class osd_renderer { public: diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 7a53ec3921b..9282c35e9b4 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -437,9 +437,9 @@ int renderer_sdl2::create() auto win = assert_window(); if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(std::dynamic_pointer_cast(win)->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); else - m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(std::dynamic_pointer_cast(win)->platform_window(), -1, SDL_RENDERER_ACCELERATED); if (!m_sdl_renderer) { diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 4a170434742..f94e3bfa631 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -198,9 +198,9 @@ inline void winrtSetWindow(::IUnknown* _window) bgfx::setPlatformData(pd); } -IInspectable* AsInspectable(Platform::Object^ o) +IInspectable* AsInspectable(Platform::Agile win) { - return reinterpret_cast(o); + return reinterpret_cast(win.Get()); } #endif @@ -226,11 +226,12 @@ int renderer_bgfx::create() bgfx::setPlatformData(blank_pd); } #ifdef OSD_WINDOWS - winSetHwnd(win->platform_window()); + winSetHwnd(std::static_pointer_cast(win)->platform_window()); #elif defined(OSD_UWP) - winrtSetWindow(win->platform_window()); + + winrtSetWindow(AsInspectable(std::static_pointer_cast(win)->platform_window())); #else - sdlSetWindow(win->platform_window()); + sdlSetWindow(std::dynamic_pointer_cast(win)->platform_window()); #endif std::string backend(m_options.bgfx_backend()); if (backend == "auto") @@ -277,11 +278,11 @@ int renderer_bgfx::create() if (win->m_index != 0) { #ifdef OSD_WINDOWS - m_framebuffer = m_targets->create_backbuffer(win->platform_window(), m_width[win->m_index], m_height[win->m_index]); + m_framebuffer = m_targets->create_backbuffer(std::static_pointer_cast(win)->platform_window(), m_width[win->m_index], m_height[win->m_index]); #elif defined(OSD_UWP) - m_framebuffer = m_targets->create_backbuffer(win->platform_window(), m_width[win->m_index], m_height[win->m_index]); + m_framebuffer = m_targets->create_backbuffer(AsInspectable(std::static_pointer_cast(win)->platform_window()), m_width[win->m_index], m_height[win->m_index]); #else - m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(win->platform_window()), m_width[win->m_index], m_height[win->m_index]); + m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(std::dynamic_pointer_cast(win)->platform_window()), m_width[win->m_index], m_height[win->m_index]); #endif bgfx::touch(win->m_index); } @@ -918,11 +919,11 @@ bool renderer_bgfx::update_dimensions() delete m_framebuffer; #ifdef OSD_WINDOWS - m_framebuffer = m_targets->create_backbuffer(win->platform_window(), width, height); + m_framebuffer = m_targets->create_backbuffer(std::static_pointer_cast(win)->platform_window(), width, height); #elif defined(OSD_UWP) - m_framebuffer = m_targets->create_backbuffer(win->platform_window(), width, height); + m_framebuffer = m_targets->create_backbuffer(AsInspectable(std::static_pointer_cast(win)->platform_window()), width, height); #else - m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(win->platform_window()), width, height); + m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(std::dynamic_pointer_cast(win)->platform_window()), width, height); #endif bgfx::setViewFrameBuffer(s_current_view, m_framebuffer->target()); diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index f3e92845ffd..d0a1ce6c9d1 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -179,7 +179,7 @@ render_primitive_list *renderer_d3d9::get_primitives() if (win == nullptr) return nullptr; - GetClientRectExceptMenu(win->platform_window(), &client, win->fullscreen()); + GetClientRectExceptMenu(std::static_pointer_cast(win)->platform_window(), &client, win->fullscreen()); if (rect_width(&client) > 0 && rect_height(&client) > 0) { win->target()->set_bounds(rect_width(&client), rect_height(&client), win->pixel_aspect()); @@ -526,7 +526,7 @@ int renderer_d3d9::initialize() // create the device immediately for the full screen case (defer for window mode in update_window_size()) auto win = assert_window(); - if (win->fullscreen() && device_create(win->main_window()->platform_window())) + if (win->fullscreen() && device_create(std::static_pointer_cast(win->main_window())->platform_window())) { return false; } @@ -747,7 +747,7 @@ void renderer_d3d9::update_presentation_parameters() m_presentation.BackBufferCount = video_config.triplebuf ? 2 : 1; m_presentation.MultiSampleType = D3DMULTISAMPLE_NONE; m_presentation.SwapEffect = D3DSWAPEFFECT_DISCARD; - m_presentation.hDeviceWindow = win->platform_window(); + m_presentation.hDeviceWindow = std::static_pointer_cast(win)->platform_window(); m_presentation.Windowed = !win->fullscreen() || win->win_has_menu(); m_presentation.EnableAutoDepthStencil = FALSE; m_presentation.AutoDepthStencilFormat = D3DFMT_D16; @@ -1214,7 +1214,7 @@ int renderer_d3d9::config_adapter_mode() RECT client; // bounds are from the window client rect - GetClientRectExceptMenu(win->platform_window(), &client, win->fullscreen()); + GetClientRectExceptMenu(std::static_pointer_cast(win)->platform_window(), &client, win->fullscreen()); m_width = client.right - client.left; m_height = client.bottom - client.top; @@ -1384,7 +1384,7 @@ bool renderer_d3d9::update_window_size() // get the current window bounds RECT client; - GetClientRectExceptMenu(win->platform_window(), &client, win->fullscreen()); + GetClientRectExceptMenu(std::static_pointer_cast(win)->platform_window(), &client, win->fullscreen()); // if we have a device and matching width/height, nothing to do if (m_device != nullptr && rect_width(&client) == m_width && rect_height(&client) == m_height) @@ -1402,7 +1402,7 @@ bool renderer_d3d9::update_window_size() // set the new bounds and create the device again m_width = rect_width(&client); m_height = rect_height(&client); - if (device_create(win->main_window()->platform_window())) + if (device_create(std::static_pointer_cast(win->main_window())->platform_window())) return false; // reset the resize state to normal, and indicate we made a change diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp index 7611c1be434..5cfcdc7543f 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -50,7 +50,7 @@ render_primitive_list *renderer_gdi::get_primitives() return nullptr; RECT client; - GetClientRect(win->platform_window(), &client); + GetClientRect(std::static_pointer_cast(win)->platform_window(), &client); win->target()->set_bounds(rect_width(&client), rect_height(&client), win->pixel_aspect()); return &win->target()->get_primitives(); } @@ -69,7 +69,7 @@ int renderer_gdi::draw(const int update) // get the target bounds RECT bounds; - GetClientRect(win->platform_window(), &bounds); + GetClientRect(std::static_pointer_cast(win)->platform_window(), &bounds); // compute width/height/pitch of target int width = rect_width(&bounds); diff --git a/src/osd/modules/render/drawnone.cpp b/src/osd/modules/render/drawnone.cpp index e8f7e8c1948..c5213afcec3 100644 --- a/src/osd/modules/render/drawnone.cpp +++ b/src/osd/modules/render/drawnone.cpp @@ -27,9 +27,9 @@ render_primitive_list *renderer_none::get_primitives() RECT client; #if defined(OSD_WINDOWS) - GetClientRect(win->platform_window(), &client); + GetClientRect(std::static_pointer_cast(win)->platform_window(), &client); #elif defined(OSD_UWP) - auto bounds = std::static_pointer_cast(win)->uwp_window()->Bounds; + auto bounds = std::static_pointer_cast(win)->platform_window()->Bounds; client.left = bounds.Left; client.right = bounds.Right; client.top = bounds.Top; diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index ffd34138891..98db62fdf1f 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -557,9 +557,9 @@ int renderer_ogl::create() // create renderer #if defined(OSD_WINDOWS) - m_gl_context = global_alloc(win_gl_context(win->platform_window())); + m_gl_context = global_alloc(win_gl_context(std::static_pointer_cast(win)->platform_window())); #else - m_gl_context = global_alloc(sdl_gl_context(win->platform_window())); + m_gl_context = global_alloc(sdl_gl_context(std::static_pointer_cast(win)->platform_window())); #endif if (m_gl_context->LastErrorMsg() != nullptr) { diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index d015432403d..c80b59185af 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -196,16 +196,16 @@ int renderer_sdl1::create() if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(std::dynamic_pointer_cast(win)->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); else - m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(std::dynamic_pointer_cast(win)->platform_window(), -1, SDL_RENDERER_ACCELERATED); if (!m_sdl_renderer) { if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE); + m_sdl_renderer = SDL_CreateRenderer(std::dynamic_pointer_cast(win)->platform_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE); else - m_sdl_renderer = SDL_CreateRenderer(win->platform_window(), -1, SDL_RENDERER_SOFTWARE); + m_sdl_renderer = SDL_CreateRenderer(std::dynamic_pointer_cast(win)->platform_window(), -1, SDL_RENDERER_SOFTWARE); } if (!m_sdl_renderer) diff --git a/src/osd/modules/sound/direct_sound.cpp b/src/osd/modules/sound/direct_sound.cpp index b6ab7205c57..3117b354c84 100644 --- a/src/osd/modules/sound/direct_sound.cpp +++ b/src/osd/modules/sound/direct_sound.cpp @@ -407,10 +407,10 @@ HRESULT sound_direct_sound::dsound_init() #ifdef SDLMAME_WIN32 SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version); - SDL_GetWindowWMInfo(osd_common_t::s_window_list.front()->platform_window(), &wminfo); + SDL_GetWindowWMInfo(std::dynamic_pointer_cast(osd_common_t::s_window_list.front())->platform_window(), &wminfo); HWND const window = wminfo.info.win.window; #else // SDLMAME_WIN32 - HWND const window = osd_common_t::s_window_list.front()->platform_window(); + HWND const window = std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window(); #endif // SDLMAME_WIN32 result = m_dsound->SetCooperativeLevel(window, DSSCL_PRIORITY); } diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index a19b3b61dec..17e25bbd875 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -217,7 +217,7 @@ void sdl_window_info::capture_pointer() { if (!m_mouse_captured) { - SDL_SetWindowGrab(platform_window(), SDL_TRUE); + SDL_SetWindowGrab(platform_window(), SDL_TRUE); SDL_SetRelativeMouseMode(SDL_TRUE); m_mouse_captured = true; } @@ -227,7 +227,7 @@ void sdl_window_info::release_pointer() { if (m_mouse_captured) { - SDL_SetWindowGrab(platform_window(), SDL_FALSE); + SDL_SetWindowGrab(platform_window(), SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE); m_mouse_captured = false; } @@ -262,7 +262,7 @@ void sdl_window_info::resize(int32_t width, int32_t height) if (width != cd.width() || height != cd.height()) { - SDL_SetWindowSize(platform_window(), width, height); + SDL_SetWindowSize(platform_window(), width, height); renderer().notify_changed(); } } @@ -306,11 +306,11 @@ void sdl_window_info::toggle_full_screen() #endif if (fullscreen() && (video_config.switchres || is_osx)) { - SDL_SetWindowFullscreen(platform_window(), 0); // Try to set mode - SDL_SetWindowDisplayMode(platform_window(), &m_original_mode->mode); // Try to set mode - SDL_SetWindowFullscreen(platform_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode + SDL_SetWindowFullscreen(platform_window(), 0); // Try to set mode + SDL_SetWindowDisplayMode(platform_window(), &m_original_mode->mode); // Try to set mode + SDL_SetWindowFullscreen(platform_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode } - SDL_DestroyWindow(platform_window()); + SDL_DestroyWindow(platform_window()); downcast(machine().osd()).release_keys(); @@ -451,12 +451,12 @@ void sdl_window_info::complete_destroy() if (fullscreen() && video_config.switchres) { - SDL_SetWindowFullscreen(platform_window(), 0); // Try to set mode - SDL_SetWindowDisplayMode(platform_window(), &m_original_mode->mode); // Try to set mode - SDL_SetWindowFullscreen(platform_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode + SDL_SetWindowFullscreen(platform_window(), 0); // Try to set mode + SDL_SetWindowDisplayMode(platform_window(), &m_original_mode->mode); // Try to set mode + SDL_SetWindowFullscreen(platform_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode } - SDL_DestroyWindow(platform_window()); + SDL_DestroyWindow(platform_window()); // release all keys ... downcast(machine().osd()).release_keys(); } @@ -770,20 +770,20 @@ int sdl_window_info::complete_create() { SDL_DisplayMode mode; //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode); - SDL_GetWindowDisplayMode(platform_window(), &mode); + SDL_GetWindowDisplayMode(platform_window(), &mode); m_original_mode->mode = mode; mode.w = temp.width(); mode.h = temp.height(); if (m_win_config.refresh) mode.refresh_rate = m_win_config.refresh; - SDL_SetWindowDisplayMode(platform_window(), &mode); // Try to set mode + SDL_SetWindowDisplayMode(platform_window(), &mode); // Try to set mode #ifndef SDLMAME_WIN32 /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution * is in place after the mode switch - which will most likely be the case * This is a hack to work around a deficiency in SDL2 */ - SDL_WarpMouseInWindow(platform_window(), 1, 1); + SDL_WarpMouseInWindow(platform_window(), 1, 1); #endif } else @@ -793,14 +793,14 @@ int sdl_window_info::complete_create() // show window - SDL_ShowWindow(platform_window()); + SDL_ShowWindow(platform_window()); //SDL_SetWindowFullscreen(window->sdl_window(), 0); //SDL_SetWindowFullscreen(window->sdl_window(), window->fullscreen()); - SDL_RaiseWindow(platform_window()); + SDL_RaiseWindow(platform_window()); #ifdef SDLMAME_WIN32 if (fullscreen()) - SDL_SetWindowGrab(platform_window(), SDL_TRUE); + SDL_SetWindowGrab(platform_window(), SDL_TRUE); #endif // set main window @@ -1075,7 +1075,7 @@ osd_dim sdl_window_info::get_min_bounds(int constrain) osd_dim sdl_window_info::get_size() { int w=0; int h=0; - SDL_GetWindowSize(platform_window(), &w, &h); + SDL_GetWindowSize(platform_window(), &w, &h); return osd_dim(w,h); } @@ -1130,7 +1130,7 @@ sdl_window_info::sdl_window_info( int index, std::shared_ptr a_monitor, const osd_window_config *config) - : osd_window(*config) + : osd_window_t(*config) , m_next(nullptr) , m_startmaximized(0) // Following three are used by input code to defer resizes diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index fda5a502a95..d6010e91ed2 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -35,7 +35,7 @@ typedef uintptr_t HashT; #define OSDWORK_CALLBACK(name) void *name(void *param, ATTR_UNUSED int threadid) -class sdl_window_info : public osd_window +class sdl_window_info : public osd_window_t { public: sdl_window_info(running_machine &a_machine, int index, std::shared_ptr a_monitor, diff --git a/src/osd/uwp/video.cpp b/src/osd/uwp/video.cpp index 51c7cc60c34..8a3de3a8ef1 100644 --- a/src/osd/uwp/video.cpp +++ b/src/osd/uwp/video.cpp @@ -71,7 +71,7 @@ bool windows_osd_interface::video_init() if (video_config.mode != VIDEO_MODE_NONE) { auto win = std::static_pointer_cast(osd_common_t::s_window_list.front()); - win->uwp_window()->Activate(); + win->platform_window()->Activate(); } return true; diff --git a/src/osd/uwp/window.cpp b/src/osd/uwp/window.cpp index 4451a4a5232..12441e17290 100644 --- a/src/osd/uwp/window.cpp +++ b/src/osd/uwp/window.cpp @@ -247,7 +247,7 @@ uwp_window_info::uwp_window_info( running_machine &machine, int index, std::shared_ptr monitor, - const osd_window_config *config) : osd_window(*config), + const osd_window_config *config) : osd_window_t(*config), m_next(nullptr), m_init_state(0), m_startmaximized(0), @@ -279,24 +279,24 @@ CoreCursor^ uwp_window_info::s_cursor = nullptr; void uwp_window_info::capture_pointer() { - uwp_window()->SetPointerCapture(); + platform_window()->SetPointerCapture(); } void uwp_window_info::release_pointer() { - uwp_window()->ReleasePointerCapture(); + platform_window()->ReleasePointerCapture(); } void uwp_window_info::hide_pointer() { - auto window = uwp_window(); + auto window = platform_window(); uwp_window_info::s_cursor = window->PointerCursor; window->PointerCursor = nullptr; } void uwp_window_info::show_pointer() { - auto window = uwp_window(); + auto window = platform_window(); window->PointerCursor = uwp_window_info::s_cursor; } @@ -501,7 +501,7 @@ void uwp_window_info::update() } // if we're visible and running and not in the middle of a resize, draw - if (platform_window() != nullptr && m_target != nullptr && has_renderer()) + if (platform_window() != nullptr && m_target != nullptr && has_renderer()) { bool got_lock = true; auto clock = std::chrono::high_resolution_clock(); @@ -545,7 +545,7 @@ void uwp_window_info::draw_video_contents(int update) std::lock_guard lock(m_render_lock); // if we're iconic, don't bother - if (platform_window() != nullptr) + if (platform_window() != nullptr) { // if no bitmap, just fill if (m_primlist == nullptr) @@ -687,9 +687,8 @@ int uwp_window_info::complete_create() // get the monitor bounds osd_rect monitorbounds = m_monitor->position_size(); - IInspectable* raw_window = reinterpret_cast(Windows::UI::Core::CoreWindow::GetForCurrentThread()); - raw_window->AddRef(); // TODO: Should probably figure out a way to auto-release - set_platform_window(raw_window); + auto coreWindow = Platform::Agile(CoreWindow::GetForCurrentThread()); + set_platform_window(coreWindow); // skip the positioning stuff for -video none */ if (video_config.mode == VIDEO_MODE_NONE) diff --git a/src/osd/uwp/window.h b/src/osd/uwp/window.h index b95676b40fb..f4907bb97ee 100644 --- a/src/osd/uwp/window.h +++ b/src/osd/uwp/window.h @@ -15,6 +15,7 @@ #include #include #include +#include #undef min #undef max @@ -46,7 +47,7 @@ // TYPE DEFINITIONS //============================================================ -class uwp_window_info : public osd_window +class uwp_window_info : public osd_window_t> { public: uwp_window_info(running_machine &machine, int index, std::shared_ptr monitor, const osd_window_config *config); @@ -60,7 +61,7 @@ public: virtual osd_dim get_size() override { - auto bounds = uwp_window()->Bounds; + auto bounds = platform_window()->Bounds; return osd_dim(bounds.Width, bounds.Height); } @@ -74,12 +75,6 @@ public: void show_pointer() override; void hide_pointer() override; - Windows::UI::Core::CoreWindow^ uwp_window() - { - auto inspectable = platform_window(); - return reinterpret_cast(inspectable); - } - virtual osd_monitor_info *monitor() const override { return m_monitor.get(); } void destroy() override; @@ -88,10 +83,6 @@ public: static void create(running_machine &machine, int index, std::shared_ptr monitor, const osd_window_config *config); - // static callbacks - - static LRESULT CALLBACK video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam); - // member variables uwp_window_info * m_next; diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index 9d86fb63301..88c0f318122 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -65,7 +65,7 @@ bool windows_osd_interface::video_init() } if (video_config.mode != VIDEO_MODE_NONE) - SetForegroundWindow(osd_common_t::s_window_list.front()->platform_window()); + SetForegroundWindow(std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window()); return true; } diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index b71ccae5c2b..3f5bbc94bd8 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -304,7 +304,7 @@ win_window_info::win_window_info( running_machine &machine, int index, std::shared_ptr monitor, - const osd_window_config *config) : osd_window(*config), + const osd_window_config *config) : osd_window_t(*config), m_next(nullptr), m_init_state(0), m_startmaximized(0), @@ -337,9 +337,9 @@ POINT win_window_info::s_saved_cursor_pos = { -1, -1 }; void win_window_info::capture_pointer() { RECT bounds; - GetClientRect(platform_window(), &bounds); - ClientToScreen(platform_window(), &reinterpret_cast(&bounds)[0]); - ClientToScreen(platform_window(), &reinterpret_cast(&bounds)[1]); + GetClientRect(platform_window(), &bounds); + ClientToScreen(platform_window(), &reinterpret_cast(&bounds)[0]); + ClientToScreen(platform_window(), &reinterpret_cast(&bounds)[1]); ClipCursor(&bounds); } @@ -423,7 +423,7 @@ void winwindow_process_events_periodic(running_machine &machine) static bool is_mame_window(HWND hwnd) { for (auto window : osd_common_t::s_window_list) - if (window->platform_window() == hwnd) + if (std::static_pointer_cast(window)->platform_window() == hwnd) return true; return false; @@ -649,10 +649,10 @@ void winwindow_toggle_full_screen(void) // iterate over windows and toggle their fullscreen state for (auto window : osd_common_t::s_window_list) - SendMessage(window->platform_window(), WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); + SendMessage(std::static_pointer_cast(window)->platform_window(), WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); // Set the first window as foreground - SetForegroundWindow(osd_common_t::s_window_list.front()->platform_window()); + SetForegroundWindow(std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window()); } @@ -668,7 +668,7 @@ BOOL winwindow_has_focus(void) // see if one of the video windows has focus for (auto window : osd_common_t::s_window_list) - if (focuswnd == window->platform_window()) + if (focuswnd == std::static_pointer_cast(window)->platform_window()) return TRUE; return FALSE; @@ -823,8 +823,8 @@ void win_window_info::destroy() osd_common_t::s_window_list.remove(shared_from_this()); // destroy the window - if (platform_window() != nullptr) - DestroyWindow(platform_window()); + if (platform_window() != nullptr) + DestroyWindow(platform_window()); // free the render target machine().render().target_free(m_target); @@ -858,14 +858,14 @@ void win_window_info::update() if (!fullscreen()) { if (m_isminimized) - SendMessage(platform_window(), WM_USER_SET_MINSIZE, 0, 0); + SendMessage(platform_window(), WM_USER_SET_MINSIZE, 0, 0); if (m_ismaximized) - SendMessage(platform_window(), WM_USER_SET_MAXSIZE, 0, 0); + SendMessage(platform_window(), WM_USER_SET_MAXSIZE, 0, 0); } } // if we're visible and running and not in the middle of a resize, draw - if (platform_window() != nullptr && m_target != nullptr && has_renderer()) + if (platform_window() != nullptr && m_target != nullptr && has_renderer()) { bool got_lock = true; @@ -889,7 +889,7 @@ void win_window_info::update() // post a redraw request with the primitive list as a parameter last_update_time = timeGetTime(); - SendMessage(platform_window(), WM_USER_REDRAW, 0, (LPARAM)primlist); + SendMessage(platform_window(), WM_USER_REDRAW, 0, (LPARAM)primlist); } } } @@ -1094,7 +1094,7 @@ int win_window_info::complete_create() // adjust the window position to the initial width/height tempwidth = (m_win_config.width != 0) ? m_win_config.width : 640; tempheight = (m_win_config.height != 0) ? m_win_config.height : 480; - SetWindowPos(platform_window(), nullptr, monitorbounds.left() + 20, monitorbounds.top() + 20, + SetWindowPos(platform_window(), nullptr, monitorbounds.left() + 20, monitorbounds.top() + 20, monitorbounds.left() + tempwidth + wnd_extra_width(), monitorbounds.top() + tempheight + wnd_extra_height(), SWP_NOZORDER); @@ -1113,14 +1113,14 @@ int win_window_info::complete_create() if (renderer().create()) return 1; - ShowWindow(platform_window(), SW_SHOW); + ShowWindow(platform_window(), SW_SHOW); } // clear the window - dc = GetDC(platform_window()); - GetClientRect(platform_window(), &client); + dc = GetDC(platform_window()); + GetClientRect(platform_window(), &client); FillRect(dc, &client, (HBRUSH)GetStockObject(BLACK_BRUSH)); - ReleaseDC(platform_window(), dc); + ReleaseDC(platform_window(), dc); return 0; } @@ -1153,7 +1153,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR HDC hdc = BeginPaint(wnd, &pstruct); window->draw_video_contents(hdc, TRUE); if (window->win_has_menu()) - DrawMenuBar(window->platform_window()); + DrawMenuBar(window->platform_window()); EndPaint(wnd, &pstruct); break; } @@ -1378,13 +1378,13 @@ void win_window_info::draw_video_contents(HDC dc, int update) std::lock_guard lock(m_render_lock); // if we're iconic, don't bother - if (platform_window() != nullptr && !IsIconic(platform_window())) + if (platform_window() != nullptr && !IsIconic(platform_window())) { // if no bitmap, just fill if (m_primlist == nullptr) { RECT fill; - GetClientRect(platform_window(), &fill); + GetClientRect(platform_window(), &fill); FillRect(dc, &fill, (HBRUSH)GetStockObject(BLACK_BRUSH)); } @@ -1633,7 +1633,7 @@ void win_window_info::update_minmax_state() // compare the maximum bounds versus the current bounds osd_dim minbounds = get_min_bounds(video_config.keepaspect); osd_dim maxbounds = get_max_bounds(video_config.keepaspect); - GetWindowRect(platform_window(), &bounds); + GetWindowRect(platform_window(), &bounds); // if either the width or height matches, we were maximized m_isminimized = (rect_width(&bounds) == minbounds.width()) || @@ -1663,12 +1663,12 @@ void win_window_info::minimize_window() // get the window rect RECT bounds; - GetWindowRect(platform_window(), &bounds); + GetWindowRect(platform_window(), &bounds); osd_rect newrect(bounds.left, bounds.top, newsize ); - SetWindowPos(platform_window(), nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); + SetWindowPos(platform_window(), nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); } @@ -1690,7 +1690,7 @@ void win_window_info::maximize_window() work.top() + (work.height() - newsize.height()) / 2, newsize); - SetWindowPos(platform_window(), nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); + SetWindowPos(platform_window(), nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); } @@ -1707,7 +1707,7 @@ void win_window_info::adjust_window_position_after_major_change() assert(GetCurrentThreadId() == window_threadid); // get the current size - GetWindowRect(platform_window(), &oldrect); + GetWindowRect(platform_window(), &oldrect); osd_rect newrect = RECT_to_osd_rect(oldrect); // adjust the window size so the client area is what we want @@ -1728,7 +1728,7 @@ void win_window_info::adjust_window_position_after_major_change() // adjust the position if different if (oldrect.left != newrect.left() || oldrect.top != newrect.top() || oldrect.right != newrect.right() || oldrect.bottom != newrect.bottom()) - SetWindowPos(platform_window(), fullscreen() ? HWND_TOPMOST : HWND_TOP, + SetWindowPos(platform_window(), fullscreen() ? HWND_TOPMOST : HWND_TOP, newrect.left(), newrect.top(), newrect.width(), newrect.height(), 0); @@ -1763,24 +1763,24 @@ void win_window_info::set_fullscreen(int fullscreen) renderer_reset(); // hide ourself - ShowWindow(platform_window(), SW_HIDE); + ShowWindow(platform_window(), SW_HIDE); // configure the window if non-fullscreen if (!fullscreen) { // adjust the style - SetWindowLong(platform_window(), GWL_STYLE, WINDOW_STYLE); - SetWindowLong(platform_window(), GWL_EXSTYLE, WINDOW_STYLE_EX); - SetWindowPos(platform_window(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowLong(platform_window(), GWL_STYLE, WINDOW_STYLE); + SetWindowLong(platform_window(), GWL_EXSTYLE, WINDOW_STYLE_EX); + SetWindowPos(platform_window(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); // force to the bottom, then back on top - SetWindowPos(platform_window(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - SetWindowPos(platform_window(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(platform_window(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(platform_window(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); // if we have previous non-fullscreen bounds, use those if (m_non_fullscreen_bounds.right != m_non_fullscreen_bounds.left) { - SetWindowPos(platform_window(), HWND_TOP, m_non_fullscreen_bounds.left, m_non_fullscreen_bounds.top, + SetWindowPos(platform_window(), HWND_TOP, m_non_fullscreen_bounds.left, m_non_fullscreen_bounds.top, rect_width(&m_non_fullscreen_bounds), rect_height(&m_non_fullscreen_bounds), SWP_NOZORDER); } @@ -1788,7 +1788,7 @@ void win_window_info::set_fullscreen(int fullscreen) // otherwise, set a small size and maximize from there else { - SetWindowPos(platform_window(), HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER); + SetWindowPos(platform_window(), HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER); maximize_window(); } } @@ -1797,15 +1797,15 @@ void win_window_info::set_fullscreen(int fullscreen) else { // save the bounds - GetWindowRect(platform_window(), &m_non_fullscreen_bounds); + GetWindowRect(platform_window(), &m_non_fullscreen_bounds); // adjust the style - SetWindowLong(platform_window(), GWL_STYLE, FULLSCREEN_STYLE); - SetWindowLong(platform_window(), GWL_EXSTYLE, FULLSCREEN_STYLE_EX); - SetWindowPos(platform_window(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowLong(platform_window(), GWL_STYLE, FULLSCREEN_STYLE); + SetWindowLong(platform_window(), GWL_EXSTYLE, FULLSCREEN_STYLE_EX); + SetWindowPos(platform_window(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); // set topmost - SetWindowPos(platform_window(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(platform_window(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } // adjust the window to compensate for the change @@ -1815,7 +1815,7 @@ void win_window_info::set_fullscreen(int fullscreen) if (!this->fullscreen() || m_fullscreen_safe) { if (video_config.mode != VIDEO_MODE_NONE) - ShowWindow(platform_window(), SW_SHOW); + ShowWindow(platform_window(), SW_SHOW); set_renderer(osd_renderer::make_for_type(video_config.mode, shared_from_this())); if (renderer().create()) diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index fa78efc2b2a..688739565fb 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -43,7 +43,7 @@ // TYPE DEFINITIONS //============================================================ -class win_window_info : public osd_window +class win_window_info : public osd_window_t { public: win_window_info(running_machine &machine, int index, std::shared_ptr monitor, const osd_window_config *config); @@ -58,7 +58,7 @@ public: virtual bool win_has_menu() override { #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - return GetMenu(platform_window()) ? true : false; + return GetMenu(platform_window()) ? true : false; #else return false; #endif @@ -68,7 +68,7 @@ public: { #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) RECT client; - GetClientRect(platform_window(), &client); + GetClientRect(platform_window(), &client); return osd_dim(client.right - client.left, client.bottom - client.top); #else throw ref new Platform::NotImplementedException(); diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index a2a81fdbd41..57fe9565f5a 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -80,7 +80,7 @@ public: winwindow_toggle_full_screen(); vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args); - win_message_box_utf8(!osd_common_t::s_window_list.empty() ? osd_common_t::s_window_list.front()->platform_window() : nullptr, buffer, emulator_info::get_appname(), MB_OK); + win_message_box_utf8(!osd_common_t::s_window_list.empty() ? std::static_pointer_cast(osd_common_t::s_window_list.front())->platform_window() : nullptr, buffer, emulator_info::get_appname(), MB_OK); } else chain_output(channel, msg, args); @@ -410,7 +410,7 @@ void MameMainApp::Run() // To satisfy the latter things, pass in the module path name char exe_path[MAX_PATH]; GetModuleFileNameA(nullptr, exe_path, MAX_PATH); - char* args[2] = { exe_path, (char*)"-verbose" }; + char* args[3] = { exe_path, (char*)"-verbose", (char*)"-mouse" }; DWORD result = emulator_info::start_frontend(*m_options.get(), *m_osd.get(), ARRAY_LENGTH(args), args); osd_output::pop(&winerror);