commit 153947a34df3bbd51412e553c47ae996b36c6f74
parent adfc50b5dbdeed4e78f6cde59d88648e56bb2236
Author: deurzen <m.deurzen@tum.de>
Date: Fri, 26 Mar 2021 03:00:31 +0100
introduces producer interior mutability for Client
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/core/client.rs b/src/core/client.rs
@@ -38,7 +38,7 @@ pub struct Client {
parent: Option<Window>,
children: RefCell<Vec<Window>>,
leader: Option<Window>,
- producer: Option<Window>,
+ producer: Cell<Option<Window>>,
consumers: RefCell<Vec<Window>>,
focused: Cell<bool>,
mapped: Cell<bool>,
@@ -99,7 +99,7 @@ impl Client {
parent: None,
children: RefCell::new(Vec::new()),
leader: None,
- producer: None,
+ producer: Cell::new(None),
consumers: RefCell::new(Vec::new()),
focused: Cell::new(false),
mapped: Cell::new(false),
@@ -424,20 +424,20 @@ impl Client {
#[inline]
pub fn set_producer(
- &mut self,
+ &self,
producer: Window,
) {
- self.producer = Some(producer);
+ self.producer.set(Some(producer));
}
#[inline]
- pub fn unset_producer(&mut self) {
- self.producer = None;
+ pub fn unset_producer(&self) {
+ self.producer.set(None);
}
#[inline]
pub fn producer(&self) -> Option<Window> {
- self.producer
+ self.producer.get()
}
#[inline]