From 7760b6ec7c666573c38029349ab2f120f3820bf5 Mon Sep 17 00:00:00 2001 From: Andrettin <andre.ng@live.com> Date: Sun, 19 Nov 2017 21:38:21 +0100 Subject: [PATCH 1/4] Fix to MouseWarpPos initialization --- src/ui/ui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index ea1bbb835..d41187da2 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -127,7 +127,7 @@ CUserInterface::CUserInterface() : ViewportCursorColor(0), Offset640X(0), Offset480Y(0), VictoryBackgroundG(NULL), DefeatBackgroundG(NULL) { - MouseWarpPos.x = MouseWarpPos.y = 0; + MouseWarpPos.x = MouseWarpPos.y = -1; Point.Name = "cursor-point"; Glass.Name = "cursor-glass"; From 8ac2bd9ea989e7405060e6134f79c9cc15a3c5bb Mon Sep 17 00:00:00 2001 From: Andrettin <andre.ng@live.com> Date: Mon, 20 Nov 2017 10:15:22 +0100 Subject: [PATCH 2/4] [PATCH] Potential fix for mouse jumping issues --- src/include/video.h | 2 -- src/video/sdl.cpp | 30 ++++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/include/video.h b/src/include/video.h index 46df30758..4083e324d 100644 --- a/src/include/video.h +++ b/src/include/video.h @@ -375,9 +375,7 @@ public: int Height; int ViewportWidth; /// Actual width of the window int ViewportHeight; /// Actual height of the window -#if defined(USE_TOUCHSCREEN) && defined(USE_WIN32) SDL_Cursor *blankCursor; -#endif int Depth; int ShaderIndex; bool FullScreen; diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp index bcc1022de..c39f94fa6 100644 --- a/src/video/sdl.cpp +++ b/src/video/sdl.cpp @@ -466,10 +466,14 @@ void InitVideoSdl() Uint32 flags = 0; if (SDL_WasInit(SDL_INIT_VIDEO) == 0) { -#ifndef USE_WIN32 +//Wyrmgus start +//#ifndef USE_WIN32 +//Wyrmgus end // Fix tablet input in full-screen mode SDL_putenv(strdup("SDL_MOUSE_RELATIVE=0")); -#endif +//Wyrmgus start +//#endif +//Wyrmgus end int res = SDL_Init( #ifdef DEBUG SDL_INIT_NOPARACHUTE | @@ -652,17 +656,25 @@ void InitVideoSdl() Video.FullScreen = (TheScreen->flags & SDL_FULLSCREEN) ? 1 : 0; Video.Depth = TheScreen->format->BitsPerPixel; -#if defined(USE_TOUCHSCREEN) && defined(USE_WIN32) +//Wyrmgus start +//#if defined(USE_TOUCHSCREEN) && defined(USE_WIN32) +//Wyrmgus end // Must not allow SDL to switch to relative mouse coordinates // with touchscreen when going fullscreen. So we don't hide the // cursor, but instead set a transparent 1px cursor Uint8 emptyCursor[] = {'\0'}; Video.blankCursor = SDL_CreateCursor(emptyCursor, emptyCursor, 1, 1, 0, 0); SDL_SetCursor(Video.blankCursor); -#else +//Wyrmgus start +//#else +//Wyrmgus end // Turn cursor off, we use our own. - SDL_ShowCursor(SDL_DISABLE); -#endif + //Wyrmgus start +// SDL_ShowCursor(SDL_DISABLE); + //Wyrmgus end +//Wyrmgus start +//#endif +//Wyrmgus end // Make default character translation easier SDL_EnableUNICODE(1); @@ -1174,8 +1186,10 @@ void ToggleFullScreen() // // Windows shows the SDL cursor when starting in fullscreen mode // then switching to window mode. This hides the cursor again. - SDL_ShowCursor(SDL_ENABLE); - SDL_ShowCursor(SDL_DISABLE); + //Wyrmgus start +// SDL_ShowCursor(SDL_ENABLE); +// SDL_ShowCursor(SDL_DISABLE); + //Wyrmgus end #endif #if defined(USE_OPENGL) || defined(USE_GLES) From 5a04b86c5e125a86bb7b3adde6203596aa9f3850 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Sun, 4 Feb 2018 15:13:38 +0100 Subject: [PATCH 3/4] Fix Wargus/war1gus#116: make window resizeable in windowed mode --- src/video/sdl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp index c39f94fa6..5e1983b0b 100644 --- a/src/video/sdl.cpp +++ b/src/video/sdl.cpp @@ -594,6 +594,8 @@ void InitVideoSdl() /* SDL_HWSURFACE|SDL_HWPALETTE | */ if (Video.FullScreen) { flags |= SDL_FULLSCREEN; + } else { + flags |= SDL_RESIZABLE; } #if defined(USE_OPENGL) || defined(USE_GLES) @@ -897,6 +899,10 @@ static void SdlDoEvent(const EventCallback &callbacks, SDL_Event &event) event.key.keysym.sym, event.key.keysym.unicode); break; + case SDL_VIDEORESIZE: + Video.ResizeScreen(event.resize.w, event.resize.h); + break; + case SDL_QUIT: Exit(0); break; @@ -1163,7 +1169,7 @@ void ToggleFullScreen() SDL_UnlockSurface(TheScreen); } - TheScreen = SDL_SetVideoMode(w, h, bpp, flags ^ SDL_FULLSCREEN); + TheScreen = SDL_SetVideoMode(w, h, bpp, (flags ^ SDL_FULLSCREEN) ^ SDL_RESIZABLE); if (!TheScreen) { TheScreen = SDL_SetVideoMode(w, h, bpp, flags); if (!TheScreen) { // completely screwed. From af300c440bb7efd589be9921ca11a3aeec3add31 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Sun, 4 Feb 2018 15:14:16 +0100 Subject: [PATCH 4/4] Revert "Declare dpi awareness so we don't get streched by windows". Should fix #204 and fix #203 This reverts commit 9b39ebd4b3f6f887a9aee759d55a73ef589f2798. --- CMakeLists.txt | 1 - src/win32/DeclareDPIAware.manifest | 7 ------- 2 files changed, 8 deletions(-) delete mode 100644 src/win32/DeclareDPIAware.manifest diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d2226363..97eee7bc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,7 +351,6 @@ source_group(video FILES ${video_SRCS}) set(win32_SRCS src/win32/SetupConsole_win32.cpp - src/win32/DeclareDPIAware.manifest src/win32/stratagus.rc ) source_group(win32 FILES ${win32_SRCS}) diff --git a/src/win32/DeclareDPIAware.manifest b/src/win32/DeclareDPIAware.manifest deleted file mode 100644 index 5dea26f9d..000000000 --- a/src/win32/DeclareDPIAware.manifest +++ /dev/null @@ -1,7 +0,0 @@ -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > - <asmv3:application> - <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> - <dpiAware>true</dpiAware> - </asmv3:windowsSettings> - </asmv3:application> -</assembly> \ No newline at end of file