Skip to content

Commit

Permalink
Restrict event_loop to macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisduerr committed Apr 23, 2024
1 parent 304bf49 commit 44a0085
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
24 changes: 22 additions & 2 deletions alacritty/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ pub struct ActionContext<'a, N, T> {
pub message_buffer: &'a mut MessageBuffer,
pub config: &'a UiConfig,
pub cursor_blink_timed_out: &'a mut bool,
#[cfg(target_os = "macos")]
pub event_loop: &'a EventLoopWindowTarget<Event>,
pub event_proxy: &'a EventLoopProxy<Event>,
pub scheduler: &'a mut Scheduler,
pub search_state: &'a mut SearchState,
Expand Down Expand Up @@ -1690,7 +1692,14 @@ impl Processor {
None => return,
};

window_context.handle_event(&proxy, &mut clipboard, &mut scheduler, event);
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,
&mut scheduler,
event,
);

window_context.draw(&mut scheduler);
},
Expand All @@ -1699,6 +1708,8 @@ impl Processor {
// Dispatch event to all windows.
for window_context in self.windows.values_mut() {
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,
&mut scheduler,
Expand Down Expand Up @@ -1784,6 +1795,8 @@ impl Processor {
WinitEvent::UserEvent(event @ Event { window_id: None, .. }) => {
for window_context in self.windows.values_mut() {
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,
&mut scheduler,
Expand All @@ -1795,7 +1808,14 @@ impl Processor {
WinitEvent::WindowEvent { window_id, .. }
| WinitEvent::UserEvent(Event { window_id: Some(window_id), .. }) => {
if let Some(window_context) = self.windows.get_mut(&window_id) {
window_context.handle_event(&proxy, &mut clipboard, &mut scheduler, event);
window_context.handle_event(
#[cfg(target_os = "macos")]
event_loop,
&proxy,
&mut clipboard,
&mut scheduler,
event,
);
}
},
_ => (),
Expand Down
3 changes: 3 additions & 0 deletions alacritty/src/window_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ impl WindowContext {
/// Process events for this terminal window.
pub fn handle_event(
&mut self,
#[cfg(target_os = "macos")] event_loop: &EventLoopWindowTarget<Event>,
event_proxy: &EventLoopProxy<Event>,
clipboard: &mut Clipboard,
scheduler: &mut Scheduler,
Expand Down Expand Up @@ -444,6 +445,8 @@ impl WindowContext {
preserve_title: self.preserve_title,
config: &self.config,
event_proxy,
#[cfg(target_os = "macos")]
event_loop,
clipboard,
scheduler,
};
Expand Down

0 comments on commit 44a0085

Please sign in to comment.