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 /target
/.vs
**/*.rs.bk **/*.rs.bk
*.log *.log
.DS_Store .DS_Store

@ -11,7 +11,9 @@ pub struct CmdLineSettings {
pub neovim_bin: Option<String>, pub neovim_bin: Option<String>,
pub files_to_open: Vec<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 geometry: Dimensions,
pub wsl: bool, pub wsl: bool,
pub remote_tcp: Option<String>, pub remote_tcp: Option<String>,
@ -25,12 +27,15 @@ pub struct CmdLineSettings {
impl Default for CmdLineSettings { impl Default for CmdLineSettings {
fn default() -> Self { fn default() -> Self {
Self { Self {
neovim_bin: None,
verbosity: 0, verbosity: 0,
log_to_file: false, log_to_file: false,
neovim_bin: None,
neovim_args: vec![], neovim_args: vec![],
files_to_open: vec![], files_to_open: vec![],
nofork: false,
no_fork: false,
no_idle: false,
srgb: true,
geometry: DEFAULT_WINDOW_GEOMETRY, geometry: DEFAULT_WINDOW_GEOMETRY,
wsl: false, wsl: false,
remote_tcp: None, remote_tcp: None,
@ -64,6 +69,16 @@ pub fn handle_command_line_arguments() -> Result<(), String> {
.long("nofork") .long("nofork")
.help("Do not detach process from terminal"), .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(
Arg::with_name("maximized") Arg::with_name("maximized")
.long("maximized") .long("maximized")
@ -129,24 +144,27 @@ pub fn handle_command_line_arguments() -> Result<(), String> {
* NEOVIDE_MULTIGRID || --multigrid * NEOVIDE_MULTIGRID || --multigrid
*/ */
SETTINGS.set::<CmdLineSettings>(&CmdLineSettings { 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 neovim_args: matches
.values_of("neovim_args") .values_of("neovim_args")
.map(|opt| opt.map(|v| v.to_owned()).collect()) .map(|opt| opt.map(|v| v.to_owned()).collect())
.unwrap_or_default(), .unwrap_or_default(),
verbosity: matches.occurrences_of("verbosity"), neovim_bin: std::env::var("NEOVIM_BIN").ok(),
log_to_file: matches.is_present("log_to_file"),
files_to_open: matches files_to_open: matches
.values_of("files") .values_of("files")
.map(|opt| opt.map(|v| v.to_owned()).collect()) .map(|opt| opt.map(|v| v.to_owned()).collect())
.unwrap_or_default(), .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"), no_fork: matches.is_present("nofork") || matches.is_present("verbosity"),
remote_tcp: matches.value_of("remote_tcp").map(|i| i.to_owned()), no_idle: matches.is_present("noidle") || std::env::var("NEOVIDE_NOIDLE").is_ok(),
nofork: matches.is_present("nofork") || matches.is_present("verbosity"), 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"), 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(), 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") { wayland_app_id: match std::env::var("NEOVIDE_APP_ID") {
Ok(val) => val, Ok(val) => val,
Err(_) => matches Err(_) => matches

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

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

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

Loading…
Cancel
Save