forked from Mirrors/openclonk
Default to not changing the resolution
1. We receive bugreports that changing the resolution doesn't work, but can't reproduce that 2. Flat screens look best at their natural resolutionfloating-point
parent
5a2831a1e7
commit
cc25878ba6
|
@ -708,6 +708,7 @@ IDS_MNU_CLONKNAMES=Clonk-Namen
|
|||
IDS_MNU_CLOSE=Schließen
|
||||
IDS_MNU_COMPONENTS=Komponenten
|
||||
IDS_MNU_CONTENTS=Inhalt nehmen
|
||||
IDS_MNU_DEFAULTRESOLUTION=Bildschirm
|
||||
IDS_MNU_DELETE=Löschen
|
||||
IDS_MNU_DUPLICATE=Duplizieren
|
||||
IDS_MNU_FILE=Datei
|
||||
|
|
|
@ -707,6 +707,7 @@ IDS_MNU_CLONKNAMES=Clonk names
|
|||
IDS_MNU_CLOSE=Close
|
||||
IDS_MNU_COMPONENTS=Components
|
||||
IDS_MNU_CONTENTS=Grab contents
|
||||
IDS_MNU_DEFAULTRESOLUTION=Screen
|
||||
IDS_MNU_DELETE=Delete
|
||||
IDS_MNU_DUPLICATE=Duplicate
|
||||
IDS_MNU_FILE=File
|
||||
|
|
|
@ -90,11 +90,9 @@ void C4ConfigDeveloper::CompileFunc(StdCompiler *pComp)
|
|||
|
||||
void C4ConfigGraphics::CompileFunc(StdCompiler *pComp)
|
||||
{
|
||||
pComp->Value(mkNamingAdapt(ResX, "ResolutionX", 800 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(ResY, "ResolutionY", 600 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(ResX, "ResolutionX", -1 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(ResY, "ResolutionY", -1 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(RefreshRate, "RefreshRate", 0 ));
|
||||
pComp->Value(mkNamingAdapt(GuiResX, "GuiResolutionX", 800 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(GuiResY, "GuiResolutionY", 600 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(ShowAllResolutions, "ShowAllResolutions", 0 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(SplitscreenDividers, "SplitscreenDividers", 1 ));
|
||||
pComp->Value(mkNamingAdapt(ShowStartupMessages, "ShowStartupMessages", 1 ,false, true));
|
||||
|
|
|
@ -100,7 +100,6 @@ public:
|
|||
int32_t ShowClock;
|
||||
int32_t ResX,ResY;
|
||||
int32_t RefreshRate; // monitor vertical refresh rate
|
||||
int32_t GuiResX,GuiResY;
|
||||
int32_t Windowed;
|
||||
int32_t ShowAllResolutions;
|
||||
int32_t ShowCrewNames; // show player name above clonks?
|
||||
|
|
|
@ -437,6 +437,9 @@ void C4Application::ParseCommandLine(int argc, char * argv[])
|
|||
|
||||
void C4Application::ApplyResolutionConstraints()
|
||||
{
|
||||
// Not changing the resolution always works anyway
|
||||
if (Config.Graphics.ResX == -1 && Config.Graphics.ResY == -1)
|
||||
return;
|
||||
// Enumerate display modes
|
||||
int32_t idx = -1, iXRes, iYRes, iBitDepth, iRefreshRate;
|
||||
int32_t best_match = -1;
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
#include <C4Version.h>
|
||||
#include "C4Network2.h"
|
||||
|
||||
void InstallCrashHandler();
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <shellapi.h>
|
||||
|
||||
void InstallCrashHandler();
|
||||
|
||||
int WINAPI WinMain (HINSTANCE hInst,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdParam,
|
||||
|
|
|
@ -463,6 +463,7 @@ bool CStdD3D::SetOutputAdapter(unsigned int iMonitor)
|
|||
|
||||
bool CStdD3D::CreatePrimarySurfaces(bool Editor, unsigned int iXRes, unsigned int iYRes, int iColorDepth, unsigned int iMonitor)
|
||||
{
|
||||
// FIXME: this needs to work with iXRes==iYRes==-1, which means "use the desktop resolution"
|
||||
DebugLog("Init DX");
|
||||
DebugLog(" Create Direct3D9...");
|
||||
if ((lpD3D=Direct3DCreate9(D3D_SDK_VERSION))==NULL) return Error(" Direct3DCreate9 failure.");
|
||||
|
|
|
@ -1207,6 +1207,7 @@ void C4StartupOptionsDlg::OnGfxResComboFill(C4GUI::ComboBox_FillCB *pFiller)
|
|||
{
|
||||
// clear all old entries first to allow a clean refill
|
||||
pFiller->ClearEntries();
|
||||
pFiller->AddEntry(LoadResStr("IDS_MNU_DEFAULTRESOLUTION"), -1);
|
||||
// fill with all possible resolutions
|
||||
int32_t idx = 0, iXRes, iYRes, iBitDepth;
|
||||
while (Application.GetIndexedDisplayMode(idx++, &iXRes, &iYRes, &iBitDepth, NULL, Config.Graphics.Monitor))
|
||||
|
@ -1225,6 +1226,8 @@ bool C4StartupOptionsDlg::OnGfxResComboSelChange(C4GUI::ComboBox *pForCombo, int
|
|||
{
|
||||
// get new resolution from string
|
||||
int iResX=(idNewSelection & 0xffff), iResY=(uint32_t(idNewSelection) & 0xffff0000) >> 16;
|
||||
if (idNewSelection == -1)
|
||||
iResX = iResY = -1;
|
||||
// different than current?
|
||||
if (iResX == Config.Graphics.ResX && iResY == Config.Graphics.ResY) return true;
|
||||
// try setting it
|
||||
|
@ -1243,12 +1246,10 @@ bool C4StartupOptionsDlg::TryNewResolution(int32_t iResX, int32_t iResY)
|
|||
int32_t iOldFontSize = Config.General.RXFontSize;
|
||||
C4GUI::Screen *pScreen = GetScreen();
|
||||
// resolution change may imply font size change
|
||||
int32_t iNewFontSize;
|
||||
if (iResX < 700)
|
||||
int32_t iNewFontSize = 14; // default (at 800x600)
|
||||
if (iResY >= 0 && iResY < 600)
|
||||
iNewFontSize = 12;
|
||||
else if (iResX < 950)
|
||||
iNewFontSize = 14; // default (at 800x600)
|
||||
else
|
||||
else if (iResY > 800)
|
||||
iNewFontSize = 16;
|
||||
// call application to set it
|
||||
if (!Application.SetVideoMode(iResX, iResY, Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, !Config.Graphics.Windowed))
|
||||
|
@ -1294,6 +1295,8 @@ bool C4StartupOptionsDlg::TryNewResolution(int32_t iResX, int32_t iResY)
|
|||
StdStrBuf C4StartupOptionsDlg::GetGfxResString(int32_t iResX, int32_t iResY)
|
||||
{
|
||||
// Display in format like "640 x 480"
|
||||
if (iResX == -1)
|
||||
return StdStrBuf(LoadResStr("IDS_MNU_DEFAULTRESOLUTION"));
|
||||
return FormatString("%d x %d", (int)iResX, (int)iResY);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,8 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne
|
|||
}
|
||||
if (!fFullScreen)
|
||||
{
|
||||
pWindow->SetSize(iXRes, iYRes);
|
||||
if (iXRes != -1)
|
||||
pWindow->SetSize(iXRes, iYRes);
|
||||
return true;
|
||||
}
|
||||
if (Priv->xf86vmode_targetmode.hdisplay == iXRes && Priv->xf86vmode_targetmode.vdisplay == iYRes)
|
||||
|
@ -184,7 +185,14 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne
|
|||
// XF86VidMode has a really weird API.
|
||||
XF86VidModeGetModeLine(dpy, DefaultScreen(dpy), (int*)&Priv->xf86vmode_oldmode.dotclock,
|
||||
(XF86VidModeModeLine*)(((char *)&Priv->xf86vmode_oldmode) + sizeof(Priv->xf86vmode_oldmode.dotclock)));
|
||||
//Priv->oldmode = *modes[0];
|
||||
if (iXRes == -1 && iYRes == -1)
|
||||
{
|
||||
Priv->xf86vmode_targetmode = Priv->xf86vmode_oldmode;
|
||||
modefound = true;
|
||||
}
|
||||
}
|
||||
if (Priv->xf86vmode_major_version >= 0 && !modefound)
|
||||
{
|
||||
// Change resolution
|
||||
int mode_num;
|
||||
XF86VidModeModeInfo **modes;
|
||||
|
@ -257,7 +265,7 @@ bool C4X11AppImpl::SwitchToFullscreen(C4AbstractApp * pApp, C4Window * pWindow)
|
|||
gdk_pointer_grab(wnd, true, GdkEventMask(0), wnd, NULL, gdk_x11_display_get_user_time(gdk_display_get_default()));
|
||||
return true;
|
||||
}
|
||||
if (xrandr_major_version >= 0)
|
||||
if (xrandr_major_version >= 0 && !(wdt == -1 && hgt == -1))
|
||||
{
|
||||
XRRScreenConfiguration * conf = XRRGetScreenInfo (dpy, pWindow->wnd);
|
||||
xrandr_oldmode = XRRConfigCurrentConfiguration (conf, &xrandr_rot);
|
||||
|
@ -297,7 +305,7 @@ void C4X11AppImpl::SwitchToDesktop(C4AbstractApp * pApp, C4Window * pWindow)
|
|||
}
|
||||
gtk_window_unfullscreen(GTK_WINDOW(pWindow->window));
|
||||
// Restore resolution
|
||||
if (xrandr_major_version >= 0)
|
||||
if (xrandr_major_version >= 0 && !(wdt == -1 && hgt == -1))
|
||||
{
|
||||
XRRScreenConfiguration * conf = XRRGetScreenInfo (dpy, pWindow->wnd);
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -258,14 +258,15 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne
|
|||
//pWindow->GetSize(&r);
|
||||
// FIXME: optimize redundant calls away. maybe make all platforms implicitely call SetVideoMode in C4Window::Init?
|
||||
// SDL doesn't support multiple monitors.
|
||||
if (!SDL_SetVideoMode(iXRes, iYRes, iColorDepth, SDL_OPENGL | (fFullScreen ? SDL_FULLSCREEN : 0)))
|
||||
if (!SDL_SetVideoMode(iXRes == -1 ? 0 : iXRes, iYRes == -1 ? 0 : iYRes, iColorDepth,
|
||||
SDL_OPENGL | (fFullScreen ? SDL_FULLSCREEN : 0)))
|
||||
{
|
||||
sLastError.Copy(SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
pWindow->SetSize(iXRes, iYRes);
|
||||
OnResolutionChanged(iXRes, iYRes);
|
||||
const SDL_VideoInfo * info = SDL_GetVideoInfo();
|
||||
OnResolutionChanged(info->current_w, info->current_h);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -317,9 +317,6 @@ protected:
|
|||
unsigned long handlerDestroy;
|
||||
|
||||
friend class C4X11AppImpl;
|
||||
#elif defined(USE_SDL_MAINLOOP)
|
||||
private:
|
||||
int width, height;
|
||||
#elif defined(USE_COCOA)
|
||||
protected:
|
||||
/*ClonkWindowController*/void* controller;
|
||||
|
|
|
@ -948,7 +948,7 @@ void C4Window::Clear()
|
|||
|
||||
void C4Window::SetSize(unsigned int width, unsigned int height)
|
||||
{
|
||||
gtk_window_resize(GTK_WINDOW(window), width, height);
|
||||
gtk_window_resize(GTK_WINDOW(window), width, height);
|
||||
}
|
||||
|
||||
bool C4Window::GetSize(C4Rect * r)
|
||||
|
|
|
@ -51,13 +51,13 @@ C4Window * C4Window::Init(WindowKind windowKind, C4AbstractApp * pApp, const cha
|
|||
return NULL;
|
||||
Active = true;
|
||||
// SDL doesn't support multiple monitors.
|
||||
if (!SDL_SetVideoMode(Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, SDL_OPENGL | (Config.Graphics.Windowed ? 0 : SDL_FULLSCREEN)))
|
||||
if (!SDL_SetVideoMode(Config.Graphics.ResX == -1 ? 0 : Config.Graphics.ResX, Config.Graphics.ResY == -1 ? 0 : Config.Graphics.ResY,
|
||||
Config.Graphics.BitDepth, SDL_OPENGL | (Config.Graphics.Windowed ? 0 : SDL_FULLSCREEN)))
|
||||
{
|
||||
Log(SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
SetSize(Config.Graphics.ResX, Config.Graphics.ResY);
|
||||
SetTitle(Title);
|
||||
return this;
|
||||
}
|
||||
|
@ -86,13 +86,13 @@ bool C4Window::RestorePosition(const char *, const char *, bool) { return true;
|
|||
bool C4Window::GetSize(C4Rect * pRect)
|
||||
{
|
||||
pRect->x = pRect->y = 0;
|
||||
pRect->Wdt = width, pRect->Hgt = height;
|
||||
const SDL_VideoInfo * info = SDL_GetVideoInfo();
|
||||
pRect->Wdt = info->current_w, pRect->Hgt = info->current_h;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Window::SetSize(unsigned int X, unsigned int Y)
|
||||
{
|
||||
width = X, height = Y;
|
||||
}
|
||||
|
||||
void C4Window::SetTitle(const char * Title)
|
||||
|
|
|
@ -850,9 +850,14 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne
|
|||
return false;
|
||||
}
|
||||
int orientation = dmode.dmDisplayOrientation;
|
||||
if (iXRes == -1 && iYRes == -1)
|
||||
{
|
||||
dspMode=dmode;
|
||||
fFound = true;
|
||||
}
|
||||
// enumerate modes
|
||||
int i=0;
|
||||
while (EnumDisplaySettingsW(Mon.GetWideChar(), i++, &dmode))
|
||||
if (!fFound) while (EnumDisplaySettingsW(Mon.GetWideChar(), i++, &dmode))
|
||||
// compare enumerated mode with requested settings
|
||||
if (dmode.dmPelsWidth==iXRes && dmode.dmPelsHeight==iYRes && dmode.dmBitsPerPel==iColorDepth && dmode.dmDisplayOrientation==orientation
|
||||
&& (iRefreshRate == 0 || dmode.dmDisplayFrequency == iRefreshRate))
|
||||
|
@ -894,10 +899,17 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne
|
|||
SetWindowLong(pWindow->hWindow, GWL_STYLE,
|
||||
GetWindowLong(pWindow->hWindow, GWL_STYLE) & ~ (WS_CAPTION|WS_THICKFRAME|WS_BORDER));
|
||||
}
|
||||
|
||||
::SetWindowPos(pWindow->hWindow, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_FRAMECHANGED);
|
||||
pWindow->SetSize(dspMode.dmPelsWidth, dspMode.dmPelsHeight);
|
||||
OnResolutionChanged(iXRes, iYRes);
|
||||
if (!fFullScreen && iXRes != -1)
|
||||
{
|
||||
pWindow->SetSize(iXRes, iYRes);
|
||||
OnResolutionChanged(iXRes, iYRes);
|
||||
}
|
||||
if (fFullScreen)
|
||||
{
|
||||
pWindow->SetSize(dspMode.dmPelsWidth, dspMode.dmPelsHeight);
|
||||
OnResolutionChanged(dspMode.dmPelsWidth, dspMode.dmPelsHeight);
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue