Change function signature of win32_has_focus

This commit is contained in:
twinaphex 2020-01-04 15:49:23 +01:00
parent aae2e6fd7d
commit 3e1f56d57f
9 changed files with 9 additions and 30 deletions

View File

@ -1373,7 +1373,7 @@ BOOL IsIconic(HWND hwnd)
}
#endif
bool win32_has_focus(void)
bool win32_has_focus(void *data)
{
if (g_win32_inited)
if (GetForegroundWindow() == main_window.hwnd)

View File

@ -96,7 +96,7 @@ void win32_show_cursor(void *data, bool state);
HWND win32_get_window(void);
bool win32_has_focus(void);
bool win32_has_focus(void *data);
void win32_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height);

View File

@ -1546,8 +1546,6 @@ static bool d3d10_gfx_alive(void* data)
return !quit;
}
static bool d3d10_gfx_focus(void* data) { return win32_has_focus(); }
static bool d3d10_gfx_suppress_screensaver(void* data, bool enable)
{
(void)data;
@ -1777,7 +1775,7 @@ video_driver_t video_d3d10 = {
d3d10_gfx_frame,
d3d10_gfx_set_nonblock_state,
d3d10_gfx_alive,
d3d10_gfx_focus,
win32_has_focus,
d3d10_gfx_suppress_screensaver,
d3d10_gfx_has_windowed,
d3d10_gfx_set_shader,

View File

@ -1624,8 +1624,6 @@ static bool d3d11_gfx_alive(void* data)
return !quit;
}
static bool d3d11_gfx_focus(void* data) { return win32_has_focus(); }
static bool d3d11_gfx_suppress_screensaver(void* data, bool enable)
{
(void)data;
@ -1849,7 +1847,7 @@ video_driver_t video_d3d11 = {
d3d11_gfx_frame,
d3d11_gfx_set_nonblock_state,
d3d11_gfx_alive,
d3d11_gfx_focus,
win32_has_focus,
d3d11_gfx_suppress_screensaver,
d3d11_gfx_has_windowed,
d3d11_gfx_set_shader,

View File

@ -1614,8 +1614,6 @@ static bool d3d12_gfx_alive(void* data)
return !quit;
}
static bool d3d12_gfx_focus(void* data) { return win32_has_focus(); }
static bool d3d12_gfx_suppress_screensaver(void* data, bool enable)
{
(void)data;
@ -1850,7 +1848,7 @@ video_driver_t video_d3d12 = {
d3d12_gfx_frame,
d3d12_gfx_set_nonblock_state,
d3d12_gfx_alive,
d3d12_gfx_focus,
win32_has_focus,
d3d12_gfx_suppress_screensaver,
d3d12_gfx_has_windowed,
d3d12_gfx_set_shader,

View File

@ -211,11 +211,6 @@ static void gfx_ctx_gdi_input_driver(void *data,
*input_data = dinput_gdi;
}
static bool gfx_ctx_gdi_has_focus(void *data)
{
return win32_has_focus();
}
static enum gfx_ctx_api gfx_ctx_gdi_get_api(void *data)
{
return win32_gdi_api;
@ -285,7 +280,7 @@ const gfx_ctx_driver_t gfx_ctx_gdi = {
gfx_ctx_gdi_update_title,
gfx_ctx_gdi_check_window,
gfx_ctx_gdi_set_resize,
gfx_ctx_gdi_has_focus,
win32_has_focus,
win32_suppress_screensaver,
true, /* has_windowed */
gfx_ctx_gdi_swap_buffers,

View File

@ -270,11 +270,6 @@ static void gfx_ctx_uwp_input_driver(void *data,
}
}
static bool gfx_ctx_uwp_has_focus(void *data)
{
return win32_has_focus();
}
static enum gfx_ctx_api gfx_ctx_uwp_get_api(void *data)
{
return uwp_api;
@ -345,7 +340,7 @@ const gfx_ctx_driver_t gfx_ctx_uwp = {
NULL, /* update title */
gfx_ctx_uwp_check_window,
gfx_ctx_uwp_set_resize,
gfx_ctx_uwp_has_focus,
win32_has_focus,
NULL, /* suppress screensaver */
true, /* has_windowed */
gfx_ctx_uwp_swap_buffers,

View File

@ -827,11 +827,6 @@ static void gfx_ctx_wgl_input_driver(void *data,
#endif
}
static bool gfx_ctx_wgl_has_focus(void *data)
{
return win32_has_focus();
}
static enum gfx_ctx_api gfx_ctx_wgl_get_api(void *data)
{
return win32_api;
@ -1001,7 +996,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_wgl_update_title,
gfx_ctx_wgl_check_window,
gfx_ctx_wgl_set_resize,
gfx_ctx_wgl_has_focus,
win32_has_focus,
win32_suppress_screensaver,
true, /* has_windowed */
gfx_ctx_wgl_swap_buffers,

View File

@ -568,7 +568,7 @@ void App::OnPackageInstalling(PackageCatalog^ sender, PackageInstallingEventArgs
// Implement UWP equivalents of various win32_* functions
extern "C" {
bool win32_has_focus(void)
bool win32_has_focus(void *data)
{
return App::GetInstance()->IsWindowFocused();
}