File tree 4 files changed +15
-0
lines changed
4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -536,6 +536,9 @@ fps_max (Maximum FPS) int 60
536
536
# Maximum FPS when game is paused.
537
537
pause_fps_max (FPS in pause menu) int 20
538
538
539
+ # Open the pause menu when the window's focus is lost. Does not pause if a formspec is open.
540
+ pause_on_lost_focus (Pause on lost window focus) bool false
541
+
539
542
# View distance in nodes.
540
543
viewing_range (Viewing range) int 100 20 4000
541
544
Original file line number Diff line number Diff line change 994
994
# type: int
995
995
# max_out_chat_queue_size = 20
996
996
997
+ # Open the pause menu when the window's focus is lost. Does not pause if a formspec is open.
998
+ # type: bool
999
+ # pause_on_lost_focus = false
1000
+
997
1001
## Advanced
998
1002
999
1003
# Timeout for client to remove unused map data from memory.
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ void set_default_settings(Settings *settings)
58
58
settings->setDefault (" enable_remote_media_server" , " true" );
59
59
settings->setDefault (" enable_client_modding" , " false" );
60
60
settings->setDefault (" max_out_chat_queue_size" , " 20" );
61
+ settings->setDefault (" pause_on_lost_focus" , " false" );
61
62
62
63
// Keymap
63
64
settings->setDefault (" remote_port" , " 30000" );
Original file line number Diff line number Diff line change @@ -1487,6 +1487,8 @@ class Game {
1487
1487
bool m_first_loop_after_window_activation = false ;
1488
1488
bool m_camera_offset_changed = false ;
1489
1489
1490
+ bool m_does_lost_focus_pause_game = false ;
1491
+
1490
1492
#ifdef __ANDROID__
1491
1493
bool m_cache_hold_aux1;
1492
1494
bool m_android_chat_open;
@@ -1741,6 +1743,10 @@ void Game::run()
1741
1743
1742
1744
// Update if minimap has been disabled by the server
1743
1745
flags.show_minimap &= client->shouldShowMinimap ();
1746
+
1747
+ if (m_does_lost_focus_pause_game && !device->isWindowFocused () && !isMenuActive ()) {
1748
+ showPauseMenu ();
1749
+ }
1744
1750
}
1745
1751
}
1746
1752
@@ -4638,6 +4644,7 @@ void Game::readSettings()
4638
4644
m_cache_cam_smoothing = rangelim (m_cache_cam_smoothing, 0 .01f , 1 .0f );
4639
4645
m_cache_mouse_sensitivity = rangelim (m_cache_mouse_sensitivity, 0.001 , 100.0 );
4640
4646
4647
+ m_does_lost_focus_pause_game = g_settings->getBool (" pause_on_lost_focus" );
4641
4648
}
4642
4649
4643
4650
/* ***************************************************************************/
You can’t perform that action at this time.
0 commit comments