Skip to content

Commit

Permalink
Revert "Give focus back (#379)" (#425)
Browse files Browse the repository at this point in the history
This reverts commit 0bf0a29.
  • Loading branch information
dzhou121 authored Apr 22, 2024
1 parent 438217c commit e0e2d51
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
7 changes: 0 additions & 7 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,6 @@ impl<'a> EventCx<'a> {
return EventPropagation::Stop;
}

let mut is_down_and_has_click = false;

match &event {
Event::PointerDown(event) => {
self.app_state.clicking.insert(id);
Expand All @@ -726,7 +724,6 @@ impl<'a> EventCx<'a> {
if self.has_event_listener(id, EventListener::Click) {
let view_state = self.app_state.view_state(id);
view_state.last_pointer_down = Some(event.clone());
is_down_and_has_click = true;
}

let bottom_left = {
Expand Down Expand Up @@ -949,10 +946,6 @@ impl<'a> EventCx<'a> {
}
}

if is_down_and_has_click {
return EventPropagation::Stop;
}

EventPropagation::Continue
}

Expand Down
16 changes: 0 additions & 16 deletions src/window_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,22 +323,6 @@ impl WindowHandle {
}
}
}

if let Event::PointerDown(event) = &event {
if cx.app_state.focus.is_none() {
if let Some(id) = was_focused {
let layout = cx.app_state.get_layout_rect(id);
if layout.contains(event.pos) {
// if the event is pointer down
// and the focus hasn't been set to anything new
// and the pointer down event is inside the previously focusd view
// we then set the focus back to that view
cx.app_state.focus = Some(id);
}
}
}
}

if was_focused != cx.app_state.focus {
cx.app_state.focus_changed(was_focused, cx.app_state.focus);
}
Expand Down

0 comments on commit e0e2d51

Please sign in to comment.