5 1 new backport x11 fs rework (#1485)
* Use XRandR 1.2 to set fullscreen resolution for single output Squash of roothorick's PR #497 (also includes Kyzentun's CMake changes from PR #716) * Cherry-pick json c++1x stuff (b9e3d7174e) * Cherry-pick c++11 support from 5bba5c0038 and 9f8b045309 * rework Linux (X11) fullscreen, improve display-related Graphics Options Implement option to select between monitors for exclusive fullscreen mode on X11 (using XRandR 1.2), or use a fullscreen borderless window. Reimplement resolution/refresh rate/display mode-related option rows using Lua, update choices dynamically so only known-good groupings of resolution/refresh rate/aspect ratio can be selected. Minimally update Windows/MacOS LowLevelWindow implementations to support changes made for Linux side. Fullscreen Borderless Window/multi monitor support from X11 not implemented for those in this commit. * allow forcibly disabling xinerama use on Linux When libXinerama is available, SM tries to use it to find the proper monitor indexes to use to set _NET_WM_FULLSCREEN_MONITORS (on borderless fullscreen). xfwm4 seems to assume that monitors are numbered in increasing order from left to right (rather than using the Xinerama-assigned numbers), so _NET_WM_FULLSCREEN_MONITORS misbehaves on Xfce. This commit bypasses use of libXinerama, and instead forces SM to induce fullscreen on the desired monitor in the backup, hacky way: remove all window hints, move window to desired monitor, then add _NET_WM_STATE_FULLSCREEN hint. This works on mutter and Xfce. * Remove multiple warnings on redundant define. This used to be hard-coded due to pthread related items, but now it's dynamically determined. * fix _fallback menu behavior for unrecognized aspect ratios * Fix error recreating existing FS texture * Bump deployment target to 10.7 to use libc++ on XCode 8 * Add explicit casts to please clang * Update changelog
This commit is contained in:
committed by
Colby Klein
parent
7ef14c340d
commit
557be7cf1b
+57
-8
@@ -12,7 +12,7 @@
|
||||
#include "RageSurface.h"
|
||||
#include "Preference.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "DisplayResolutions.h"
|
||||
#include "DisplaySpec.h"
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
|
||||
// Statistics stuff
|
||||
@@ -90,17 +90,33 @@ RString RageDisplay::SetVideoMode( VideoModeParams p, bool &bNeedReloadTextures
|
||||
vs.push_back( err );
|
||||
|
||||
// Fall back on a known resolution good rather than 640 x 480.
|
||||
DisplayResolutions dr;
|
||||
this->GetDisplayResolutions( dr );
|
||||
DisplaySpecs dr;
|
||||
this->GetDisplaySpecs(dr);
|
||||
if( dr.empty() )
|
||||
{
|
||||
vs.push_back( "No display resolutions" );
|
||||
return SETVIDEOMODE_FAILED.GetValue() + " " + join(";",vs);
|
||||
}
|
||||
|
||||
const DisplayResolution &d = *dr.begin();
|
||||
p.width = d.iWidth;
|
||||
p.height = d.iHeight;
|
||||
DisplaySpec d = *dr.begin();
|
||||
// Try to find DisplaySpec corresponding to requested display
|
||||
for (const auto &candidate: dr)
|
||||
{
|
||||
if (candidate.currentMode() != nullptr)
|
||||
{
|
||||
d = candidate;
|
||||
if (candidate.id() == p.sDisplayId)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p.sDisplayId = d.id();
|
||||
const DisplayMode supported = d.currentMode() != nullptr ? *d.currentMode() : *d.supportedModes().begin();
|
||||
p.width = supported.width;
|
||||
p.height = supported.height;
|
||||
p.rate = static_cast<int> (round(supported.refreshRate));
|
||||
if( (err = this->TryVideoMode(p,bNeedReloadTextures)) == "" )
|
||||
return RString();
|
||||
vs.push_back( err );
|
||||
@@ -714,8 +730,8 @@ void RageDisplay::ChangeCentering( int iTranslateX, int iTranslateY, int iAddWid
|
||||
RageMatrix RageDisplay::GetCenteringMatrix( float fTranslateX, float fTranslateY, float fAddWidth, float fAddHeight ) const
|
||||
{
|
||||
// in screen space, left edge = -1, right edge = 1, bottom edge = -1. top edge = 1
|
||||
float fWidth = (float) GetActualVideoModeParams().width;
|
||||
float fHeight = (float) GetActualVideoModeParams().height;
|
||||
float fWidth = (float) GetActualVideoModeParams().windowWidth;
|
||||
float fHeight = (float) GetActualVideoModeParams().windowHeight;
|
||||
float fPercentShiftX = SCALE( fTranslateX, 0, fWidth, 0, +2.0f );
|
||||
float fPercentShiftY = SCALE( fTranslateY, 0, fHeight, 0, -2.0f );
|
||||
float fPercentScaleX = SCALE( fAddWidth, 0, fWidth, 1.0f, 2.0f );
|
||||
@@ -990,6 +1006,16 @@ void RageCompiledGeometry::Set( const vector<msMesh> &vMeshes, bool bNeedsNormal
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
// Register with Lua.
|
||||
static void register_REFRESH_DEFAULT(lua_State *L)
|
||||
{
|
||||
lua_pushstring( L, "REFRESH_DEFAULT" );
|
||||
lua_pushinteger( L, REFRESH_DEFAULT );
|
||||
lua_settable( L, LUA_GLOBALSINDEX);
|
||||
}
|
||||
REGISTER_WITH_LUA_FUNCTION( register_REFRESH_DEFAULT );
|
||||
|
||||
|
||||
/** @brief Allow Lua to have access to the RageDisplay. */
|
||||
class LunaRageDisplay: public Luna<RageDisplay>
|
||||
{
|
||||
@@ -1026,6 +1052,26 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int GetDisplaySpecs( T* p, lua_State *L )
|
||||
{
|
||||
DisplaySpecs s;
|
||||
p->GetDisplaySpecs(s);
|
||||
pushDisplaySpecs(L, s);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int SupportsRenderToTexture( T* p, lua_State *L )
|
||||
{
|
||||
lua_pushboolean(L, p->SupportsRenderToTexture());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int SupportsFullscreenBorderlessWindow( T* p, lua_State *L )
|
||||
{
|
||||
lua_pushboolean(L, p->SupportsFullscreenBorderlessWindow());
|
||||
return 1;
|
||||
}
|
||||
|
||||
LunaRageDisplay()
|
||||
{
|
||||
ADD_METHOD( GetDisplayWidth );
|
||||
@@ -1033,6 +1079,9 @@ public:
|
||||
ADD_METHOD( GetFPS );
|
||||
ADD_METHOD( GetVPF );
|
||||
ADD_METHOD( GetCumFPS );
|
||||
ADD_METHOD( GetDisplaySpecs );
|
||||
ADD_METHOD( SupportsRenderToTexture );
|
||||
ADD_METHOD( SupportsFullscreenBorderlessWindow);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user