fixed merge errors

This commit is contained in:
K Simmons 2022-08-11 12:24:48 -07:00
parent 133c194f4a
commit ab9f073443
3 changed files with 74 additions and 110 deletions

View file

@ -284,15 +284,11 @@ impl Presenter {
{ {
events_to_send.push(( events_to_send.push((
clicked_region.clone(), clicked_region.clone(),
<<<<<<< HEAD
MouseRegionEvent::Drag(*prev_drag_position, *e),
=======
MouseRegionEvent::Drag(DragRegionEvent { MouseRegionEvent::Drag(DragRegionEvent {
region: clicked_region.bounds, region: clicked_region.bounds,
prev_drag_position: *prev_drag_position, prev_drag_position: *prev_drag_position,
platform_event: e.clone(), platform_event: e.clone(),
}), }),
>>>>>>> 4bd8a4b0 (wip tab drag and drop)
)); ));
} }
@ -313,7 +309,7 @@ impl Presenter {
_ => {} _ => {}
} }
let (invalidated_views, dispatch_directives, handled) = { let (invalidated_views, handled) = {
let mut event_cx = self.handle_hover_events(&event, cx); let mut event_cx = self.handle_hover_events(&event, cx);
event_cx.process_region_events(events_to_send); event_cx.process_region_events(events_to_send);
@ -321,25 +317,9 @@ impl Presenter {
event_cx.handled = event_cx.dispatch_event(root_view_id, &event); event_cx.handled = event_cx.dispatch_event(root_view_id, &event);
} }
if let Some(callback) = region.handlers.get(&event.handler_key()) { (event_cx.invalidated_views, event_cx.handled)
event_cx.with_current_view(region.view_id, |event_cx| {
callback(event, event_cx);
})
}
(
event_cx.invalidated_views,
event_cx.dispatched_actions,
event_cx.handled,
)
}; };
if !handled {
handled = event_cx.dispatch_event(root_view_id, &event);
}
invalidated_views.extend(event_cx.invalidated_views);
for view_id in invalidated_views { for view_id in invalidated_views {
cx.notify_view(self.window_id, view_id); cx.notify_view(self.window_id, view_id);
} }

View file

@ -421,13 +421,11 @@ impl TerminalEl {
let drag_connection = self.terminal; let drag_connection = self.terminal;
cx.scene.push_mouse_region( cx.scene.push_mouse_region(
MouseRegion::new(view_id, None, visible_bounds) MouseRegion::new(view_id, None, visible_bounds)
.on_down( .on_down(MouseButton::Left, move |e, cx| {
MouseButton::Left,
move |MouseButtonEvent { position, .. }, cx| {
if let Some(conn_handle) = mouse_down_connection.upgrade(cx.app) { if let Some(conn_handle) = mouse_down_connection.upgrade(cx.app) {
conn_handle.update(cx.app, |terminal, cx| { conn_handle.update(cx.app, |terminal, cx| {
let (point, side) = TerminalEl::mouse_to_cell_data( let (point, side) = TerminalEl::mouse_to_cell_data(
position, e.position,
origin, origin,
cur_size, cur_size,
display_offset, display_offset,
@ -438,46 +436,34 @@ impl TerminalEl {
cx.notify(); cx.notify();
}) })
} }
}, })
) .on_click(MouseButton::Left, move |e, cx| {
.on_click(
MouseButton::Left,
move |MouseButtonEvent {
position,
click_count,
..
},
cx| {
cx.focus_parent_view(); cx.focus_parent_view();
if let Some(conn_handle) = click_connection.upgrade(cx.app) { if let Some(conn_handle) = click_connection.upgrade(cx.app) {
conn_handle.update(cx.app, |terminal, cx| { conn_handle.update(cx.app, |terminal, cx| {
let (point, side) = TerminalEl::mouse_to_cell_data( let (point, side) = TerminalEl::mouse_to_cell_data(
position, e.position,
origin, origin,
cur_size, cur_size,
display_offset, display_offset,
); );
terminal.click(point, side, click_count); terminal.click(point, side, e.click_count);
cx.notify(); cx.notify();
}); });
} }
}, })
) .on_click(MouseButton::Right, move |e, cx| {
.on_click( cx.dispatch_action(DeployContextMenu {
MouseButton::Right, position: e.position,
move |MouseButtonEvent { position, .. }, cx| { });
cx.dispatch_action(DeployContextMenu { position }); })
}, .on_drag(MouseButton::Left, move |e, cx| {
)
.on_drag(
MouseButton::Left,
move |_, MouseMovedEvent { position, .. }, cx| {
if let Some(conn_handle) = drag_connection.upgrade(cx.app) { if let Some(conn_handle) = drag_connection.upgrade(cx.app) {
conn_handle.update(cx.app, |terminal, cx| { conn_handle.update(cx.app, |terminal, cx| {
let (point, side) = TerminalEl::mouse_to_cell_data( let (point, side) = TerminalEl::mouse_to_cell_data(
position, e.position,
origin, origin,
cur_size, cur_size,
display_offset, display_offset,
@ -488,8 +474,7 @@ impl TerminalEl {
cx.notify() cx.notify()
}); });
} }
}, }),
),
); );
} }

View file

@ -14,8 +14,8 @@ use gpui::{
impl_actions, impl_internal_actions, impl_actions, impl_internal_actions,
platform::{CursorStyle, NavigationDirection}, platform::{CursorStyle, NavigationDirection},
AnyViewHandle, AnyWeakViewHandle, AppContext, AsyncAppContext, Entity, EventContext, AnyViewHandle, AnyWeakViewHandle, AppContext, AsyncAppContext, Entity, EventContext,
ModelHandle, MouseButton, MouseButtonEvent, MutableAppContext, PromptLevel, Quad, ModelHandle, MouseButton, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View,
RenderContext, Task, View, ViewContext, ViewHandle, WeakViewHandle, ViewContext, ViewHandle, WeakViewHandle,
}; };
use project::{Project, ProjectEntryId, ProjectPath}; use project::{Project, ProjectEntryId, ProjectPath};
use serde::Deserialize; use serde::Deserialize;
@ -1143,12 +1143,11 @@ impl View for Pane {
}, },
) )
.with_cursor_style(CursorStyle::PointingHand) .with_cursor_style(CursorStyle::PointingHand)
.on_down( .on_down(MouseButton::Left, |e, cx| {
MouseButton::Left, cx.dispatch_action(DeployNewMenu {
|MouseButtonEvent { position, .. }, cx| { position: e.position,
cx.dispatch_action(DeployNewMenu { position }); });
}, })
)
.boxed(), .boxed(),
MouseEventHandler::new::<SplitIcon, _, _>( MouseEventHandler::new::<SplitIcon, _, _>(
1, 1,