summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-02-05 01:58:55 +0100
committer couriersud <couriersud@arcor.de>2015-02-05 01:58:55 +0100
commit5d33de6aab0222a3d8136ce51d7eec967f211e56 (patch)
treef318f2ca90d3b5f85b93d29f4e8ffa874c7b96a0
parent0c7b5ff66e7abc8d53e0172de6944ecc9fa1508f (diff)
Remove some passing around of running_machine where it is not needed.
(nw)
-rw-r--r--src/osd/sdl/input.c16
-rw-r--r--src/osd/sdl/input.h8
-rw-r--r--src/osd/sdl/video.c10
-rw-r--r--src/osd/sdl/window.c80
-rw-r--r--src/osd/sdl/window.h15
5 files changed, 61 insertions, 68 deletions
diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c
index d04b3fd14af..b9d2ef1376c 100644
--- a/src/osd/sdl/input.c
+++ b/src/osd/sdl/input.c
@@ -1473,7 +1473,7 @@ void sdl_osd_interface::input_exit()
// sdlinput_get_focus_window
//============================================================
-sdl_window_info *sdlinput_get_focus_window(running_machine &machine)
+sdl_window_info *sdlinput_get_focus_window()
{
if (focus_window) // only be set on SDL >= 1.3
return focus_window;
@@ -1566,7 +1566,7 @@ INLINE void resize_all_windows(void)
{
if (w->m_resize_width && w->m_resize_height && ((now - w->m_last_resize) > osd_ticks_per_second() / 10))
{
- w->window_resize(w->m_resize_width, w->m_resize_height);
+ w->resize(w->m_resize_width, w->m_resize_height);
w->m_resize_width = 0;
w->m_resize_height = 0;
}
@@ -1576,7 +1576,7 @@ INLINE void resize_all_windows(void)
#endif
-void sdlinput_process_events_buf(running_machine &machine)
+void sdlinput_process_events_buf()
{
SDL_Event event;
@@ -1944,7 +1944,7 @@ void sdlinput_poll(running_machine &machine)
machine.schedule_exit();
break;
case SDL_VIDEORESIZE:
- sdl_window_list->window_resize(event.resize.w, event.resize.h);
+ sdl_window_list->resize(event.resize.w, event.resize.h);
break;
#else
case SDL_TEXTINPUT:
@@ -1977,7 +1977,7 @@ void sdlinput_poll(running_machine &machine)
app_has_mouse_focus = 0;
break;
case SDL_WINDOWEVENT_MOVED:
- window->window_clear();
+ window->clear();
focus_window = window;
break;
case SDL_WINDOWEVENT_RESIZED:
@@ -1998,7 +1998,7 @@ void sdlinput_poll(running_machine &machine)
{
//printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
if (event.window.data1 != window->width() || event.window.data2 != window->height())
- window->window_resize(event.window.data1, event.window.data2);
+ window->resize(event.window.data1, event.window.data2);
}
}
focus_window = window;
@@ -2029,7 +2029,7 @@ void sdlinput_poll(running_machine &machine)
//============================================================
-void sdlinput_release_keys(running_machine &machine)
+void sdlinput_release_keys()
{
// FIXME: SDL >= 1.3 will nuke the window event buffer when
// a window is closed. This will leave keys in a pressed
@@ -2053,7 +2053,7 @@ void sdlinput_release_keys(running_machine &machine)
// sdlinput_should_hide_mouse
//============================================================
-int sdlinput_should_hide_mouse(running_machine &machine)
+int sdlinput_should_hide_mouse()
{
// if we are paused, no
if (input_paused)
diff --git a/src/osd/sdl/input.h b/src/osd/sdl/input.h
index abb79fbdf28..c76ac189f6d 100644
--- a/src/osd/sdl/input.h
+++ b/src/osd/sdl/input.h
@@ -19,11 +19,11 @@
//============================================================
void sdlinput_poll(running_machine &machine);
-int sdlinput_should_hide_mouse(running_machine &machine);
+int sdlinput_should_hide_mouse();
-sdl_window_info *sdlinput_get_focus_window(running_machine &machine);
+sdl_window_info *sdlinput_get_focus_window();
-void sdlinput_process_events_buf(running_machine &machine);
-void sdlinput_release_keys(running_machine &machine);
+void sdlinput_process_events_buf();
+void sdlinput_release_keys();
#endif /* __SDLINPUT_H__ */
diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c
index a7374845dc0..19216bf5059 100644
--- a/src/osd/sdl/video.c
+++ b/src/osd/sdl/video.c
@@ -312,7 +312,7 @@ void sdl_osd_interface::update(bool skip_redraw)
{
// profiler_mark(PROFILER_BLIT);
for (window = sdl_window_list; window != NULL; window = window->m_next)
- window->video_window_update(machine());
+ window->update();
// profiler_mark(PROFILER_END);
}
@@ -544,7 +544,7 @@ sdl_monitor_info *sdl_monitor_info::pick_monitor(sdl_options &options, int index
static void check_osd_inputs(running_machine &machine)
{
- sdl_window_info *window = sdlinput_get_focus_window(machine);
+ sdl_window_info *window = sdlinput_get_focus_window();
// check for toggling fullscreen mode
if (ui_input_pressed(machine, IPT_OSD_1))
@@ -553,7 +553,7 @@ static void check_osd_inputs(running_machine &machine)
while (curwin != (sdl_window_info *)NULL)
{
- curwin->toggle_full_screen(machine);
+ curwin->toggle_full_screen();
curwin = curwin->m_next;
}
}
@@ -582,10 +582,10 @@ static void check_osd_inputs(running_machine &machine)
#endif
if (ui_input_pressed(machine, IPT_OSD_6))
- window->modify_prescale(machine, -1);
+ window->modify_prescale(-1);
if (ui_input_pressed(machine, IPT_OSD_7))
- window->modify_prescale(machine, 1);
+ window->modify_prescale(1);
}
//============================================================
diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c
index 463eb0d5ae6..5bde6feecc5 100644
--- a/src/osd/sdl/window.c
+++ b/src/osd/sdl/window.c
@@ -100,26 +100,21 @@ static sdl_draw_info draw;
struct worker_param {
worker_param()
- : m_window(NULL), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
+ : m_window(NULL), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0)
{
}
- worker_param(running_machine &amachine, sdl_window_info *awindow)
- : m_window(awindow), m_list(NULL), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
- {
- }
- worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list &alist)
- : m_window(awindow), m_list(&alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
+ worker_param(sdl_window_info *awindow, render_primitive_list &alist)
+ : m_window(awindow), m_list(&alist), m_resize_new_width(0), m_resize_new_height(0)
{
}
worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
- : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
+ : m_window(awindow), m_list(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height)
{
}
worker_param(sdl_window_info *awindow)
- : m_window(awindow), m_list(NULL), m_machine(NULL), m_resize_new_width(0), m_resize_new_height(0)
+ : m_window(awindow), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0)
{
}
- running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
sdl_window_info *window() const { assert(m_window != NULL); return m_window; }
render_primitive_list *list() const { return m_list; }
int new_width() const { return m_resize_new_width; }
@@ -129,7 +124,6 @@ struct worker_param {
private:
sdl_window_info *m_window;
render_primitive_list *m_list;
- running_machine *m_machine;
int m_resize_new_width;
int m_resize_new_height;
};
@@ -139,7 +133,6 @@ private:
// PROTOTYPES
//============================================================
-static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window);
static void sdlwindow_sync(void);
//============================================================
@@ -353,7 +346,7 @@ void sdl_osd_interface::window_exit()
{
sdl_window_info *temp = sdl_window_list;
sdl_window_list = temp->m_next;
- temp->video_window_destroy(machine());
+ temp->destroy();
// free the window itself
global_free(temp);
}
@@ -462,7 +455,7 @@ void sdl_window_info::blit_surface_size(int window_width, int window_height)
newwidth = window_width;
if ((m_blitwidth != newwidth) || (m_blitheight != newheight))
- window_clear();
+ clear();
m_blitwidth = newwidth;
m_blitheight = newheight;
@@ -503,13 +496,13 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_resize_wt )
window->blit_surface_size(window->m_width, window->m_height);
- window->window_clear();
+ window->clear();
osd_free(wp);
return NULL;
}
-void sdl_window_info::window_resize(INT32 width, INT32 height)
+void sdl_window_info::resize(INT32 width, INT32 height)
{
ASSERT_MAIN_THREAD();
@@ -537,7 +530,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_clear_surface_wt )
return NULL;
}
-void sdl_window_info::window_clear()
+void sdl_window_info::clear()
{
worker_param wp;
@@ -592,7 +585,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt )
#endif
- sdlinput_release_keys(wp->machine());
+ sdlinput_release_keys();
// toggle the window mode
window->set_fullscreen(!window->fullscreen());
@@ -602,11 +595,11 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt )
return NULL;
}
-void sdl_window_info::toggle_full_screen(running_machine &machine)
+void sdl_window_info::toggle_full_screen()
{
ASSERT_MAIN_THREAD();
- execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(machine, this));
+ execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(this));
}
OSDWORK_CALLBACK( sdl_window_info::destroy_all_textures_wt )
@@ -621,9 +614,9 @@ OSDWORK_CALLBACK( sdl_window_info::destroy_all_textures_wt )
return NULL;
}
-void sdl_window_info::modify_prescale(running_machine &machine, int dir)
+void sdl_window_info::modify_prescale(int dir)
{
- worker_param wp = worker_param(machine, this);
+ worker_param wp = worker_param(this);
int new_prescale = prescale();
if (dir > 0 && prescale() < 3)
@@ -647,7 +640,7 @@ void sdl_window_info::modify_prescale(running_machine &machine, int dir)
execute_async_wait(destroy_all_textures_wt, wp);
m_prescale = new_prescale;
}
- machine.ui().popup_time(1, "Prescale %d", prescale());
+ machine().ui().popup_time(1, "Prescale %d", prescale());
}
}
@@ -656,7 +649,7 @@ void sdl_window_info::modify_prescale(running_machine &machine, int dir)
// (main or window thread)
//============================================================
-static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_info *window)
+void sdl_window_info::update_cursor_state()
{
#if (USE_XINPUT)
// Hack for wii-lightguns:
@@ -671,22 +664,22 @@ static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_i
#if (SDLMAME_SDL2)
// do not do mouse capture if the debugger's enabled to avoid
// the possibility of losing control
- if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
+ if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
{
//FIXME: SDL1.3: really broken: the whole SDL code
// will only work correct with relative mouse movements ...
- if (!window->fullscreen() && !sdlinput_should_hide_mouse(machine))
+ if (!fullscreen() && !sdlinput_should_hide_mouse())
{
SDL_ShowCursor(SDL_ENABLE);
- if (SDL_GetWindowGrab(window->sdl_window() ))
- SDL_SetWindowGrab(window->sdl_window(), SDL_FALSE);
+ if (SDL_GetWindowGrab(sdl_window() ))
+ SDL_SetWindowGrab(sdl_window(), SDL_FALSE);
SDL_SetRelativeMouseMode(SDL_FALSE);
}
else
{
SDL_ShowCursor(SDL_DISABLE);
- if (!SDL_GetWindowGrab(window->sdl_window()))
- SDL_SetWindowGrab(window->sdl_window(), SDL_TRUE);
+ if (!SDL_GetWindowGrab(sdl_window()))
+ SDL_SetWindowGrab(sdl_window(), SDL_TRUE);
SDL_SetRelativeMouseMode(SDL_TRUE);
}
SDL_SetCursor(NULL); // Force an update in case the underlying driver has changed visibility
@@ -695,9 +688,9 @@ static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_i
#else
// do not do mouse capture if the debugger's enabled to avoid
// the possibility of losing control
- if (!(machine.debug_flags & DEBUG_FLAG_OSD_ENABLED))
+ if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
{
- if ( window->fullscreen() || sdlinput_should_hide_mouse(machine) )
+ if ( fullscreen() || sdlinput_should_hide_mouse() )
{
SDL_ShowCursor(SDL_DISABLE);
if (!SDL_WM_GrabInput(SDL_GRAB_QUERY))
@@ -721,9 +714,9 @@ static void sdlwindow_update_cursor_state(running_machine &machine, sdl_window_i
static OSDWORK_CALLBACK( sdlwindow_update_cursor_state_wt )
{
worker_param * wp = (worker_param *) param;
- //sdl_window_info * window = wp->window;
+ sdl_window_info * window = wp->window();
- sdlwindow_update_cursor_state(wp->machine(), wp->window());
+ window->update_cursor_state();
osd_free(wp);
return NULL;
@@ -794,8 +787,7 @@ int sdl_window_info::window_init()
return 0;
error:
- video_window_destroy(m_machine);
- // free the window itself
+ destroy();
return 1;
}
@@ -832,14 +824,14 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt )
#endif
// release all keys ...
- sdlinput_release_keys(wp->machine());
+ sdlinput_release_keys();
osd_free(wp);
return NULL;
}
-void sdl_window_info::video_window_destroy(running_machine &machine)
+void sdl_window_info::destroy()
{
sdl_window_info **prevptr;
@@ -860,7 +852,7 @@ void sdl_window_info::video_window_destroy(running_machine &machine)
}
// free the textures etc
- execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(machine, this));
+ execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(this));
// free the render target, after the textures!
this->machine().render().target_free(m_target);
@@ -1023,7 +1015,7 @@ void sdl_window_info::pick_best_mode(int *fswidth, int *fsheight)
// (main thread)
//============================================================
-void sdl_window_info::video_window_update(running_machine &machine)
+void sdl_window_info::update()
{
osd_ticks_t event_wait_ticks;
ASSERT_MAIN_THREAD();
@@ -1031,7 +1023,7 @@ void sdl_window_info::video_window_update(running_machine &machine)
// adjust the cursor state
//sdlwindow_update_cursor_state(machine, window);
- execute_async(&sdlwindow_update_cursor_state_wt, worker_param(machine, this));
+ execute_async(&sdlwindow_update_cursor_state_wt, worker_param(this));
// if we're visible and running and not in the middle of a resize, draw
if (m_target != NULL)
@@ -1054,7 +1046,7 @@ void sdl_window_info::video_window_update(running_machine &machine)
else if (video_config.switchres)
{
this->pick_best_mode(&tempwidth, &tempheight);
- window_resize(tempwidth, tempheight);
+ resize(tempwidth, tempheight);
}
}
@@ -1082,7 +1074,7 @@ void sdl_window_info::video_window_update(running_machine &machine)
// and redraw now
- execute_async(&draw_video_contents_wt, worker_param(machine, this, primlist));
+ execute_async(&draw_video_contents_wt, worker_param(this, primlist));
}
}
}
@@ -1355,7 +1347,7 @@ OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt )
ASSERT_REDRAW_THREAD();
// Some configurations require events to be polled in the worker thread
- sdlinput_process_events_buf(wp->machine());
+ sdlinput_process_events_buf();
window->m_primlist = wp->list();
diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h
index 825f9eab234..3c2167e6d1d 100644
--- a/src/osd/sdl/window.h
+++ b/src/osd/sdl/window.h
@@ -116,14 +116,15 @@ public:
}
int window_init();
+ void destroy();
- void video_window_update(running_machine &machine);
- void toggle_full_screen(running_machine &machine);
- void modify_prescale(running_machine &machine, int dir);
- void window_resize(INT32 width, INT32 height);
- void window_clear();
+ void update();
+ void toggle_full_screen();
+ void modify_prescale(int dir);
+ void resize(INT32 width, INT32 height);
+ void clear();
+ int xy_to_render_target(int x, int y, int *xt, int *yt);
- void video_window_destroy(running_machine &machine);
void get_min_bounds(int *window_width, int *window_height, int constrain);
void get_max_bounds(int *window_width, int *window_height, int constrain);
@@ -132,6 +133,7 @@ public:
int fullscreen() const { return m_fullscreen; }
void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
+ void update_cursor_state();
void blit_surface_size(int window_width, int window_height);
void pick_best_mode(int *fswidth, int *fsheight);
@@ -139,7 +141,6 @@ public:
int index() const { return m_index; }
- int xy_to_render_target(int x, int y, int *xt, int *yt);
render_target *target() { return m_target; }