mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
update screen config in case the window gets moved outside teeworlds
This commit is contained in:
parent
aacc0b0eda
commit
989b19a342
|
@ -688,7 +688,7 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
|
|||
}
|
||||
|
||||
// create window
|
||||
m_pWindow = SDL_CreateWindow(pName, ScreenPos.x, ScreenPos.y, *pWidth, *pHeight, SdlFlags);
|
||||
m_pWindow = SDL_CreateWindow(pName, ScreenPos.x, ScreenPos.y+10, *pWidth, *pHeight, SdlFlags);
|
||||
if(m_pWindow == NULL)
|
||||
{
|
||||
dbg_msg("gfx", "unable to create window: %s", SDL_GetError());
|
||||
|
@ -798,6 +798,11 @@ bool CGraphicsBackend_SDL_OpenGL::SetWindowScreen(int Index)
|
|||
return false;
|
||||
}
|
||||
|
||||
int CGraphicsBackend_SDL_OpenGL::GetWindowScreen()
|
||||
{
|
||||
return SDL_GetWindowDisplayIndex(m_pWindow);
|
||||
}
|
||||
|
||||
int CGraphicsBackend_SDL_OpenGL::WindowActive()
|
||||
{
|
||||
return SDL_GetWindowFlags(m_pWindow)&SDL_WINDOW_INPUT_FOCUS;
|
||||
|
|
|
@ -202,6 +202,7 @@ public:
|
|||
virtual bool Fullscreen(bool State); // on=true/off=false
|
||||
virtual void SetWindowBordered(bool State); // on=true/off=false
|
||||
virtual bool SetWindowScreen(int Index);
|
||||
virtual int GetWindowScreen();
|
||||
virtual int WindowActive();
|
||||
virtual int WindowOpen();
|
||||
};
|
||||
|
|
|
@ -1862,6 +1862,11 @@ void CClient::Run()
|
|||
{
|
||||
Input()->MouseModeRelative();
|
||||
m_WindowMustRefocus = 0;
|
||||
|
||||
// update screen in case it got moved
|
||||
int ActScreen = Graphics()->GetWindowScreen();
|
||||
if(ActScreen > 0 && ActScreen != g_Config.m_GfxScreen)
|
||||
g_Config.m_GfxScreen = ActScreen;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -863,6 +863,11 @@ bool CGraphics_Threaded::SetWindowScreen(int Index)
|
|||
return m_pBackend->SetWindowScreen(Index);
|
||||
}
|
||||
|
||||
int CGraphics_Threaded::GetWindowScreen()
|
||||
{
|
||||
return m_pBackend->GetWindowScreen();
|
||||
}
|
||||
|
||||
int CGraphics_Threaded::WindowActive()
|
||||
{
|
||||
return m_pBackend->WindowActive();
|
||||
|
|
|
@ -322,6 +322,7 @@ public:
|
|||
virtual bool Fullscreen(bool State) = 0;
|
||||
virtual void SetWindowBordered(bool State) = 0;
|
||||
virtual bool SetWindowScreen(int Index) = 0;
|
||||
virtual int GetWindowScreen() = 0;
|
||||
virtual int WindowActive() = 0;
|
||||
virtual int WindowOpen() = 0;
|
||||
|
||||
|
@ -442,6 +443,7 @@ public:
|
|||
virtual bool Fullscreen(bool State);
|
||||
virtual void SetWindowBordered(bool State);
|
||||
virtual bool SetWindowScreen(int Index);
|
||||
virtual int GetWindowScreen();
|
||||
|
||||
virtual int WindowActive();
|
||||
virtual int WindowOpen();
|
||||
|
|
|
@ -202,6 +202,7 @@ public:
|
|||
virtual void SetWindowBordered(bool State) = 0;
|
||||
virtual bool SetWindowScreen(int Index) = 0;
|
||||
virtual bool SetVSync(bool State) = 0;
|
||||
virtual int GetWindowScreen() = 0;
|
||||
|
||||
virtual void Minimize() = 0;
|
||||
virtual void Maximize() = 0;
|
||||
|
|
Loading…
Reference in a new issue