remove --front-end CLI option

Can use `--config front_end="Software"` instead.
This commit is contained in:
Wez Furlong committed 2021-02-27 23:59:04 -08:00
1 parent d837dc45a1
commit 04ecd16493
8 files changed
+35 -80

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ brief notes about them may accumulate here.
* Windows: Fixed [ToggleFullScreen](config/lua/keyassignment/ToggleFullScreen.md) so that it once again toggles between full screen and normal placement. [#177](https://github.com/wez/wezterm/issues/177)
* New: [exit_behavior](config/lua/config/exit_behavior.md) config option to keep panes open after the program has completed. [#499](https://github.com/wez/wezterm/issues/499)
* Closing the configuration error window no longer requires confirmation
* New: added `--config name=value` options to `wezterm`, `wezterm-gui` and `wezterm-mux-server`. The `--font-locator`, `--font-rasterizer` and `--font-shaper` CLI options have been removed in favor of this new mechanism.
* New: added `--config name=value` options to `wezterm`, `wezterm-gui` and `wezterm-mux-server`. The `--front-end`, `--font-locator`, `--font-rasterizer` and `--font-shaper` CLI options have been removed in favor of this new mechanism.
* New: [window:set_config_overrides](config/lua/window/set_config_overrides.md) method that can be used to override GUI related configuration options on a per-window basis. Click through to see examples of dynamically toggling ligatures and window opacity. [#469](https://github.com/wez/wezterm/issues/469) [#329](https://github.com/wez/wezterm/issues/329)
### 20210203-095643-70a364eb
+1 -29
View File
@@ -1,4 +1,4 @@
use config::{FrontEndSelection, SshParameters};
use config::SshParameters;
use std::ffi::OsString;
use structopt::StructOpt;
@@ -22,13 +22,6 @@ pub fn name_equals_value(arg: &str) -> Result<(String, String), String> {
#[derive(Debug, StructOpt, Default, Clone)]
pub struct StartCommand {
#[structopt(
long = "front-end",
possible_values = &FrontEndSelection::variants(),
case_insensitive = true
)]
pub front_end: Option<FrontEndSelection>,
/// If true, do not connect to domains marked as connect_automatically
/// in your wezterm.toml configuration file.
#[structopt(long = "no-auto-connect")]
@@ -58,13 +51,6 @@ pub struct StartCommand {
#[derive(Debug, StructOpt, Clone)]
pub struct SshCommand {
#[structopt(
long = "front-end",
possible_values = &FrontEndSelection::variants(),
case_insensitive = true
)]
pub front_end: Option<FrontEndSelection>,
/// Specifies the remote system using the form:
/// `[username@]host[:port]`.
/// If `username@` is omitted, then your local $USER is used
@@ -82,13 +68,6 @@ pub struct SshCommand {
#[derive(Debug, StructOpt, Clone)]
pub struct SerialCommand {
#[structopt(
long = "front-end",
possible_values = &FrontEndSelection::variants(),
case_insensitive = true
)]
pub front_end: Option<FrontEndSelection>,
/// Set the baud rate. The default is 9600 baud.
#[structopt(long = "baud")]
pub baud: Option<usize>,
@@ -102,13 +81,6 @@ pub struct SerialCommand {
#[derive(Debug, StructOpt, Clone)]
pub struct ConnectCommand {
#[structopt(
long = "front-end",
possible_values = &FrontEndSelection::variants(),
case_insensitive = true
)]
pub front_end: Option<FrontEndSelection>,
/// Name of the multiplexer domain section from the configuration
/// to which you'd like to connect
pub domain_name: String,
+2 -24
View File
@@ -34,22 +34,7 @@ impl Drop for GuiFrontEnd {
}
impl GuiFrontEnd {
pub fn try_new_swrast() -> anyhow::Result<Rc<GuiFrontEnd>> {
::window::prefer_swrast();
Self::try_new()
}
pub fn try_new() -> anyhow::Result<Rc<GuiFrontEnd>> {
#[cfg(windows)]
{
if is_running_in_rdp_session() {
// Using OpenGL in RDP has problematic behavior upon
// disconnect, so we force the use of software rendering.
log::trace!("Running in an RDP session, use SWRAST");
prefer_swrast();
}
}
let connection = Connection::init()?;
let front_end = Rc::new(GuiFrontEnd { connection });
let mux = Mux::get().expect("mux started and running on main thread");
@@ -131,15 +116,8 @@ pub fn shutdown() {
FRONT_END.with(|f| drop(f.borrow_mut().take()));
}
pub fn try_new(sel: FrontEndSelection) -> Result<Rc<GuiFrontEnd>, Error> {
let front_end = match sel {
FrontEndSelection::Software => GuiFrontEnd::try_new_swrast(),
FrontEndSelection::OpenGL => GuiFrontEnd::try_new(),
};
let front_end = front_end?;
pub fn try_new() -> Result<Rc<GuiFrontEnd>, Error> {
let front_end = GuiFrontEnd::try_new()?;
FRONT_END.with(|f| *f.borrow_mut() = Some(Rc::clone(&front_end)));
Ok(front_end)
}
+8 -12
View File
@@ -105,7 +105,7 @@ async fn async_run_ssh(opts: SshCommand) -> anyhow::Result<()> {
Ok(())
}
fn run_ssh(config: config::ConfigHandle, opts: SshCommand) -> anyhow::Result<()> {
fn run_ssh(opts: SshCommand) -> anyhow::Result<()> {
// Set up the mux with no default domain; there's a good chance that
// we'll need to show authentication UI and we don't want its domain
// to become the default domain.
@@ -113,8 +113,7 @@ fn run_ssh(config: config::ConfigHandle, opts: SshCommand) -> anyhow::Result<()>
Mux::set_mux(&mux);
crate::update::load_last_release_info_and_set_banner();
let front_end_selection = opts.front_end.unwrap_or(config.front_end);
let gui = crate::gui::try_new(front_end_selection)?;
let gui = crate::gui::try_new()?;
// Keep the frontend alive until we've run through the ssh authentication
// phase. This is passed into the thread and dropped when it is done.
@@ -149,8 +148,7 @@ fn run_serial(config: config::ConfigHandle, opts: &SerialCommand) -> anyhow::Res
Mux::set_mux(&mux);
crate::update::load_last_release_info_and_set_banner();
let front_end = opts.front_end.unwrap_or(config.front_end);
let gui = crate::gui::try_new(front_end)?;
let gui = crate::gui::try_new()?;
block_on(domain.attach())?; // FIXME: blocking
{
@@ -195,8 +193,7 @@ fn run_mux_client(config: config::ConfigHandle, opts: &ConnectCommand) -> anyhow
Mux::set_mux(&mux);
crate::update::load_last_release_info_and_set_banner();
let front_end_selection = opts.front_end.unwrap_or(config.front_end);
let gui = crate::gui::try_new(front_end_selection)?;
let gui = crate::gui::try_new()?;
let opts = opts.clone();
let cmd = if !opts.prog.is_empty() {
@@ -268,7 +265,7 @@ async fn async_run_terminal_gui(
spawn_tab_in_default_domain_if_mux_is_empty(cmd).await
}
fn run_terminal_gui(config: config::ConfigHandle, opts: StartCommand) -> anyhow::Result<()> {
fn run_terminal_gui(opts: StartCommand) -> anyhow::Result<()> {
if let Some(cls) = opts.class.as_ref() {
crate::gui::set_window_class(cls);
}
@@ -310,8 +307,7 @@ fn run_terminal_gui(config: config::ConfigHandle, opts: StartCommand) -> anyhow:
Mux::set_mux(&mux);
crate::update::load_last_release_info_and_set_banner();
let front_end_selection = opts.front_end.unwrap_or(config.front_end);
let gui = crate::gui::try_new(front_end_selection)?;
let gui = crate::gui::try_new()?;
let activity = Activity::new();
let do_auto_connect = !opts.no_auto_connect;
@@ -462,9 +458,9 @@ fn run() -> anyhow::Result<()> {
{
SubCommand::Start(start) => {
log::trace!("Using configuration: {:#?}\nopts: {:#?}", config, opts);
run_terminal_gui(config, start)
run_terminal_gui(start)
}
SubCommand::Ssh(ssh) => run_ssh(config, ssh),
SubCommand::Ssh(ssh) => run_ssh(ssh),
SubCommand::Serial(serial) => run_serial(config, &serial),
SubCommand::Connect(connect) => run_mux_client(config, &connect),
}
+13
View File
@@ -28,6 +28,19 @@ impl WindowConfiguration for ConfigBridge {
configuration().prefer_egl
}
fn prefer_swrast(&self) -> bool {
#[cfg(windows)]
{
if is_running_in_rdp_session() {
// Using OpenGL in RDP has problematic behavior upon
// disconnect, so we force the use of software rendering.
log::trace!("Running in an RDP session, use SWRAST");
return true;
}
}
configuration().front_end == config::FrontEndSelection::Software
}
fn native_macos_fullscreen_mode(&self) -> bool {
configuration().native_macos_fullscreen_mode
}
+4
View File
@@ -27,6 +27,10 @@ pub trait WindowConfiguration {
true
}
fn prefer_swrast(&self) -> bool {
false
}
fn native_macos_fullscreen_mode(&self) -> bool {
false
}
+6 -3
View File
@@ -1,4 +1,3 @@
use crate::{is_swrast_preferred, prefer_swrast};
use anyhow::{anyhow, bail, ensure, Error};
use std::ffi::c_void;
use std::rc::Rc;
@@ -405,9 +404,10 @@ impl GlState {
}
let mut errors = vec![];
let mut prefer_swrast = crate::configuration::config().prefer_swrast();
for _ in 0..2 {
if is_swrast_preferred() {
if prefer_swrast {
// Assuming that we're using Mesa, set an environment
// variable that should select CPU based rendering.
std::env::set_var("LIBGL_ALWAYS_SOFTWARE", "true");
@@ -445,7 +445,10 @@ impl GlState {
if cfg!(windows) {
break;
}
prefer_swrast();
if prefer_swrast {
break;
}
prefer_swrast = true;
}
bail!("with_egl_lib failed: {}", errors.join(", "))
}
-11
View File
@@ -1,6 +1,5 @@
use promise::Future;
use std::any::Any;
use std::sync::atomic::{AtomicBool, Ordering};
pub mod bitmaps;
pub mod color;
pub mod configuration;
@@ -252,13 +251,3 @@ pub trait WindowOpsMut {
fn config_did_change(&mut self) {}
}
static PREFER_SWRAST: AtomicBool = AtomicBool::new(false);
pub fn prefer_swrast() {
PREFER_SWRAST.store(true, Ordering::Release);
}
pub fn is_swrast_preferred() -> bool {
PREFER_SWRAST.load(Ordering::Acquire)
}