Merge pull request #1614 from zed-industries/dock

Dock
This commit is contained in:
Kay Simmons 2022-09-14 12:40:59 -07:00 committed by GitHub
commit 29f46539f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 2463 additions and 1396 deletions

View file

@ -366,7 +366,7 @@ impl TerminalElement {
) {
let connection = self.terminal;
let mut region = MouseRegion::new(view_id, None, visible_bounds);
let mut region = MouseRegion::new::<Self>(view_id, view_id, visible_bounds);
// Terminal Emulator controlled behavior:
region = region
@ -427,7 +427,14 @@ impl TerminalElement {
position: e.position,
});
}
});
})
.on_scroll(TerminalElement::generic_button_handler(
connection,
origin,
move |terminal, origin, e, _cx| {
terminal.scroll_wheel(e, origin);
},
));
// Mouse mode handlers:
// All mouse modes need the extra click handlers
@ -742,24 +749,13 @@ impl Element for TerminalElement {
fn dispatch_event(
&mut self,
event: &gpui::Event,
bounds: gpui::geometry::rect::RectF,
visible_bounds: gpui::geometry::rect::RectF,
layout: &mut Self::LayoutState,
_bounds: gpui::geometry::rect::RectF,
_visible_bounds: gpui::geometry::rect::RectF,
_layout: &mut Self::LayoutState,
_paint: &mut Self::PaintState,
cx: &mut gpui::EventContext,
) -> bool {
match event {
Event::ScrollWheel(e) => visible_bounds
.contains_point(e.position)
.then(|| {
let origin = bounds.origin() + vec2f(layout.size.cell_width, 0.);
if let Some(terminal) = self.terminal.upgrade(cx.app) {
terminal.update(cx.app, |term, _| term.scroll_wheel(e, origin));
cx.notify();
}
})
.is_some(),
Event::KeyDown(KeyDownEvent { keystroke, .. }) => {
if !cx.is_parent_view_focused() {
return false;