Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put everything in Context behind the same Mutex #1050

Merged
merged 13 commits into from
Jan 10, 2022
Prev Previous commit
Next Next commit
Fix some compilation issues
  • Loading branch information
emilk committed Jan 8, 2022
commit 8a3de4e5cbc369ea33ed50f2d842f09371766847
6 changes: 3 additions & 3 deletions egui_demo_lib/src/apps/http_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Resource {
}

impl Resource {
fn from_response(ctx: &egui::Context, response: ehttp::Response) -> Self {
fn from_response(ctx: &egui::CtxRef, response: ehttp::Response) -> Self {
let content_type = response.content_type().unwrap_or_default();
let image = if content_type.starts_with("image/") {
decode_image(&response.bytes)
Expand Down Expand Up @@ -240,7 +240,7 @@ fn selectable_text(ui: &mut egui::Ui, mut text: &str) {

#[cfg(feature = "syntect")]
fn syntax_highlighting(
ctx: &egui::Context,
ctx: &egui::CtxRef,
response: &ehttp::Response,
text: &str,
) -> Option<ColoredText> {
Expand All @@ -253,7 +253,7 @@ fn syntax_highlighting(
}

#[cfg(not(feature = "syntect"))]
fn syntax_highlighting(_ctx: &egui::Context, _: &ehttp::Response, _: &str) -> Option<ColoredText> {
fn syntax_highlighting(_ctx: &egui::CtxRef, _: &ehttp::Response, _: &str) -> Option<ColoredText> {
None
}

Expand Down
2 changes: 1 addition & 1 deletion egui_web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ pub fn local_storage_remove(key: &str) {
}

#[cfg(feature = "persistence")]
pub fn load_memory(ctx: &egui::Context) {
pub fn load_memory(ctx: &egui::CtxRef) {
if let Some(memory_string) = local_storage_get("egui_memory_ron") {
match ron::from_str(&memory_string) {
Ok(memory) => {
Expand Down
3 changes: 2 additions & 1 deletion epaint/src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ mod rw_lock_impl {

#[cfg(not(feature = "multi_threaded"))]
mod arc_impl {
pub use std::rc::Rc as Arc;
// pub use std::rc::Rc as Arc; // TODO(emilk): optimize single threaded code by using `Rc` instead of `Arc`.
pub use std::sync::Arc;
}

// ----------------------------------------------------------------------------
Expand Down