diff options
author | 2016-04-17 18:27:07 -0400 | |
---|---|---|
committer | 2016-04-18 10:03:01 -0400 | |
commit | 870db16e99efcb64a95ca1e321e8dacc389ce53e (patch) | |
tree | e3d1db14b8498d4cd06f55a65529f9700f8d6e57 /src | |
parent | 55d3e544e013174880c8f208264683aac6d711f9 (diff) |
Standardize platform window pointer storage in osd_window.
Also encapsulate show/hide capture/release cursor functionality.
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/modules/debugger/debugwin.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/debugger/win/debugwininfo.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/input/input_dinput.h | 2 | ||||
-rw-r--r-- | src/osd/modules/input/input_rawinput.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/input/input_sdlcommon.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/input/input_win32.cpp | 10 | ||||
-rw-r--r-- | src/osd/modules/osdwindow.h | 34 | ||||
-rw-r--r-- | src/osd/modules/render/draw13.cpp | 4 | ||||
-rw-r--r-- | src/osd/modules/render/drawbgfx.cpp | 12 | ||||
-rw-r--r-- | src/osd/modules/render/drawd3d.cpp | 12 | ||||
-rw-r--r-- | src/osd/modules/render/drawgdi.cpp | 4 | ||||
-rw-r--r-- | src/osd/modules/render/drawnone.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/render/drawogl.cpp | 4 | ||||
-rw-r--r-- | src/osd/modules/render/drawsdl.cpp | 8 | ||||
-rw-r--r-- | src/osd/modules/sound/direct_sound.cpp | 4 | ||||
-rw-r--r-- | src/osd/sdl/window.cpp | 77 | ||||
-rw-r--r-- | src/osd/sdl/window.h | 8 | ||||
-rw-r--r-- | src/osd/windows/video.cpp | 2 | ||||
-rw-r--r-- | src/osd/windows/window.cpp | 169 | ||||
-rw-r--r-- | src/osd/windows/window.h | 10 | ||||
-rw-r--r-- | src/osd/windows/winmain.cpp | 2 |
21 files changed, 221 insertions, 151 deletions
diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp index 3c85b5f4119..c3994efbd2f 100644 --- a/src/osd/modules/debugger/debugwin.cpp +++ b/src/osd/modules/debugger/debugwin.cpp @@ -236,7 +236,7 @@ void debugger_windows::show_all() void debugger_windows::hide_all() { - SetForegroundWindow(win_window_list->m_hwnd); + SetForegroundWindow(win_window_list->platform_window<HWND>()); for (debugwin_info &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 64d178de9f9..8c02ee17e1c 100644 --- a/src/osd/modules/debugger/win/debugwininfo.cpp +++ b/src/osd/modules/debugger/win/debugwininfo.cpp @@ -35,7 +35,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, win_window_list->m_hwnd, create_standard_menubar(), GetModuleHandleUni(), this); + 0, 0, 100, 100, win_window_list->platform_window<HWND>(), create_standard_menubar(), GetModuleHandleUni(), this); if (m_wnd == NULL) return; diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h index 6dacf8ebd77..f339bef561e 100644 --- a/src/osd/modules/input/input_dinput.h +++ b/src/osd/modules/input/input_dinput.h @@ -103,7 +103,7 @@ public: } // set the cooperative level - result = devinfo->dinput.device->SetCooperativeLevel(win_window_list->m_hwnd, cooperative_level); + result = devinfo->dinput.device->SetCooperativeLevel(win_window_list->platform_window<HWND>(), 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 1f281d48922..20ed82cc4a1 100644 --- a/src/osd/modules/input/input_rawinput.cpp +++ b/src/osd/modules/input/input_rawinput.cpp @@ -475,7 +475,7 @@ public: registration.usUsagePage = usagepage(); registration.usUsage = usage(); registration.dwFlags = m_global_inputs_enabled ? 0x00000100 : 0; - registration.hwndTarget = win_window_list->m_hwnd; + registration.hwndTarget = win_window_list->platform_window<HWND>(); // 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 10d9f7b3b52..85febac18f6 100644 --- a/src/osd/modules/input/input_sdlcommon.cpp +++ b/src/osd/modules/input/input_sdlcommon.cpp @@ -43,7 +43,7 @@ static inline sdl_window_info * window_from_id(Uint32 windowID) for (w = sdl_window_list; w != NULL; w = w->m_next) { //printf("w->window_id: %d\n", w->window_id); - if (w->sdl_window() == window) + if (w->platform_window<SDL_Window*>() == window) { return w; } diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp index d4cba8304b4..5bef565beed 100644 --- a/src/osd/modules/input/input_win32.cpp +++ b/src/osd/modules/input/input_win32.cpp @@ -152,7 +152,7 @@ public: mouse.lY = (cursor_info.ptScreenPos.y - win32_mouse.last_point.y) * INPUT_RELATIVE_PER_PIXEL; RECT window_pos = {0}; - GetWindowRect(win_window_list->m_hwnd, &window_pos); + GetWindowRect(win_window_list->platform_window<HWND>(), &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; @@ -274,8 +274,8 @@ public: RECT client_rect; // get the position relative to the window - GetClientRect(win_window_list->m_hwnd, &client_rect); - ScreenToClient(win_window_list->m_hwnd, &mousepos); + GetClientRect(win_window_list->platform_window<HWND>(), &client_rect); + ScreenToClient(win_window_list->platform_window<HWND>(), &mousepos); // convert to absolute coordinates xpos = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right); @@ -335,10 +335,10 @@ private: POINT mousepos; // get the position relative to the window - GetClientRect(win_window_list->m_hwnd, &client_rect); + GetClientRect(win_window_list->platform_window<HWND>(), &client_rect); mousepos.x = args.xpos; mousepos.y = args.ypos; - ScreenToClient(win_window_list->m_hwnd, &mousepos); + ScreenToClient(win_window_list->platform_window<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/osdwindow.h b/src/osd/modules/osdwindow.h index 218e48145d5..428d821413c 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -112,12 +112,13 @@ public: osd_window() : #ifndef OSD_SDL - m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0), + m_dc(0), m_resize_state(0), #endif m_primlist(nullptr), m_index(0), m_main(nullptr), - m_prescale(1) + m_prescale(1), + m_platform_window(nullptr) {} virtual ~osd_window() { } @@ -142,19 +143,30 @@ public: virtual osd_monitor_info *monitor() const = 0; -#ifdef OSD_SDL - virtual SDL_Window *sdl_window() = 0; -#else + template <class TWindow> + TWindow platform_window() const { return static_cast<TWindow>(m_platform_window); } + + void set_platform_window(void *window) + { + assert(window == nullptr || m_platform_window == nullptr); + m_platform_window = window; + } + + // Clips the pointer to the bounds of this window + virtual void capture_pointer() = 0; + + // Releases the pointer from a previously captured state + virtual void release_pointer() = 0; + + virtual void show_pointer() = 0; + virtual void hide_pointer() = 0; + +#ifndef OSD_SDL virtual bool win_has_menu() = 0; // FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ? virtual osd_monitor_info *winwindow_video_window_monitor(const osd_rect *proposed) = 0; - // window handle and info - HWND m_hwnd; HDC m_dc; // only used by GDI renderer! - // FIXME: this is the same as win_window_list->m_hwnd, i.e. first window. - // During modularization, this should be passed in differently - HWND m_focus_hwnd; int m_resize_state; #endif @@ -165,6 +177,8 @@ public: osd_window *m_main; protected: int m_prescale; +private: + void *m_platform_window; }; class osd_renderer diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 79356d4ea22..20daa28d8d4 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -437,9 +437,9 @@ int renderer_sdl1::create() } if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(window().platform_window<SDL_Window*>(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); else - m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(window().platform_window<SDL_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 f90e7f060e1..479cea4f3b2 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -164,9 +164,9 @@ int renderer_bgfx::create() bgfx::setPlatformData(blank_pd); } #ifdef OSD_WINDOWS - bgfx::winSetHwnd(window().m_hwnd); + bgfx::winSetHwnd(window().platform_window<HWND>()); #else - bgfx::sdlSetWindow(window().sdl_window()); + bgfx::sdlSetWindow(window().platform_window<SDL_Window*>()); #endif std::string backend(m_options.bgfx_backend()); if (backend == "auto") @@ -213,9 +213,9 @@ int renderer_bgfx::create() if (window().m_index != 0) { #ifdef OSD_WINDOWS - m_framebuffer = m_targets->create_backbuffer(window().m_hwnd, m_width[window().m_index], m_height[window().m_index]); + m_framebuffer = m_targets->create_backbuffer(window().platform_window<HWND>(), m_width[window().m_index], m_height[window().m_index]); #else - m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().sdl_window()), m_width[window().m_index], m_height[window().m_index]); + m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().platform_window<SDL_Window*>()), m_width[window().m_index], m_height[window().m_index]); #endif bgfx::touch(window().m_index); } @@ -803,9 +803,9 @@ bool renderer_bgfx::update_dimensions() delete m_framebuffer; #ifdef OSD_WINDOWS - m_framebuffer = m_targets->create_backbuffer(window().m_hwnd, width, height); + m_framebuffer = m_targets->create_backbuffer(window().platform_window<HWND>(), width, height); #else - m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().sdl_window()), width, height); + m_framebuffer = m_targets->create_backbuffer(sdlNativeWindowHandle(window().platform_window<SDL_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 6c7a96bbfb8..fa5dc500e2e 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -200,7 +200,7 @@ render_primitive_list *renderer_d3d9::get_primitives() { RECT client; - GetClientRectExceptMenu(window().m_hwnd, &client, window().fullscreen()); + GetClientRectExceptMenu(window().platform_window<HWND>(), &client, window().fullscreen()); if (rect_width(&client) > 0 && rect_height(&client) > 0) { window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect()); @@ -581,7 +581,7 @@ int renderer_d3d9::initialize() } // create the device immediately for the full screen case (defer for window mode) - if (window().fullscreen() && device_create(window().m_focus_hwnd)) + if (window().fullscreen() && device_create(window().m_main->platform_window<HWND>())) { return false; } @@ -827,7 +827,7 @@ try_again: m_presentation.BackBufferCount = video_config.triplebuf ? 2 : 1; m_presentation.MultiSampleType = D3DMULTISAMPLE_NONE; m_presentation.SwapEffect = D3DSWAPEFFECT_DISCARD; - m_presentation.hDeviceWindow = window().m_hwnd; + m_presentation.hDeviceWindow = window().platform_window<HWND>(); m_presentation.Windowed = !window().fullscreen() || window().win_has_menu(); m_presentation.EnableAutoDepthStencil = FALSE; m_presentation.AutoDepthStencilFormat = D3DFMT_D16; @@ -1200,7 +1200,7 @@ int renderer_d3d9::config_adapter_mode() RECT client; // bounds are from the window client rect - GetClientRectExceptMenu(window().m_hwnd, &client, window().fullscreen()); + GetClientRectExceptMenu(window().platform_window<HWND>(), &client, window().fullscreen()); m_width = client.right - client.left; m_height = client.bottom - client.top; @@ -1363,7 +1363,7 @@ int renderer_d3d9::update_window_size() { // get the current window bounds RECT client; - GetClientRectExceptMenu(window().m_hwnd, &client, window().fullscreen()); + GetClientRectExceptMenu(window().platform_window<HWND>(), &client, window().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) @@ -1381,7 +1381,7 @@ int 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(window().m_focus_hwnd)) + if (window().m_main != nullptr && device_create(window().m_main->platform_window<HWND>())) 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 ec1e5f57a4a..bfc949e5296 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -46,7 +46,7 @@ int renderer_gdi::create() render_primitive_list *renderer_gdi::get_primitives() { RECT client; - GetClientRect(window().m_hwnd, &client); + GetClientRect(window().platform_window<HWND>(), &client); window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect()); return &window().target()->get_primitives(); } @@ -63,7 +63,7 @@ int renderer_gdi::draw(const int update) // get the target bounds RECT bounds; - GetClientRect(window().m_hwnd, &bounds); + GetClientRect(window().platform_window<HWND>(), &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 d266369e7a6..5e261daafe2 100644 --- a/src/osd/modules/render/drawnone.cpp +++ b/src/osd/modules/render/drawnone.cpp @@ -22,7 +22,7 @@ render_primitive_list *renderer_none::get_primitives() { RECT client; - GetClientRect(window().m_hwnd, &client); + GetClientRect(window().platform_window<HWND>(), &client); window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect()); return &window().target()->get_primitives(); } diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index 452a3c570ab..6853602353b 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -563,9 +563,9 @@ int renderer_ogl::create() { // create renderer #if defined(OSD_WINDOWS) - m_gl_context = global_alloc(win_gl_context(window().m_hwnd)); + m_gl_context = global_alloc(win_gl_context(window().platform_window<HWND>())); #else - m_gl_context = global_alloc(sdl_gl_context(window().sdl_window())); + m_gl_context = global_alloc(sdl_gl_context(window().platform_window<SDL_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 2450dd1b8b3..a2ba368c060 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -193,16 +193,16 @@ int renderer_sdl2::create() if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(window().platform_window<SDL_Window*>(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED); else - m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_ACCELERATED); + m_sdl_renderer = SDL_CreateRenderer(window().platform_window<SDL_Window*>(), -1, SDL_RENDERER_ACCELERATED); if (!m_sdl_renderer) { if (video_config.waitvsync) - m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE); + m_sdl_renderer = SDL_CreateRenderer(window().platform_window<SDL_Window*>(), -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE); else - m_sdl_renderer = SDL_CreateRenderer(window().sdl_window(), -1, SDL_RENDERER_SOFTWARE); + m_sdl_renderer = SDL_CreateRenderer(window().platform_window<SDL_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 0ec810578a3..83b7edd65ca 100644 --- a/src/osd/modules/sound/direct_sound.cpp +++ b/src/osd/modules/sound/direct_sound.cpp @@ -404,10 +404,10 @@ HRESULT sound_direct_sound::dsound_init() #ifdef SDLMAME_WIN32 SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version); - SDL_GetWindowWMInfo(sdl_window_list->sdl_window(), &wminfo); + SDL_GetWindowWMInfo(sdl_window_list->platform_window<SDL_Window*>(), &wminfo); HWND const window = wminfo.info.win.window; #else // SDLMAME_WIN32 - HWND const window = win_window_list->m_hwnd; + HWND const window = win_window_list->platform_window<HWND>(); #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 7cec35d400a..e6d4c71b4a3 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -377,6 +377,31 @@ void sdl_osd_interface::window_exit() } +void sdl_window_info::capture_pointer() +{ + if (!SDL_GetWindowGrab(platform_window<SDL_Window*>())) + SDL_SetWindowGrab(platform_window<SDL_Window*>(), SDL_TRUE); + SDL_SetRelativeMouseMode(SDL_TRUE); +} + +void sdl_window_info::release_pointer() +{ + if (SDL_GetWindowGrab(platform_window<SDL_Window*>())) + SDL_SetWindowGrab(platform_window<SDL_Window*>(), SDL_FALSE); + SDL_SetRelativeMouseMode(SDL_FALSE); +} + +void sdl_window_info::hide_pointer() +{ + SDL_ShowCursor(SDL_DISABLE); +} + +void sdl_window_info::show_pointer() +{ + SDL_ShowCursor(SDL_ENABLE); + +} + //============================================================ // sdlwindow_resize @@ -392,7 +417,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_resize_wt ) ASSERT_WINDOW_THREAD(); - SDL_SetWindowSize(window->sdl_window(), width, height); + SDL_SetWindowSize(window->platform_window<SDL_Window*>(), width, height); window->renderer().notify_changed(); osd_free(wp); @@ -475,11 +500,11 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) #endif if (window->fullscreen() && (video_config.switchres || is_osx)) { - SDL_SetWindowFullscreen(window->sdl_window(), 0); // Try to set mode - SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode->mode); // Try to set mode - SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode + SDL_SetWindowFullscreen(window->platform_window<SDL_Window*>(), 0); // Try to set mode + SDL_SetWindowDisplayMode(window->platform_window<SDL_Window*>(), &window->m_original_mode->mode); // Try to set mode + SDL_SetWindowFullscreen(window->platform_window<SDL_Window*>(), SDL_WINDOW_FULLSCREEN); // Try to set mode } - SDL_DestroyWindow(window->sdl_window()); + SDL_DestroyWindow(window->platform_window<SDL_Window*>()); downcast<sdl_osd_interface &>(window->machine().osd()).release_keys(); @@ -555,20 +580,17 @@ void sdl_window_info::update_cursor_state() if (!fullscreen() && !should_hide_mouse) { - SDL_ShowCursor(SDL_ENABLE); - if (SDL_GetWindowGrab(sdl_window() )) - SDL_SetWindowGrab(sdl_window(), SDL_FALSE); - SDL_SetRelativeMouseMode(SDL_FALSE); + show_pointer(); + release_pointer(); } else { - SDL_ShowCursor(SDL_DISABLE); - if (!SDL_GetWindowGrab(sdl_window())) - SDL_SetWindowGrab(sdl_window(), SDL_TRUE); - SDL_SetRelativeMouseMode(SDL_TRUE); + hide_pointer(); + capture_pointer(); } + SDL_SetCursor(nullptr); // Force an update in case the underlying driver has changed visibility - } + } #endif } @@ -657,11 +679,11 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt ) if (window->fullscreen() && video_config.switchres) { - SDL_SetWindowFullscreen(window->sdl_window(), 0); // Try to set mode - SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode->mode); // Try to set mode - SDL_SetWindowFullscreen(window->sdl_window(), SDL_WINDOW_FULLSCREEN); // Try to set mode + SDL_SetWindowFullscreen(window->platform_window<SDL_Window*>(), 0); // Try to set mode + SDL_SetWindowDisplayMode(window->platform_window<SDL_Window*>(), &window->m_original_mode->mode); // Try to set mode + SDL_SetWindowFullscreen(window->platform_window<SDL_Window*>(), SDL_WINDOW_FULLSCREEN); // Try to set mode } - SDL_DestroyWindow(window->sdl_window()); + SDL_DestroyWindow(window->platform_window<SDL_Window*>()); // release all keys ... downcast<sdl_osd_interface &>(window->machine().osd()).release_keys(); @@ -928,14 +950,14 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) osd_rect work = window->monitor()->usuable_position_size(); // create the SDL window - window->m_sdl_window = SDL_CreateWindow(window->m_title, + auto sdlwindow = SDL_CreateWindow(window->m_title, work.left() + (work.width() - temp.width()) / 2, work.top() + (work.height() - temp.height()) / 2, temp.width(), temp.height(), window->m_extra_flags); //window().sdl_window() = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, // width, height, m_extra_flags); - if ( window->m_sdl_window == nullptr ) + if (sdlwindow == nullptr ) { if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_OPENGL)) osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError()); @@ -944,18 +966,20 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) return (void *) &result[1]; } + window->set_platform_window(sdlwindow); + if (window->fullscreen() && video_config.switchres) { SDL_DisplayMode mode; //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode); - SDL_GetWindowDisplayMode(window->sdl_window(), &mode); + SDL_GetWindowDisplayMode(window->platform_window<SDL_Window*>(), &mode); window->m_original_mode->mode = mode; mode.w = temp.width(); mode.h = temp.height(); if (window->m_win_config.refresh) mode.refresh_rate = window->m_win_config.refresh; - SDL_SetWindowDisplayMode(window->sdl_window(), &mode); // Try to set mode + SDL_SetWindowDisplayMode(window->platform_window<SDL_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 @@ -971,14 +995,14 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) // show window - SDL_ShowWindow(window->sdl_window()); + SDL_ShowWindow(window->platform_window<SDL_Window*>()); //SDL_SetWindowFullscreen(window->sdl_window(), 0); //SDL_SetWindowFullscreen(window->sdl_window(), window->fullscreen()); - SDL_RaiseWindow(window->sdl_window()); + SDL_RaiseWindow(window->platform_window<SDL_Window*>()); #ifdef SDLMAME_WIN32 if (window->fullscreen()) - SDL_SetWindowGrab(window->sdl_window(), SDL_TRUE); + SDL_SetWindowGrab(window->platform_window<SDL_Window*>(), SDL_TRUE); #endif // set main window @@ -1308,7 +1332,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(m_sdl_window, &w, &h); + SDL_GetWindowSize(platform_window<SDL_Window*>(), &w, &h); return osd_dim(w,h); } @@ -1368,7 +1392,6 @@ sdl_window_info::sdl_window_info(running_machine &a_machine, int index, osd_moni m_minimum_dim(0,0), m_windowed_dim(0,0), m_rendered_event(0, 1), m_target(0), - m_sdl_window(NULL), m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0) { m_win_config = *config; diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index 7a62d3a5925..0a8abf24c10 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -47,6 +47,11 @@ public: void resize(INT32 width, INT32 height); void destroy(); + void capture_pointer() override; + void release_pointer() override; + void show_pointer() override; + void hide_pointer() override; + void notify_changed(); osd_dim get_size() override; @@ -58,7 +63,6 @@ public: int fullscreen() const override { return m_fullscreen; } render_target *target() override { return m_target; } - SDL_Window *sdl_window() override { return m_sdl_window; } int prescale() const { return m_prescale; } osd_renderer &renderer() const { return *m_renderer; } @@ -84,8 +88,6 @@ private: osd_event m_rendered_event; render_target * m_target; - // Needs to be here as well so we can identify window - SDL_Window *m_sdl_window; // Original display_mode SDL_DM_Wrapper *m_original_mode; diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index d73ad8bf522..c4ee864389a 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -81,7 +81,7 @@ bool windows_osd_interface::video_init() } if (video_config.mode != VIDEO_MODE_NONE) - SetForegroundWindow(win_window_list->m_hwnd); + SetForegroundWindow(win_window_list->platform_window<HWND>()); return true; } diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index c2f05428ec2..612e55237e8 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -304,6 +304,9 @@ void windows_osd_interface::window_exit() { assert(GetCurrentThreadId() == main_threadid); + // if we hid the cursor during the emulation, show it + win_window_list->show_pointer(); + // free all the windows while (win_window_list != nullptr) { @@ -343,9 +346,6 @@ void windows_osd_interface::window_exit() // kill the window thread ready event if (window_thread_ready_event) CloseHandle(window_thread_ready_event); - - // if we hid the cursor during the emulation, show it - while (ShowCursor(TRUE) < 0) ; } win_window_info::win_window_info(running_machine &machine) @@ -380,9 +380,44 @@ win_window_info::~win_window_info() if (m_renderer != nullptr) { delete m_renderer; + } +} + +POINT win_window_info::s_saved_cursor_pos = { -1, -1 }; + +void win_window_info::capture_pointer() +{ + RECT bounds; + GetClientRect(platform_window<HWND>(), &bounds); + ClientToScreen(platform_window<HWND>(), &reinterpret_cast<POINT *>(&bounds)[0]); + ClientToScreen(platform_window<HWND>(), &reinterpret_cast<POINT *>(&bounds)[1]); + ClipCursor(&bounds); +} + +void win_window_info::release_pointer() +{ + ClipCursor(nullptr); } + +void win_window_info::hide_pointer() +{ + GetCursorPos(&s_saved_cursor_pos); + + while (ShowCursor(FALSE) >= -1) {}; + ShowCursor(TRUE); } +void win_window_info::show_pointer() +{ + if (s_saved_cursor_pos.x != -1 || s_saved_cursor_pos.y != -1) + { + SetCursorPos(s_saved_cursor_pos.x, s_saved_cursor_pos.y); + s_saved_cursor_pos.x = s_saved_cursor_pos.y = -1; + } + + while (ShowCursor(TRUE) < 1) {}; + ShowCursor(FALSE); +} //============================================================ // winwindow_process_events_periodic @@ -410,7 +445,7 @@ void winwindow_process_events_periodic(running_machine &machine) static BOOL is_mame_window(HWND hwnd) { for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next) - if (window->m_hwnd == hwnd) + if (window->platform_window<HWND>() == hwnd) return TRUE; return FALSE; @@ -658,8 +693,8 @@ void winwindow_toggle_full_screen(void) // iterate over windows and toggle their fullscreen state for (window = win_window_list; window != nullptr; window = window->m_next) - SendMessage(window->m_hwnd, WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); - SetForegroundWindow(win_window_list->m_hwnd); + SendMessage(window->platform_window<HWND>(), WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); + SetForegroundWindow(win_window_list->platform_window<HWND>()); } @@ -676,7 +711,7 @@ BOOL winwindow_has_focus(void) // see if one of the video windows has focus for (window = win_window_list; window != nullptr; window = window->m_next) - if (focuswnd == window->m_hwnd) + if (focuswnd == window->platform_window<HWND>()) return TRUE; return FALSE; @@ -690,10 +725,10 @@ BOOL winwindow_has_focus(void) void winwindow_update_cursor_state(running_machine &machine) { - static POINT saved_cursor_pos = { -1, -1 }; - assert(GetCurrentThreadId() == main_threadid); + win_window_info *window = win_window_list; + // if we should hide the mouse cursor, then do it // rules are: // 1. we must have focus before hiding the cursor @@ -702,35 +737,19 @@ void winwindow_update_cursor_state(running_machine &machine) // the input system requests it if (winwindow_has_focus() && ((!video_config.windowed && !win_window_list->win_has_menu()) || (!machine.paused() && downcast<windows_osd_interface&>(machine.osd()).should_hide_mouse()))) { - win_window_info *window = win_window_list; - RECT bounds; - // hide cursor - while (ShowCursor(FALSE) >= -1) { }; - ShowCursor(TRUE); - - // store the cursor position - GetCursorPos(&saved_cursor_pos); + window->hide_pointer(); - // clip cursor to game video window - GetClientRect(window->m_hwnd, &bounds); - ClientToScreen(window->m_hwnd, &((POINT *)&bounds)[0]); - ClientToScreen(window->m_hwnd, &((POINT *)&bounds)[1]); - ClipCursor(&bounds); + // clip pointer to game video window + window->capture_pointer(); } else { // show cursor - while (ShowCursor(TRUE) < 1) { }; - ShowCursor(FALSE); + window->show_pointer(); // allow cursor to move freely - ClipCursor(nullptr); - if (saved_cursor_pos.x != -1 || saved_cursor_pos.y != -1) - { - SetCursorPos(saved_cursor_pos.x, saved_cursor_pos.y); - saved_cursor_pos.x = saved_cursor_pos.y = -1; - } + window->release_pointer(); } } @@ -766,6 +785,12 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in } } } + else + { + // Give the main window a reference to itself + window->m_main = window; + } + // see if we are safe for fullscreen window->m_fullscreen_safe = TRUE; for (win = win_window_list; win != nullptr; win = win->m_next) @@ -828,8 +853,8 @@ void win_window_info::destroy() } // destroy the window - if (m_hwnd != nullptr) - SendMessage(m_hwnd, WM_USER_SELF_TERMINATE, 0, 0); + if (platform_window<HWND>() != nullptr) + SendMessage(platform_window<HWND>(), WM_USER_SELF_TERMINATE, 0, 0); // free the render target machine().render().target_free(m_target); @@ -865,14 +890,14 @@ void win_window_info::update() if (!m_fullscreen) { if (m_isminimized) - SendMessage(m_hwnd, WM_USER_SET_MINSIZE, 0, 0); + SendMessage(platform_window<HWND>(), WM_USER_SET_MINSIZE, 0, 0); if (m_ismaximized) - SendMessage(m_hwnd, WM_USER_SET_MAXSIZE, 0, 0); + SendMessage(platform_window<HWND>(), WM_USER_SET_MAXSIZE, 0, 0); } } // if we're visible and running and not in the middle of a resize, draw - if (m_hwnd != nullptr && m_target != nullptr && m_renderer != nullptr) + if (platform_window<HWND>() != nullptr && m_target != nullptr && m_renderer != nullptr) { bool got_lock = true; @@ -900,7 +925,7 @@ void win_window_info::update() // post a redraw request with the primitive list as a parameter last_update_time = timeGetTime(); mtlog_add("winwindow_video_window_update: PostMessage start"); - SendMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist); + SendMessage(platform_window<HWND>(), WM_USER_REDRAW, 0, (LPARAM)primlist); mtlog_add("winwindow_video_window_update: PostMessage end"); } } @@ -932,7 +957,7 @@ osd_monitor_info *win_window_info::winwindow_video_window_monitor(const osd_rect monitor = win_monitor_info::monitor_from_handle(MonitorFromRect(&p, MONITOR_DEFAULTTONEAREST)); } else - monitor = win_monitor_info::monitor_from_handle(MonitorFromWindow(m_hwnd, MONITOR_DEFAULTTONEAREST)); + monitor = win_monitor_info::monitor_from_handle(MonitorFromWindow(platform_window<HWND>(), MONITOR_DEFAULTTONEAREST)); } // in full screen, just use the configured monitor @@ -1238,7 +1263,7 @@ int win_window_info::complete_create() } // create the window, but don't show it yet - m_hwnd = win_create_window_ex_utf8( + HWND hwnd = win_create_window_ex_utf8( m_fullscreen ? FULLSCREEN_STYLE_EX : WINDOW_STYLE_EX, "MAME", m_title, @@ -1249,14 +1274,14 @@ int win_window_info::complete_create() menu, GetModuleHandleUni(), nullptr); - if (m_hwnd == nullptr) + + if (hwnd == nullptr) return 1; - // set window #0 as the focus window for all windows, required for D3D & multimonitor - m_focus_hwnd = win_window_list->m_hwnd; + set_platform_window(hwnd); // set a pointer back to us - SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)this); // skip the positioning stuff for -video none */ if (video_config.mode == VIDEO_MODE_NONE) @@ -1265,7 +1290,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(m_hwnd, nullptr, monitorbounds.left() + 20, monitorbounds.top() + 20, + SetWindowPos(platform_window<HWND>(), nullptr, monitorbounds.left() + 20, monitorbounds.top() + 20, monitorbounds.left() + tempwidth + wnd_extra_width(), monitorbounds.top() + tempheight + wnd_extra_height(), SWP_NOZORDER); @@ -1289,14 +1314,14 @@ int win_window_info::complete_create() if (m_renderer->create()) return 1; - ShowWindow(m_hwnd, SW_SHOW); + ShowWindow(platform_window<HWND>(), SW_SHOW); } // clear the window - dc = GetDC(m_hwnd); - GetClientRect(m_hwnd, &client); + dc = GetDC(platform_window<HWND>()); + GetClientRect(platform_window<HWND>(), &client); FillRect(dc, &client, (HBRUSH)GetStockObject(BLACK_BRUSH)); - ReleaseDC(m_hwnd, dc); + ReleaseDC(platform_window<HWND>(), dc); return 0; } @@ -1329,7 +1354,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->m_hwnd); + DrawMenuBar(window->platform_window<HWND>()); EndPaint(wnd, &pstruct); break; } @@ -1484,7 +1509,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR case WM_DESTROY: global_free(window->m_renderer); window->m_renderer = nullptr; - window->m_hwnd = nullptr; + window->set_platform_window(nullptr); return DefWindowProc(wnd, message, wparam, lparam); // self redraw: draw ourself in a non-painty way @@ -1503,7 +1528,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR // self destruct case WM_USER_SELF_TERMINATE: - DestroyWindow(window->m_hwnd); + DestroyWindow(window->platform_window<HWND>()); break; // fullscreen set @@ -1566,13 +1591,13 @@ void win_window_info::draw_video_contents(HDC dc, int update) mtlog_add("draw_video_contents: render lock acquired"); // if we're iconic, don't bother - if (m_hwnd != nullptr && !IsIconic(m_hwnd)) + if (platform_window<HWND>() != nullptr && !IsIconic(platform_window<HWND>())) { // if no bitmap, just fill if (m_primlist == nullptr) { RECT fill; - GetClientRect(m_hwnd, &fill); + GetClientRect(platform_window<HWND>(), &fill); FillRect(dc, &fill, (HBRUSH)GetStockObject(BLACK_BRUSH)); } @@ -1820,7 +1845,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(m_hwnd, &bounds); + GetWindowRect(platform_window<HWND>(), &bounds); // if either the width or height matches, we were maximized m_isminimized = (rect_width(&bounds) == minbounds.width()) || @@ -1850,12 +1875,12 @@ void win_window_info::minimize_window() // get the window rect RECT bounds; - GetWindowRect(m_hwnd, &bounds); + GetWindowRect(platform_window<HWND>(), &bounds); osd_rect newrect(bounds.left, bounds.top, newsize ); - SetWindowPos(m_hwnd, nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); + SetWindowPos(platform_window<HWND>(), nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); } @@ -1877,7 +1902,7 @@ void win_window_info::maximize_window() work.top() + (work.height() - newsize.height()) / 2, newsize); - SetWindowPos(m_hwnd, nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); + SetWindowPos(platform_window<HWND>(), nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); } @@ -1894,7 +1919,7 @@ void win_window_info::adjust_window_position_after_major_change() assert(GetCurrentThreadId() == window_threadid); // get the current size - GetWindowRect(m_hwnd, &oldrect); + GetWindowRect(platform_window<HWND>(), &oldrect); osd_rect newrect = RECT_to_osd_rect(oldrect); // adjust the window size so the client area is what we want @@ -1915,7 +1940,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(m_hwnd, m_fullscreen ? HWND_TOPMOST : HWND_TOP, + SetWindowPos(platform_window<HWND>(), m_fullscreen ? HWND_TOPMOST : HWND_TOP, newrect.left(), newrect.top(), newrect.width(), newrect.height(), 0); @@ -1948,24 +1973,24 @@ void win_window_info::set_fullscreen(int fullscreen) m_renderer = nullptr; // hide ourself - ShowWindow(m_hwnd, SW_HIDE); + ShowWindow(platform_window<HWND>(), SW_HIDE); // configure the window if non-fullscreen if (!fullscreen) { // adjust the style - SetWindowLong(m_hwnd, GWL_STYLE, WINDOW_STYLE); - SetWindowLong(m_hwnd, GWL_EXSTYLE, WINDOW_STYLE_EX); - SetWindowPos(m_hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowLong(platform_window<HWND>(), GWL_STYLE, WINDOW_STYLE); + SetWindowLong(platform_window<HWND>(), GWL_EXSTYLE, WINDOW_STYLE_EX); + SetWindowPos(platform_window<HWND>(), 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); // force to the bottom, then back on top - SetWindowPos(m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(platform_window<HWND>(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(platform_window<HWND>(), 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(m_hwnd, HWND_TOP, m_non_fullscreen_bounds.left, m_non_fullscreen_bounds.top, + SetWindowPos(platform_window<HWND>(), 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); } @@ -1973,7 +1998,7 @@ void win_window_info::set_fullscreen(int fullscreen) // otherwise, set a small size and maximize from there else { - SetWindowPos(m_hwnd, HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER); + SetWindowPos(platform_window<HWND>(), HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER); maximize_window(); } } @@ -1982,15 +2007,15 @@ void win_window_info::set_fullscreen(int fullscreen) else { // save the bounds - GetWindowRect(m_hwnd, &m_non_fullscreen_bounds); + GetWindowRect(platform_window<HWND>(), &m_non_fullscreen_bounds); // adjust the style - SetWindowLong(m_hwnd, GWL_STYLE, FULLSCREEN_STYLE); - SetWindowLong(m_hwnd, GWL_EXSTYLE, FULLSCREEN_STYLE_EX); - SetWindowPos(m_hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowLong(platform_window<HWND>(), GWL_STYLE, FULLSCREEN_STYLE); + SetWindowLong(platform_window<HWND>(), GWL_EXSTYLE, FULLSCREEN_STYLE_EX); + SetWindowPos(platform_window<HWND>(), 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); // set topmost - SetWindowPos(m_hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(platform_window<HWND>(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } // adjust the window to compensate for the change @@ -2000,7 +2025,7 @@ void win_window_info::set_fullscreen(int fullscreen) if (!m_fullscreen || m_fullscreen_safe) { if (video_config.mode != VIDEO_MODE_NONE) - ShowWindow(m_hwnd, SW_SHOW); + ShowWindow(platform_window<HWND>(), SW_SHOW); m_renderer = reinterpret_cast<osd_renderer *>(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this))); if (m_renderer->create()) diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index 8ca2d832b47..be9f4c4ee63 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -59,7 +59,7 @@ public: virtual bool win_has_menu() override { #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - return GetMenu(m_hwnd) ? true : false; + return GetMenu(platform_window<HWND>()) ? true : false; #else return false; #endif @@ -69,13 +69,18 @@ public: { #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) RECT client; - GetClientRect(m_hwnd, &client); + GetClientRect(platform_window<HWND>(), &client); return osd_dim(client.right - client.left, client.bottom - client.top); #else throw ref new Platform::NotImplementedException(); #endif } + void capture_pointer() override; + void release_pointer() override; + void show_pointer() override; + void hide_pointer() override; + virtual osd_monitor_info *monitor() const override { return m_monitor; } void destroy(); @@ -137,6 +142,7 @@ private: void adjust_window_position_after_major_change(); void set_fullscreen(int fullscreen); + static POINT s_saved_cursor_pos; running_machine & m_machine; }; diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 115d33395db..ba3e6af9c4a 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -73,7 +73,7 @@ public: winwindow_toggle_full_screen(); vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args); - win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : nullptr, buffer, emulator_info::get_appname(), MB_OK); + win_message_box_utf8(win_window_list ? win_window_list->platform_window<HWND>() : nullptr, buffer, emulator_info::get_appname(), MB_OK); } else chain_output(channel, msg, args); |