Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
68e4530
New Plugin trait
lucasmerlin Jul 16, 2025
07bd077
New Plugin trait
lucasmerlin Jul 16, 2025
9441580
Add setup fn, prevent adding popup multiple times and add documentation
lucasmerlin Jul 23, 2025
54f56c4
Lint
lucasmerlin Jul 23, 2025
e5887bb
Add setup fn, prevent adding popup multiple times and add documentation
lucasmerlin Jul 23, 2025
ec40261
Lint
lucasmerlin Jul 23, 2025
4488bec
Add basic accessibility inspector plugin
lucasmerlin Jul 16, 2025
5a320ac
Merge branch 'lucas/plugin-trait' into lucas/accessibility-inspector
lucasmerlin Jul 23, 2025
fb99bba
Don't call setup again when adding plugin multiple times
lucasmerlin Jul 23, 2025
a6c4e2f
Make it possible to obtain a typed reference to a plugin
lucasmerlin Jul 23, 2025
b42c3f6
Move to plugins.rs
lucasmerlin Jul 23, 2025
d0115d7
Port LabelSelectionState to new Plugin api
lucasmerlin Jul 23, 2025
4590770
Port remaining plugins
lucasmerlin Jul 23, 2025
8a5317d
Clippy
lucasmerlin Jul 23, 2025
d72323f
Fix deadlock
lucasmerlin Jul 23, 2025
f1449ea
Merge branch 'lucas/plugin-trait' into lucas/accessibility-inspector
lucasmerlin Jul 23, 2025
dcf52b2
Make second side panel a bottom panel
lucasmerlin Jul 24, 2025
8b2104f
Grid
lucasmerlin Jul 24, 2025
bb9ffc8
Small ui improvements
lucasmerlin Jul 24, 2025
0033e45
Clippy
lucasmerlin Jul 24, 2025
1fc9f1b
Lint
lucasmerlin Jul 24, 2025
5ce5b7f
Fix dnd deadlock
lucasmerlin Jul 28, 2025
c857fb9
Fixes from review
lucasmerlin Aug 7, 2025
cf1f747
Merge branch 'lucas/plugin-trait' into lucas/accessibility-inspector
lucasmerlin Aug 7, 2025
da3d65d
Add `Id::from_high_entropy_bits`
lucasmerlin Aug 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes from review
  • Loading branch information
lucasmerlin committed Aug 7, 2025
commit c857fb949162ca96d68ff5883a85ce6bb6f2d3cb
6 changes: 2 additions & 4 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1836,8 +1836,7 @@ impl Context {
impl Context {
/// Call the given callback at the start of each pass of each viewport.
///
/// This can be used for egui _plugins_.
/// See [`crate::debug_text`] for an example.
/// This is a convenience wrapper around [`Self::add_plugin`].
pub fn on_begin_pass(&self, debug_name: &'static str, cb: plugin::ContextCallback) {
self.with_plugin(|p: &mut crate::plugin::CallbackPlugin| {
p.on_begin_plugins.push((debug_name, cb));
Expand All @@ -1846,8 +1845,7 @@ impl Context {

/// Call the given callback at the end of each pass of each viewport.
///
/// This can be used for egui _plugins_.
/// See [`crate::debug_text`] for an example.
/// This is a convenience wrapper around [`Self::add_plugin`].
pub fn on_end_pass(&self, debug_name: &'static str, cb: plugin::ContextCallback) {
self.with_plugin(|p: &mut crate::plugin::CallbackPlugin| {
p.on_end_plugins.push((debug_name, cb));
Expand Down
8 changes: 3 additions & 5 deletions crates/egui/src/debug_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ pub struct DebugTextPlugin {
}

impl Plugin for DebugTextPlugin {
fn name(&self) -> &'static str {
fn debug_name(&self) -> &'static str {
"DebugTextPlugin"
}

fn on_end_pass(&mut self, ctx: &Context) {
if !self.entries.is_empty() {
let entries = std::mem::take(&mut self.entries);
Self::paint_entries(ctx, entries);
}
let entries = std::mem::take(&mut self.entries);
Self::paint_entries(ctx, entries);
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/drag_and_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct DragAndDrop {
}

impl Plugin for DragAndDrop {
fn name(&self) -> &'static str {
fn debug_name(&self) -> &'static str {
"DragAndDrop"
}

Expand Down
4 changes: 0 additions & 4 deletions crates/egui/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ impl Id {
self.0.get()
}

pub fn from_value(value: u64) -> Self {
Self::from_hash(value)
}

#[cfg(feature = "accesskit")]
pub(crate) fn accesskit_id(&self) -> accesskit::NodeId {
self.value().into()
Expand Down
18 changes: 9 additions & 9 deletions crates/egui/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait Plugin: Send + Sync + 'static {
/// Plugin name.
///
/// Used when profiling.
fn name(&self) -> &'static str;
fn debug_name(&self) -> &'static str;

/// Called once, when the plugin is registered.
///
Expand All @@ -31,17 +31,17 @@ pub trait Plugin: Send + Sync + 'static {
/// Can be used to show ui, e.g. a [`crate::Window`].
fn on_end_pass(&mut self, ctx: &Context) {}

/// Called just before the output is passed to the backend.
///
/// Useful to inspect or modify the output.
/// Since this is called outside a pass, don't show ui here.
fn output_hook(&mut self, output: &mut FullOutput) {}

/// Called just before the input is processed.
///
/// Useful to inspect or modify the input.
/// Since this is called outside a pass, don't show ui here.
fn input_hook(&mut self, input: &mut RawInput) {}

/// Called just before the output is passed to the backend.
///
/// Useful to inspect or modify the output.
/// Since this is called outside a pass, don't show ui here.
fn output_hook(&mut self, output: &mut FullOutput) {}
}

pub(crate) struct PluginHandle {
Expand Down Expand Up @@ -140,7 +140,7 @@ impl PluginsOrdered {
{
for plugin in &self.0 {
let mut plugin = plugin.lock();
profiling::scope!("plugin", plugin.dyn_plugin_mut().name());
profiling::scope!("plugin", plugin.dyn_plugin_mut().debug_name());
f(plugin.dyn_plugin_mut());
}
}
Expand Down Expand Up @@ -213,7 +213,7 @@ pub(crate) struct CallbackPlugin {
}

impl Plugin for CallbackPlugin {
fn name(&self) -> &'static str {
fn debug_name(&self) -> &'static str {
"CallbackPlugins"
}

Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/text_selection/label_text_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Default for LabelSelectionState {
}

impl Plugin for LabelSelectionState {
fn name(&self) -> &'static str {
fn debug_name(&self) -> &'static str {
"LabelSelectionState"
}

Expand Down
Loading