From 8bd1ef77ff060a7f0136e1c69e7c6bec1a2026d6 Mon Sep 17 00:00:00 2001 From: OV2 Date: Wed, 10 Oct 2012 20:41:00 +0200 Subject: [PATCH 1/3] win32: no -lSDL if HAVE_SDL!=1 --- Makefile.win | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.win b/Makefile.win index 000242afea..9977948245 100644 --- a/Makefile.win +++ b/Makefile.win @@ -228,9 +228,9 @@ $(TARGET): $(OBJ) $(JTARGET): $(JOBJ) ifeq ($(CXX_BUILD), 1) - $(Q)$(CXX) -o $@ $(JOBJ) -lSDL -ldxguid -ldinput8 -lole32 $(LDFLAGS) + $(Q)$(CXX) -o $@ $(JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) else - $(Q)$(CC) -o $@ $(JOBJ) -lSDL -ldxguid -ldinput8 -lole32 $(LDFLAGS) + $(Q)$(CC) -o $@ $(JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) endif @$(if $(Q), $(shell echo echo LD $@),) From 13fafd80abcab24fa2229c3e138c6982bbb297f8 Mon Sep 17 00:00:00 2001 From: OV2 Date: Wed, 10 Oct 2012 20:56:28 +0200 Subject: [PATCH 2/3] win32: only hide cursor if in fullscreen --- gfx/context/wgl_ctx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gfx/context/wgl_ctx.c b/gfx/context/wgl_ctx.c index cd244a15c9..51406b156b 100644 --- a/gfx/context/wgl_ctx.c +++ b/gfx/context/wgl_ctx.c @@ -217,6 +217,14 @@ static bool set_fullscreen(unsigned width, unsigned height) return ChangeDisplaySettings(&devmode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL; } +static void show_cursor(bool show) +{ + if(show) + while(ShowCursor(TRUE)<0); + else + while(ShowCursor(FALSE)>=0); +} + static bool gfx_ctx_set_video_mode( unsigned width, unsigned height, unsigned bits, bool fullscreen) @@ -272,13 +280,14 @@ static bool gfx_ctx_set_video_mode( if (!fullscreen || windowed_full) { - ShowCursor(FALSE); ShowWindow(g_hwnd, SW_RESTORE); UpdateWindow(g_hwnd); SetForegroundWindow(g_hwnd); SetFocus(g_hwnd); } + show_cursor(!fullscreen); + // Wait until GL context is created (or failed to do so ...) MSG msg; while (!g_inited && !g_quit && GetMessage(&msg, g_hwnd, 0, 0)) From 691491ccdbb30dd7ea1cf4511dc6269302a4708b Mon Sep 17 00:00:00 2001 From: OV2 Date: Wed, 10 Oct 2012 21:41:31 +0200 Subject: [PATCH 3/3] win32: windowed fullscreen on current monitor --- gfx/context/wgl_ctx.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gfx/context/wgl_ctx.c b/gfx/context/wgl_ctx.c index 51406b156b..fc2e15d321 100644 --- a/gfx/context/wgl_ctx.c +++ b/gfx/context/wgl_ctx.c @@ -25,6 +25,7 @@ static HWND g_hwnd; static HGLRC g_hrc; static HDC g_hdc; +static HMONITOR g_last_hm = 0; static bool g_quit; static bool g_inited; @@ -232,8 +233,11 @@ static bool gfx_ctx_set_video_mode( (void)bits; DWORD style; - RECT screen_rect; - GetClientRect(GetDesktopWindow(), &screen_rect); + MONITORINFO current_mon; + current_mon.cbSize = sizeof(MONITORINFO); + if(!g_last_hm) + g_last_hm = MonitorFromWindow(GetDesktopWindow(),MONITOR_DEFAULTTONEAREST); + GetMonitorInfo(g_last_hm,¤t_mon); g_resize_width = width; g_resize_height = height; @@ -242,15 +246,15 @@ static bool gfx_ctx_set_video_mode( if (fullscreen) { if (windowed_full) + { style = WS_EX_TOPMOST | WS_POPUP; + g_resize_width = width = current_mon.rcMonitor.right - current_mon.rcMonitor.left; + g_resize_height = height = current_mon.rcMonitor.bottom - current_mon.rcMonitor.top; + } else { style = WS_POPUP | WS_VISIBLE; - AdjustWindowRect(&screen_rect, style, FALSE); - width = screen_rect.right - screen_rect.left; - height = screen_rect.bottom - screen_rect.top; - if (!set_fullscreen(width, height)) goto error; @@ -269,7 +273,7 @@ static bool gfx_ctx_set_video_mode( } g_hwnd = CreateWindowEx(0, "RetroArch", "RetroArch", style, - windowed_full ? 0 : CW_USEDEFAULT, windowed_full ? 0 : CW_USEDEFAULT, + fullscreen && windowed_full ? current_mon.rcMonitor.left : CW_USEDEFAULT, fullscreen && windowed_full ? current_mon.rcMonitor.top : CW_USEDEFAULT, width, height, NULL, NULL, NULL, NULL); @@ -331,6 +335,7 @@ static void gfx_ctx_destroy(void) if (g_hwnd) { + g_last_hm = MonitorFromWindow(g_hwnd,MONITOR_DEFAULTTONEAREST); DestroyWindow(g_hwnd); UnregisterClass("RetroArch", GetModuleHandle(NULL)); g_hwnd = NULL;