Remove deprecated fields from `PlatformOutput` (#7523)
This commit is contained in:
parent
72b9b9d750
commit
802d307e4a
|
|
@ -305,8 +305,6 @@ impl AppRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_platform_output(&self, platform_output: egui::PlatformOutput) {
|
fn handle_platform_output(&self, platform_output: egui::PlatformOutput) {
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
#[cfg(feature = "web_screen_reader")]
|
#[cfg(feature = "web_screen_reader")]
|
||||||
if self.egui_ctx.options(|o| o.screen_reader) {
|
if self.egui_ctx.options(|o| o.screen_reader) {
|
||||||
super::screen_reader::speak(&platform_output.events_description());
|
super::screen_reader::speak(&platform_output.events_description());
|
||||||
|
|
@ -315,8 +313,6 @@ impl AppRunner {
|
||||||
let egui::PlatformOutput {
|
let egui::PlatformOutput {
|
||||||
commands,
|
commands,
|
||||||
cursor_icon,
|
cursor_icon,
|
||||||
open_url,
|
|
||||||
copied_text,
|
|
||||||
events: _, // already handled
|
events: _, // already handled
|
||||||
mutable_text_under_cursor: _, // TODO(#4569): https://github.com/emilk/egui/issues/4569
|
mutable_text_under_cursor: _, // TODO(#4569): https://github.com/emilk/egui/issues/4569
|
||||||
ime,
|
ime,
|
||||||
|
|
@ -342,14 +338,6 @@ impl AppRunner {
|
||||||
|
|
||||||
super::set_cursor_icon(cursor_icon);
|
super::set_cursor_icon(cursor_icon);
|
||||||
|
|
||||||
if let Some(open) = open_url {
|
|
||||||
super::open_url(&open.url, open.new_tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
if !copied_text.is_empty() {
|
|
||||||
super::set_clipboard_text(&copied_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.has_focus() {
|
if self.has_focus() {
|
||||||
// The eframe app has focus.
|
// The eframe app has focus.
|
||||||
if ime.is_some() {
|
if ime.is_some() {
|
||||||
|
|
|
||||||
|
|
@ -827,14 +827,11 @@ impl State {
|
||||||
window: &Window,
|
window: &Window,
|
||||||
platform_output: egui::PlatformOutput,
|
platform_output: egui::PlatformOutput,
|
||||||
) {
|
) {
|
||||||
#![allow(deprecated)]
|
|
||||||
profiling::function_scope!();
|
profiling::function_scope!();
|
||||||
|
|
||||||
let egui::PlatformOutput {
|
let egui::PlatformOutput {
|
||||||
commands,
|
commands,
|
||||||
cursor_icon,
|
cursor_icon,
|
||||||
open_url,
|
|
||||||
copied_text,
|
|
||||||
events: _, // handled elsewhere
|
events: _, // handled elsewhere
|
||||||
mutable_text_under_cursor: _, // only used in eframe web
|
mutable_text_under_cursor: _, // only used in eframe web
|
||||||
ime,
|
ime,
|
||||||
|
|
@ -860,14 +857,6 @@ impl State {
|
||||||
|
|
||||||
self.set_cursor_icon(window, cursor_icon);
|
self.set_cursor_icon(window, cursor_icon);
|
||||||
|
|
||||||
if let Some(open_url) = open_url {
|
|
||||||
open_url_in_browser(&open_url.url);
|
|
||||||
}
|
|
||||||
|
|
||||||
if !copied_text.is_empty() {
|
|
||||||
self.clipboard.set_text(copied_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
let allow_ime = ime.is_some();
|
let allow_ime = ime.is_some();
|
||||||
if self.allow_ime != allow_ime {
|
if self.allow_ime != allow_ime {
|
||||||
self.allow_ime = allow_ime;
|
self.allow_ime = allow_ime;
|
||||||
|
|
|
||||||
|
|
@ -698,7 +698,7 @@ impl ContextImpl {
|
||||||
/// ```
|
/// ```
|
||||||
/// # let ctx = egui::Context::default();
|
/// # let ctx = egui::Context::default();
|
||||||
/// if ctx.input(|i| i.key_pressed(egui::Key::A)) {
|
/// if ctx.input(|i| i.key_pressed(egui::Key::A)) {
|
||||||
/// ctx.output_mut(|o| o.copied_text = "Hello!".to_string());
|
/// ctx.copy_text("Hello!".to_owned());
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
|
@ -1534,7 +1534,7 @@ impl Context {
|
||||||
/// ```
|
/// ```
|
||||||
/// # let ctx = egui::Context::default();
|
/// # let ctx = egui::Context::default();
|
||||||
/// # let open_url = egui::OpenUrl::same_tab("http://www.example.com");
|
/// # let open_url = egui::OpenUrl::same_tab("http://www.example.com");
|
||||||
/// ctx.output_mut(|o| o.open_url = Some(open_url));
|
/// ctx.send_cmd(egui::OutputCommand::OpenUrl(open_url));
|
||||||
/// ```
|
/// ```
|
||||||
pub fn open_url(&self, open_url: crate::OpenUrl) {
|
pub fn open_url(&self, open_url: crate::OpenUrl) {
|
||||||
self.send_cmd(crate::OutputCommand::OpenUrl(open_url));
|
self.send_cmd(crate::OutputCommand::OpenUrl(open_url));
|
||||||
|
|
|
||||||
|
|
@ -113,24 +113,6 @@ pub struct PlatformOutput {
|
||||||
/// Set the cursor to this icon.
|
/// Set the cursor to this icon.
|
||||||
pub cursor_icon: CursorIcon,
|
pub cursor_icon: CursorIcon,
|
||||||
|
|
||||||
/// If set, open this url.
|
|
||||||
#[deprecated = "Use `Context::open_url` or `PlatformOutput::commands` instead"]
|
|
||||||
pub open_url: Option<OpenUrl>,
|
|
||||||
|
|
||||||
/// If set, put this text in the system clipboard. Ignore if empty.
|
|
||||||
///
|
|
||||||
/// This is often a response to [`crate::Event::Copy`] or [`crate::Event::Cut`].
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// # egui::__run_test_ui(|ui| {
|
|
||||||
/// if ui.button("📋").clicked() {
|
|
||||||
/// ui.output_mut(|o| o.copied_text = "some_text".to_string());
|
|
||||||
/// }
|
|
||||||
/// # });
|
|
||||||
/// ```
|
|
||||||
#[deprecated = "Use `Context::copy_text` or `PlatformOutput::commands` instead"]
|
|
||||||
pub copied_text: String,
|
|
||||||
|
|
||||||
/// Events that may be useful to e.g. a screen reader.
|
/// Events that may be useful to e.g. a screen reader.
|
||||||
pub events: Vec<OutputEvent>,
|
pub events: Vec<OutputEvent>,
|
||||||
|
|
||||||
|
|
@ -187,13 +169,9 @@ impl PlatformOutput {
|
||||||
|
|
||||||
/// Add on new output.
|
/// Add on new output.
|
||||||
pub fn append(&mut self, newer: Self) {
|
pub fn append(&mut self, newer: Self) {
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
let Self {
|
let Self {
|
||||||
mut commands,
|
mut commands,
|
||||||
cursor_icon,
|
cursor_icon,
|
||||||
open_url,
|
|
||||||
copied_text,
|
|
||||||
mut events,
|
mut events,
|
||||||
mutable_text_under_cursor,
|
mutable_text_under_cursor,
|
||||||
ime,
|
ime,
|
||||||
|
|
@ -205,12 +183,6 @@ impl PlatformOutput {
|
||||||
|
|
||||||
self.commands.append(&mut commands);
|
self.commands.append(&mut commands);
|
||||||
self.cursor_icon = cursor_icon;
|
self.cursor_icon = cursor_icon;
|
||||||
if open_url.is_some() {
|
|
||||||
self.open_url = open_url;
|
|
||||||
}
|
|
||||||
if !copied_text.is_empty() {
|
|
||||||
self.copied_text = copied_text;
|
|
||||||
}
|
|
||||||
self.events.append(&mut events);
|
self.events.append(&mut events);
|
||||||
self.mutable_text_under_cursor = mutable_text_under_cursor;
|
self.mutable_text_under_cursor = mutable_text_under_cursor;
|
||||||
self.ime = ime.or(self.ime);
|
self.ime = ime.or(self.ime);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue