Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
j-axa committed Jun 25, 2024
1 parent 2bf1f02 commit c283ce6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
9 changes: 5 additions & 4 deletions crates/eframe/src/native/glow_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ impl GlutinWindowContext {
let display_builder = glutin_winit::DisplayBuilder::new()
// we might want to expose this option to users in the future. maybe using an env var or using native_options.
.with_preference(glutin_winit::ApiPreference::FallbackEgl) // https://github.com/emilk/egui/issues/2520#issuecomment-1367841150
.with_window_attributes(Some(egui_winit::create_winit_window_builder(
.with_window_attributes(Some(egui_winit::create_winit_window_attributes(
egui_ctx,
event_loop,
viewport_builder.clone(),
Expand Down Expand Up @@ -1104,17 +1104,18 @@ impl GlutinWindowContext {
window
} else {
log::debug!("Creating a window for viewport {viewport_id:?}");
let window_builder = egui_winit::create_winit_window_builder(
let window_attributes = egui_winit::create_winit_window_attributes(
&self.egui_ctx,
event_loop,
viewport.builder.clone(),
);
if window_builder.transparent() && self.gl_config.supports_transparency() == Some(false)
if window_attributes.transparent()
&& self.gl_config.supports_transparency() == Some(false)
{
log::error!("Cannot create transparent window: the GL config does not support it");
}
let window =
glutin_winit::finalize_window(event_loop, window_builder, &self.gl_config)?;
glutin_winit::finalize_window(event_loop, window_attributes, &self.gl_config)?;
egui_winit::apply_viewport_builder_to_window(
&self.egui_ctx,
&window,
Expand Down
23 changes: 4 additions & 19 deletions crates/egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub(crate) use profiling_scopes::*;
use winit::{
dpi::{PhysicalPosition, PhysicalSize},
event::ElementState,
//event_loop::EventLoopWindowTarget,
window::{CursorGrabMode, Window, WindowButtons, WindowLevel},
};

Expand Down Expand Up @@ -169,11 +168,6 @@ impl State {
window,
event_loop_proxy,
));
//self.accesskit = Some(accesskit_winit::Adapter::new(
// window,
// initial_tree_update_factory,
// event_loop_proxy,
//));
}

/// Call this once a graphics context has been created to update the maximum texture dimensions
Expand Down Expand Up @@ -1517,31 +1511,24 @@ fn process_viewport_command(
/// Possible causes of error include denied permission, incompatible system, and lack of memory.
pub fn create_window(
egui_ctx: &egui::Context,
//event_loop: &EventLoopWindowTarget<T>,
event_loop: &winit::event_loop::ActiveEventLoop,
viewport_builder: &ViewportBuilder,
) -> Result<Window, winit::error::OsError> {
crate::profile_function!();

let window_builder =
create_winit_window_builder(egui_ctx, event_loop, viewport_builder.clone());
//let window = {
// crate::profile_scope!("WindowBuilder::build");
// window_builder.build(event_loop)?
//};
let window_attributes =
create_winit_window_attributes(egui_ctx, event_loop, viewport_builder.clone());
let window = event_loop
.create_window(window_builder)
.create_window(window_attributes)
.expect("failed to create window");
apply_viewport_builder_to_window(egui_ctx, &window, viewport_builder);
Ok(window)
}

pub fn create_winit_window_builder(
pub fn create_winit_window_attributes(
egui_ctx: &egui::Context,
//event_loop: &EventLoopWindowTarget<T>,
event_loop: &winit::event_loop::ActiveEventLoop,
viewport_builder: ViewportBuilder,
//) -> winit::window::WindowBuilder {
) -> winit::window::WindowAttributes {
crate::profile_function!();

Expand Down Expand Up @@ -1602,7 +1589,6 @@ pub fn create_winit_window_builder(
} = viewport_builder;

let mut window_builder = winit::window::WindowAttributes::default()
//let mut window_builder = winit::window::WindowBuilder::new()
.with_title(title.unwrap_or_else(|| "egui window".to_owned()))
.with_transparent(transparent.unwrap_or(false))
.with_decorations(decorations.unwrap_or(true))
Expand Down Expand Up @@ -1698,7 +1684,6 @@ pub fn create_winit_window_builder(
#[cfg(target_os = "windows")]
{
use winit::platform::windows::WindowAttributesExtWindows as _;
//use winit::platform::windows::WindowBuilderExtWindows as _;
if let Some(enable) = _drag_and_drop {
window_builder = window_builder.with_drag_and_drop(enable);
}
Expand Down
3 changes: 1 addition & 2 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ struct ContextImpl {

#[cfg(feature = "accesskit")]
is_accesskit_enabled: bool,
//#[cfg(feature = "accesskit")]
//accesskit_node_classes: accesskit::NodeClassSet,

loaders: Arc<Loaders>,
}

Expand Down

0 comments on commit c283ce6

Please sign in to comment.