Replace usages of is_parent_view_focused with is_self_focused

Previously, this was used because we didn't have access to the current
view and `EventContext` was an element-only abstraction. Now that the
`EventContext` wraps the current view's `ViewContext` we can simply check
for the view's focus and avoid querying ancestors.
This commit is contained in:
Antonio Scandurra 2023-05-05 10:08:22 +02:00
parent 80ad59a620
commit b9ed327b94
2 changed files with 2 additions and 10 deletions

View file

@ -408,7 +408,7 @@ impl TerminalElement {
)
// Update drag selections
.on_drag(MouseButton::Left, move |event, _: &mut TerminalView, cx| {
if cx.is_parent_view_focused() {
if cx.is_self_focused() {
if let Some(conn_handle) = connection.upgrade(cx) {
conn_handle.update(cx, |terminal, cx| {
terminal.mouse_drag(event, origin);
@ -444,7 +444,7 @@ impl TerminalElement {
},
)
.on_move(move |event, _: &mut TerminalView, cx| {
if cx.is_parent_view_focused() {
if cx.is_self_focused() {
if let Some(conn_handle) = connection.upgrade(cx) {
conn_handle.update(cx, |terminal, cx| {
terminal.mouse_move(&event, origin);