parent
cb46f0e1ac
commit
73759da0f5
|
@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
### Fixed
|
||||
|
||||
- Crash due to assertion failure on 32-bit architectures
|
||||
- Segmentation fault on shutdown with Wayland
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
|
||||
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
|
||||
use std::ffi::c_void;
|
||||
|
||||
use log::{debug, warn};
|
||||
|
@ -7,9 +7,9 @@ use alacritty_terminal::term::ClipboardType;
|
|||
|
||||
#[cfg(any(test, not(any(feature = "x11", target_os = "macos", windows))))]
|
||||
use copypasta::nop_clipboard::NopClipboardContext;
|
||||
#[cfg(all(not(any(target_os = "macos", windows)), feature = "wayland"))]
|
||||
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
|
||||
use copypasta::wayland_clipboard;
|
||||
#[cfg(all(not(any(target_os = "macos", windows)), feature = "x11"))]
|
||||
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
||||
use copypasta::x11_clipboard::{Primary as X11SelectionClipboard, X11ClipboardContext};
|
||||
#[cfg(any(feature = "x11", target_os = "macos", windows))]
|
||||
use copypasta::ClipboardContext;
|
||||
|
@ -21,28 +21,21 @@ pub struct Clipboard {
|
|||
}
|
||||
|
||||
impl Clipboard {
|
||||
#[cfg(any(target_os = "macos", windows))]
|
||||
#[cfg(any(not(feature = "wayland"), target_os = "macos", windows))]
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "macos", windows)))]
|
||||
pub fn new(_display: Option<*mut c_void>) -> Self {
|
||||
#[cfg(feature = "wayland")]
|
||||
if let Some(display) = _display {
|
||||
let (selection, clipboard) =
|
||||
unsafe { wayland_clipboard::create_clipboards_from_external(display) };
|
||||
return Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) };
|
||||
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
|
||||
pub unsafe fn new(display: Option<*mut c_void>) -> Self {
|
||||
match display {
|
||||
Some(display) => {
|
||||
let (selection, clipboard) =
|
||||
wayland_clipboard::create_clipboards_from_external(display);
|
||||
Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) }
|
||||
},
|
||||
None => Self::default(),
|
||||
}
|
||||
|
||||
#[cfg(feature = "x11")]
|
||||
return Self {
|
||||
clipboard: Box::new(ClipboardContext::new().unwrap()),
|
||||
selection: Some(Box::new(X11ClipboardContext::<X11SelectionClipboard>::new().unwrap())),
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "x11"))]
|
||||
return Self::new_nop();
|
||||
}
|
||||
|
||||
/// Used for tests and to handle missing clipboard provider when built without the `x11`
|
||||
|
@ -55,8 +48,15 @@ impl Clipboard {
|
|||
|
||||
impl Default for Clipboard {
|
||||
fn default() -> Self {
|
||||
#[cfg(any(feature = "x11", target_os = "macos", windows))]
|
||||
#[cfg(any(target_os = "macos", windows))]
|
||||
return Self { clipboard: Box::new(ClipboardContext::new().unwrap()), selection: None };
|
||||
|
||||
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
||||
return Self {
|
||||
clipboard: Box::new(ClipboardContext::new().unwrap()),
|
||||
selection: Some(Box::new(X11ClipboardContext::<X11SelectionClipboard>::new().unwrap())),
|
||||
};
|
||||
|
||||
#[cfg(not(any(feature = "x11", target_os = "macos", windows)))]
|
||||
return Self::new_nop();
|
||||
}
|
||||
|
|
|
@ -399,16 +399,6 @@ impl Window {
|
|||
self.window().set_simple_fullscreen(simple_fullscreen);
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
|
||||
pub fn wayland_display(&self) -> Option<*mut std::ffi::c_void> {
|
||||
self.window().wayland_display()
|
||||
}
|
||||
|
||||
#[cfg(not(any(feature = "wayland", target_os = "macos", windows)))]
|
||||
pub fn wayland_display(&self) -> Option<*mut std::ffi::c_void> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
|
||||
pub fn wayland_surface(&self) -> Option<&Attached<WlSurface>> {
|
||||
self.wayland_surface.as_ref()
|
||||
|
|
|
@ -928,7 +928,6 @@ pub struct Processor<N> {
|
|||
mouse: Mouse,
|
||||
received_count: usize,
|
||||
suppress_chars: bool,
|
||||
clipboard: Clipboard,
|
||||
modifiers: ModifiersState,
|
||||
config: Config,
|
||||
message_buffer: MessageBuffer,
|
||||
|
@ -951,11 +950,6 @@ impl<N: Notify + OnResize> Processor<N> {
|
|||
display: Display,
|
||||
cli_options: CLIOptions,
|
||||
) -> Processor<N> {
|
||||
#[cfg(not(any(target_os = "macos", windows)))]
|
||||
let clipboard = Clipboard::new(display.window.wayland_display());
|
||||
#[cfg(any(target_os = "macos", windows))]
|
||||
let clipboard = Clipboard::new();
|
||||
|
||||
Processor {
|
||||
notifier,
|
||||
mouse: Default::default(),
|
||||
|
@ -967,7 +961,6 @@ impl<N: Notify + OnResize> Processor<N> {
|
|||
message_buffer,
|
||||
display,
|
||||
event_queue: Vec::new(),
|
||||
clipboard,
|
||||
search_state: SearchState::new(),
|
||||
cli_options,
|
||||
dirty: false,
|
||||
|
@ -1012,6 +1005,12 @@ impl<N: Notify + OnResize> Processor<N> {
|
|||
self.event_queue.push(event.into());
|
||||
}
|
||||
|
||||
// NOTE: Since this takes a pointer to the winit event loop, it MUST be dropped first.
|
||||
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
|
||||
let mut clipboard = unsafe { Clipboard::new(event_loop.wayland_display()) };
|
||||
#[cfg(any(not(feature = "wayland"), target_os = "macos", windows))]
|
||||
let mut clipboard = Clipboard::new();
|
||||
|
||||
event_loop.run_return(|event, event_loop, control_flow| {
|
||||
if self.config.ui_config.debug.print_events {
|
||||
info!("glutin event: {:?}", event);
|
||||
|
@ -1067,7 +1066,7 @@ impl<N: Notify + OnResize> Processor<N> {
|
|||
terminal: &mut terminal,
|
||||
notifier: &mut self.notifier,
|
||||
mouse: &mut self.mouse,
|
||||
clipboard: &mut self.clipboard,
|
||||
clipboard: &mut clipboard,
|
||||
received_count: &mut self.received_count,
|
||||
suppress_chars: &mut self.suppress_chars,
|
||||
modifiers: &mut self.modifiers,
|
||||
|
|
Loading…
Reference in New Issue