Files
itgmania212121/src/ScreenOptionsMasterPrefs.h
T
Drew Barbarello 557be7cf1b 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
2017-06-18 08:55:16 -07:00

109 lines
4.0 KiB
C++

#ifndef SCREEN_OPTIONS_MASTER_PREFS_H
#define SCREEN_OPTIONS_MASTER_PREFS_H
#include "EnumHelper.h"
static const int MAX_OPTIONS=16;
enum OptEffect
{
OPT_SAVE_PREFERENCES = (1<<0),
OPT_APPLY_GRAPHICS = (1<<1),
OPT_APPLY_THEME = (1<<2),
OPT_CHANGE_GAME = (1<<3),
OPT_APPLY_SOUND = (1<<4),
OPT_APPLY_SONG = (1<<5),
OPT_APPLY_ASPECT_RATIO = (1<<6),
NUM_OptEffect = 7,
OptEffect_Invalid = MAX_OPTIONS+1
};
const RString& OptEffectToString( OptEffect e );
OptEffect StringToOptEffect( const std::string &e );
LuaDeclareType( OptEffect );
struct ConfOption
{
static ConfOption *Find( RString name );
// Name of this option.
RString name;
// Name of the preference this option affects.
RString m_sPrefName;
typedef void (*MoveData_t)( int &sel, bool ToSel, const ConfOption *pConfOption );
MoveData_t MoveData;
int m_iEffects;
bool m_bAllowThemeItems;
/* For dynamic options, update the options. Since this changes the available
* options, this may invalidate the offsets returned by Get() and Put(). */
void UpdateAvailableOptions();
/* Return the list of available selections; Get() and Put() use indexes into
* this array. UpdateAvailableOptions() should be called before using this. */
void MakeOptionsList( vector<RString> &out ) const;
inline int Get() const { int sel; MoveData( sel, true, this ); return sel; }
inline void Put( int sel ) const { MoveData( sel, false, this ); }
int GetEffects() const;
ConfOption( const char *n, MoveData_t m,
const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL )
{
name = n;
m_sPrefName = name; // copy from name (not n), to allow refcounting
MoveData = m;
MakeOptionsListCB = NULL;
m_iEffects = 0;
m_bAllowThemeItems = true;
#define PUSH( c ) if(c) names.push_back(c);
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
}
void AddOption( const RString &sName ) { PUSH(sName); }
#undef PUSH
ConfOption( const char *n, MoveData_t m,
void (*lst)( vector<RString> &out ) )
{
name = n;
MoveData = m;
MakeOptionsListCB = lst;
m_iEffects = 0;
m_bAllowThemeItems = false; // don't theme dynamic choices
}
// private:
vector<RString> names;
void (*MakeOptionsListCB)( vector<RString> &out );
};
#endif
/**
* @file
* @author Glenn Maynard (c) 2003-2004
* @section LICENSE
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/