RetroArch/gfx/common/win32_common.h

207 lines
5.7 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2014-01-01 01:50:59 +01:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2017-01-22 13:40:32 +01:00
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2019 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WIN32_COMMON_H__
#define WIN32_COMMON_H__
2015-04-09 05:19:29 +02:00
#include <string.h>
2015-11-11 17:41:20 +01:00
#ifndef _XBOX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
2017-09-03 23:39:25 -04:00
#if _WIN32_WINNT <= 0x0400
/* Windows versions below 98 do not support multiple monitors, so fake it */
#define COMPILE_MULTIMON_STUBS
#include <multimon.h>
#endif
2015-11-11 17:41:20 +01:00
#endif
2015-04-09 05:19:29 +02:00
#include <boolean.h>
2016-06-03 08:06:49 +02:00
#include <retro_common_api.h>
2017-12-30 13:35:47 +01:00
#include <retro_environment.h>
2015-04-09 05:19:29 +02:00
#include "../../driver.h"
#include "../../retroarch.h"
2015-04-09 05:19:29 +02:00
2018-05-14 03:57:27 +02:00
#ifndef _XBOX
2015-11-19 07:59:10 +01:00
#include "../../ui/drivers/ui_win32_resource.h"
2016-06-07 16:33:55 +02:00
#include "../../ui/drivers/ui_win32.h"
2022-05-17 13:21:56 +02:00
#if (defined(_MSC_VER) && (_MSC_VER >= 1400)) || defined(__MINGW32__)
#ifndef HAVE_CLIP_WINDOW
#define HAVE_CLIP_WINDOW
#endif
#endif
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 /* Windows 2000 and higher */
/* Supports taskbar */
#ifndef HAVE_TASKBAR
#define HAVE_TASKBAR
#endif
/* Supports window transparency */
#ifndef HAVE_WINDOW_TRANSP
#define HAVE_WINDOW_TRANSP
#endif
#endif
#endif
2017-12-30 13:35:47 +01:00
RETRO_BEGIN_DECLS
2018-05-12 19:03:39 +02:00
#if !defined(_XBOX)
extern unsigned g_win32_resize_width;
extern unsigned g_win32_resize_height;
extern float g_win32_refresh_rate;
2018-05-12 19:03:39 +02:00
extern bool g_win32_inited;
extern bool g_win32_restore_desktop;
extern ui_window_win32_t main_window;
2015-11-11 18:26:10 +01:00
void win32_monitor_get_info(void);
void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id);
2015-11-11 18:16:28 +01:00
2018-04-15 17:55:37 +02:00
int win32_change_display_settings(const char *str, void *devmode_data,
unsigned flags);
void create_wgl_context(HWND hwnd, bool *quit);
2022-04-25 18:39:27 +02:00
#if defined(HAVE_VULKAN)
void create_vk_context(HWND hwnd, bool *quit);
2022-04-25 18:39:27 +02:00
#endif
2022-04-25 18:39:27 +02:00
#if defined(HAVE_GDI)
2017-01-04 23:13:08 -05:00
void create_gdi_context(HWND hwnd, bool *quit);
2022-04-25 18:39:27 +02:00
#endif
2015-11-19 08:56:08 +01:00
2019-02-07 05:42:23 +01:00
bool win32_get_video_output(DEVMODE *dm, int mode, size_t len);
2018-08-17 14:50:56 +02:00
#if !defined(__WINRT__)
2018-05-09 16:12:52 +02:00
bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name);
void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
unsigned *width, unsigned *height, bool fullscreen, bool windowed_full,
RECT *rect, RECT *mon_rect, DWORD *style);
#endif
2016-06-04 05:54:33 +02:00
void win32_monitor_from_window(void);
2022-05-17 13:21:56 +02:00
#endif
2015-11-17 10:49:36 +01:00
void win32_monitor_init(void);
2015-11-12 05:16:06 +01:00
bool win32_set_video_mode(void *data,
unsigned width, unsigned height,
2015-11-12 05:17:21 +01:00
bool fullscreen);
2015-11-12 05:16:06 +01:00
2015-11-12 02:51:40 +01:00
bool win32_window_create(void *data, unsigned style,
RECT *mon_rect, unsigned width,
unsigned height, bool fullscreen);
bool win32_suppress_screensaver(void *data, bool enable);
2015-04-09 05:19:29 +02:00
bool win32_get_metrics(void *data,
2016-12-02 23:36:23 -05:00
enum display_metric_types type, float *value);
2015-04-09 05:19:29 +02:00
void win32_show_cursor(void *data, bool state);
2015-04-10 09:30:18 +02:00
2015-11-17 09:41:18 +01:00
HWND win32_get_window(void);
bool win32_get_client_rect(RECT* rect);
bool is_running_on_xbox(void);
bool win32_has_focus(void *data);
2015-11-17 08:58:49 +01:00
2022-05-17 13:21:56 +02:00
#ifdef HAVE_CLIP_WINDOW
void win32_clip_window(bool grab);
2022-05-17 13:21:56 +02:00
#endif
2020-07-18 17:09:07 +02:00
void win32_check_window(void *data,
bool *quit,
2015-11-11 19:48:24 +01:00
bool *resize, unsigned *width, unsigned *height);
2015-04-10 09:36:03 +02:00
2016-01-09 04:59:12 +01:00
void win32_set_window(unsigned *width, unsigned *height,
2016-01-09 05:00:56 +01:00
bool fullscreen, bool windowed_full, void *rect_data);
2016-01-09 04:59:12 +01:00
2017-08-09 03:53:19 +02:00
void win32_get_video_output_size(
unsigned *width, unsigned *height, char *desc, size_t desc_len);
2017-08-09 03:53:19 +02:00
void win32_get_video_output_prev(
2017-08-09 03:44:03 +02:00
unsigned *width, unsigned *height);
2017-08-09 04:09:44 +02:00
void win32_get_video_output_next(
unsigned *width, unsigned *height);
2015-11-17 10:16:16 +01:00
void win32_window_reset(void);
2015-11-17 09:44:26 +01:00
void win32_destroy_window(void);
bool win32_taskbar_is_created(void);
float win32_get_refresh_rate(void *data);
#if defined(HAVE_D3D8) || defined(HAVE_D3D9) || defined (HAVE_D3D10) || defined (HAVE_D3D11) || defined (HAVE_D3D12)
LRESULT CALLBACK wnd_proc_d3d_dinput(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_d3d_winraw(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_d3d_common(HWND hwnd, UINT message,
2015-11-28 21:50:28 +01:00
WPARAM wparam, LPARAM lparam);
#endif
2015-11-28 21:50:28 +01:00
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE)
LRESULT CALLBACK wnd_proc_wgl_dinput(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_wgl_winraw(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_wgl_common(HWND hwnd, UINT message,
2015-11-28 21:50:28 +01:00
WPARAM wparam, LPARAM lparam);
#endif
2015-11-28 21:50:28 +01:00
#if defined(HAVE_VULKAN)
LRESULT CALLBACK wnd_proc_vk_dinput(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_vk_winraw(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_vk_common(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
#endif
2022-04-25 18:39:27 +02:00
#if defined(HAVE_GDI)
LRESULT CALLBACK wnd_proc_gdi_dinput(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_gdi_winraw(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
LRESULT CALLBACK wnd_proc_gdi_common(HWND hwnd, UINT message,
2017-01-04 22:57:00 -05:00
WPARAM wparam, LPARAM lparam);
2022-04-25 18:39:27 +02:00
#endif
2017-01-04 22:57:00 -05:00
2015-11-17 10:49:36 +01:00
#ifdef _XBOX
BOOL IsIconic(HWND hwnd);
#endif
bool win32_load_content_from_gui(const char *szFilename);
2019-08-28 23:58:15 +02:00
void win32_setup_pixel_format(HDC hdc, bool supports_gl);
void win32_update_title(void);
2017-12-30 13:35:47 +01:00
RETRO_END_DECLS
#endif