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
+93
-17
@@ -834,6 +834,7 @@ class OptionRowHandlerLua : public OptionRowHandler
|
||||
public:
|
||||
LuaReference *m_pLuaTable;
|
||||
LuaReference m_EnabledForPlayersFunc;
|
||||
LuaReference m_ReloadFunc;
|
||||
|
||||
bool m_TableIsSane;
|
||||
bool m_GoToFirstOnStart;
|
||||
@@ -941,6 +942,17 @@ public:
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_getfield(L, -1, "Reload");
|
||||
if(!lua_isnil(L, -1))
|
||||
{
|
||||
if(!lua_isfunction(L, -1))
|
||||
{
|
||||
LuaHelpers::ReportScriptErrorFmt("LUA_ERROR: \"%s\" \"Reload\" entry is not a function.", RowName.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_getfield(L, -1, "LoadSelections");
|
||||
if(!lua_isfunction(L, -1))
|
||||
{
|
||||
@@ -1007,6 +1019,22 @@ public:
|
||||
LUA->Release(L);
|
||||
}
|
||||
|
||||
void LoadChoices( Lua *L )
|
||||
{
|
||||
// Iterate over the "Choices" table.
|
||||
lua_getfield(L, -1, "Choices");
|
||||
lua_pushnil( L );
|
||||
while( lua_next(L, -2) != 0 )
|
||||
{
|
||||
// `key' is at index -2 and `value' at index -1
|
||||
const char *pValue = lua_tostring( L, -1 );
|
||||
//LOG->Trace( "choice: '%s'", pValue);
|
||||
m_Def.m_vsChoices.push_back( pValue );
|
||||
lua_pop( L, 1 ); // removes `value'; keeps `key' for next iteration
|
||||
}
|
||||
lua_pop( L, 1 ); // pop choices table
|
||||
}
|
||||
|
||||
virtual bool LoadInternal( const Commands &cmds )
|
||||
{
|
||||
const Command &command = cmds.v[0];
|
||||
@@ -1059,18 +1087,7 @@ public:
|
||||
m_Def.m_selectType = StringToSelectType( pStr );
|
||||
lua_pop( L, 1 );
|
||||
|
||||
// Iterate over the "Choices" table.
|
||||
lua_getfield(L, -1, "Choices");
|
||||
lua_pushnil( L );
|
||||
while( lua_next(L, -2) != 0 )
|
||||
{
|
||||
// `key' is at index -2 and `value' at index -1
|
||||
const char *pValue = lua_tostring( L, -1 );
|
||||
//LOG->Trace( "choice: '%s'", pValue);
|
||||
m_Def.m_vsChoices.push_back( pValue );
|
||||
lua_pop( L, 1 ); // removes `value'; keeps `key' for next iteration
|
||||
}
|
||||
lua_pop( L, 1 ); // pop choices table
|
||||
LoadChoices( L );
|
||||
|
||||
// Set the EnabledForPlayers function.
|
||||
lua_getfield(L, -1, "EnabledForPlayers");
|
||||
@@ -1093,6 +1110,10 @@ public:
|
||||
}
|
||||
lua_pop( L, 1 ); // pop ReloadRowMessages table
|
||||
|
||||
// Set the Reload function
|
||||
lua_getfield(L, -1, "Reload");
|
||||
m_ReloadFunc.SetFromStack( L );
|
||||
|
||||
lua_pop( L, 1 ); // pop main table
|
||||
ASSERT( lua_gettop(L) == 0 );
|
||||
|
||||
@@ -1102,8 +1123,47 @@ public:
|
||||
|
||||
virtual ReloadChanged Reload()
|
||||
{
|
||||
if (!m_TableIsSane)
|
||||
{
|
||||
return RELOAD_CHANGED_NONE;
|
||||
}
|
||||
|
||||
/* We'll always call SetEnabledForPlayers, and
|
||||
* return at least RELOAD_CHANGED_ENABLED,
|
||||
* to preserve original OptionRowHandlerLua behavior.
|
||||
*
|
||||
* Will also call the standard OptionRowHandler::Reload
|
||||
* function to determine whether we should declare a full
|
||||
* RELOAD_CHANGED_ALL
|
||||
*/
|
||||
ReloadChanged effect = RELOAD_CHANGED_ENABLED;
|
||||
|
||||
if (!m_ReloadFunc.IsNil())
|
||||
{
|
||||
Lua *L = LUA->Get();
|
||||
m_ReloadFunc.PushSelf( L );
|
||||
|
||||
// Argument 1: (self)
|
||||
m_pLuaTable->PushSelf( L );
|
||||
RString error = "Reload: ";
|
||||
|
||||
LuaHelpers::RunScriptOnStack( L, error, 1, 1, true );
|
||||
effect = std::max( effect, Enum::Check<ReloadChanged>( L, -1 ));
|
||||
lua_pop( L, 1 );
|
||||
|
||||
if (effect == RELOAD_CHANGED_ALL)
|
||||
{
|
||||
m_Def.m_vsChoices.clear();
|
||||
m_pLuaTable->PushSelf( L );
|
||||
LoadChoices( L );
|
||||
lua_pop( L, 1 );
|
||||
ASSERT( lua_gettop(L) == 0 );
|
||||
}
|
||||
LUA->Release( L );
|
||||
}
|
||||
|
||||
SetEnabledForPlayers();
|
||||
return RELOAD_CHANGED_ENABLED;
|
||||
return effect;
|
||||
}
|
||||
|
||||
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||
@@ -1174,6 +1234,7 @@ public:
|
||||
|
||||
ASSERT( lua_gettop(L) == 0 );
|
||||
|
||||
int effects = 0;
|
||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||
{
|
||||
PlayerNumber p = *pn;
|
||||
@@ -1206,9 +1267,14 @@ public:
|
||||
ASSERT( lua_gettop(L) == 6 ); // vbSelectedOut, m_iLuaTable, function, self, arg, arg
|
||||
|
||||
RString error= "SaveSelections: ";
|
||||
LuaHelpers::RunScriptOnStack( L, error, 3, 0, true );
|
||||
ASSERT( lua_gettop(L) == 2 );
|
||||
LuaHelpers::RunScriptOnStack( L, error, 3, 1, true );
|
||||
ASSERT( lua_gettop(L) == 3 ); // SaveSelections *may* return effects flags, otherwise nil
|
||||
double ret = lua_tonumber( L, -1 );
|
||||
ASSERT_M( (lua_isnumber( L, -1 ) && std::floor( ret ) == ret) || lua_isnil( L, -1 ),
|
||||
"SaveSelections must return integer flags, or nill" );
|
||||
effects |= static_cast<int>( ret );
|
||||
|
||||
lua_pop( L, 1 ); // pop effects
|
||||
lua_pop( L, 1 ); // pop option table
|
||||
lua_pop( L, 1 ); // pop vbSelected table
|
||||
|
||||
@@ -1217,8 +1283,7 @@ public:
|
||||
|
||||
LUA->Release(L);
|
||||
|
||||
// XXX: allow specifying the mask
|
||||
return 0;
|
||||
return effects;
|
||||
}
|
||||
virtual bool NotifyOfSelection(PlayerNumber pn, int choice)
|
||||
{
|
||||
@@ -1593,6 +1658,17 @@ OptionRowHandler* OptionRowHandlerUtil::MakeSimple( const MenuRowDef &mr )
|
||||
return pHand;
|
||||
}
|
||||
|
||||
// Expose ReloadChanged to Lua
|
||||
static const char *ReloadChangedNames[] =
|
||||
{
|
||||
"None",
|
||||
"Enabled",
|
||||
"All"
|
||||
};
|
||||
XToString( ReloadChanged );
|
||||
StringToX( ReloadChanged );
|
||||
LuaXType( ReloadChanged );
|
||||
|
||||
/*
|
||||
* (c) 2002-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
Reference in New Issue
Block a user