mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Merge pull request #944 from bradhugh/unify_windowlist
Unify window_list in Windows and SDL OSD
This commit is contained in:
commit
6c1464238c
@ -237,7 +237,7 @@ void debugger_windows::show_all()
|
||||
|
||||
void debugger_windows::hide_all()
|
||||
{
|
||||
SetForegroundWindow(win_window_list.front()->platform_window<HWND>());
|
||||
SetForegroundWindow(osd_common_t::s_window_list.front()->platform_window<HWND>());
|
||||
for (debugwin_info &info : m_window_list)
|
||||
info.hide();
|
||||
}
|
||||
|
@ -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, win_window_list.front()->platform_window<HWND>(), create_standard_menubar(), GetModuleHandleUni(), this);
|
||||
0, 0, 100, 100, osd_common_t::s_window_list.front()->platform_window<HWND>(), create_standard_menubar(), GetModuleHandleUni(), this);
|
||||
if (m_wnd == nullptr)
|
||||
return;
|
||||
|
||||
|
@ -574,7 +574,7 @@ public:
|
||||
dinput_joystick_device *devinfo;
|
||||
int result = 0;
|
||||
|
||||
if (!win_window_list.empty() && win_window_list.front()->win_has_menu())
|
||||
if (!osd_common_t::s_window_list.empty() && osd_common_t::s_window_list.front()->win_has_menu())
|
||||
cooperative_level = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE;
|
||||
|
||||
// allocate and link in a new device
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
}
|
||||
|
||||
// set the cooperative level
|
||||
result = devinfo->dinput.device->SetCooperativeLevel(win_window_list.front()->platform_window<HWND>(), cooperative_level);
|
||||
result = devinfo->dinput.device->SetCooperativeLevel(osd_common_t::s_window_list.front()->platform_window<HWND>(), cooperative_level);
|
||||
if (result != DI_OK)
|
||||
goto error;
|
||||
|
||||
|
@ -475,7 +475,7 @@ public:
|
||||
registration.usUsagePage = usagepage();
|
||||
registration.usUsage = usage();
|
||||
registration.dwFlags = m_global_inputs_enabled ? 0x00000100 : 0;
|
||||
registration.hwndTarget = win_window_list.front()->platform_window<HWND>();
|
||||
registration.hwndTarget = osd_common_t::s_window_list.front()->platform_window<HWND>();
|
||||
|
||||
// register the device
|
||||
register_rawinput_devices(®istration, 1, sizeof(registration));
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
case SDL_KEYDOWN:
|
||||
keyboard.state[OSD_SDL_INDEX_KEYSYM(&sdlevent.key.keysym)] = 0x80;
|
||||
if (sdlevent.key.keysym.sym < 0x20)
|
||||
machine().ui_input().push_char_event(sdl_window_list.front()->target(), sdlevent.key.keysym.sym);
|
||||
machine().ui_input().push_char_event(osd_common_t::s_window_list.front()->target(), sdlevent.key.keysym.sym);
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
@ -155,7 +155,7 @@ public:
|
||||
if (*sdlevent.text.text)
|
||||
{
|
||||
auto window = GET_FOCUS_WINDOW(&event.text);
|
||||
//printf("Focus window is %p - wl %p\n", window, sdl_window_list);
|
||||
//printf("Focus window is %p - wl %p\n", window, osd_common_t::s_window_list);
|
||||
if (window != nullptr)
|
||||
{
|
||||
auto ptr = sdlevent.text.text;
|
||||
|
@ -39,12 +39,12 @@ static inline std::shared_ptr<sdl_window_info> window_from_id(Uint32 windowID)
|
||||
{
|
||||
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
||||
|
||||
for (auto w : sdl_window_list)
|
||||
for (auto w : osd_common_t::s_window_list)
|
||||
{
|
||||
//printf("w->window_id: %d\n", w->window_id);
|
||||
if (w->platform_window<SDL_Window*>() == window)
|
||||
{
|
||||
return w;
|
||||
return std::static_pointer_cast<sdl_window_info>(w);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -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.front()->platform_window<HWND>(), &window_pos);
|
||||
GetWindowRect(osd_common_t::s_window_list.front()->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;
|
||||
@ -269,13 +269,13 @@ public:
|
||||
|
||||
// get the cursor position and transform into final results
|
||||
GetCursorPos(&mousepos);
|
||||
if (!win_window_list.empty())
|
||||
if (!osd_common_t::s_window_list.empty())
|
||||
{
|
||||
RECT client_rect;
|
||||
|
||||
// get the position relative to the window
|
||||
GetClientRect(win_window_list.front()->platform_window<HWND>(), &client_rect);
|
||||
ScreenToClient(win_window_list.front()->platform_window<HWND>(), &mousepos);
|
||||
GetClientRect(osd_common_t::s_window_list.front()->platform_window<HWND>(), &client_rect);
|
||||
ScreenToClient(osd_common_t::s_window_list.front()->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.front()->platform_window<HWND>(), &client_rect);
|
||||
GetClientRect(osd_common_t::s_window_list.front()->platform_window<HWND>(), &client_rect);
|
||||
mousepos.x = args.xpos;
|
||||
mousepos.y = args.ypos;
|
||||
ScreenToClient(win_window_list.front()->platform_window<HWND>(), &mousepos);
|
||||
ScreenToClient(osd_common_t::s_window_list.front()->platform_window<HWND>(), &mousepos);
|
||||
|
||||
// convert to absolute coordinates
|
||||
mouse.lX = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right);
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
virtual bool should_hide_mouse()
|
||||
{
|
||||
if (winwindow_has_focus() // has focus
|
||||
&& (!video_config.windowed || !win_window_list.front()->win_has_menu()) // not windowed or doesn't have a menu
|
||||
&& (!video_config.windowed || !osd_common_t::s_window_list.front()->win_has_menu()) // not windowed or doesn't have a menu
|
||||
&& (input_enabled() && !input_paused()) // input enabled and not paused
|
||||
&& (mouse_enabled() || lightgun_enabled())) // either mouse or lightgun enabled in the core
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ public:
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!win_window_list.empty() && win_window_list.front()->win_has_menu())
|
||||
if (!osd_common_t::s_window_list.empty() && osd_common_t::s_window_list.front()->win_has_menu())
|
||||
cooperative_level = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE;
|
||||
|
||||
// allocate and link in a new device
|
||||
|
@ -159,6 +159,8 @@ osd_options::osd_options()
|
||||
add_entries(osd_options::s_option_entries);
|
||||
}
|
||||
|
||||
// Window list
|
||||
std::list<std::shared_ptr<osd_window>> osd_common_t::s_window_list;
|
||||
|
||||
//-------------------------------------------------
|
||||
// osd_interface - constructor
|
||||
|
@ -164,6 +164,7 @@ private:
|
||||
};
|
||||
|
||||
// ======================> osd_interface
|
||||
class osd_window;
|
||||
|
||||
// description of the currently-running machine
|
||||
class osd_common_t : public osd_interface, osd_output
|
||||
@ -237,6 +238,8 @@ public:
|
||||
void set_verbose(bool print_verbose) { m_print_verbose = print_verbose; }
|
||||
|
||||
void notify(const char *outname, INT32 value) const { m_output->notify(outname, value); }
|
||||
|
||||
static std::list<std::shared_ptr<osd_window>> s_window_list;
|
||||
protected:
|
||||
virtual bool input_init();
|
||||
virtual void input_pause();
|
||||
|
@ -21,10 +21,6 @@
|
||||
#include "render/drawsdl.h"
|
||||
#endif
|
||||
|
||||
osd_window::~osd_window()
|
||||
{
|
||||
}
|
||||
|
||||
std::unique_ptr<osd_renderer> osd_renderer::make_for_type(int mode, std::shared_ptr<osd_window> window, int extra_flags)
|
||||
{
|
||||
switch(mode)
|
||||
|
@ -125,8 +125,6 @@ public:
|
||||
m_main(nullptr)
|
||||
{}
|
||||
|
||||
virtual ~osd_window();
|
||||
|
||||
virtual render_target *target() = 0;
|
||||
virtual int fullscreen() const = 0;
|
||||
virtual running_machine &machine() const = 0;
|
||||
@ -175,6 +173,9 @@ public:
|
||||
virtual void show_pointer() = 0;
|
||||
virtual void hide_pointer() = 0;
|
||||
|
||||
virtual void update() = 0;
|
||||
virtual void destroy() = 0;
|
||||
|
||||
void renderer_reset() { m_renderer.reset(); }
|
||||
#ifndef OSD_SDL
|
||||
virtual bool win_has_menu() = 0;
|
||||
|
@ -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.front()->platform_window<SDL_Window*>(), &wminfo);
|
||||
SDL_GetWindowWMInfo(osd_common_t::s_window_list.front()->platform_window<SDL_Window*>(), &wminfo);
|
||||
HWND const window = wminfo.info.win.window;
|
||||
#else // SDLMAME_WIN32
|
||||
HWND const window = win_window_list.front()->platform_window<HWND>();
|
||||
HWND const window = osd_common_t::s_window_list.front()->platform_window<HWND>();
|
||||
#endif // SDLMAME_WIN32
|
||||
result = m_dsound->SetCooperativeLevel(window, DSSCL_PRIORITY);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void sdl_osd_interface::update(bool skip_redraw)
|
||||
if (!skip_redraw)
|
||||
{
|
||||
// profiler_mark(PROFILER_BLIT);
|
||||
for (auto window : sdl_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
window->update();
|
||||
// profiler_mark(PROFILER_END);
|
||||
}
|
||||
@ -273,11 +273,11 @@ static void check_osd_inputs(running_machine &machine)
|
||||
// check for toggling fullscreen mode
|
||||
if (machine.ui_input().pressed(IPT_OSD_1))
|
||||
{
|
||||
for (auto curwin : sdl_window_list)
|
||||
curwin->toggle_full_screen();
|
||||
for (auto curwin : osd_common_t::s_window_list)
|
||||
std::static_pointer_cast<sdl_window_info>(curwin)->toggle_full_screen();
|
||||
}
|
||||
|
||||
auto window = sdl_window_list.front();
|
||||
auto window = osd_common_t::s_window_list.front();
|
||||
if (machine.ui_input().pressed(IPT_OSD_2))
|
||||
{
|
||||
//FIXME: on a per window basis
|
||||
@ -304,10 +304,10 @@ static void check_osd_inputs(running_machine &machine)
|
||||
#endif
|
||||
|
||||
if (machine.ui_input().pressed(IPT_OSD_6))
|
||||
window->modify_prescale(-1);
|
||||
std::static_pointer_cast<sdl_window_info>(window)->modify_prescale(-1);
|
||||
|
||||
if (machine.ui_input().pressed(IPT_OSD_7))
|
||||
window->modify_prescale(1);
|
||||
std::static_pointer_cast<sdl_window_info>(window)->modify_prescale(1);
|
||||
|
||||
if (machine.ui_input().pressed(IPT_OSD_8))
|
||||
window->renderer().record();
|
||||
|
@ -64,12 +64,6 @@
|
||||
#define WMSZ_RIGHT (7)
|
||||
#endif
|
||||
|
||||
//============================================================
|
||||
// GLOBAL VARIABLES
|
||||
//============================================================
|
||||
|
||||
std::list<std::shared_ptr<sdl_window_info>> sdl_window_list;
|
||||
|
||||
class SDL_DM_Wrapper
|
||||
{
|
||||
public:
|
||||
@ -154,7 +148,7 @@ bool sdl_osd_interface::window_init()
|
||||
|
||||
void sdl_osd_interface::update_slider_list()
|
||||
{
|
||||
for (auto window : sdl_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
{
|
||||
// check if any window has dirty sliders
|
||||
if (window->renderer().sliders_dirty())
|
||||
@ -169,7 +163,7 @@ void sdl_osd_interface::build_slider_list()
|
||||
{
|
||||
m_sliders.clear();
|
||||
|
||||
for (auto window : sdl_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
{
|
||||
std::vector<ui::menu_item> window_sliders = window->renderer().get_slider_list();
|
||||
m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end());
|
||||
@ -186,9 +180,9 @@ void sdl_osd_interface::window_exit()
|
||||
osd_printf_verbose("Enter sdlwindow_exit\n");
|
||||
|
||||
// free all the windows
|
||||
while (!sdl_window_list.empty())
|
||||
while (!osd_common_t::s_window_list.empty())
|
||||
{
|
||||
auto window = sdl_window_list.front();
|
||||
auto window = osd_common_t::s_window_list.front();
|
||||
|
||||
// Part of destroy removes the window from the list
|
||||
window->destroy();
|
||||
@ -399,7 +393,7 @@ int sdl_window_info::window_init()
|
||||
m_startmaximized = options.maximize();
|
||||
|
||||
// add us to the list
|
||||
sdl_window_list.push_back(std::static_pointer_cast<sdl_window_info>(shared_from_this()));
|
||||
osd_common_t::s_window_list.push_back(std::static_pointer_cast<sdl_window_info>(shared_from_this()));
|
||||
|
||||
set_renderer(osd_renderer::make_for_type(video_config.mode, static_cast<osd_window*>(this)->shared_from_this()));
|
||||
|
||||
@ -451,7 +445,7 @@ void sdl_window_info::destroy()
|
||||
//osd_event_wait(window->rendered_event, osd_ticks_per_second()*10);
|
||||
|
||||
// remove us from the list
|
||||
sdl_window_list.remove(std::static_pointer_cast<sdl_window_info>(shared_from_this()));
|
||||
osd_common_t::s_window_list.remove(std::static_pointer_cast<sdl_window_info>(shared_from_this()));
|
||||
|
||||
// free the textures etc
|
||||
complete_destroy();
|
||||
@ -773,7 +767,7 @@ int sdl_window_info::complete_create()
|
||||
// set main window
|
||||
if (m_index > 0)
|
||||
{
|
||||
for (auto w : sdl_window_list)
|
||||
for (auto w : osd_common_t::s_window_list)
|
||||
{
|
||||
if (w->m_index == 0)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
void toggle_full_screen();
|
||||
void modify_prescale(int dir);
|
||||
void resize(INT32 width, INT32 height);
|
||||
void destroy();
|
||||
void destroy() override;
|
||||
|
||||
void capture_pointer() override;
|
||||
void release_pointer() override;
|
||||
@ -121,13 +121,6 @@ struct osd_draw_callbacks
|
||||
osd_renderer *(*create)(osd_window *window);
|
||||
};
|
||||
|
||||
//============================================================
|
||||
// GLOBAL VARIABLES
|
||||
//============================================================
|
||||
|
||||
// window - list
|
||||
extern std::list<std::shared_ptr<sdl_window_info>> sdl_window_list;
|
||||
|
||||
//============================================================
|
||||
// PROTOTYPES
|
||||
//============================================================
|
||||
|
@ -80,7 +80,7 @@ bool windows_osd_interface::video_init()
|
||||
}
|
||||
|
||||
if (video_config.mode != VIDEO_MODE_NONE)
|
||||
SetForegroundWindow(win_window_list.front()->platform_window<HWND>());
|
||||
SetForegroundWindow(osd_common_t::s_window_list.front()->platform_window<HWND>());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -169,7 +169,7 @@ void windows_osd_interface::update(bool skip_redraw)
|
||||
if (!skip_redraw)
|
||||
{
|
||||
// profiler_mark(PROFILER_BLIT);
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
window->update();
|
||||
// profiler_mark(PROFILER_END);
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ using namespace Windows::UI::Core;
|
||||
// GLOBAL VARIABLES
|
||||
//============================================================
|
||||
|
||||
std::list<std::shared_ptr<win_window_info>> win_window_list;
|
||||
static DWORD main_threadid;
|
||||
|
||||
// actual physical resolution
|
||||
@ -209,10 +208,10 @@ bool windows_osd_interface::window_init()
|
||||
|
||||
void windows_osd_interface::update_slider_list()
|
||||
{
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
{
|
||||
// check if any window has dirty sliders
|
||||
if (window->m_renderer && window->m_renderer->sliders_dirty())
|
||||
if (window->renderer().sliders_dirty())
|
||||
{
|
||||
build_slider_list();
|
||||
return;
|
||||
@ -222,27 +221,27 @@ void windows_osd_interface::update_slider_list()
|
||||
|
||||
int windows_osd_interface::window_count()
|
||||
{
|
||||
return win_window_list.size();
|
||||
return osd_common_t::s_window_list.size();
|
||||
}
|
||||
|
||||
void windows_osd_interface::build_slider_list()
|
||||
{
|
||||
m_sliders.clear();
|
||||
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
{
|
||||
// take the sliders of the first window
|
||||
std::vector<ui::menu_item> window_sliders = window->m_renderer->get_slider_list();
|
||||
std::vector<ui::menu_item> window_sliders = window->renderer().get_slider_list();
|
||||
m_sliders.insert(m_sliders.end(), window_sliders.begin(), window_sliders.end());
|
||||
}
|
||||
}
|
||||
|
||||
void windows_osd_interface::add_audio_to_recording(const INT16 *buffer, int samples_this_frame)
|
||||
{
|
||||
auto window = win_window_list.front(); // We only record on the first window
|
||||
if (window != nullptr && window->m_renderer != nullptr)
|
||||
auto window = osd_common_t::s_window_list.front(); // We only record on the first window
|
||||
if (window != nullptr)
|
||||
{
|
||||
window->m_renderer->add_audio_to_recording(buffer, samples_this_frame);
|
||||
window->renderer().add_audio_to_recording(buffer, samples_this_frame);
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,13 +255,13 @@ void windows_osd_interface::window_exit()
|
||||
assert(GetCurrentThreadId() == main_threadid);
|
||||
|
||||
// if we hid the cursor during the emulation, show it
|
||||
if (!win_window_list.empty())
|
||||
win_window_list.front()->show_pointer();
|
||||
if (!osd_common_t::s_window_list.empty())
|
||||
osd_common_t::s_window_list.front()->show_pointer();
|
||||
|
||||
// free all the windows
|
||||
while (!win_window_list.empty())
|
||||
while (!osd_common_t::s_window_list.empty())
|
||||
{
|
||||
auto window = win_window_list.front();
|
||||
auto window = osd_common_t::s_window_list.front();
|
||||
|
||||
// Destroy removes it from the list also
|
||||
window->destroy();
|
||||
@ -316,7 +315,6 @@ win_window_info::win_window_info(
|
||||
m_lastclicktime(std::chrono::system_clock::time_point::min()),
|
||||
m_lastclickx(0),
|
||||
m_lastclicky(0),
|
||||
m_renderer(nullptr),
|
||||
m_machine(machine)
|
||||
{
|
||||
memset(m_title,0,sizeof(m_title));
|
||||
@ -327,10 +325,6 @@ win_window_info::win_window_info(
|
||||
m_prescale = video_config.prescale;
|
||||
}
|
||||
|
||||
win_window_info::~win_window_info()
|
||||
{
|
||||
}
|
||||
|
||||
POINT win_window_info::s_saved_cursor_pos = { -1, -1 };
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
@ -423,7 +417,7 @@ void winwindow_process_events_periodic(running_machine &machine)
|
||||
|
||||
static BOOL is_mame_window(HWND hwnd)
|
||||
{
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
if (window->platform_window<HWND>() == hwnd)
|
||||
return TRUE;
|
||||
|
||||
@ -587,9 +581,9 @@ void winwindow_take_snap(void)
|
||||
assert(GetCurrentThreadId() == main_threadid);
|
||||
|
||||
// iterate over windows and request a snap
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
{
|
||||
window->m_renderer->save();
|
||||
window->renderer().save();
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,9 +599,9 @@ void winwindow_toggle_fsfx(void)
|
||||
assert(GetCurrentThreadId() == main_threadid);
|
||||
|
||||
// iterate over windows and request a snap
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
{
|
||||
window->m_renderer->toggle_fsfx();
|
||||
window->renderer().toggle_fsfx();
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,9 +617,9 @@ void winwindow_take_video(void)
|
||||
assert(GetCurrentThreadId() == main_threadid);
|
||||
|
||||
// iterate over windows and request a snap
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
{
|
||||
window->m_renderer->record();
|
||||
window->renderer().record();
|
||||
}
|
||||
}
|
||||
|
||||
@ -641,7 +635,7 @@ void winwindow_toggle_full_screen(void)
|
||||
assert(GetCurrentThreadId() == main_threadid);
|
||||
|
||||
// if we are in debug mode, never go full screen
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
if (window->machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)
|
||||
return;
|
||||
|
||||
@ -649,11 +643,11 @@ void winwindow_toggle_full_screen(void)
|
||||
video_config.windowed = !video_config.windowed;
|
||||
|
||||
// iterate over windows and toggle their fullscreen state
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
SendMessage(window->platform_window<HWND>(), WM_USER_SET_FULLSCREEN, !video_config.windowed, 0);
|
||||
|
||||
// Set the first window as foreground
|
||||
SetForegroundWindow(win_window_list.front()->platform_window<HWND>());
|
||||
SetForegroundWindow(osd_common_t::s_window_list.front()->platform_window<HWND>());
|
||||
}
|
||||
|
||||
|
||||
@ -668,7 +662,7 @@ BOOL winwindow_has_focus(void)
|
||||
HWND focuswnd = GetFocus();
|
||||
|
||||
// see if one of the video windows has focus
|
||||
for (auto window : win_window_list)
|
||||
for (auto window : osd_common_t::s_window_list)
|
||||
if (focuswnd == window->platform_window<HWND>())
|
||||
return TRUE;
|
||||
|
||||
@ -686,10 +680,10 @@ void winwindow_update_cursor_state(running_machine &machine)
|
||||
assert(GetCurrentThreadId() == main_threadid);
|
||||
|
||||
// If no windows, just return
|
||||
if (win_window_list.empty())
|
||||
if (osd_common_t::s_window_list.empty())
|
||||
return;
|
||||
|
||||
auto window = win_window_list.front();
|
||||
auto window = osd_common_t::s_window_list.front();
|
||||
|
||||
// if we should hide the mouse cursor, then do it
|
||||
// rules are:
|
||||
@ -734,11 +728,11 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in
|
||||
// set main window
|
||||
if (window->m_index > 0)
|
||||
{
|
||||
for (auto w : win_window_list)
|
||||
for (auto w : osd_common_t::s_window_list)
|
||||
{
|
||||
if (w->m_index == 0)
|
||||
{
|
||||
window->set_main_window(std::dynamic_pointer_cast<osd_window>(w));
|
||||
window->set_main_window(std::static_pointer_cast<osd_window>(w));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -751,12 +745,12 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in
|
||||
|
||||
// see if we are safe for fullscreen
|
||||
window->m_fullscreen_safe = TRUE;
|
||||
for (auto win : win_window_list)
|
||||
if (win->m_monitor == monitor)
|
||||
for (auto win : osd_common_t::s_window_list)
|
||||
if (win->monitor() == monitor)
|
||||
window->m_fullscreen_safe = FALSE;
|
||||
|
||||
// add us to the list
|
||||
win_window_list.push_back(window);
|
||||
osd_common_t::s_window_list.push_back(window);
|
||||
|
||||
// load the layout
|
||||
window->m_target = machine.render().target_alloc();
|
||||
@ -800,7 +794,7 @@ void win_window_info::destroy()
|
||||
assert(GetCurrentThreadId() == main_threadid);
|
||||
|
||||
// remove us from the list
|
||||
win_window_list.remove(std::static_pointer_cast<win_window_info>(shared_from_this()));
|
||||
osd_common_t::s_window_list.remove(shared_from_this());
|
||||
|
||||
// destroy the window
|
||||
if (platform_window<HWND>() != nullptr)
|
||||
@ -845,7 +839,7 @@ void win_window_info::update()
|
||||
}
|
||||
|
||||
// if we're visible and running and not in the middle of a resize, draw
|
||||
if (platform_window<HWND>() != nullptr && m_target != nullptr && m_renderer != nullptr)
|
||||
if (platform_window<HWND>() != nullptr && m_target != nullptr)
|
||||
{
|
||||
bool got_lock = true;
|
||||
|
||||
@ -864,7 +858,7 @@ void win_window_info::update()
|
||||
m_render_lock.unlock();
|
||||
|
||||
// ensure the target bounds are up-to-date, and then get the primitives
|
||||
primlist = m_renderer->get_primitives();
|
||||
primlist = renderer().get_primitives();
|
||||
|
||||
// post a redraw request with the primitive list as a parameter
|
||||
last_update_time = timeGetTime();
|
||||
@ -1088,7 +1082,7 @@ int win_window_info::complete_create()
|
||||
fullscreen() ? FULLSCREEN_STYLE : WINDOW_STYLE,
|
||||
monitorbounds.left() + 20, monitorbounds.top() + 20,
|
||||
monitorbounds.left() + 100, monitorbounds.top() + 100,
|
||||
nullptr,//(win_window_list != nullptr) ? win_window_list->m_hwnd : nullptr,
|
||||
nullptr,//(osd_common_t::s_window_list != nullptr) ? osd_common_t::s_window_list->m_hwnd : nullptr,
|
||||
menu,
|
||||
GetModuleHandleUni(),
|
||||
nullptr);
|
||||
@ -1123,8 +1117,8 @@ int win_window_info::complete_create()
|
||||
// show the window
|
||||
if (!fullscreen() || m_fullscreen_safe)
|
||||
{
|
||||
m_renderer = osd_renderer::make_for_type(video_config.mode, std::static_pointer_cast<win_window_info>(shared_from_this()));
|
||||
if (m_renderer->create())
|
||||
set_renderer(osd_renderer::make_for_type(video_config.mode, shared_from_this()));
|
||||
if (renderer().create())
|
||||
return 1;
|
||||
|
||||
ShowWindow(platform_window<HWND>(), SW_SHOW);
|
||||
@ -1320,7 +1314,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
|
||||
|
||||
// destroy: clean up all attached rendering bits and nullptr out our hwnd
|
||||
case WM_DESTROY:
|
||||
window->m_renderer.reset();
|
||||
window->renderer_reset();
|
||||
window->set_platform_window(nullptr);
|
||||
return DefWindowProc(wnd, message, wparam, lparam);
|
||||
|
||||
@ -1366,8 +1360,8 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
|
||||
// set focus: if we're not the primary window, switch back
|
||||
// commented out ATM because this prevents us from resizing secondary windows
|
||||
// case WM_SETFOCUS:
|
||||
// if (window != win_window_list && win_window_list != nullptr)
|
||||
// SetFocus(win_window_list->m_hwnd);
|
||||
// if (window != osd_common_t::s_window_list && osd_common_t::s_window_list != nullptr)
|
||||
// SetFocus(osd_common_t::s_window_list->m_hwnd);
|
||||
// break;
|
||||
|
||||
// everything else: defaults
|
||||
@ -1407,7 +1401,7 @@ void win_window_info::draw_video_contents(HDC dc, int update)
|
||||
{
|
||||
// update DC
|
||||
m_dc = dc;
|
||||
m_renderer->draw(update);
|
||||
renderer().draw(update);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1825,8 +1819,8 @@ void win_window_info::set_fullscreen(int fullscreen)
|
||||
if (video_config.mode != VIDEO_MODE_NONE)
|
||||
ShowWindow(platform_window<HWND>(), SW_SHOW);
|
||||
|
||||
m_renderer = osd_renderer::make_for_type(video_config.mode, std::static_pointer_cast<win_window_info>(shared_from_this()));
|
||||
if (m_renderer->create())
|
||||
set_renderer(osd_renderer::make_for_type(video_config.mode, shared_from_this()));
|
||||
if (renderer().create())
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -1845,7 +1839,7 @@ bool winwindow_qt_filter(void *message)
|
||||
if(msg->hwnd) // get the machine associated with this window
|
||||
ptr = GetWindowLongPtr(msg->hwnd, GWLP_USERDATA);
|
||||
else // any one will have to do
|
||||
ptr = (LONG_PTR)win_window_list;
|
||||
ptr = (LONG_PTR)osd_common_t::s_window_list;
|
||||
|
||||
winwindow_dispatch_message(((win_window_info *)ptr)->machine(), msg);
|
||||
return true;
|
||||
|
@ -48,14 +48,13 @@ class win_window_info : public osd_window
|
||||
{
|
||||
public:
|
||||
win_window_info(running_machine &machine, int index, osd_monitor_info *monitor, const osd_window_config *config);
|
||||
virtual ~win_window_info();
|
||||
|
||||
running_machine &machine() const override { return m_machine; }
|
||||
|
||||
virtual render_target *target() override { return m_target; }
|
||||
int fullscreen() const override { return m_fullscreen; }
|
||||
|
||||
void update();
|
||||
void update() override;
|
||||
|
||||
virtual osd_monitor_info *winwindow_video_window_monitor(const osd_rect *proposed) override;
|
||||
|
||||
@ -86,7 +85,7 @@ public:
|
||||
|
||||
virtual osd_monitor_info *monitor() const override { return m_monitor; }
|
||||
|
||||
void destroy();
|
||||
void destroy() override;
|
||||
|
||||
// static
|
||||
|
||||
@ -126,9 +125,6 @@ public:
|
||||
int m_lastclickx;
|
||||
int m_lastclicky;
|
||||
|
||||
// drawing data
|
||||
std::unique_ptr<osd_renderer> m_renderer;
|
||||
|
||||
private:
|
||||
void draw_video_contents(HDC dc, int update);
|
||||
int complete_create();
|
||||
@ -159,14 +155,6 @@ struct osd_draw_callbacks
|
||||
void (*exit)(void);
|
||||
};
|
||||
|
||||
//============================================================
|
||||
// GLOBAL VARIABLES
|
||||
//============================================================
|
||||
|
||||
// windows
|
||||
extern std::list<std::shared_ptr<win_window_info>> win_window_list;
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// PROTOTYPES
|
||||
|
@ -71,11 +71,11 @@ public:
|
||||
char buffer[1024];
|
||||
|
||||
// if we are in fullscreen mode, go to windowed mode
|
||||
if ((video_config.windowed == 0) && !win_window_list.empty())
|
||||
if ((video_config.windowed == 0) && !osd_common_t::s_window_list.empty())
|
||||
winwindow_toggle_full_screen();
|
||||
|
||||
vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args);
|
||||
win_message_box_utf8(!win_window_list.empty() ? win_window_list.front()->platform_window<HWND>() : nullptr, buffer, emulator_info::get_appname(), MB_OK);
|
||||
win_message_box_utf8(!osd_common_t::s_window_list.empty() ? osd_common_t::s_window_list.front()->platform_window<HWND>() : nullptr, buffer, emulator_info::get_appname(), MB_OK);
|
||||
}
|
||||
else
|
||||
chain_output(channel, msg, args);
|
||||
@ -519,9 +519,9 @@ void windows_osd_interface::init(running_machine &machine)
|
||||
osd_common_t::init_subsystems();
|
||||
|
||||
// notify listeners of screen configuration
|
||||
for (auto info : win_window_list)
|
||||
for (auto info : osd_common_t::s_window_list)
|
||||
{
|
||||
machine.output().set_value(string_format("Orientation(%s)", info->m_monitor->devicename()).c_str(), info->m_targetorient);
|
||||
machine.output().set_value(string_format("Orientation(%s)", info->monitor()->devicename()).c_str(), std::static_pointer_cast<win_window_info>(info)->m_targetorient);
|
||||
}
|
||||
|
||||
// hook up the debugger log
|
||||
|
Loading…
Reference in New Issue
Block a user