Skip to content

Commit

Permalink
Simplify wayland configure event
Browse files Browse the repository at this point in the history
Remove the unnecessary PendingEvent struct, and just call functions
directly. I think this is easier to reason about, and fits better with
the current architecture of SCTK 0.17
  • Loading branch information
tmccombs committed Jul 4, 2024
1 parent 69686f4 commit 7b06526
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 263 deletions.
9 changes: 8 additions & 1 deletion window/src/os/wayland/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use mio::unix::SourceFd;
use mio::{Events, Interest, Poll, Token};
use wayland_client::backend::WaylandError;
use wayland_client::globals::registry_queue_init;
use wayland_client::{Connection as WConnection, EventQueue};
use wayland_client::{Connection as WConnection, EventQueue, QueueHandle};

use crate::screen::{ScreenInfo, Screens};
use crate::spawn::SPAWN_QUEUE;
Expand All @@ -25,6 +25,7 @@ pub struct WaylandConnection {
pub(super) connection: WConnection,
pub(super) event_queue: RefCell<EventQueue<WaylandState>>,
pub(super) wayland_state: RefCell<WaylandState>,
queue_handle: QueueHandle<WaylandState>,
}

impl WaylandConnection {
Expand All @@ -41,6 +42,7 @@ impl WaylandConnection {
gl_connection: RefCell::new(None),
event_queue: RefCell::new(event_queue),
wayland_state: RefCell::new(wayland_state),
queue_handle: qh,
};

Ok(wayland_connection)
Expand Down Expand Up @@ -155,6 +157,11 @@ impl WaylandConnection {

future
}

pub(super) fn queue_handle() -> QueueHandle<WaylandState> {
let conn = Connection::get().unwrap().wayland();
conn.queue_handle.clone()
}
}

impl ConnectionOps for WaylandConnection {
Expand Down
Loading

0 comments on commit 7b06526

Please sign in to comment.