Skip to content

Commit

Permalink
still update focus if pointerdown was processed
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhou121 committed Jun 13, 2024
1 parent 0e1cb1d commit 9a9e6c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ impl<'a> EventCx<'a> {
.event_before_children(self, &event)
.is_processed()
{
if let Event::PointerDown(event) = &event {
if self.app_state.keyboard_navigable.contains(&view_id) {
let rect = view_id.get_size().unwrap_or_default().to_rect();
let now_focused = rect.contains(event.pos);
if now_focused {
self.app_state.update_focus(view_id, false);
}
}
}
return EventPropagation::Stop;
}

Expand Down
8 changes: 2 additions & 6 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,10 @@ impl<W: wgpu::WindowHandle> Renderer<W> {
{
let size = Size::new(size.width.max(1.0), size.height.max(1.0));

let force_tiny_skia = if let Some(val) = std::env::var("FLOEM_FORCE_TINY_SKIA")
let force_tiny_skia = std::env::var("FLOEM_FORCE_TINY_SKIA")
.ok()
.map(|val| val.as_str() == "1")
{
val
} else {
false
};
.unwrap_or(false);

let vger_err = if !force_tiny_skia {
match VgerRenderer::new(window.clone(), size.width as u32, size.height as u32, scale) {
Expand Down

0 comments on commit 9a9e6c2

Please sign in to comment.