Skip to content

Commit

Permalink
linux: changed Con::new to take Option<&str> instead of &Option<String>
Browse files Browse the repository at this point in the history
  • Loading branch information
pentamassiv committed Oct 5, 2024
1 parent 9c84962 commit bbaa7c7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Enigo {

let held = (Vec::new(), Vec::new());
#[cfg(feature = "wayland")]
let wayland = match wayland::Con::new(wayland_display) {
let wayland = match wayland::Con::new(wayland_display.as_deref()) {
Ok(con) => {
connection_established = true;
debug!("wayland connection established");
Expand All @@ -89,7 +89,7 @@ impl Enigo {
}
}
#[cfg(any(feature = "x11rb", feature = "xdo"))]
let x11 = match x11::Con::new(x11_display, *linux_delay) {
let x11 = match x11::Con::new(x11_display.as_deref(), *linux_delay) {
Ok(con) => {
connection_established = true;
debug!("x11 connection established");
Expand Down
2 changes: 1 addition & 1 deletion src/linux/wayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Con {
///
/// # Errors
/// TODO
pub fn new(dpy_name: &Option<String>) -> Result<Self, NewConError> {
pub fn new(dpy_name: Option<&str>) -> Result<Self, NewConError> {
// Setup Wayland Connection
let connection = if let Some(dyp_name) = dpy_name {
debug!(
Expand Down
2 changes: 1 addition & 1 deletion src/linux/x11rb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Con {
///
/// # Errors
/// TODO
pub fn new(dpy_name: &Option<String>, delay: u32) -> Result<Con, NewConError> {
pub fn new(dpy_name: Option<&str>, delay: u32) -> Result<Con, NewConError> {
debug!("using x11rb");
let (connection, screen_idx) = x11rb::connect(dpy_name.as_deref())?;
let setup = connection.setup();
Expand Down
2 changes: 1 addition & 1 deletion src/linux/xdo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl Con {
/// Create a new Enigo instance
/// If no `dyp_name` is provided, the $DISPLAY environment variable is read
/// and used instead
pub fn new(dyp_name: &Option<String>, delay: u32) -> Result<Self, NewConError> {
pub fn new(dyp_name: Option<&str>, delay: u32) -> Result<Self, NewConError> {
debug!("using xdo");
let xdo = match dyp_name {
Some(name) => {
Expand Down

0 comments on commit bbaa7c7

Please sign in to comment.