Skip to content

Commit

Permalink
Switch behaviour of "Fillscreen mode" to a true borderless window (#467)
Browse files Browse the repository at this point in the history
- alternative to: #462
  • Loading branch information
mickelson authored Aug 14, 2018
1 parent a00617f commit f7b70ac
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 45 deletions.
4 changes: 2 additions & 2 deletions config/language/cn.msg
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ _help_language;Select the language to use in Attract-Mode's user interface
_help_layout_file;Some layouts provide multiple layout*.nut files. Select which layout file to use
_help_misc;Configure miscellaneous settings
_help_mouse_threshold;The threshold for registering mouse moves, from 1 to 100 (100=least sensitive)
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode. Setting this to 'No' may reduce screen flicker when launching games
_help_plugin_command;The executable associated with this plug-in
_help_plugin_enabled;Set whether this plug-in is enabled
_help_plugin_sel;Configure plug-in
Expand All @@ -431,6 +431,6 @@ _help_sound_sel;Assign a sound to this event/action
_help_startup_mode;Set what should happen when Attract-Mode first starts up
_help_track_usage;Configure whether Attract-Mode should track usage (played time and play count for each game)
_help_video_decoder;Configure the decoder to use for video playback (if multiple decoders are available)
_help_volume;Valid volume settings are from 0 (mute) to 100
_help_volume;Valid volume settings are from 0 (mute) to 100
_help_window_mode;Set whether Attract-Mode fills the screen or runs in a window
_sort_regexp;^(Vs\. The |The |Vs\. )
2 changes: 1 addition & 1 deletion config/language/de.msg
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ _help_input_default_action;Set the default behaviour for this control
_help_joystick_map;Map the frontend's joystick slots to specifically named joystick/gamepad devices attached to your computer (You can use this to force the frontend to always use 'Microsoft X-Box 360 pad' as Joystick 0, for example.)
_help_language;Select the language to use in Attract-Mode's user interface
_help_layout_file;Some layouts provide multiple layout*.nut files. Select which layout file to use
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode. Setting this to 'No' may reduce screen flicker when launching games
_help_shortcut_artwork_name_edit;Optionally provide an artwork name to be associated with this shortcut. The frontend will try to load artworks with this name when displaying the shortcut
_help_shortcut_delete;Delete this shortcut from the Romlist
_help_shortcut_label_edit;Edit this shortcut's label
Expand Down
2 changes: 1 addition & 1 deletion config/language/en.msg
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ _help_language;Select the language to use in Attract-Mode's user interface
_help_layout_file;Some layouts provide multiple layout*.nut files. Select which layout file to use
_help_misc;Configure miscellaneous settings
_help_mouse_threshold;The threshold for registering mouse moves, from 1 to 100 (100=least sensitive)
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode. Setting this to 'No' may reduce screen flicker when launching games
_help_plugin_command;The executable associated with this plug-in
_help_plugin_enabled;Set whether this plug-in is enabled
_help_plugin_sel;Configure plug-in
Expand Down
2 changes: 1 addition & 1 deletion config/language/es.msg
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ _help_input_default_action;Set the default behaviour for this control
_help_joystick_map;Map the frontend's joystick slots to specifically named joystick/gamepad devices attached to your computer (You can use this to force the frontend to always use 'Microsoft X-Box 360 pad' as Joystick 0, for example.)
_help_language;Select the language to use in Attract-Mode's user interface
_help_layout_file;Some layouts provide multiple layout*.nut files. Select which layout file to use
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode. Setting this to 'No' may reduce screen flicker when launching games
_help_shortcut_artwork_name_edit;Optionally provide an artwork name to be associated with this shortcut. The frontend will try to load artworks with this name when displaying the shortcut
_help_shortcut_delete;Delete this shortcut from the Romlist
_help_shortcut_label_edit;Edit this shortcut's label
Expand Down
2 changes: 1 addition & 1 deletion config/language/fr.msg
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ _help_input_action;
_help_input_default_action;Set the default behaviour for this control
_help_joystick_map;Map the frontend's joystick slots to specifically named joystick/gamepad devices attached to your computer (You can use this to force the frontend to always use 'Microsoft X-Box 360 pad' as Joystick 0, for example.)
_help_layout_file;Some layouts provide multiple layout*.nut files. Select which layout file to use
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode. Setting this to 'No' may reduce screen flicker when launching games
_help_shortcut_artwork_name_edit;Optionally provide an artwork name to be associated with this shortcut. The frontend will try to load artworks with this name when displaying the shortcut
_help_shortcut_delete;Delete this shortcut from the Romlist
_help_shortcut_label_edit;Edit this shortcut's label
Expand Down
2 changes: 1 addition & 1 deletion config/language/jp.msg
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ _help_input_default_action;Set the default behaviour for this control
_help_intro;Configure intro
_help_joystick_map;Map the frontend's joystick slots to specifically named joystick/gamepad devices attached to your computer (You can use this to force the frontend to always use 'Microsoft X-Box 360 pad' as Joystick 0, for example.)
_help_layout_file;Some layouts provide multiple layout*.nut files. Select which layout file to use
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode. Setting this to 'No' may reduce screen flicker when launching games
_help_scrape_vids;Set whether game videos should be downloaded when scraping
_help_shortcut_artwork_name_edit;Optionally provide an artwork name to be associated with this shortcut. The frontend will try to load artworks with this name when displaying the shortcut
_help_shortcut_delete;Delete this shortcut from the Romlist
Expand Down
4 changes: 2 additions & 2 deletions config/language/msg_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ _help_language;Select the language to use in Attract-Mode's user interface
_help_layout_file;Some layouts provide multiple layout*.nut files. Select which layout file to use
_help_misc;Configure miscellaneous settings
_help_mouse_threshold;The threshold for registering mouse moves, from 1 to 100 (100=least sensitive)
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode
_help_multiple_monitors;Enable the use of multiple monitors by Attract-Mode. Setting this to 'No' may reduce screen flicker when launching games
_help_plugin_command;The executable associated with this plug-in
_help_plugin_enabled;Set whether this plug-in is enabled
_help_plugin_sel;Configure plug-in
Expand All @@ -387,7 +387,7 @@ _help_sound_sel;Assign a sound to this event/action
_help_startup_mode;Set what should happen when Attract-Mode first starts up
_help_track_usage;Configure whether Attract-Mode should track usage (played time and play count for each game)
_help_video_decoder;Configure the decoder to use for video playback (if multiple decoders are available)
_help_volume;Valid volume settings are from 0 (mute) to 100
_help_volume;Valid volume settings are from 0 (mute) to 100
_help_window_mode;Set whether Attract-Mode fills the screen or runs in a window
_help_hide_console;Hide console on startup. Note that this only works if starting Attract-Mode from a Windows GUI. If started from an existing console window (e.g. a batch file) then the process will always "attach" to the existing console and output to it.
_sort_regexp;^(Vs\. The |The |Vs\. )
Expand Down
2 changes: 1 addition & 1 deletion src/fe_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ FeSettings::FeSettings( const std::string &config_path,
m_confirm_favs( true ),
m_confirm_exit( true ),
m_track_usage( true ),
m_multimon( true ),
m_multimon( false ),
#ifdef SFML_SYSTEM_LINUX
m_window_mode( Fullscreen ),
#else
Expand Down
54 changes: 19 additions & 35 deletions src/fe_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ class FeWindowPosition : public FeBaseConfigurable
}
};

bool is_multimon_config( FeSettings &fes )
{
return (( fes.get_info_bool( FeSettings::MultiMon ) )
&& ( !is_windowed_mode( fes.get_window_mode() ) ));
}

const char *FeWindowPosition::FILENAME = "window.am";

FeWindow::FeWindow( FeSettings &fes )
Expand Down Expand Up @@ -119,36 +125,18 @@ void FeWindow::onCreate()
// SetWindowLongPtr( getSystemHandle(), GWL_STYLE,
// WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS );
//
int left, top, width, height;
if (( m_fes.get_info_bool( FeSettings::MultiMon ) )
&& ( !is_windowed_mode( m_fes.get_window_mode() ) ))
if ( is_multimon_config( m_fes ) )
{
left = GetSystemMetrics( SM_XVIRTUALSCREEN );
top = GetSystemMetrics( SM_YVIRTUALSCREEN );
width = GetSystemMetrics( SM_CXVIRTUALSCREEN );
height = GetSystemMetrics( SM_CYVIRTUALSCREEN );
}
else
{
left = getPosition().x;
top = getPosition().y;
width = getSize().x;
height = getSize().y;
// Note that as of 2.1, SFML caches the window size internally
setPosition( sf::Vector2i(
GetSystemMetrics( SM_XVIRTUALSCREEN ),
GetSystemMetrics( SM_YVIRTUALSCREEN ) ) );

setSize( sf::Vector2u(
GetSystemMetrics( SM_CXVIRTUALSCREEN ),
GetSystemMetrics( SM_CYVIRTUALSCREEN ) ) );
}

if ( m_fes.get_window_mode() == FeSettings::Default ) // "fill screen" mode
{
// resize the window off screen 1 pixel in each direction so we don't see the window border
left -= 1;
top -= 1;
width += 2;
height += 2;
}

// As of 2.1, SFML caches the window size internally
setPosition( sf::Vector2i( left, top ) );
setSize( sf::Vector2u( width, height ) );

#elif defined(USE_XLIB)
//
// Notes: if xinerama and multimon are enabled, this should set our window to cover all available
Expand All @@ -159,9 +147,10 @@ void FeWindow::onCreate()
//
int x, y, width, height;
get_x11_geometry(
m_fes.get_info_bool( FeSettings::MultiMon ) && !is_windowed_mode( m_fes.get_window_mode() ),
is_multimon_config( m_fes ),
x, y, width, height );

// Note that as of 2.1, SFML caches the window size internally
setPosition( sf::Vector2i( x, y ) );
setSize( sf::Vector2u( width, height ) );

Expand All @@ -188,7 +177,7 @@ void FeWindow::initial_create()
int win_mode = m_fes.get_window_mode();

#ifdef USE_XINERAMA
if ( m_fes.get_info_bool( FeSettings::MultiMon ) && ( win_mode != FeSettings::Default ))
if ( is_multimon_config( m_fes ) && ( win_mode != FeSettings::Default ))
FeLog() << " ! NOTE: Use the 'Fill Screen' window mode if you want multiple monitor support to function correctly" << std::endl;
#endif

Expand Down Expand Up @@ -220,11 +209,6 @@ void FeWindow::initial_create()
#endif

#ifdef SFML_SYSTEM_WINDOWS
// Fill Screen mode has an offset so the top row and the left column of the window is not visible.
// We call setView to compensate this -1,-1 offset of the window.
if ( win_mode == FeSettings::Default )
setView(sf::View(sf::FloatRect(getPosition().x, getPosition().y, getSize().x, getSize().y)));

SetForegroundWindow( getSystemHandle() );
#endif

Expand Down Expand Up @@ -286,7 +270,7 @@ void wait_callback( void *o )
}
// Clear the frame buffer so there is no stale frame flashing on game launch/exit
// Don't clear if Multimonitor is enabled and window mode is set to Fill Screen
if( !win->m_fes.get_info_bool( FeSettings::MultiMon ) || ( win->m_fes.get_window_mode() != FeSettings::Default ) )
if ( !is_multimon_config( win->m_fes ) )
{
win->clear();
win->display();
Expand Down

0 comments on commit f7b70ac

Please sign in to comment.