Projects STRLCPY alacritty Commits 5e8c9f16
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    CHANGELOG.md
    skipped 9 lines
    10 10  ### Fixed
    11 11   
    12 12  - Crash due to assertion failure on 32-bit architectures
     13 +- Segmentation fault on shutdown with Wayland
    13 14   
    14 15  ## 0.7.1
    15 16   
    skipped 839 lines
  • ■ ■ ■ ■ ■ ■
    alacritty/src/clipboard.rs
    1  -#[cfg(not(any(target_os = "macos", target_os = "windows")))]
     1 +#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
    2 2  use std::ffi::c_void;
    3 3   
    4 4  use log::{debug, warn};
    skipped 2 lines
    7 7   
    8 8  #[cfg(any(test, not(any(feature = "x11", target_os = "macos", windows))))]
    9 9  use copypasta::nop_clipboard::NopClipboardContext;
    10  -#[cfg(all(not(any(target_os = "macos", windows)), feature = "wayland"))]
     10 +#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
    11 11  use copypasta::wayland_clipboard;
    12  -#[cfg(all(not(any(target_os = "macos", windows)), feature = "x11"))]
     12 +#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
    13 13  use copypasta::x11_clipboard::{Primary as X11SelectionClipboard, X11ClipboardContext};
    14 14  #[cfg(any(feature = "x11", target_os = "macos", windows))]
    15 15  use copypasta::ClipboardContext;
    skipped 5 lines
    21 21  }
    22 22   
    23 23  impl Clipboard {
    24  - #[cfg(any(target_os = "macos", windows))]
     24 + #[cfg(any(not(feature = "wayland"), target_os = "macos", windows))]
    25 25   pub fn new() -> Self {
    26 26   Self::default()
    27 27   }
    28 28   
    29  - #[cfg(not(any(target_os = "macos", windows)))]
    30  - pub fn new(_display: Option<*mut c_void>) -> Self {
    31  - #[cfg(feature = "wayland")]
    32  - if let Some(display) = _display {
    33  - let (selection, clipboard) =
    34  - unsafe { wayland_clipboard::create_clipboards_from_external(display) };
    35  - return Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) };
     29 + #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
     30 + pub unsafe fn new(display: Option<*mut c_void>) -> Self {
     31 + match display {
     32 + Some(display) => {
     33 + let (selection, clipboard) =
     34 + wayland_clipboard::create_clipboards_from_external(display);
     35 + Self { clipboard: Box::new(clipboard), selection: Some(Box::new(selection)) }
     36 + },
     37 + None => Self::default(),
    36 38   }
    37  - 
    38  - #[cfg(feature = "x11")]
    39  - return Self {
    40  - clipboard: Box::new(ClipboardContext::new().unwrap()),
    41  - selection: Some(Box::new(X11ClipboardContext::<X11SelectionClipboard>::new().unwrap())),
    42  - };
    43  - 
    44  - #[cfg(not(feature = "x11"))]
    45  - return Self::new_nop();
    46 39   }
    47 40   
    48 41   /// Used for tests and to handle missing clipboard provider when built without the `x11`
    skipped 6 lines
    55 48   
    56 49  impl Default for Clipboard {
    57 50   fn default() -> Self {
    58  - #[cfg(any(feature = "x11", target_os = "macos", windows))]
     51 + #[cfg(any(target_os = "macos", windows))]
    59 52   return Self { clipboard: Box::new(ClipboardContext::new().unwrap()), selection: None };
     53 + 
     54 + #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
     55 + return Self {
     56 + clipboard: Box::new(ClipboardContext::new().unwrap()),
     57 + selection: Some(Box::new(X11ClipboardContext::<X11SelectionClipboard>::new().unwrap())),
     58 + };
     59 + 
    60 60   #[cfg(not(any(feature = "x11", target_os = "macos", windows)))]
    61 61   return Self::new_nop();
    62 62   }
    skipped 31 lines
  • ■ ■ ■ ■ ■ ■
    alacritty/src/event.rs
    skipped 873 lines
    874 874   mouse: Mouse,
    875 875   received_count: usize,
    876 876   suppress_chars: bool,
    877  - clipboard: Clipboard,
    878 877   modifiers: ModifiersState,
    879 878   config: Config,
    880 879   message_buffer: MessageBuffer,
    skipped 15 lines
    896 895   display: Display,
    897 896   cli_options: CLIOptions,
    898 897   ) -> Processor<N> {
    899  - #[cfg(not(any(target_os = "macos", windows)))]
    900  - let clipboard = Clipboard::new(display.window.wayland_display());
    901  - #[cfg(any(target_os = "macos", windows))]
    902  - let clipboard = Clipboard::new();
    903  - 
    904 898   Processor {
    905 899   notifier,
    906 900   mouse: Default::default(),
    skipped 5 lines
    912 906   message_buffer,
    913 907   display,
    914 908   event_queue: Vec::new(),
    915  - clipboard,
    916 909   search_state: SearchState::new(),
    917 910   cli_options,
    918 911   }
    skipped 37 lines
    956 949   self.event_queue.push(event.into());
    957 950   }
    958 951   
     952 + // NOTE: Since this takes a pointer to the winit event loop, it MUST be dropped first.
     953 + #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
     954 + let mut clipboard = unsafe { Clipboard::new(event_loop.wayland_display()) };
     955 + #[cfg(any(not(feature = "wayland"), target_os = "macos", windows))]
     956 + let mut clipboard = Clipboard::new();
     957 + 
    959 958   event_loop.run_return(|event, event_loop, control_flow| {
    960 959   if self.config.ui_config.debug.print_events {
    961 960   info!("glutin event: {:?}", event);
    skipped 49 lines
    1011 1010   terminal: &mut terminal,
    1012 1011   notifier: &mut self.notifier,
    1013 1012   mouse: &mut self.mouse,
    1014  - clipboard: &mut self.clipboard,
    1015 1013   size_info: &mut self.display.size_info,
     1014 + clipboard: &mut clipboard,
    1016 1015   received_count: &mut self.received_count,
    1017 1016   suppress_chars: &mut self.suppress_chars,
    1018 1017   modifiers: &mut self.modifiers,
    skipped 393 lines
  • ■ ■ ■ ■ ■ ■
    alacritty/src/window.rs
    skipped 400 lines
    401 401   }
    402 402   
    403 403   #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
    404  - pub fn wayland_display(&self) -> Option<*mut std::ffi::c_void> {
    405  - self.window().wayland_display()
    406  - }
    407  - 
    408  - #[cfg(not(any(feature = "wayland", target_os = "macos", windows)))]
    409  - pub fn wayland_display(&self) -> Option<*mut std::ffi::c_void> {
    410  - None
    411  - }
    412  - 
    413  - #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
    414 404   pub fn wayland_surface(&self) -> Option<&Attached<WlSurface>> {
    415 405   self.wayland_surface.as_ref()
    416 406   }
    skipped 88 lines
Please wait...
Page is in error, reload to recover