Ensure gtk apps only run on X11

This commit is contained in:
2023-09-25 11:08:27 -07:00
parent 3c48ab1c7f
commit ae2f100b38
2 changed files with 17 additions and 1 deletions

View File

@ -77,6 +77,14 @@ fn main() -> anyhow::Result<()> {
init_logging("BSCREENSAVER_DIALOG_GTK3_LOG");
glib::log_set_default_handler(glib::rust_log_handler);
// Can't use the rust version as it requires gtk_init() to be
// called first, but the underlying C function requires that
// it hasn't.
let backends = CString::new("x11").unwrap();
unsafe {
gtk::gdk::ffi::gdk_set_allowed_backends(backends.as_ptr());
};
let config = Configuration::load()?;
let new_login_command =
if config.new_login_command == NewLoginCommand::Disabled {