From 231c075867a123eb7407bbbfab80d853acf1f854 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 15 Apr 2021 10:37:31 +0200 Subject: [PATCH] Add #[inline(always)] to a few things --- CHANGELOG.md | 2 +- egui/src/memory.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a379d163..55dd6aaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ NOTE: [`eframe`](eframe/CHANGELOG.md), [`egui_web`](egui_web/CHANGELOG.md) and [ * Add `Response::request_focus` and `Response::surrender_focus`. ### Changed 🔧 -* Make `Memrory::has_focus` public (again) +* Make `Memory::has_focus` public (again) ### Fixed 🐛 * Fix [defocus-bug on touch screens](https://github.com/emilk/egui/issues/288) diff --git a/egui/src/memory.rs b/egui/src/memory.rs index db80791f..608b0b0f 100644 --- a/egui/src/memory.rs +++ b/egui/src/memory.rs @@ -297,12 +297,14 @@ impl Memory { } /// Does this widget have keybaord focus? + #[inline(always)] pub fn has_focus(&self, id: Id) -> bool { self.interaction.focus.id == Some(id) } /// Give keyboard focus to a specific widget. /// See also [`crate::Response::request_focus`]. + #[inline(always)] pub fn request_focus(&mut self, id: Id) { self.interaction.focus.id = Some(id); } @@ -324,14 +326,17 @@ impl Memory { } /// Stop editing of active `TextEdit` (if any). + #[inline(always)] pub fn stop_text_input(&mut self) { self.interaction.focus.id = None; } + #[inline(always)] pub fn is_anything_being_dragged(&self) -> bool { self.interaction.drag_id.is_some() } + #[inline(always)] pub fn is_being_dragged(&self, id: Id) -> bool { self.interaction.drag_id == Some(id) }