Allow to inhibit screensaver/system sleep

This commit is contained in:
Robin Gareus
2019-08-11 20:37:07 +02:00
parent 246cc74f9b
commit 9fb403546c
4 changed files with 34 additions and 1 deletions

View File

@@ -865,6 +865,8 @@ ARDOUR_UI::~ARDOUR_UI ()
{
UIConfiguration::instance().save_state();
ARDOUR_UI_UTILS::inhibit_screensaver (false);
stop_video_server();
if (getenv ("ARDOUR_RUNNING_UNDER_VALGRIND")) {
@@ -2643,6 +2645,9 @@ ARDOUR_UI::map_transport_state ()
layered_button.set_sensitive (true);
update_disk_space ();
}
if (UIConfiguration::instance().get_screen_saver_mode () == InhibitWhileRecording) {
inhibit_screensaver (_session->actively_recording ());
}
}
void

View File

@@ -475,8 +475,20 @@ ARDOUR_UI::parameter_changed (std::string p)
}
} else if ( (p == "snap-to-region-sync") || (p == "snap-to-region-start") || (p == "snap-to-region-end") ) {
if (editor) editor->mark_region_boundary_cache_dirty();
} else if (p == "screen-saver-mode") {
switch (UIConfiguration::instance().get_screen_saver_mode ()) {
using namespace ARDOUR_UI_UTILS;
case InhibitWhileRecording:
inhibit_screensaver (_session && _session->actively_recording ());
break;
case InhibitAlways:
inhibit_screensaver (true);
break;
case InhibitNever:
inhibit_screensaver (false);
break;
}
}
}
void

View File

@@ -2223,6 +2223,21 @@ RCOptionEditor::RCOptionEditor ()
slts->tip_widget(),
_("Lock GUI after this many idle seconds (zero to never lock)"));
add_option (_("General"), slts);
ComboOption<ScreenSaverMode>* scsvr = new ComboOption<ScreenSaverMode> (
"screen-saver-mode",
_("System Screensaver Mode"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_screen_saver_mode),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_screen_saver_mode)
);
scsvr->add (InhibitNever, _("Never Inhibit"));
scsvr->add (InhibitWhileRecording, _("Inhibit while Recording"));
scsvr->add (InhibitAlways, string_compose (_("Inhibit while %1 is running"), PROGRAM_NAME));
add_option (_("General"), scsvr);
} // !mixbus
add_option (_("General/Session"), new OptionEditorHeading (S_("Options|Undo")));

View File

@@ -42,6 +42,7 @@ UI_CONFIG_VARIABLE (bool, editor_stereo_only_meters, "editor-stereo-only-meters"
#endif
UI_CONFIG_VARIABLE (bool, show_waveform_clipping, "show-waveform-clipping", true)
UI_CONFIG_VARIABLE (uint32_t, lock_gui_after_seconds, "lock-gui-after-seconds", 0)
UI_CONFIG_VARIABLE (ARDOUR::ScreenSaverMode, screen_saver_mode, "screen-saver-mode", InhibitWhileRecording)
UI_CONFIG_VARIABLE (bool, draggable_playhead, "draggable-playhead", true)
UI_CONFIG_VARIABLE (float, draggable_playhead_speed, "draggable-playhead-speed", 1.0)
UI_CONFIG_VARIABLE (float, extra_ui_extents_time, "extra-ui-extents-time", 1.0)