Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into winit-0.29
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Dec 14, 2023
2 parents a13959a + c8dd3dd commit c2ad585
Show file tree
Hide file tree
Showing 46 changed files with 716 additions and 680 deletions.
1,056 changes: 596 additions & 460 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ members = [
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.72"
version = "0.24.1"
version = "0.24.2"


[profile.release]
Expand Down Expand Up @@ -48,6 +48,7 @@ opt-level = 2


[workspace.dependencies]
criterion = { version = "0.5.1", default-features = false }
puffin = "0.18"
raw-window-handle = "0.5.0"
thiserror = "1.0.37"
Expand Down
7 changes: 0 additions & 7 deletions crates/egui/src/containers/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ impl Area {
self
}

#[deprecated = "Use `constrain_to` instead"]
#[inline]
pub fn drag_bounds(mut self, constrain_rect: Rect) -> Self {
self.constrain_rect = Some(constrain_rect);
self
}

/// Where the "root" of the area is.
///
/// For instance, if you set this to [`Align2::RIGHT_TOP`]
Expand Down
30 changes: 0 additions & 30 deletions crates/egui/src/containers/collapsing_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,36 +424,6 @@ impl CollapsingHeader {
self
}

/// Can the [`CollapsingHeader`] be selected by clicking it? Default: `false`.
#[deprecated = "Use the more powerful egui::collapsing_header::CollapsingState::show_header"] // Deprecated in 2022-04-28, before egui 0.18
#[inline]
pub fn selectable(mut self, selectable: bool) -> Self {
self.selectable = selectable;
self
}

/// If you set this to 'true', the [`CollapsingHeader`] will be shown as selected.
///
/// Example:
/// ```
/// # egui::__run_test_ui(|ui| {
/// let mut selected = false;
/// let response = egui::CollapsingHeader::new("Select and open me")
/// .selectable(true)
/// .selected(selected)
/// .show(ui, |ui| ui.label("Body"));
/// if response.header_response.clicked() {
/// selected = true;
/// }
/// # });
/// ```
#[deprecated = "Use the more powerful egui::collapsing_header::CollapsingState::show_header"] // Deprecated in 2022-04-28, before egui 0.18
#[inline]
pub fn selected(mut self, selected: bool) -> Self {
self.selected = selected;
self
}

/// Should the [`CollapsingHeader`] show a background behind it? Default: `false`.
///
/// To show it behind all [`CollapsingHeader`] you can just use:
Expand Down
6 changes: 0 additions & 6 deletions crates/egui/src/containers/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@ impl Frame {
self
}

#[deprecated = "Renamed inner_margin in egui 0.18"]
#[inline]
pub fn margin(self, margin: impl Into<Margin>) -> Self {
self.inner_margin(margin)
}

#[inline]
pub fn shadow(mut self, shadow: Shadow) -> Self {
self.shadow = shadow;
Expand Down
9 changes: 0 additions & 9 deletions crates/egui/src/containers/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,6 @@ impl<'open> Window<'open> {
self
}

#[deprecated = "Use `constrain_to` instead"]
#[inline]
pub fn drag_bounds(mut self, constrain_rect: Rect) -> Self {
#![allow(deprecated)]

self.area = self.area.drag_bounds(constrain_rect);
self
}

/// Where the "root" of the window is.
///
/// For instance, if you set this to [`Align2::RIGHT_TOP`]
Expand Down
10 changes: 0 additions & 10 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,16 +707,6 @@ impl Context {
})
}

/// Read-write access to [`Fonts`].
#[inline]
#[deprecated = "This function will be removed"]
pub fn fonts_mut<R>(&self, writer: impl FnOnce(Option<&mut Fonts>) -> R) -> R {
self.write(move |ctx| {
let pixels_per_point = ctx.pixels_per_point();
writer(ctx.fonts.get_mut(&pixels_per_point.into()))
})
}

/// Read-only access to [`Options`].
#[inline]
pub fn options<R>(&self, reader: impl FnOnce(&Options) -> R) -> R {
Expand Down
9 changes: 0 additions & 9 deletions crates/egui/src/data/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,6 @@ impl Modifiers {
command: false,
};

#[deprecated = "Use `Modifiers::ALT | Modifiers::SHIFT` instead"]
pub const ALT_SHIFT: Self = Self {
alt: true,
ctrl: false,
shift: true,
mac_cmd: false,
command: false,
};

/// The Mac ⌘ Command key
pub const MAC_CMD: Self = Self {
alt: false,
Expand Down
8 changes: 0 additions & 8 deletions crates/egui/src/data/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,6 @@ pub struct PlatformOutput {
}

impl PlatformOutput {
/// Open the given url in a web browser.
///
/// If egui is running in a browser, the same tab will be reused.
#[deprecated = "Use Context::open_url instead"]
pub fn open_url(&mut self, url: impl ToString) {
self.open_url = Some(OpenUrl::same_tab(url));
}

/// This can be used by a text-to-speech system to describe the events (if any).
pub fn events_description(&self) -> String {
// only describe last event:
Expand Down
5 changes: 0 additions & 5 deletions crates/egui/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ impl Id {
/// though obviously it will lead to a lot of collisions if you do use it!
pub const NULL: Self = Self(0);

#[deprecated = "Use Id::NULL"]
pub fn null() -> Self {
Self(0)
}

pub(crate) const fn background() -> Self {
Self(1)
}
Expand Down
17 changes: 1 addition & 16 deletions crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct Memory {
///
/// This will be saved between different program runs if you use the `persistence` feature.
///
/// To store a state common for all your widgets (a singleton), use [`Id::null`] as the key.
/// To store a state common for all your widgets (a singleton), use [`Id::NULL`] as the key.
pub data: crate::util::IdTypeMap,

// ------------------------------------------
Expand Down Expand Up @@ -666,21 +666,6 @@ impl Memory {
}
}

/// Set an event filter for a widget.
///
/// You must first give focus to the widget before calling this.
#[deprecated = "Use set_focus_lock_filter instead"]
pub fn lock_focus(&mut self, id: Id, lock_focus: bool) {
self.set_focus_lock_filter(
id,
EventFilter {
tab: lock_focus,
arrows: lock_focus,
escape: false,
},
);
}

/// Give keyboard focus to a specific widget.
/// See also [`crate::Response::request_focus`].
#[inline(always)]
Expand Down
10 changes: 0 additions & 10 deletions crates/egui/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ impl Painter {
pub(crate) fn set_invisible(&mut self) {
self.fade_to_color = Some(Color32::TRANSPARENT);
}

#[deprecated = "Use Painter::with_clip_rect"] // Deprecated in 2022-04-18, before egui 0.18
pub fn sub_region(&self, rect: Rect) -> Self {
Self {
ctx: self.ctx.clone(),
layer_id: self.layer_id,
clip_rect: rect.intersect(self.clip_rect),
fade_to_color: self.fade_to_color,
}
}
}

/// ## Accessors etc
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/util/id_type_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ use crate::Id;
///
/// Values can either be "persisted" (serializable) or "temporary" (cleared when egui is shut down).
///
/// You can store state using the key [`Id::null`]. The state will then only be identified by its type.
/// You can store state using the key [`Id::NULL`]. The state will then only be identified by its type.
///
/// ```
/// # use egui::{Id, util::IdTypeMap};
Expand Down
5 changes: 0 additions & 5 deletions crates/egui/src/widgets/text_edit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,6 @@ impl<'t> TextEdit<'t> {
self
}

#[deprecated = "Use .font(…) instead"]
pub fn text_style(self, text_style: TextStyle) -> Self {
self.font(text_style)
}

#[inline]
pub fn text_color(mut self, text_color: Color32) -> Self {
self.text_color = Some(text_color);
Expand Down
5 changes: 4 additions & 1 deletion crates/egui_demo_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ serde = { version = "1", optional = true, features = ["derive"] }

# native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
env_logger = "0.10"
env_logger = { version = "0.10", default-features = false, features = [
"auto-color",
"humantime",
] }
rfd = { version = "0.11", optional = true }

# web:
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ serde = { version = "1", optional = true, features = ["derive"] }


[dev-dependencies]
criterion = { version = "0.4", default-features = false }
criterion.workspace = true


[[bench]]
Expand Down
4 changes: 4 additions & 0 deletions crates/egui_extras/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ This file is updated upon each release.
Changes since the last release can be found at <https://github.com/emilk/egui/compare/latest...HEAD> or by running the `scripts/generate_changelog.py` script.


## 0.24.2 - 2023-12-08 - `Table` scroll bug fix
* Fix `Table` scrolling bug [#3690](https://github.com/emilk/egui/pull/3690)


## 0.24.1 - 2023-11-30
* Add more years for datepicker [#3599](https://github.com/emilk/egui/pull/3599) (thanks [@vaqxai](https://github.com/vaqxai)!)

Expand Down
10 changes: 1 addition & 9 deletions crates/egui_extras/src/image.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(deprecated)]

use egui::{mutex::Mutex, TextureFilter, TextureOptions};
use egui::{mutex::Mutex, TextureOptions};

#[cfg(feature = "svg")]
use resvg::{tiny_skia, usvg};
Expand Down Expand Up @@ -126,14 +126,6 @@ impl RetainedImage {
self
}

#[deprecated = "Use with_options instead"]
pub fn with_texture_filter(self, filter: TextureFilter) -> Self {
self.with_options(TextureOptions {
magnification: filter,
minification: filter,
})
}

/// The size of the image data (number of pixels wide/high).
pub fn size(&self) -> [usize; 2] {
self.size
Expand Down
18 changes: 8 additions & 10 deletions crates/egui_extras/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,6 @@ impl<'a> TableBuilder<'a> {
self
}

#[deprecated = "Renamed to vscroll"]
pub fn scroll(self, vscroll: bool) -> Self {
self.vscroll(vscroll)
}

/// Enables scrolling the table's contents using mouse drag (default: `true`).
///
/// See [`ScrollArea::drag_to_scroll`] for more.
Expand Down Expand Up @@ -592,7 +587,7 @@ impl<'a> Table<'a> {
auto_shrink,
} = scroll_options;

let avail_rect = ui.available_rect_before_wrap();
let cursor_position = ui.cursor().min;

let mut scroll_area = ScrollArea::new([false, vscroll])
.auto_shrink(true)
Expand All @@ -613,6 +608,8 @@ impl<'a> Table<'a> {
scroll_area.show(ui, move |ui| {
let mut scroll_to_y_range = None;

let clip_rect = ui.clip_rect();

// Hide first-frame-jitters when auto-sizing.
ui.add_visible_ui(!first_frame_auto_size_columns, |ui| {
let layout = StripLayout::new(ui, CellDirection::Horizontal, cell_layout);
Expand All @@ -624,8 +621,8 @@ impl<'a> Table<'a> {
max_used_widths: max_used_widths_ref,
striped,
row_nr: 0,
start_y: avail_rect.top(),
end_y: avail_rect.bottom(),
start_y: clip_rect.top(),
end_y: clip_rect.bottom(),
scroll_to_row: scroll_to_row.map(|(r, _)| r),
scroll_to_y_range: &mut scroll_to_y_range,
});
Expand All @@ -647,7 +644,7 @@ impl<'a> Table<'a> {
let bottom = ui.min_rect().bottom();

let spacing_x = ui.spacing().item_spacing.x;
let mut x = avail_rect.left() - spacing_x * 0.5;
let mut x = cursor_position.x - spacing_x * 0.5;
for (i, column_width) in state.column_widths.iter_mut().enumerate() {
let column = &columns[i];
let column_is_resizable = column.resizable.unwrap_or(resizable);
Expand Down Expand Up @@ -800,7 +797,8 @@ impl<'a> TableBody<'a> {

/// Add a single row with the given height.
///
/// If you have many thousands of row it can be more performant to instead use [`Self::rows`] or [`Self::heterogeneous_rows`].
/// ⚠️ It is much more performant to use [`Self::rows`] or [`Self::heterogeneous_rows`],
/// as those functions will only render the visible rows.
pub fn row(&mut self, height: f32, add_row_content: impl FnOnce(TableRow<'a, '_>)) {
let top_y = self.layout.cursor.y;
add_row_content(TableRow {
Expand Down
5 changes: 0 additions & 5 deletions crates/egui_glow/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,11 +624,6 @@ impl Painter {
self.textures.get(&texture_id).copied()
}

#[deprecated = "renamed 'texture'"]
pub fn get_texture(&self, texture_id: egui::TextureId) -> Option<glow::Texture> {
self.texture(texture_id)
}

#[allow(clippy::needless_pass_by_value)] // False positive
pub fn register_native_texture(&mut self, native: glow::Texture) -> egui::TextureId {
self.assert_not_destroyed();
Expand Down
14 changes: 0 additions & 14 deletions crates/egui_plot/src/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,20 +574,6 @@ impl Polygon {
self
}

#[deprecated = "Use `fill_color`."]
#[allow(unused, clippy::needless_pass_by_value)]
#[inline]
pub fn color(mut self, color: impl Into<Color32>) -> Self {
self
}

#[deprecated = "Use `fill_color`."]
#[allow(unused, clippy::needless_pass_by_value)]
#[inline]
pub fn fill_alpha(mut self, _alpha: impl Into<f32>) -> Self {
self
}

/// Fill color. Defaults to the stroke color with added transparency.
#[inline]
pub fn fill_color(mut self, color: impl Into<Color32>) -> Self {
Expand Down
18 changes: 0 additions & 18 deletions crates/egui_plot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,24 +1393,6 @@ impl PlotUi {
&self.response
}

/// Returns `true` if the plot area is currently hovered.
#[deprecated = "Use plot_ui.response().hovered()"]
pub fn plot_hovered(&self) -> bool {
self.response.hovered()
}

/// Returns `true` if the plot was clicked by the primary button.
#[deprecated = "Use plot_ui.response().clicked()"]
pub fn plot_clicked(&self) -> bool {
self.response.clicked()
}

/// Returns `true` if the plot was clicked by the secondary button.
#[deprecated = "Use plot_ui.response().secondary_clicked()"]
pub fn plot_secondary_clicked(&self) -> bool {
self.response.secondary_clicked()
}

/// The pointer position in plot coordinates. Independent of whether the pointer is in the plot area.
pub fn pointer_coordinate(&self) -> Option<PlotPoint> {
// We need to subtract the drag delta to keep in sync with the frame-delayed screen transform:
Expand Down
Loading

0 comments on commit c2ad585

Please sign in to comment.