Merge pull request from Wargus/tim

Fixes a bunch of issues...
This commit is contained in:
Tim Felgentreff 2018-02-04 15:41:43 +01:00 committed by GitHub
commit 47d35617ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 20 deletions

View file

@ -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})

View file

@ -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;

View file

@ -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";

View file

@ -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 |
@ -590,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)
@ -652,17 +658,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);
@ -885,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;
@ -1151,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.
@ -1174,8 +1192,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)

View file

@ -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>