Skip to content

Commit 1e9f9f1

Browse files
authored
Remove workarounds for upstream fixes that have landed
### Related * Part of RR-5804 `re_dataframe_ui/src/header_tooltip.rs`: arrow 58.3 implements `Display` for `DataType` (apache/arrow-rs#8351), so the copy button no longer needs pretty-`Debug`. The button label one line above already used `Display`, so the label and the clipboard now agree. `re_dataframe_ui/src/filters/boolean.rs`: `array_sort` keeps inner list nullability again (apache/datafusion#19947, reachable from 53.0.0; we resolve 54.1.0), so the `arrow_cast` to `List(Boolean)` is redundant. `test_boolean_equals_list_nullable` covers the `nullable: false` shape that used to fail, and its snapshots are unchanged. `re_audio/src/waveform_envelope.rs`: `Rangef::union` exists upstream (emilk/egui#8603) and our `[patch]` resolves egui from `main`. `re_viewer/src/app/{logic,mod}.rs`: egui 0.36 syncs the OS window theme itself in `end_pass` (emilk/egui#8299), gated on `Options::sync_window_theme`, which defaults to true and is never disabled here. `sync_native_window_theme` and the `last_window_theme` cache are dead. ### What Four TODOs pointed at upstream issues that are now closed, and each fix is already in the version we resolve. ### Agent 🤖 This PR was prepared by a coding agent. Source-Ref: 385c5b729ef8b906610d160ed2b753a0e8e145e4
1 parent 703fb00 commit 1e9f9f1

5 files changed

Lines changed: 7 additions & 39 deletions

File tree

‎crates/top/re_viewer/src/app/logic.rs‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,31 +87,12 @@ impl App {
8787

8888
self.state.cleanup(&store_hub);
8989

90-
self.sync_native_window_theme(egui_ctx);
9190
self.sync_native_window_decorations(egui_ctx);
9291

9392
// Return the `StoreHub` to the Viewer so we have it on the next frame
9493
self.store_hub = Some(store_hub);
9594
}
9695

97-
/// Keep the OS window's appearance in sync with our egui theme.
98-
///
99-
/// This affects the way the macOS traffic light buttons are painted. Without this,
100-
/// they look wrong when the themes mismatch and the window isn't focused.
101-
// TODO(emilk/egui#8299): Remove once the egui fix lands
102-
fn sync_native_window_theme(&mut self, egui_ctx: &egui::Context) {
103-
let window_theme = match egui_ctx.options(|o| o.theme_preference) {
104-
egui::ThemePreference::System => egui::SystemTheme::SystemDefault,
105-
egui::ThemePreference::Dark => egui::SystemTheme::Dark,
106-
egui::ThemePreference::Light => egui::SystemTheme::Light,
107-
};
108-
109-
if self.last_window_theme != Some(window_theme) {
110-
self.last_window_theme = Some(window_theme);
111-
egui_ctx.send_viewport_cmd(egui::ViewportCommand::SetTheme(window_theme));
112-
}
113-
}
114-
11596
/// Hand the window decorations over to the OS, or take them over ourselves.
11697
///
11798
/// Only this may act on [`re_viewer_context::AppOptions::custom_window_decorations`];

‎crates/top/re_viewer/src/app/mod.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ pub struct App {
173173
/// Measures how long a frame takes to paint
174174
pub(crate) frame_time_history: egui::util::History<f32>,
175175

176-
/// The last theme we pushed to the OS window (via [`egui::ViewportCommand::SetTheme`]).
177-
last_window_theme: Option<egui::SystemTheme>,
178-
179176
/// Read via [`Self::custom_window_decorations`].
180177
window_decorations_request: WindowDecorationsRequest,
181178

@@ -571,7 +568,6 @@ impl App {
571568
latest_latency_interest: None,
572569

573570
frame_time_history: egui::util::History::new(1..100, 0.5),
574-
last_window_theme: None,
575571

576572
window_decorations_request: WindowDecorationsRequest::NotSent,
577573

‎crates/utils/re_audio/src/waveform_envelope.rs‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl AudioBuffer {
4040
.chunks_exact(num_channels)
4141
.map(|frame| frame.iter().sum::<f32>() / num_channels as f32)
4242
.fold(Rangef::NOTHING, |range, mixed| {
43-
union(range, Rangef::point(mixed))
43+
range.union(Rangef::point(mixed))
4444
})
4545
})
4646
.collect();
@@ -67,16 +67,13 @@ impl WaveformEnvelope {
6767
let last = last_frame
6868
.div_ceil(self.frames_per_bucket)
6969
.clamp(first + 1, n);
70-
self.buckets[first..last].iter().copied().reduce(union)
70+
self.buckets[first..last]
71+
.iter()
72+
.copied()
73+
.reduce(Rangef::union)
7174
}
7275
}
7376

74-
/// The smallest range containing both.
75-
// TODO(emilk/egui#8603): use `Rangef::union` once released.
76-
fn union(a: Rangef, b: Rangef) -> Rangef {
77-
Rangef::new(a.min.min(b.min), a.max.max(b.max))
78-
}
79-
8077
#[cfg(test)]
8178
mod tests {
8279
use super::*;

‎crates/viewer_support/re_dataframe_ui/src/filters/boolean.rs‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::fmt::Formatter;
22

33
use arrow::datatypes::{DataType, Field};
44
use datafusion::common::Column;
5-
use datafusion::functions::core::expr_fn::arrow_cast;
65
use datafusion::logical_expr::{Expr, col, lit, not};
76
use datafusion::prelude::{array_element, array_has, array_sort};
87
use re_ui::syntax_highlighting::SyntaxHighlightedBuilder;
@@ -199,13 +198,8 @@ impl Filter for NullableBooleanFilter {
199198
if let Some(value) = self.value.as_bool() {
200199
array_has(col(column), lit(value))
201200
} else {
202-
// TODO(apache/datafusion#19947): Remove arrow_cast when resolved
203201
col(column.clone()).is_null().or(array_element(
204-
array_sort(
205-
arrow_cast(col(column), lit("List(Boolean)")),
206-
lit("ASC"),
207-
lit("NULLS FIRST"),
208-
),
202+
array_sort(col(column), lit("ASC"), lit("NULLS FIRST")),
209203
lit(1),
210204
)
211205
.is_null())

‎crates/viewer_support/re_dataframe_ui/src/header_tooltip.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ fn datatype_ui(ui: &mut egui::Ui, column_name: &str, datatype: &arrow::datatypes
166166
)
167167
.clicked()
168168
{
169-
ui.copy_text(format!("{datatype:#?}")); // TODO(apache/arrow-rs#8351): use Display once arrow 57 is released
169+
ui.copy_text(datatype.to_string());
170170
re_log::info!("Copied full datatype of column `{column_name}` to clipboard");
171171
}
172172
},

0 commit comments

Comments
 (0)