add srgb setting, commandline arg, and environment variable to fix amd windows machines

macos-click-through
Keith Simmons 3 years ago committed by Keith Simmons
parent a81c65b781
commit c23c176c00

1
.gitignore vendored

@ -1,4 +1,5 @@
/target
/.vs
**/*.rs.bk
*.log
.DS_Store

@ -11,7 +11,9 @@ pub struct CmdLineSettings {
pub neovim_bin: Option<String>,
pub files_to_open: Vec<String>,
pub nofork: bool,
pub no_fork: bool,
pub no_idle: bool,
pub srgb: bool,
pub geometry: Dimensions,
pub wsl: bool,
pub remote_tcp: Option<String>,
@ -25,12 +27,15 @@ pub struct CmdLineSettings {
impl Default for CmdLineSettings {
fn default() -> Self {
Self {
neovim_bin: None,
verbosity: 0,
log_to_file: false,
neovim_bin: None,
neovim_args: vec![],
files_to_open: vec![],
nofork: false,
no_fork: false,
no_idle: false,
srgb: true,
geometry: DEFAULT_WINDOW_GEOMETRY,
wsl: false,
remote_tcp: None,
@ -64,6 +69,16 @@ pub fn handle_command_line_arguments() -> Result<(), String> {
.long("nofork")
.help("Do not detach process from terminal"),
)
.arg(
Arg::with_name("noidle")
.long("noidle")
.help("Render every frame. Takes more power and cpu time but possibly fixes animation issues"),
)
.arg(
Arg::with_name("srgb")
.long("srgb")
.help("Use standard color space to initialize the window. Swapping this variable sometimes fixes issues on startup"),
)
.arg(
Arg::with_name("maximized")
.long("maximized")
@ -129,24 +144,27 @@ pub fn handle_command_line_arguments() -> Result<(), String> {
* NEOVIDE_MULTIGRID || --multigrid
*/
SETTINGS.set::<CmdLineSettings>(&CmdLineSettings {
neovim_bin: std::env::var("NEOVIM_BIN").ok(),
verbosity: matches.occurrences_of("verbosity"),
log_to_file: matches.is_present("log_to_file"),
neovim_args: matches
.values_of("neovim_args")
.map(|opt| opt.map(|v| v.to_owned()).collect())
.unwrap_or_default(),
verbosity: matches.occurrences_of("verbosity"),
log_to_file: matches.is_present("log_to_file"),
neovim_bin: std::env::var("NEOVIM_BIN").ok(),
files_to_open: matches
.values_of("files")
.map(|opt| opt.map(|v| v.to_owned()).collect())
.unwrap_or_default(),
maximized: matches.is_present("maximized") || std::env::var("NEOVIDE_MAXIMIZED").is_ok(),
multi_grid: std::env::var("NEOVIDE_MULTIGRID").is_ok() || matches.is_present("multi_grid"),
remote_tcp: matches.value_of("remote_tcp").map(|i| i.to_owned()),
nofork: matches.is_present("nofork") || matches.is_present("verbosity"),
no_fork: matches.is_present("nofork") || matches.is_present("verbosity"),
no_idle: matches.is_present("noidle") || std::env::var("NEOVIDE_NOIDLE").is_ok(),
srgb: matches.is_present("srgb") || !std::env::var("NEOVIDE_NO_SRGB").is_ok(),
geometry: parse_window_geometry(matches.value_of("geometry").map(|i| i.to_owned()))?,
wsl: matches.is_present("wsl"),
remote_tcp: matches.value_of("remote_tcp").map(|i| i.to_owned()),
multi_grid: std::env::var("NEOVIDE_MULTIGRID").is_ok() || matches.is_present("multi_grid"),
maximized: matches.is_present("maximized") || std::env::var("NEOVIDE_MAXIMIZED").is_ok(),
frameless: matches.is_present("frameless") || std::env::var("NEOVIDE_FRAMELESS").is_ok(),
geometry: parse_window_geometry(matches.value_of("geometry").map(|i| i.to_owned()))?,
wayland_app_id: match std::env::var("NEOVIDE_APP_ID") {
Ok(val) => val,
Err(_) => matches

@ -205,7 +205,7 @@ fn maybe_disown() {
let settings = SETTINGS.get::<CmdLineSettings>();
if cfg!(debug_assertions) || settings.nofork {
if cfg!(debug_assertions) || settings.no_fork {
return;
}

@ -17,10 +17,7 @@ impl Default for WindowSettings {
fullscreen: false,
iso_layout: false,
refresh_rate: 60,
no_idle: SETTINGS
.get::<CmdLineSettings>()
.neovim_args
.contains(&String::from("--noIdle")),
no_idle: SETTINGS.get::<CmdLineSettings>().no_idle,
remember_window_size: false,
}
}

@ -243,11 +243,12 @@ pub fn create_window(
let event_loop = EventLoop::new();
let cmd_line_settings = SETTINGS.get::<CmdLineSettings>();
let winit_window_builder = window::WindowBuilder::new()
.with_title("Neovide")
.with_window_icon(Some(icon))
.with_maximized(SETTINGS.get::<CmdLineSettings>().maximized)
.with_decorations(!SETTINGS.get::<CmdLineSettings>().frameless);
.with_maximized(cmd_line_settings.maximized)
.with_decorations(!cmd_line_settings.frameless);
#[cfg(target_os = "linux")]
let winit_window_builder = winit_window_builder
@ -262,7 +263,7 @@ pub fn create_window(
.with_stencil_buffer(8)
.with_gl_profile(GlProfile::Core)
.with_vsync(false)
.with_srgb(false)
.with_srgb(cmd_line_settings.srgb)
.build_windowed(winit_window_builder, &event_loop)
.unwrap();
let windowed_context = unsafe { windowed_context.make_current().unwrap() };

Loading…
Cancel
Save