mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-31 00:22:31 +00:00
Go through function pointer
This commit is contained in:
parent
b78b29cb14
commit
ea5f458fbd
@ -156,7 +156,10 @@ void win32_monitor_from_window(void)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
win32_monitor_last = MonitorFromWindow(main_window.hwnd, MONITOR_DEFAULTTONEAREST);
|
||||
ui_window_win32_destroy(&main_window);
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
|
||||
if (window)
|
||||
window->destroy(&main_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -373,14 +376,16 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message,
|
||||
break;
|
||||
case WM_CREATE:
|
||||
{
|
||||
ui_window_win32_t window;
|
||||
ui_window_win32_t win32_window;
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
LPCREATESTRUCT p_cs = (LPCREATESTRUCT)lparam;
|
||||
curD3D = p_cs->lpCreateParams;
|
||||
g_inited = true;
|
||||
|
||||
window.hwnd = hwnd;
|
||||
win32_window.hwnd = hwnd;
|
||||
|
||||
ui_window_win32_set_droppable(&window, true);
|
||||
if (window)
|
||||
window->set_droppable(&win32_window, true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -417,11 +422,14 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message,
|
||||
break;
|
||||
case WM_CREATE:
|
||||
{
|
||||
ui_window_win32_t window;
|
||||
window.hwnd = hwnd;
|
||||
ui_window_win32_t win32_window;
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
win32_window.hwnd = hwnd;
|
||||
|
||||
create_graphics_context(hwnd, &g_quit);
|
||||
ui_window_win32_set_droppable(&window, true);
|
||||
|
||||
if (window)
|
||||
window->set_droppable(&win32_window, true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -660,6 +668,8 @@ void win32_set_window(unsigned *width, unsigned *height,
|
||||
|
||||
if (!fullscreen || windowed_full)
|
||||
{
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
|
||||
if (!fullscreen && settings->ui.menubar_enable)
|
||||
{
|
||||
RECT rc_temp = {0, 0, (LONG)*height, 0x7FFF};
|
||||
@ -672,7 +682,9 @@ void win32_set_window(unsigned *width, unsigned *height,
|
||||
ShowWindow(main_window.hwnd, SW_RESTORE);
|
||||
UpdateWindow(main_window.hwnd);
|
||||
SetForegroundWindow(main_window.hwnd);
|
||||
ui_window_win32_set_focused(&main_window);
|
||||
|
||||
if (window)
|
||||
window->set_focused(&main_window);
|
||||
}
|
||||
|
||||
win32_show_cursor(!fullscreen);
|
||||
@ -742,13 +754,18 @@ BOOL IsIconic(HWND hwnd)
|
||||
|
||||
bool win32_has_focus(void)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
#endif
|
||||
if (!g_inited)
|
||||
return false;
|
||||
|
||||
#ifdef _XBOX
|
||||
return GetForegroundWindow() == main_window.hwnd;
|
||||
#else
|
||||
return ui_window_win32_focused(&main_window);
|
||||
if (window)
|
||||
return window->focused(&main_window);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -76,15 +76,16 @@ static void gfx_ctx_d3d_swap_buffers(void *data)
|
||||
|
||||
static void gfx_ctx_d3d_update_title(void *data)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
char buffer_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
char buf[128] = {0};
|
||||
char buffer_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
|
||||
if (video_monitor_get_fps(buf, sizeof(buf),
|
||||
if (window && video_monitor_get_fps(buf, sizeof(buf),
|
||||
buffer_fps, sizeof(buffer_fps)))
|
||||
{
|
||||
#ifndef _XBOX
|
||||
ui_window_win32_set_title(&main_window, buf);
|
||||
window->set_title(&main_window, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -389,10 +389,11 @@ static void gfx_ctx_wgl_update_window_title(void *data)
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
|
||||
if (video_monitor_get_fps(buf, sizeof(buf),
|
||||
if (window && video_monitor_get_fps(buf, sizeof(buf),
|
||||
buf_fps, sizeof(buf_fps)))
|
||||
ui_window_win32_set_title(&main_window, buf);
|
||||
window->set_title(&main_window, buf);
|
||||
if (settings->fps_show)
|
||||
runloop_msg_queue_push(buf_fps, 1, 1, false);
|
||||
}
|
||||
|
@ -187,6 +187,7 @@ static void shader_dlg_params_clear(void)
|
||||
|
||||
for (i = 0; i < GFX_MAX_PARAMETERS; i++)
|
||||
{
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
shader_param_ctrl_t*control = &g_shader_dlg.controls[i];
|
||||
|
||||
if (control->type == SHADER_PARAM_CTRL_NONE)
|
||||
@ -197,7 +198,8 @@ static void shader_dlg_params_clear(void)
|
||||
case SHADER_PARAM_CTRL_NONE:
|
||||
break;
|
||||
case SHADER_PARAM_CTRL_CHECKBOX:
|
||||
ui_window_win32_destroy(&control->checkbox);
|
||||
if (window)
|
||||
window->destroy(&control->checkbox);
|
||||
break;
|
||||
case SHADER_PARAM_CTRL_TRACKBAR:
|
||||
DestroyWindow(control->trackbar.label_title);
|
||||
@ -216,7 +218,7 @@ void shader_dlg_params_reload(void)
|
||||
RECT parent_rect;
|
||||
int i, pos_x, pos_y;
|
||||
video_shader_ctx_t shader_info;
|
||||
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
video_shader_driver_get_current_shader(&shader_info);
|
||||
|
||||
shader_dlg_params_clear();
|
||||
@ -295,8 +297,8 @@ void shader_dlg_params_reload(void)
|
||||
|
||||
}
|
||||
|
||||
if (g_shader_dlg.separator.hwnd)
|
||||
ui_window_win32_destroy(&g_shader_dlg.separator);
|
||||
if (window && g_shader_dlg.separator.hwnd)
|
||||
window->destroy(&g_shader_dlg.separator);
|
||||
|
||||
g_shader_dlg.separator.hwnd = CreateWindowEx(0, "STATIC", "",
|
||||
SS_ETCHEDHORZ | WS_VISIBLE | WS_CHILD, SHADER_DLG_CTRL_X,
|
||||
@ -325,6 +327,8 @@ static void shader_dlg_update_on_top_state(void)
|
||||
|
||||
void shader_dlg_show(HWND parent_hwnd)
|
||||
{
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
|
||||
if (!IsWindowVisible(g_shader_dlg.window.hwnd))
|
||||
{
|
||||
if (parent_hwnd)
|
||||
@ -335,7 +339,7 @@ void shader_dlg_show(HWND parent_hwnd)
|
||||
0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
else
|
||||
ui_window_win32_set_visible(&g_shader_dlg.window, true);
|
||||
window->set_visible(&g_shader_dlg.window, true);
|
||||
|
||||
shader_dlg_update_on_top_state();
|
||||
|
||||
@ -343,7 +347,7 @@ void shader_dlg_show(HWND parent_hwnd)
|
||||
|
||||
}
|
||||
|
||||
ui_window_win32_set_focused(&g_shader_dlg.window);
|
||||
window->set_focused(&g_shader_dlg.window);
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
|
||||
@ -351,6 +355,7 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
|
||||
{
|
||||
int i, pos;
|
||||
video_shader_ctx_t shader_info;
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
|
||||
video_shader_driver_get_current_shader(&shader_info);
|
||||
|
||||
@ -362,7 +367,8 @@ static LRESULT CALLBACK ShaderDlgWndProc(HWND hwnd, UINT message,
|
||||
case WM_CLOSE:
|
||||
case WM_DESTROY:
|
||||
case WM_QUIT:
|
||||
ui_window_win32_set_visible(&g_shader_dlg.window, false);
|
||||
if (window)
|
||||
window->set_visible(&g_shader_dlg.window, false);
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -48,38 +48,38 @@
|
||||
#include "../../../runloop.h"
|
||||
#include "../../../tasks/tasks_internal.h"
|
||||
|
||||
void ui_window_win32_destroy(void *data)
|
||||
static void ui_window_win32_destroy(void *data)
|
||||
{
|
||||
ui_window_win32_t *window = (ui_window_win32_t*)data;
|
||||
DestroyWindow(window->hwnd);
|
||||
}
|
||||
|
||||
void ui_window_win32_set_focused(void *data)
|
||||
static void ui_window_win32_set_focused(void *data)
|
||||
{
|
||||
ui_window_win32_t *window = (ui_window_win32_t*)data;
|
||||
SetFocus(window->hwnd);
|
||||
}
|
||||
|
||||
void ui_window_win32_set_visible(void *data,
|
||||
static void ui_window_win32_set_visible(void *data,
|
||||
bool set_visible)
|
||||
{
|
||||
ui_window_win32_t *window = (ui_window_win32_t*)data;
|
||||
ShowWindow(window->hwnd, set_visible ? SW_SHOWNORMAL : SW_HIDE);
|
||||
}
|
||||
|
||||
void ui_window_win32_set_title(void *data, char *buf)
|
||||
static void ui_window_win32_set_title(void *data, char *buf)
|
||||
{
|
||||
ui_window_win32_t *window = (ui_window_win32_t*)data;
|
||||
SetWindowText(window->hwnd, buf);
|
||||
}
|
||||
|
||||
void ui_window_win32_set_droppable(void *data, bool droppable)
|
||||
static void ui_window_win32_set_droppable(void *data, bool droppable)
|
||||
{
|
||||
ui_window_win32_t *window = (ui_window_win32_t*)data;
|
||||
DragAcceptFiles(window->hwnd, droppable);
|
||||
}
|
||||
|
||||
bool ui_window_win32_focused(void *data)
|
||||
static bool ui_window_win32_focused(void *data)
|
||||
{
|
||||
ui_window_win32_t *window = (ui_window_win32_t*)data;
|
||||
return (GetForegroundWindow() == window->hwnd);
|
||||
|
@ -37,19 +37,6 @@ typedef struct ui_window_win32
|
||||
HWND hwnd;
|
||||
} ui_window_win32_t;
|
||||
|
||||
void ui_window_win32_set_visible(void *data,
|
||||
bool set_visible);
|
||||
|
||||
void ui_window_win32_set_focused(void *data);
|
||||
|
||||
void ui_window_win32_destroy(void *data);
|
||||
|
||||
void ui_window_win32_set_title(void *data, char *buf);
|
||||
|
||||
void ui_window_win32_set_droppable(void *data, bool droppable);
|
||||
|
||||
bool ui_window_win32_focused(void *data);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user