From 52fecd71b962c9f65ec2b609fdfc7dbdc2a31064 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Mon, 16 Sep 2019 17:10:12 +0200 Subject: [PATCH] Remove code for setting _NET_WM_PID This code is no longer necessary since winit now does this for us. --- alacritty_terminal/src/window.rs | 60 -------------------------------- 1 file changed, 60 deletions(-) diff --git a/alacritty_terminal/src/window.rs b/alacritty_terminal/src/window.rs index 47828ac..b5c56d3 100644 --- a/alacritty_terminal/src/window.rs +++ b/alacritty_terminal/src/window.rs @@ -175,8 +175,6 @@ impl Window { is_focused: false, }; - window.run_os_extensions(); - Ok(window) } @@ -411,64 +409,6 @@ impl Window { } } -pub trait OsExtensions { - fn run_os_extensions(&self) {} -} - -#[cfg(any(target_os = "macos", windows))] -impl OsExtensions for Window {} - -#[cfg(not(any(target_os = "macos", windows)))] -impl OsExtensions for Window { - fn run_os_extensions(&self) { - use libc::getpid; - use std::ffi::CStr; - use std::ptr; - use x11_dl::xlib::{self, PropModeReplace, XA_CARDINAL}; - - let xlib_display = self.window().get_xlib_display(); - let xlib_window = self.window().get_xlib_window(); - - if let (Some(xlib_window), Some(xlib_display)) = (xlib_window, xlib_display) { - let xlib = xlib::Xlib::open().expect("get xlib"); - - // Set _NET_WM_PID to process pid - unsafe { - let _net_wm_pid = CStr::from_ptr(b"_NET_WM_PID\0".as_ptr() as *const _); - let atom = (xlib.XInternAtom)(xlib_display as *mut _, _net_wm_pid.as_ptr(), 0); - let pid = getpid(); - - (xlib.XChangeProperty)( - xlib_display as _, - xlib_window as _, - atom, - XA_CARDINAL, - 32, - PropModeReplace, - &pid as *const i32 as *const u8, - 1, - ); - } - // Although this call doesn't actually pass any data, it does cause - // WM_CLIENT_MACHINE to be set. WM_CLIENT_MACHINE MUST be set if _NET_WM_PID is set - // (which we do above). - unsafe { - (xlib.XSetWMProperties)( - xlib_display as _, - xlib_window as _, - ptr::null_mut(), - ptr::null_mut(), - ptr::null_mut(), - 0, - ptr::null_mut(), - ptr::null_mut(), - ptr::null_mut(), - ); - } - } - } -} - impl Proxy { /// Wakes up the event loop of the window ///