all: use let chains
This commit is contained in:
parent
3d5d146d65
commit
286857971a
89 changed files with 1516 additions and 1574 deletions
|
|
@ -17,12 +17,11 @@ fn create_bridge() -> anyhow::Result<()> {
|
||||||
|
|
||||||
fn create_version() -> anyhow::Result<()> {
|
fn create_version() -> anyhow::Result<()> {
|
||||||
let mut version_string = env!("CARGO_PKG_VERSION").to_string();
|
let mut version_string = env!("CARGO_PKG_VERSION").to_string();
|
||||||
if let Ok(output) = Command::new("git").arg("rev-parse").arg("HEAD").output() {
|
if let Ok(output) = Command::new("git").arg("rev-parse").arg("HEAD").output()
|
||||||
if output.status.success() {
|
&& output.status.success()
|
||||||
if let Ok(commit) = std::str::from_utf8(&output.stdout) {
|
&& let Ok(commit) = std::str::from_utf8(&output.stdout)
|
||||||
write!(version_string, " ({})", commit.trim())?;
|
{
|
||||||
}
|
write!(version_string, " ({})", commit.trim())?;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let mut f = open("version.rs")?;
|
let mut f = open("version.rs")?;
|
||||||
writeln!(f, "pub const VERSION: &str = \"{}\";", version_string)?;
|
writeln!(f, "pub const VERSION: &str = \"{}\";", version_string)?;
|
||||||
|
|
|
||||||
|
|
@ -595,13 +595,12 @@ fn struct_needs_lt(s: &Struct, protocols: &Protocols) -> Result<bool> {
|
||||||
}
|
}
|
||||||
let mut needs_lt = false;
|
let mut needs_lt = false;
|
||||||
for field in &s.fields {
|
for field in &s.fields {
|
||||||
if let Field::Real(f) = field {
|
if let Field::Real(f) = field
|
||||||
if f.value.is_none() {
|
&& f.value.is_none()
|
||||||
if needs_lifetime(&f.ty, protocols)? {
|
&& needs_lifetime(&f.ty, protocols)?
|
||||||
needs_lt = true;
|
{
|
||||||
break;
|
needs_lt = true;
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.needs_lt.set(Some(needs_lt));
|
s.needs_lt.set(Some(needs_lt));
|
||||||
|
|
@ -674,11 +673,11 @@ fn struct_has_fds(s: &Struct, protocols: &Protocols) -> Result<bool> {
|
||||||
}
|
}
|
||||||
let mut has_fds = false;
|
let mut has_fds = false;
|
||||||
for field in &s.fields {
|
for field in &s.fields {
|
||||||
if let Field::Real(f) = field {
|
if let Field::Real(f) = field
|
||||||
if type_has_fds(&f.ty, protocols)? {
|
&& type_has_fds(&f.ty, protocols)?
|
||||||
has_fds = true;
|
{
|
||||||
break;
|
has_fds = true;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.has_fds.set(Some(has_fds));
|
s.has_fds.set(Some(has_fds));
|
||||||
|
|
@ -1519,10 +1518,10 @@ fn format_struct<F: Write>(
|
||||||
}
|
}
|
||||||
writeln!(f, " Ok(Self {{")?;
|
writeln!(f, " Ok(Self {{")?;
|
||||||
for field in &s.fields {
|
for field in &s.fields {
|
||||||
if let Field::Real(rf) = field {
|
if let Field::Real(rf) = field
|
||||||
if rf.value.is_none() {
|
&& rf.value.is_none()
|
||||||
writeln!(f, " {},", rf.name)?;
|
{
|
||||||
}
|
writeln!(f, " {},", rf.name)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeln!(f, " }})")?;
|
writeln!(f, " }})")?;
|
||||||
|
|
|
||||||
|
|
@ -1857,22 +1857,22 @@ impl ConfigClient {
|
||||||
run_cb("shortcut", &handler, ());
|
run_cb("shortcut", &handler, ());
|
||||||
}
|
}
|
||||||
self.pressed_keysym.set(None);
|
self.pressed_keysym.set(None);
|
||||||
if was_latched {
|
if was_latched
|
||||||
if let Entry::Occupied(mut oe) = self.key_handlers.borrow_mut().entry((seat, ms)) {
|
&& let Entry::Occupied(mut oe) = self.key_handlers.borrow_mut().entry((seat, ms))
|
||||||
let o = oe.get_mut();
|
{
|
||||||
if o.latched.is_empty() {
|
let o = oe.get_mut();
|
||||||
if o.cb.is_none() {
|
if o.latched.is_empty() {
|
||||||
self.send(&ClientMessage::RemoveShortcut { seat, mods, sym });
|
if o.cb.is_none() {
|
||||||
oe.remove();
|
self.send(&ClientMessage::RemoveShortcut { seat, mods, sym });
|
||||||
} else if o.cb_mask != o.registered_mask {
|
oe.remove();
|
||||||
o.registered_mask = o.cb_mask;
|
} else if o.cb_mask != o.registered_mask {
|
||||||
self.send(&ClientMessage::AddShortcut2 {
|
o.registered_mask = o.cb_mask;
|
||||||
seat,
|
self.send(&ClientMessage::AddShortcut2 {
|
||||||
mods: ms.mods,
|
seat,
|
||||||
mod_mask: o.cb_mask,
|
mods: ms.mods,
|
||||||
sym: ms.sym,
|
mod_mask: o.cb_mask,
|
||||||
});
|
sym: ms.sym,
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -441,10 +441,10 @@ impl ToConnectorId for &'_ str {
|
||||||
("USB-", CON_USB),
|
("USB-", CON_USB),
|
||||||
];
|
];
|
||||||
for (prefix, ty) in pairs {
|
for (prefix, ty) in pairs {
|
||||||
if let Some(suffix) = self.strip_prefix(prefix) {
|
if let Some(suffix) = self.strip_prefix(prefix)
|
||||||
if let Ok(idx) = u32::from_str(suffix) {
|
&& let Ok(idx) = u32::from_str(suffix)
|
||||||
return Ok((ty, idx));
|
{
|
||||||
}
|
return Ok((ty, idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(format!("`{}` is not a valid connector identifier", self))
|
Err(format!("`{}` is not a valid connector identifier", self))
|
||||||
|
|
|
||||||
|
|
@ -247,13 +247,13 @@ impl Backend for MetalBackend {
|
||||||
for device in devices.values() {
|
for device in devices.values() {
|
||||||
let mut change = device.dev.master.change();
|
let mut change = device.dev.master.change();
|
||||||
for connector in device.connectors.lock().values() {
|
for connector in device.connectors.lock().values() {
|
||||||
if let Some(crtc) = connector.crtc.get() {
|
if let Some(crtc) = connector.crtc.get()
|
||||||
if idle == crtc.active.value.get() {
|
&& idle == crtc.active.value.get()
|
||||||
crtc.active.value.set(!idle);
|
{
|
||||||
change.change_object(crtc.id, |c| {
|
crtc.active.value.set(!idle);
|
||||||
c.change(crtc.active.id, (!idle) as _);
|
change.change_object(crtc.id, |c| {
|
||||||
});
|
c.change(crtc.active.id, (!idle) as _);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Err(e) = change.commit(DRM_MODE_ATOMIC_ALLOW_MODESET, 0) {
|
if let Err(e) = change.commit(DRM_MODE_ATOMIC_ALLOW_MODESET, 0) {
|
||||||
|
|
@ -283,10 +283,10 @@ impl Backend for MetalBackend {
|
||||||
fn get_input_fds(&self) -> Vec<Rc<OwnedFd>> {
|
fn get_input_fds(&self) -> Vec<Rc<OwnedFd>> {
|
||||||
let mut res = vec![];
|
let mut res = vec![];
|
||||||
for dev in &*self.device_holder.input_devices.borrow() {
|
for dev in &*self.device_holder.input_devices.borrow() {
|
||||||
if let Some(dev) = dev {
|
if let Some(dev) = dev
|
||||||
if let Some(fd) = dev.fd.get() {
|
&& let Some(fd) = dev.fd.get()
|
||||||
res.push(fd);
|
{
|
||||||
}
|
res.push(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
|
|
@ -428,11 +428,11 @@ impl LibInputAdapter for DeviceHolder {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
Err(e) => return Err(LibInputError::Stat(e.into())),
|
Err(e) => return Err(LibInputError::Stat(e.into())),
|
||||||
};
|
};
|
||||||
if let Some(MetalDevice::Input(d)) = self.devices.get(&stat.st_rdev) {
|
if let Some(MetalDevice::Input(d)) = self.devices.get(&stat.st_rdev)
|
||||||
if let Some(fd) = d.fd.get() {
|
&& let Some(fd) = d.fd.get()
|
||||||
return uapi::fcntl_dupfd_cloexec(fd.raw(), 0)
|
{
|
||||||
.map_err(|e| LibInputError::DupFd(e.into()));
|
return uapi::fcntl_dupfd_cloexec(fd.raw(), 0)
|
||||||
}
|
.map_err(|e| LibInputError::DupFd(e.into()));
|
||||||
}
|
}
|
||||||
Err(LibInputError::DeviceUnavailable)
|
Err(LibInputError::DeviceUnavailable)
|
||||||
}
|
}
|
||||||
|
|
@ -537,25 +537,25 @@ impl MetalInputDevice {
|
||||||
|
|
||||||
fn set_accel_profile_(&self, profile: AccelProfile) {
|
fn set_accel_profile_(&self, profile: AccelProfile) {
|
||||||
self.desired.accel_profile.set(Some(profile));
|
self.desired.accel_profile.set(Some(profile));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().accel_available() {
|
&& dev.device().accel_available()
|
||||||
dev.device().set_accel_profile(profile);
|
{
|
||||||
self.effective
|
dev.device().set_accel_profile(profile);
|
||||||
.accel_profile
|
self.effective
|
||||||
.set(Some(dev.device().accel_profile()));
|
.accel_profile
|
||||||
}
|
.set(Some(dev.device().accel_profile()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_click_method_(&self, method: ConfigClickMethod) {
|
fn set_click_method_(&self, method: ConfigClickMethod) {
|
||||||
self.desired.click_method.set(Some(method));
|
self.desired.click_method.set(Some(method));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().has_click_methods() {
|
&& dev.device().has_click_methods()
|
||||||
dev.device().set_click_method(method);
|
{
|
||||||
self.effective
|
dev.device().set_click_method(method);
|
||||||
.click_method
|
self.effective
|
||||||
.set(Some(dev.device().click_method()));
|
.click_method
|
||||||
}
|
.set(Some(dev.device().click_method()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -595,13 +595,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
|
|
||||||
fn set_left_handed(&self, left_handed: bool) {
|
fn set_left_handed(&self, left_handed: bool) {
|
||||||
self.desired.left_handed.set(Some(left_handed));
|
self.desired.left_handed.set(Some(left_handed));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().left_handed_available() {
|
&& dev.device().left_handed_available()
|
||||||
dev.device().set_left_handed(left_handed);
|
{
|
||||||
self.effective
|
dev.device().set_left_handed(left_handed);
|
||||||
.left_handed
|
self.effective
|
||||||
.set(Some(dev.device().left_handed()));
|
.left_handed
|
||||||
}
|
.set(Some(dev.device().left_handed()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -629,13 +629,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
|
|
||||||
fn set_accel_speed(&self, speed: f64) {
|
fn set_accel_speed(&self, speed: f64) {
|
||||||
self.desired.accel_speed.set(Some(speed));
|
self.desired.accel_speed.set(Some(speed));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().accel_available() {
|
&& dev.device().accel_available()
|
||||||
dev.device().set_accel_speed(speed);
|
{
|
||||||
self.effective
|
dev.device().set_accel_speed(speed);
|
||||||
.accel_speed
|
self.effective
|
||||||
.set(Some(dev.device().accel_speed()));
|
.accel_speed
|
||||||
}
|
.set(Some(dev.device().accel_speed()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -653,13 +653,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
|
|
||||||
fn set_calibration_matrix(&self, m: [[f32; 3]; 2]) {
|
fn set_calibration_matrix(&self, m: [[f32; 3]; 2]) {
|
||||||
self.desired.calibration_matrix.set(Some(m));
|
self.desired.calibration_matrix.set(Some(m));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().has_calibration_matrix() {
|
&& dev.device().has_calibration_matrix()
|
||||||
dev.device().set_calibration_matrix(m);
|
{
|
||||||
self.effective
|
dev.device().set_calibration_matrix(m);
|
||||||
.calibration_matrix
|
self.effective
|
||||||
.set(Some(dev.device().get_calibration_matrix()));
|
.calibration_matrix
|
||||||
}
|
.set(Some(dev.device().get_calibration_matrix()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -677,13 +677,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
|
|
||||||
fn set_tap_enabled(&self, enabled: bool) {
|
fn set_tap_enabled(&self, enabled: bool) {
|
||||||
self.desired.tap_enabled.set(Some(enabled));
|
self.desired.tap_enabled.set(Some(enabled));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().tap_available() {
|
&& dev.device().tap_available()
|
||||||
dev.device().set_tap_enabled(enabled);
|
{
|
||||||
self.effective
|
dev.device().set_tap_enabled(enabled);
|
||||||
.tap_enabled
|
self.effective
|
||||||
.set(Some(dev.device().tap_enabled()));
|
.tap_enabled
|
||||||
}
|
.set(Some(dev.device().tap_enabled()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -693,13 +693,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
|
|
||||||
fn set_drag_enabled(&self, enabled: bool) {
|
fn set_drag_enabled(&self, enabled: bool) {
|
||||||
self.desired.drag_enabled.set(Some(enabled));
|
self.desired.drag_enabled.set(Some(enabled));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().tap_available() {
|
&& dev.device().tap_available()
|
||||||
dev.device().set_drag_enabled(enabled);
|
{
|
||||||
self.effective
|
dev.device().set_drag_enabled(enabled);
|
||||||
.drag_enabled
|
self.effective
|
||||||
.set(Some(dev.device().drag_enabled()));
|
.drag_enabled
|
||||||
}
|
.set(Some(dev.device().drag_enabled()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -709,13 +709,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
|
|
||||||
fn set_drag_lock_enabled(&self, enabled: bool) {
|
fn set_drag_lock_enabled(&self, enabled: bool) {
|
||||||
self.desired.drag_lock_enabled.set(Some(enabled));
|
self.desired.drag_lock_enabled.set(Some(enabled));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().tap_available() {
|
&& dev.device().tap_available()
|
||||||
dev.device().set_drag_lock_enabled(enabled);
|
{
|
||||||
self.effective
|
dev.device().set_drag_lock_enabled(enabled);
|
||||||
.drag_lock_enabled
|
self.effective
|
||||||
.set(Some(dev.device().drag_lock_enabled()));
|
.drag_lock_enabled
|
||||||
}
|
.set(Some(dev.device().drag_lock_enabled()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -725,13 +725,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
|
|
||||||
fn set_natural_scrolling_enabled(&self, enabled: bool) {
|
fn set_natural_scrolling_enabled(&self, enabled: bool) {
|
||||||
self.desired.natural_scrolling_enabled.set(Some(enabled));
|
self.desired.natural_scrolling_enabled.set(Some(enabled));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().has_natural_scrolling() {
|
&& dev.device().has_natural_scrolling()
|
||||||
dev.device().set_natural_scrolling_enabled(enabled);
|
{
|
||||||
self.effective
|
dev.device().set_natural_scrolling_enabled(enabled);
|
||||||
.natural_scrolling_enabled
|
self.effective
|
||||||
.set(Some(dev.device().natural_scrolling_enabled()));
|
.natural_scrolling_enabled
|
||||||
}
|
.set(Some(dev.device().natural_scrolling_enabled()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -763,13 +763,13 @@ impl InputDevice for MetalInputDevice {
|
||||||
self.desired
|
self.desired
|
||||||
.middle_button_emulation_enabled
|
.middle_button_emulation_enabled
|
||||||
.set(Some(enabled));
|
.set(Some(enabled));
|
||||||
if let Some(dev) = self.inputdev.get() {
|
if let Some(dev) = self.inputdev.get()
|
||||||
if dev.device().middle_button_emulation_available() {
|
&& dev.device().middle_button_emulation_available()
|
||||||
dev.device().set_middle_button_emulation_enabled(enabled);
|
{
|
||||||
self.effective
|
dev.device().set_middle_button_emulation_enabled(enabled);
|
||||||
.middle_button_emulation_enabled
|
self.effective
|
||||||
.set(Some(dev.device().middle_button_emulation_enabled()));
|
.middle_button_emulation_enabled
|
||||||
}
|
.set(Some(dev.device().middle_button_emulation_enabled()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -345,10 +345,10 @@ impl MetalBackend {
|
||||||
let id = &slf.device_holder.devices;
|
let id = &slf.device_holder.devices;
|
||||||
let mut slots = slf.device_holder.input_devices.borrow_mut();
|
let mut slots = slf.device_holder.input_devices.borrow_mut();
|
||||||
let dev = 'dev: {
|
let dev = 'dev: {
|
||||||
if let Some(dev) = slots[slot].clone() {
|
if let Some(dev) = slots[slot].clone()
|
||||||
if dev.id == device_id {
|
&& dev.id == device_id
|
||||||
break 'dev dev;
|
{
|
||||||
}
|
break 'dev dev;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -200,13 +200,13 @@ impl MetalConnector {
|
||||||
present_fb = Some(fb);
|
present_fb = Some(fb);
|
||||||
}
|
}
|
||||||
self.perform_screencopies(&present_fb, &node, &cd);
|
self.perform_screencopies(&present_fb, &node, &cd);
|
||||||
if let Some(sync_file) = self.cursor_sync_file.take() {
|
if let Some(sync_file) = self.cursor_sync_file.take()
|
||||||
if let Err(e) = self.state.ring.readable(&sync_file).await {
|
&& let Err(e) = self.state.ring.readable(&sync_file).await
|
||||||
log::error!(
|
{
|
||||||
"Could not wait for cursor sync file to complete: {}",
|
log::error!(
|
||||||
ErrorFmt(e)
|
"Could not wait for cursor sync file to complete: {}",
|
||||||
);
|
ErrorFmt(e)
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
self.await_present_fb(present_fb.as_mut()).await;
|
self.await_present_fb(present_fb.as_mut()).await;
|
||||||
let mut res = self.program_connector(
|
let mut res = self.program_connector(
|
||||||
|
|
@ -216,36 +216,36 @@ impl MetalConnector {
|
||||||
cursor_programming.as_ref(),
|
cursor_programming.as_ref(),
|
||||||
present_fb.as_ref(),
|
present_fb.as_ref(),
|
||||||
);
|
);
|
||||||
if res.is_err() {
|
if res.is_err()
|
||||||
if let Some(dsd_id) = direct_scanout_id {
|
&& let Some(dsd_id) = direct_scanout_id
|
||||||
let fb = self.prepare_present_fb(
|
{
|
||||||
&cd,
|
let fb = self.prepare_present_fb(
|
||||||
&linear_cd,
|
&cd,
|
||||||
buffer,
|
&linear_cd,
|
||||||
&plane,
|
buffer,
|
||||||
latched.as_ref().unwrap(),
|
&plane,
|
||||||
false,
|
latched.as_ref().unwrap(),
|
||||||
)?;
|
false,
|
||||||
present_fb = Some(fb);
|
)?;
|
||||||
self.await_present_fb(present_fb.as_mut()).await;
|
present_fb = Some(fb);
|
||||||
res = self.program_connector(
|
self.await_present_fb(present_fb.as_mut()).await;
|
||||||
version,
|
res = self.program_connector(
|
||||||
&crtc,
|
version,
|
||||||
&plane,
|
&crtc,
|
||||||
cursor_programming.as_ref(),
|
&plane,
|
||||||
present_fb.as_ref(),
|
cursor_programming.as_ref(),
|
||||||
);
|
present_fb.as_ref(),
|
||||||
if res.is_ok() {
|
);
|
||||||
let mut cache = self.scanout_buffers.borrow_mut();
|
if res.is_ok() {
|
||||||
if let Some(buffer) = cache.remove(&dsd_id) {
|
let mut cache = self.scanout_buffers.borrow_mut();
|
||||||
cache.insert(
|
if let Some(buffer) = cache.remove(&dsd_id) {
|
||||||
dsd_id,
|
cache.insert(
|
||||||
DirectScanoutCache {
|
dsd_id,
|
||||||
tex: buffer.tex,
|
DirectScanoutCache {
|
||||||
fb: None,
|
tex: buffer.tex,
|
||||||
},
|
fb: None,
|
||||||
);
|
},
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -369,20 +369,22 @@ impl MetalConnector {
|
||||||
change!(c, plane.crtc_y, crtc_y);
|
change!(c, plane.crtc_y, crtc_y);
|
||||||
change!(c, plane.crtc_w, crtc_w);
|
change!(c, plane.crtc_w, crtc_w);
|
||||||
change!(c, plane.crtc_h, crtc_h);
|
change!(c, plane.crtc_h, crtc_h);
|
||||||
if !try_async_flip && !self.dev.is_nvidia {
|
if !try_async_flip
|
||||||
if let Some(sf) = self.backend.signaled_sync_file.get() {
|
&& !self.dev.is_nvidia
|
||||||
c.change(plane.in_fence_fd, sf.0.raw() as u64);
|
&& let Some(sf) = self.backend.signaled_sync_file.get()
|
||||||
}
|
{
|
||||||
|
c.change(plane.in_fence_fd, sf.0.raw() as u64);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if self.dev.is_amd && crtc.vrr_enabled.value.get() {
|
// Work around https://gitlab.freedesktop.org/drm/amd/-/issues/2186
|
||||||
// Work around https://gitlab.freedesktop.org/drm/amd/-/issues/2186
|
if self.dev.is_amd
|
||||||
if let Some(fb) = &*self.active_framebuffer.borrow() {
|
&& crtc.vrr_enabled.value.get()
|
||||||
changes.change_object(plane.id, |c| {
|
&& let Some(fb) = &*self.active_framebuffer.borrow()
|
||||||
c.change(plane.fb_id, fb.fb.id().0 as _);
|
{
|
||||||
});
|
changes.change_object(plane.id, |c| {
|
||||||
}
|
c.change(plane.fb_id, fb.fb.id().0 as _);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(cursor) = cursor {
|
if let Some(cursor) = cursor {
|
||||||
|
|
@ -408,10 +410,10 @@ impl MetalConnector {
|
||||||
c.change(plane.src_y.id, 0);
|
c.change(plane.src_y.id, 0);
|
||||||
c.change(plane.src_w.id, (*width as u64) << 16);
|
c.change(plane.src_w.id, (*width as u64) << 16);
|
||||||
c.change(plane.src_h.id, (*height as u64) << 16);
|
c.change(plane.src_h.id, (*height as u64) << 16);
|
||||||
if !self.dev.is_nvidia {
|
if !self.dev.is_nvidia
|
||||||
if let Some(sf) = self.backend.signaled_sync_file.get() {
|
&& let Some(sf) = self.backend.signaled_sync_file.get()
|
||||||
c.change(plane.in_fence_fd, sf.0.raw() as u64);
|
{
|
||||||
}
|
c.change(plane.in_fence_fd, sf.0.raw() as u64);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -606,11 +608,11 @@ impl MetalConnector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(clear) = pass.clear {
|
if let Some(clear) = pass.clear
|
||||||
if clear != Color::SOLID_BLACK {
|
&& clear != Color::SOLID_BLACK
|
||||||
// Background could be visible.
|
{
|
||||||
return None;
|
// Background could be visible.
|
||||||
}
|
return None;
|
||||||
}
|
}
|
||||||
ct
|
ct
|
||||||
};
|
};
|
||||||
|
|
@ -683,10 +685,10 @@ impl MetalConnector {
|
||||||
break 'format f;
|
break 'format f;
|
||||||
}
|
}
|
||||||
// Try opaque format if possible.
|
// Try opaque format if possible.
|
||||||
if let Some(opaque) = dmabuf.format.opaque {
|
if let Some(opaque) = dmabuf.format.opaque
|
||||||
if let Some(f) = plane.formats.get(&opaque.drm) {
|
&& let Some(f) = plane.formats.get(&opaque.drm)
|
||||||
break 'format f;
|
{
|
||||||
}
|
break 'format f;
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -759,13 +759,13 @@ impl MetalConnector {
|
||||||
}
|
}
|
||||||
if let Err(e) = self.master.queue_sequence(crtc.id) {
|
if let Err(e) = self.master.queue_sequence(crtc.id) {
|
||||||
log::error!("Could not queue a CRTC sequence: {}", ErrorFmt(&e));
|
log::error!("Could not queue a CRTC sequence: {}", ErrorFmt(&e));
|
||||||
if let DrmError::QueueSequence(OsError(c::EOPNOTSUPP)) = e {
|
if let DrmError::QueueSequence(OsError(c::EOPNOTSUPP)) = e
|
||||||
if let Some(node) = self.state.root.outputs.get(&self.connector_id) {
|
&& let Some(node) = self.state.root.outputs.get(&self.connector_id)
|
||||||
log::warn!("{}: Switching to vblank emulation", self.kernel_id());
|
{
|
||||||
crtc.needs_vblank_emulation.set(true);
|
log::warn!("{}: Switching to vblank emulation", self.kernel_id());
|
||||||
node.global.connector.needs_vblank_emulation.set(true);
|
crtc.needs_vblank_emulation.set(true);
|
||||||
node.vblank();
|
node.global.connector.needs_vblank_emulation.set(true);
|
||||||
}
|
node.vblank();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
crtc.have_queued_sequence.set(true);
|
crtc.have_queued_sequence.set(true);
|
||||||
|
|
@ -856,15 +856,13 @@ impl Connector for MetalConnector {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_enabled(&self, enabled: bool) {
|
fn set_enabled(&self, enabled: bool) {
|
||||||
if self.enabled.replace(enabled) != enabled {
|
if self.enabled.replace(enabled) != enabled
|
||||||
if self.display.borrow_mut().connection == ConnectorStatus::Connected {
|
&& self.display.borrow_mut().connection == ConnectorStatus::Connected
|
||||||
if let Some(dev) = self.backend.device_holder.drm_devices.get(&self.dev.devnum) {
|
&& let Some(dev) = self.backend.device_holder.drm_devices.get(&self.dev.devnum)
|
||||||
if let Err(e) = self.backend.handle_drm_change_(&dev, true) {
|
&& let Err(e) = self.backend.handle_drm_change_(&dev, true)
|
||||||
dev.unprocessed_change.set(true);
|
{
|
||||||
log::error!("Could not dis/enable connector: {}", ErrorFmt(e));
|
dev.unprocessed_change.set(true);
|
||||||
}
|
log::error!("Could not dis/enable connector: {}", ErrorFmt(e));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -930,11 +928,11 @@ impl Connector for MetalConnector {
|
||||||
}
|
}
|
||||||
dd.non_desktop_effective = non_desktop_effective;
|
dd.non_desktop_effective = non_desktop_effective;
|
||||||
drop(dd);
|
drop(dd);
|
||||||
if let Some(dev) = self.backend.device_holder.drm_devices.get(&self.dev.devnum) {
|
if let Some(dev) = self.backend.device_holder.drm_devices.get(&self.dev.devnum)
|
||||||
if let Err(e) = self.backend.handle_drm_change_(&dev, true) {
|
&& let Err(e) = self.backend.handle_drm_change_(&dev, true)
|
||||||
dev.unprocessed_change.set(true);
|
{
|
||||||
log::error!("Could not override non-desktop setting: {}", ErrorFmt(e));
|
dev.unprocessed_change.set(true);
|
||||||
}
|
log::error!("Could not override non-desktop setting: {}", ErrorFmt(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -991,11 +989,11 @@ impl Connector for MetalConnector {
|
||||||
}
|
}
|
||||||
self.try_switch_format.set(true);
|
self.try_switch_format.set(true);
|
||||||
}
|
}
|
||||||
if let Some(dev) = self.backend.device_holder.drm_devices.get(&self.dev.devnum) {
|
if let Some(dev) = self.backend.device_holder.drm_devices.get(&self.dev.devnum)
|
||||||
if let Err(e) = self.backend.handle_drm_change_(&dev, true) {
|
&& let Err(e) = self.backend.handle_drm_change_(&dev, true)
|
||||||
dev.unprocessed_change.set(true);
|
{
|
||||||
log::error!("Could not change format: {}", ErrorFmt(e));
|
dev.unprocessed_change.set(true);
|
||||||
}
|
log::error!("Could not change format: {}", ErrorFmt(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1376,10 +1374,10 @@ fn create_connector_display_data(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for desc in &edid.base_block.descriptors {
|
for desc in &edid.base_block.descriptors {
|
||||||
if let Some(desc) = desc {
|
if let Some(desc) = desc
|
||||||
if let Descriptor::DisplayRangeLimitsAndAdditionalTiming(timings) = desc {
|
&& let Descriptor::DisplayRangeLimitsAndAdditionalTiming(timings) = desc
|
||||||
break 'fetch_min_hz timings.vertical_field_rate_min as u64;
|
{
|
||||||
}
|
break 'fetch_min_hz timings.vertical_field_rate_min as u64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
|
|
@ -1450,11 +1448,11 @@ fn create_connector_display_data(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut mode_opt = desired_state.mode.borrow_mut();
|
let mut mode_opt = desired_state.mode.borrow_mut();
|
||||||
if let Some(mode) = &*mode_opt {
|
if let Some(mode) = &*mode_opt
|
||||||
if !info.modes.contains(mode) {
|
&& !info.modes.contains(mode)
|
||||||
log::warn!("Discarding previously desired mode");
|
{
|
||||||
*mode_opt = None;
|
log::warn!("Discarding previously desired mode");
|
||||||
}
|
*mode_opt = None;
|
||||||
}
|
}
|
||||||
if mode_opt.is_none() {
|
if mode_opt.is_none() {
|
||||||
*mode_opt = info.modes.first().cloned();
|
*mode_opt = info.modes.first().cloned();
|
||||||
|
|
@ -1854,12 +1852,11 @@ impl MetalBackend {
|
||||||
for c in removed_connectors {
|
for c in removed_connectors {
|
||||||
dev.futures.remove(&c);
|
dev.futures.remove(&c);
|
||||||
if let Some(c) = dev.connectors.remove(&c) {
|
if let Some(c) = dev.connectors.remove(&c) {
|
||||||
if let Some(lease_id) = c.lease.get() {
|
if let Some(lease_id) = c.lease.get()
|
||||||
if let Some(lease) = dev.dev.leases.remove(&lease_id) {
|
&& let Some(lease) = dev.dev.leases.remove(&lease_id)
|
||||||
if !lease.try_revoke() {
|
&& !lease.try_revoke()
|
||||||
dev.dev.leases_to_break.set(lease_id, lease);
|
{
|
||||||
}
|
dev.dev.leases_to_break.set(lease_id, lease);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
match c.frontend_state.get() {
|
match c.frontend_state.get() {
|
||||||
FrontState::Removed | FrontState::Disconnected => {}
|
FrontState::Removed | FrontState::Disconnected => {}
|
||||||
|
|
@ -1908,12 +1905,11 @@ impl MetalBackend {
|
||||||
}
|
}
|
||||||
if disconnect {
|
if disconnect {
|
||||||
c.tearing_requested.set(false);
|
c.tearing_requested.set(false);
|
||||||
if let Some(lease_id) = c.lease.get() {
|
if let Some(lease_id) = c.lease.get()
|
||||||
if let Some(lease) = dev.dev.leases.remove(&lease_id) {
|
&& let Some(lease) = dev.dev.leases.remove(&lease_id)
|
||||||
if !lease.try_revoke() {
|
&& !lease.try_revoke()
|
||||||
dev.dev.leases_to_break.set(lease_id, lease);
|
{
|
||||||
}
|
dev.dev.leases_to_break.set(lease_id, lease);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
c.send_event(ConnectorEvent::Disconnected);
|
c.send_event(ConnectorEvent::Disconnected);
|
||||||
} else if preserve_any {
|
} else if preserve_any {
|
||||||
|
|
@ -2493,13 +2489,13 @@ impl MetalBackend {
|
||||||
log::warn!("Cannot preserve connector whose crtc is inactive");
|
log::warn!("Cannot preserve connector whose crtc is inactive");
|
||||||
fail!(c.id);
|
fail!(c.id);
|
||||||
}
|
}
|
||||||
if let Some(plane) = c.primary_plane.get() {
|
if let Some(plane) = c.primary_plane.get()
|
||||||
if plane.crtc_id.value.get() != crtc.id {
|
&& plane.crtc_id.value.get() != crtc.id
|
||||||
log::warn!(
|
{
|
||||||
"Cannot preserve connector whose primary plane is attached to a different crtc"
|
log::warn!(
|
||||||
);
|
"Cannot preserve connector whose primary plane is attached to a different crtc"
|
||||||
fail!(c.id);
|
);
|
||||||
}
|
fail!(c.id);
|
||||||
}
|
}
|
||||||
if let Some(plane) = c.cursor_plane.get() {
|
if let Some(plane) = c.cursor_plane.get() {
|
||||||
let crtc_id = plane.crtc_id.value.get();
|
let crtc_id = plane.crtc_id.value.get();
|
||||||
|
|
@ -2510,11 +2506,11 @@ impl MetalBackend {
|
||||||
fail!(c.id);
|
fail!(c.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(m) = &dd.colorspace {
|
if let Some(m) = &dd.colorspace
|
||||||
if m.value.get() != dd.persistent.color_space.get().to_drm() {
|
&& m.value.get() != dd.persistent.color_space.get().to_drm()
|
||||||
log::debug!("Connector has wrong colorspace");
|
{
|
||||||
fail!(c.id);
|
log::debug!("Connector has wrong colorspace");
|
||||||
}
|
fail!(c.id);
|
||||||
}
|
}
|
||||||
if let Some(diff) = self.compare_hdr_metadata(&dev.dev, &dd) {
|
if let Some(diff) = self.compare_hdr_metadata(&dev.dev, &dd) {
|
||||||
log::debug!("{}", diff);
|
log::debug!("{}", diff);
|
||||||
|
|
@ -2541,23 +2537,22 @@ impl MetalBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_render_device(&self, dev: &MetalDrmDevice, force: bool) {
|
fn make_render_device(&self, dev: &MetalDrmDevice, force: bool) {
|
||||||
if !force {
|
if !force
|
||||||
if let Some(ctx) = self.ctx.get() {
|
&& let Some(ctx) = self.ctx.get()
|
||||||
if ctx.dev_id == dev.id {
|
&& ctx.dev_id == dev.id
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let ctx = dev.ctx.get();
|
let ctx = dev.ctx.get();
|
||||||
if self.signaled_sync_file.is_none() {
|
if self.signaled_sync_file.is_none()
|
||||||
if let Some(sync) = ctx.gfx.sync_obj_ctx() {
|
&& let Some(sync) = ctx.gfx.sync_obj_ctx()
|
||||||
match sync.create_signaled_sync_file() {
|
{
|
||||||
Ok(sf) => {
|
match sync.create_signaled_sync_file() {
|
||||||
self.signaled_sync_file.set(Some(sf));
|
Ok(sf) => {
|
||||||
}
|
self.signaled_sync_file.set(Some(sf));
|
||||||
Err(e) => {
|
}
|
||||||
log::warn!("Could not create signaled sync file: {}", ErrorFmt(e));
|
Err(e) => {
|
||||||
}
|
log::warn!("Could not create signaled sync file: {}", ErrorFmt(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2675,32 +2670,31 @@ impl MetalBackend {
|
||||||
flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
self.reset_connectors_and_crtcs(dev, &mut changes, preserve);
|
self.reset_connectors_and_crtcs(dev, &mut changes, preserve);
|
||||||
for connector in dev.connectors.lock().values() {
|
for connector in dev.connectors.lock().values() {
|
||||||
if !preserve.connectors.contains(&connector.id) {
|
if !preserve.connectors.contains(&connector.id)
|
||||||
if let Err(e) = self.assign_connector_crtc(connector, &mut changes) {
|
&& let Err(e) = self.assign_connector_crtc(connector, &mut changes)
|
||||||
log::error!("Could not assign a crtc: {}", ErrorFmt(e));
|
{
|
||||||
}
|
log::error!("Could not assign a crtc: {}", ErrorFmt(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.reset_planes(dev, &mut changes, preserve);
|
self.reset_planes(dev, &mut changes, preserve);
|
||||||
let mut old_buffers = vec![];
|
let mut old_buffers = vec![];
|
||||||
for connector in dev.connectors.lock().values() {
|
for connector in dev.connectors.lock().values() {
|
||||||
if !preserve.connectors.contains(&connector.id) {
|
if !preserve.connectors.contains(&connector.id)
|
||||||
if let Err(e) =
|
&& let Err(e) =
|
||||||
self.assign_connector_planes(connector, &mut changes, &ctx, &mut old_buffers)
|
self.assign_connector_planes(connector, &mut changes, &ctx, &mut old_buffers)
|
||||||
{
|
{
|
||||||
log::error!("Could not assign a plane: {}", ErrorFmt(e));
|
log::error!("Could not assign a plane: {}", ErrorFmt(e));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let res = loop {
|
let res = loop {
|
||||||
let res = changes.commit(flags, 0);
|
let res = changes.commit(flags, 0);
|
||||||
if let Err(e) = &res {
|
if let Err(e) = &res
|
||||||
if flags.not_contains(DRM_MODE_ATOMIC_ALLOW_MODESET) {
|
&& flags.not_contains(DRM_MODE_ATOMIC_ALLOW_MODESET)
|
||||||
log::warn!("Fast commit failed, retrying with modeset: {}", ErrorFmt(e));
|
{
|
||||||
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
|
log::warn!("Fast commit failed, retrying with modeset: {}", ErrorFmt(e));
|
||||||
continue;
|
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
break res;
|
break res;
|
||||||
};
|
};
|
||||||
|
|
@ -2775,11 +2769,11 @@ impl MetalBackend {
|
||||||
if dd.should_enable_vrr() {
|
if dd.should_enable_vrr() {
|
||||||
vrr_crtcs.insert(crtc_id);
|
vrr_crtcs.insert(crtc_id);
|
||||||
}
|
}
|
||||||
if let Some(m) = &dd.colorspace {
|
if let Some(m) = &dd.colorspace
|
||||||
if m.value.get() != dd.persistent.color_space.get().to_drm() {
|
&& m.value.get() != dd.persistent.color_space.get().to_drm()
|
||||||
log::debug!("Connector has wrong colorspace");
|
{
|
||||||
return false;
|
log::debug!("Connector has wrong colorspace");
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(diff) = self.compare_hdr_metadata(&dev.dev, &dd) {
|
if let Some(diff) = self.compare_hdr_metadata(&dev.dev, &dd) {
|
||||||
log::debug!("{}", diff);
|
log::debug!("{}", diff);
|
||||||
|
|
@ -3139,10 +3133,9 @@ impl MetalBackend {
|
||||||
if plane.ty == PlaneType::Primary
|
if plane.ty == PlaneType::Primary
|
||||||
&& !plane.assigned.get()
|
&& !plane.assigned.get()
|
||||||
&& plane.lease.is_none()
|
&& plane.lease.is_none()
|
||||||
|
&& let Some(format) = plane.formats.get(&format.drm)
|
||||||
{
|
{
|
||||||
if let Some(format) = plane.formats.get(&format.drm) {
|
break 'primary_plane (plane.clone(), &format.modifiers);
|
||||||
break 'primary_plane (plane.clone(), &format.modifiers);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Err(MetalError::NoPrimaryPlaneForConnector);
|
return Err(MetalError::NoPrimaryPlaneForConnector);
|
||||||
|
|
@ -3189,12 +3182,11 @@ impl MetalBackend {
|
||||||
&& !plane.assigned.get()
|
&& !plane.assigned.get()
|
||||||
&& plane.lease.is_none()
|
&& plane.lease.is_none()
|
||||||
&& plane.formats.contains_key(&ARGB8888.drm)
|
&& plane.formats.contains_key(&ARGB8888.drm)
|
||||||
|
&& let Some(format) = plane.formats.get(&ARGB8888.drm)
|
||||||
{
|
{
|
||||||
if let Some(format) = plane.formats.get(&ARGB8888.drm) {
|
cursor_plane = Some(plane.clone());
|
||||||
cursor_plane = Some(plane.clone());
|
cursor_modifiers = &format.modifiers;
|
||||||
cursor_modifiers = &format.modifiers;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut cursor_buffers = None;
|
let mut cursor_buffers = None;
|
||||||
|
|
|
||||||
|
|
@ -265,12 +265,11 @@ impl Drop for ClientHolder {
|
||||||
self.data.remove_activation_tokens();
|
self.data.remove_activation_tokens();
|
||||||
self.data.commit_timelines.clear();
|
self.data.commit_timelines.clear();
|
||||||
self.data.property_changed(CL_CHANGED_DESTROYED);
|
self.data.property_changed(CL_CHANGED_DESTROYED);
|
||||||
if self.data.is_xwayland {
|
if self.data.is_xwayland
|
||||||
if let Some(pidfd) = self.data.state.xwayland.pidfd.get() {
|
&& let Some(pidfd) = self.data.state.xwayland.pidfd.get()
|
||||||
if let Err(e) = pidfd_send_signal(&pidfd, c::SIGKILL) {
|
&& let Err(e) = pidfd_send_signal(&pidfd, c::SIGKILL)
|
||||||
log::error!("Could not kill Xwayland: {}", ErrorFmt(e));
|
{
|
||||||
}
|
log::error!("Could not kill Xwayland: {}", ErrorFmt(e));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,11 @@ async fn receive(data: Rc<Client>) {
|
||||||
// log::trace!("{:x?}", data_buf);
|
// log::trace!("{:x?}", data_buf);
|
||||||
let parser = MsgParser::new(&mut buf, &data_buf[..]);
|
let parser = MsgParser::new(&mut buf, &data_buf[..]);
|
||||||
if let Err(e) = obj.handle_request(&data, request, parser) {
|
if let Err(e) = obj.handle_request(&data, request, parser) {
|
||||||
if let ClientError::InvalidMethod = e {
|
if let ClientError::InvalidMethod = e
|
||||||
if let Ok(obj) = data.objects.get_obj(obj_id) {
|
&& let Ok(obj) = data.objects.get_obj(obj_id)
|
||||||
data.invalid_request(&*obj, request);
|
{
|
||||||
return Err(e);
|
data.invalid_request(&*obj, request);
|
||||||
}
|
return Err(e);
|
||||||
}
|
}
|
||||||
return Err(ClientError::RequestError(Box::new(e)));
|
return Err(ClientError::RequestError(Box::new(e)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,21 +76,18 @@ impl ClientMem {
|
||||||
flags: c::c_int,
|
flags: c::c_int,
|
||||||
) -> Result<Self, ClientMemError> {
|
) -> Result<Self, ClientMemError> {
|
||||||
let mut sigbus_impossible = false;
|
let mut sigbus_impossible = false;
|
||||||
if let Ok(seals) = uapi::fcntl_get_seals(fd.raw()) {
|
if let Ok(seals) = uapi::fcntl_get_seals(fd.raw())
|
||||||
if seals & c::F_SEAL_SHRINK != 0 {
|
&& seals & c::F_SEAL_SHRINK != 0
|
||||||
if let Ok(stat) = uapi::fstat(fd.raw()) {
|
&& let Ok(stat) = uapi::fstat(fd.raw())
|
||||||
sigbus_impossible = stat.st_size as u64 >= len as u64;
|
{
|
||||||
}
|
sigbus_impossible = stat.st_size as u64 >= len as u64;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !sigbus_impossible {
|
if !sigbus_impossible && let Some(client) = client {
|
||||||
if let Some(client) = client {
|
log::debug!(
|
||||||
log::debug!(
|
"Client {} ({}) has created a shm buffer that might cause SIGBUS",
|
||||||
"Client {} ({}) has created a shm buffer that might cause SIGBUS",
|
client.pid_info.comm,
|
||||||
client.pid_info.comm,
|
client.id,
|
||||||
client.id,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let data = if len == 0 {
|
let data = if len == 0 {
|
||||||
&mut [][..]
|
&mut [][..]
|
||||||
|
|
|
||||||
|
|
@ -200,10 +200,10 @@ impl ConfigProxyHandler {
|
||||||
self.window_matcher_leafs.clear();
|
self.window_matcher_leafs.clear();
|
||||||
self.window_matchers.clear();
|
self.window_matchers.clear();
|
||||||
|
|
||||||
if let Some(path) = &self.path {
|
if let Some(path) = &self.path
|
||||||
if let Err(e) = uapi::unlink(path.as_str()) {
|
&& let Err(e) = uapi::unlink(path.as_str())
|
||||||
log::error!("Could not unlink {}: {}", path, ErrorFmt(OsError(e.0)));
|
{
|
||||||
}
|
log::error!("Could not unlink {}: {}", path, ErrorFmt(OsError(e.0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -963,10 +963,10 @@ impl ConfigProxyHandler {
|
||||||
let seat = self.get_seat(seat)?;
|
let seat = self.get_seat(seat)?;
|
||||||
let output = seat.get_output();
|
let output = seat.get_output();
|
||||||
let mut workspace = Workspace(0);
|
let mut workspace = Workspace(0);
|
||||||
if !output.is_dummy {
|
if !output.is_dummy
|
||||||
if let Some(ws) = output.workspace.get() {
|
&& let Some(ws) = output.workspace.get()
|
||||||
workspace = self.get_workspace_by_name(&ws.name);
|
{
|
||||||
}
|
workspace = self.get_workspace_by_name(&ws.name);
|
||||||
}
|
}
|
||||||
self.respond(Response::GetSeatWorkspace { workspace });
|
self.respond(Response::GetSeatWorkspace { workspace });
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -975,12 +975,11 @@ impl ConfigProxyHandler {
|
||||||
fn handle_get_seat_keyboard_workspace(&self, seat: Seat) -> Result<(), CphError> {
|
fn handle_get_seat_keyboard_workspace(&self, seat: Seat) -> Result<(), CphError> {
|
||||||
let seat = self.get_seat(seat)?;
|
let seat = self.get_seat(seat)?;
|
||||||
let mut workspace = Workspace(0);
|
let mut workspace = Workspace(0);
|
||||||
if let Some(output) = seat.get_keyboard_output() {
|
if let Some(output) = seat.get_keyboard_output()
|
||||||
if !output.is_dummy {
|
&& !output.is_dummy
|
||||||
if let Some(ws) = output.workspace.get() {
|
&& let Some(ws) = output.workspace.get()
|
||||||
workspace = self.get_workspace_by_name(&ws.name);
|
{
|
||||||
}
|
workspace = self.get_workspace_by_name(&ws.name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.respond(Response::GetSeatKeyboardWorkspace { workspace });
|
self.respond(Response::GetSeatKeyboardWorkspace { workspace });
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -1900,12 +1899,12 @@ impl ConfigProxyHandler {
|
||||||
}
|
}
|
||||||
let id = ClientMatcher(self.client_matcher_ids.fetch_add(1));
|
let id = ClientMatcher(self.client_matcher_ids.fetch_add(1));
|
||||||
let cache = &self.client_matcher_cache;
|
let cache = &self.client_matcher_cache;
|
||||||
if let Some(matcher) = cache.get(&criterion) {
|
if let Some(matcher) = cache.get(&criterion)
|
||||||
if let Some(matcher) = matcher.upgrade() {
|
&& let Some(matcher) = matcher.upgrade()
|
||||||
self.client_matchers.set(id, matcher);
|
{
|
||||||
self.respond(Response::CreateClientMatcher { matcher: id });
|
self.client_matchers.set(id, matcher);
|
||||||
return Ok(());
|
self.respond(Response::CreateClientMatcher { matcher: id });
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
let mgr = &self.state.cl_matcher_manager;
|
let mgr = &self.state.cl_matcher_manager;
|
||||||
let mut upstream = vec![];
|
let mut upstream = vec![];
|
||||||
|
|
@ -2000,12 +1999,12 @@ impl ConfigProxyHandler {
|
||||||
}
|
}
|
||||||
let id = WindowMatcher(self.window_matcher_ids.fetch_add(1));
|
let id = WindowMatcher(self.window_matcher_ids.fetch_add(1));
|
||||||
let cache = &self.window_matcher_cache;
|
let cache = &self.window_matcher_cache;
|
||||||
if let Some(matcher) = cache.get(&criterion) {
|
if let Some(matcher) = cache.get(&criterion)
|
||||||
if let Some(matcher) = matcher.upgrade() {
|
&& let Some(matcher) = matcher.upgrade()
|
||||||
self.window_matchers.set(id, matcher);
|
{
|
||||||
self.respond(Response::CreateWindowMatcher { matcher: id });
|
self.window_matchers.set(id, matcher);
|
||||||
return Ok(());
|
self.respond(Response::CreateWindowMatcher { matcher: id });
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
let mgr = &self.state.tl_matcher_manager;
|
let mgr = &self.state.tl_matcher_manager;
|
||||||
let mut upstream = vec![];
|
let mut upstream = vec![];
|
||||||
|
|
|
||||||
|
|
@ -107,13 +107,13 @@ where
|
||||||
pub fn run(self) {
|
pub fn run(self) {
|
||||||
let n = self.node;
|
let n = self.node;
|
||||||
n.needs_event.set(true);
|
n.needs_event.set(true);
|
||||||
if n.new_data != n.data {
|
if n.new_data != n.data
|
||||||
if let Some(on_unmatch) = n.on_unmatch.take() {
|
&& let Some(on_unmatch) = n.on_unmatch.take()
|
||||||
if n.leaf.strong_count() == 0 {
|
{
|
||||||
return;
|
if n.leaf.strong_count() == 0 {
|
||||||
}
|
return;
|
||||||
on_unmatch();
|
|
||||||
}
|
}
|
||||||
|
on_unmatch();
|
||||||
}
|
}
|
||||||
n.data.set(n.new_data.get());
|
n.data.set(n.new_data.get());
|
||||||
if n.data.is_some() != n.on_unmatch.is_some() {
|
if n.data.is_some() != n.on_unmatch.is_some() {
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove(&self, target_id: Target::Id) {
|
pub fn remove(&self, target_id: Target::Id) {
|
||||||
if let Some(node) = self.data.borrow_mut().remove(&target_id) {
|
if let Some(node) = self.data.borrow_mut().remove(&target_id)
|
||||||
if let Some(node) = node.node.upgrade() {
|
&& let Some(node) = node.node.upgrade()
|
||||||
node.data().destroyed().remove(&self.id);
|
{
|
||||||
}
|
node.data().destroyed().remove(&self.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,11 @@ impl TlmMatchClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle(&self, node: &ToplevelData) {
|
pub fn handle(&self, node: &ToplevelData) {
|
||||||
if let Some(client) = &node.client {
|
if let Some(client) = &node.client
|
||||||
if self.node.get(client) {
|
&& self.node.get(client)
|
||||||
let data = self.downstream.get_or_create(node);
|
{
|
||||||
self.downstream.update_matched(node, data, true, false);
|
let data = self.downstream.get_or_create(node);
|
||||||
}
|
self.downstream.update_matched(node, data, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,10 @@ const HOME: &str = "HOME";
|
||||||
const HEADER_SIZE: u32 = 16;
|
const HEADER_SIZE: u32 = 16;
|
||||||
|
|
||||||
pub static DEFAULT_CURSOR_SIZE: Lazy<u32> = Lazy::new(|| {
|
pub static DEFAULT_CURSOR_SIZE: Lazy<u32> = Lazy::new(|| {
|
||||||
if let Ok(size) = env::var(XCURSOR_SIZE) {
|
if let Ok(size) = env::var(XCURSOR_SIZE)
|
||||||
if let Ok(val) = size.parse() {
|
&& let Ok(val) = size.parse()
|
||||||
return val;
|
{
|
||||||
}
|
return val;
|
||||||
}
|
}
|
||||||
24
|
24
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -78,14 +78,14 @@ impl CursorUserGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn damage_active(&self) {
|
fn damage_active(&self) {
|
||||||
if let Some(active) = self.active.get() {
|
if let Some(active) = self.active.get()
|
||||||
if let Some(cursor) = active.cursor.get() {
|
&& let Some(cursor) = active.cursor.get()
|
||||||
let (x, y) = active.pos.get();
|
{
|
||||||
let x_int = x.round_down();
|
let (x, y) = active.pos.get();
|
||||||
let y_int = y.round_down();
|
let x_int = x.round_down();
|
||||||
let extents = cursor.extents_at_scale(Scale::default());
|
let y_int = y.round_down();
|
||||||
self.state.damage2(true, extents.move_(x_int, y_int));
|
let extents = cursor.extents_at_scale(Scale::default());
|
||||||
}
|
self.state.damage2(true, extents.move_(x_int, y_int));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,10 +136,10 @@ impl CursorUserGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_visible(&self, visible: bool) {
|
pub fn set_visible(&self, visible: bool) {
|
||||||
if let Some(user) = self.active.get() {
|
if let Some(user) = self.active.get()
|
||||||
if let Some(cursor) = user.cursor.get() {
|
&& let Some(cursor) = user.cursor.get()
|
||||||
cursor.set_visible(visible);
|
{
|
||||||
}
|
cursor.set_visible(visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,11 +369,11 @@ impl CursorUser {
|
||||||
|
|
||||||
fn set_cursor2(&self, cursor: Option<Rc<dyn Cursor>>) {
|
fn set_cursor2(&self, cursor: Option<Rc<dyn Cursor>>) {
|
||||||
if let Some(old) = self.cursor.get() {
|
if let Some(old) = self.cursor.get() {
|
||||||
if let Some(new) = cursor.as_ref() {
|
if let Some(new) = cursor.as_ref()
|
||||||
if rc_eq(&old, new) {
|
&& rc_eq(&old, new)
|
||||||
self.update_hardware_cursor();
|
{
|
||||||
return;
|
self.update_hardware_cursor();
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
old.handle_unset();
|
old.handle_unset();
|
||||||
if self.software_cursor() {
|
if self.software_cursor() {
|
||||||
|
|
@ -409,17 +409,17 @@ impl CursorUser {
|
||||||
x = x.apply_fract(x_tmp);
|
x = x.apply_fract(x_tmp);
|
||||||
y = y.apply_fract(y_tmp);
|
y = y.apply_fract(y_tmp);
|
||||||
}
|
}
|
||||||
if self.software_cursor() {
|
if self.software_cursor()
|
||||||
if let Some(cursor) = self.cursor.get() {
|
&& let Some(cursor) = self.cursor.get()
|
||||||
let (old_x, old_y) = self.pos.get();
|
{
|
||||||
let old_x_int = old_x.round_down();
|
let (old_x, old_y) = self.pos.get();
|
||||||
let old_y_int = old_y.round_down();
|
let old_x_int = old_x.round_down();
|
||||||
let extents = cursor.extents_at_scale(Scale::default());
|
let old_y_int = old_y.round_down();
|
||||||
self.group
|
let extents = cursor.extents_at_scale(Scale::default());
|
||||||
.state
|
self.group
|
||||||
.damage2(true, extents.move_(old_x_int, old_y_int));
|
.state
|
||||||
self.group.state.damage2(true, extents.move_(x_int, y_int));
|
.damage2(true, extents.move_(old_x_int, old_y_int));
|
||||||
}
|
self.group.state.damage2(true, extents.move_(x_int, y_int));
|
||||||
}
|
}
|
||||||
self.pos.set((x, y));
|
self.pos.set((x, y));
|
||||||
self.update_hardware_cursor_(false);
|
self.update_hardware_cursor_(false);
|
||||||
|
|
|
||||||
|
|
@ -243,12 +243,12 @@ impl ForkerProxy {
|
||||||
true => Ok((io.pop_fd().unwrap(), pid)),
|
true => Ok((io.pop_fd().unwrap(), pid)),
|
||||||
_ => Err(ForkerError::PidfdForkFailed),
|
_ => Err(ForkerError::PidfdForkFailed),
|
||||||
};
|
};
|
||||||
if let Some(handoff) = self.pending_pidfds.remove(&id) {
|
if let Some(handoff) = self.pending_pidfds.remove(&id)
|
||||||
if let Some(handoff) = handoff.upgrade() {
|
&& let Some(handoff) = handoff.upgrade()
|
||||||
handoff.pidfd.set(Some(res));
|
{
|
||||||
if let Some(w) = handoff.waiter.take() {
|
handoff.pidfd.set(Some(res));
|
||||||
w.wake();
|
if let Some(w) = handoff.waiter.take() {
|
||||||
}
|
w.wake();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -937,24 +937,23 @@ pub fn create_render_pass(
|
||||||
}
|
}
|
||||||
if render_cursor {
|
if render_cursor {
|
||||||
let cursor_user_group = seat.cursor_group();
|
let cursor_user_group = seat.cursor_group();
|
||||||
if render_hardware_cursor || !cursor_user_group.hardware_cursor() {
|
if (render_hardware_cursor || !cursor_user_group.hardware_cursor())
|
||||||
if let Some(cursor_user) = cursor_user_group.active() {
|
&& let Some(cursor_user) = cursor_user_group.active()
|
||||||
if let Some(cursor) = cursor_user.get() {
|
&& let Some(cursor) = cursor_user.get()
|
||||||
cursor.tick();
|
{
|
||||||
let (mut x, mut y) = cursor_user.position();
|
cursor.tick();
|
||||||
x -= Fixed::from_int(rect.x1());
|
let (mut x, mut y) = cursor_user.position();
|
||||||
y -= Fixed::from_int(rect.y1());
|
x -= Fixed::from_int(rect.x1());
|
||||||
cursor.render(&mut renderer, x, y);
|
y -= Fixed::from_int(rect.y1());
|
||||||
}
|
cursor.render(&mut renderer, x, y);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(visualizer) = visualizer {
|
if let Some(visualizer) = visualizer
|
||||||
if let Some(cursor_rect) = cursor_rect {
|
&& let Some(cursor_rect) = cursor_rect
|
||||||
visualizer.render(&cursor_rect, &mut renderer.base);
|
{
|
||||||
}
|
visualizer.render(&cursor_rect, &mut renderer.base);
|
||||||
}
|
}
|
||||||
let c = match black_background {
|
let c = match black_background {
|
||||||
true => Color::SOLID_BLACK,
|
true => Color::SOLID_BLACK,
|
||||||
|
|
|
||||||
|
|
@ -296,12 +296,11 @@ fn run_ops(fb: &Framebuffer, ops: &[GfxApiOpt]) -> Option<SyncFile> {
|
||||||
};
|
};
|
||||||
let user = fb.ctx.buffer_resv_user;
|
let user = fb.ctx.buffer_resv_user;
|
||||||
for op in ops {
|
for op in ops {
|
||||||
if let GfxApiOpt::CopyTexture(ct) = op {
|
if let GfxApiOpt::CopyTexture(ct) = op
|
||||||
if ct.release_sync == ReleaseSync::Explicit {
|
&& ct.release_sync == ReleaseSync::Explicit
|
||||||
if let Some(resv) = &ct.buffer_resv {
|
&& let Some(resv) = &ct.buffer_resv
|
||||||
resv.set_sync_file(user, &file);
|
{
|
||||||
}
|
resv.set_sync_file(user, &file);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Some(file);
|
return Some(file);
|
||||||
|
|
@ -429,10 +428,10 @@ fn handle_explicit_sync(ctx: &GlRenderContext, img: Option<&Rc<EglImage>>, sync:
|
||||||
};
|
};
|
||||||
sync.wait();
|
sync.wait();
|
||||||
} else {
|
} else {
|
||||||
if let Some(img) = img {
|
if let Some(img) = img
|
||||||
if let Err(e) = img.dmabuf.import_sync_file(DMA_BUF_SYNC_READ, &sync_file) {
|
&& let Err(e) = img.dmabuf.import_sync_file(DMA_BUF_SYNC_READ, &sync_file)
|
||||||
log::error!("Could not import sync file into dmabuf: {}", ErrorFmt(e));
|
{
|
||||||
}
|
log::error!("Could not import sync file into dmabuf: {}", ErrorFmt(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ unsafe fn get_extensions(ext: *const c::c_char) -> Option<AHashSet<String>> {
|
||||||
let ext = unsafe { CStr::from_ptr(ext).to_bytes() };
|
let ext = unsafe { CStr::from_ptr(ext).to_bytes() };
|
||||||
for part in ext.split_str(" ") {
|
for part in ext.split_str(" ") {
|
||||||
let name = part.trim_ascii();
|
let name = part.trim_ascii();
|
||||||
if name.len() > 0 {
|
if name.len() > 0
|
||||||
if let Ok(s) = str::from_utf8(name) {
|
&& let Ok(s) = str::from_utf8(name)
|
||||||
res.insert(s.to_string());
|
{
|
||||||
}
|
res.insert(s.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(res)
|
Some(res)
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ impl VulkanRenderer {
|
||||||
let height = height as u32;
|
let height = height as u32;
|
||||||
let cached = &mut *self.blend_buffers.borrow_mut();
|
let cached = &mut *self.blend_buffers.borrow_mut();
|
||||||
let cached = cached.entry((width, height));
|
let cached = cached.entry((width, height));
|
||||||
if let Entry::Occupied(entry) = &cached {
|
if let Entry::Occupied(entry) = &cached
|
||||||
if let Some(buffer) = entry.get().upgrade() {
|
&& let Some(buffer) = entry.get().upgrade()
|
||||||
return Ok(buffer);
|
{
|
||||||
}
|
return Ok(buffer);
|
||||||
}
|
}
|
||||||
let limits = self.device.blend_limits;
|
let limits = self.device.blend_limits;
|
||||||
if width > limits.max_width || height > limits.max_height {
|
if width > limits.max_width || height > limits.max_height {
|
||||||
|
|
|
||||||
|
|
@ -669,10 +669,10 @@ impl VulkanBoMapping {
|
||||||
|
|
||||||
impl Drop for VulkanBoMapping {
|
impl Drop for VulkanBoMapping {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self.upload {
|
if self.upload
|
||||||
if let Err(e) = self.upload() {
|
&& let Err(e) = self.upload()
|
||||||
log::error!("Could not upload to image: {}", ErrorFmt(e));
|
{
|
||||||
}
|
log::error!("Could not upload to image: {}", ErrorFmt(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -721,10 +721,10 @@ fn validate_modifier(
|
||||||
if disjoint && !modifier.features.contains(FormatFeatureFlags::DISJOINT) {
|
if disjoint && !modifier.features.contains(FormatFeatureFlags::DISJOINT) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(plane_count) = plane_count {
|
if let Some(plane_count) = plane_count
|
||||||
if plane_count != modifier.planes {
|
&& plane_count != modifier.planes
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
let Some(limits) = modifier.transfer_limits else {
|
let Some(limits) = modifier.transfer_limits else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -558,15 +558,15 @@ impl GfxFramebuffer for VulkanImage {
|
||||||
) -> Result<Option<SyncFile>, GfxError> {
|
) -> Result<Option<SyncFile>, GfxError> {
|
||||||
let mut blend_buffer =
|
let mut blend_buffer =
|
||||||
blend_buffer.map(|b| b.clone().into_vk(&self.renderer.device.device));
|
blend_buffer.map(|b| b.clone().into_vk(&self.renderer.device.device));
|
||||||
if let Some(bb) = &blend_buffer {
|
if let Some(bb) = &blend_buffer
|
||||||
if bb.size() != self.size() {
|
&& bb.size() != self.size()
|
||||||
log::error!(
|
{
|
||||||
"Blend buffer has invalid size: {:?} != {:?}",
|
log::error!(
|
||||||
bb.size(),
|
"Blend buffer has invalid size: {:?} != {:?}",
|
||||||
self.size()
|
bb.size(),
|
||||||
);
|
self.size()
|
||||||
blend_buffer = None;
|
);
|
||||||
}
|
blend_buffer = None;
|
||||||
}
|
}
|
||||||
self.renderer
|
self.renderer
|
||||||
.execute(
|
.execute(
|
||||||
|
|
|
||||||
|
|
@ -670,11 +670,12 @@ impl VulkanRenderer {
|
||||||
for pos in &memory.fill_targets[f.range.clone()] {
|
for pos in &memory.fill_targets[f.range.clone()] {
|
||||||
memory.data_buffer.extend_from_slice(uapi::as_bytes(pos));
|
memory.data_buffer.extend_from_slice(uapi::as_bytes(pos));
|
||||||
}
|
}
|
||||||
if let Some(VulkanOp::Fill(p)) = mops.last_mut() {
|
if let Some(VulkanOp::Fill(p)) = mops.last_mut()
|
||||||
if p.color == f.color && idx > 0 {
|
&& p.color == f.color
|
||||||
p.instances += f.instances;
|
&& idx > 0
|
||||||
continue;
|
{
|
||||||
}
|
p.instances += f.instances;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
mops.push(VulkanOp::Fill(f));
|
mops.push(VulkanOp::Fill(f));
|
||||||
}
|
}
|
||||||
|
|
@ -874,10 +875,10 @@ impl VulkanRenderer {
|
||||||
})?;
|
})?;
|
||||||
for ops in memory.ops.values_mut() {
|
for ops in memory.ops.values_mut() {
|
||||||
for op in ops {
|
for op in ops {
|
||||||
if let VulkanOp::Tex(c) = op {
|
if let VulkanOp::Tex(c) = op
|
||||||
if let Some(addr) = &mut c.color_management_data_address {
|
&& let Some(addr) = &mut c.color_management_data_address
|
||||||
*addr += buffer.buffer.address;
|
{
|
||||||
}
|
*addr += buffer.buffer.address;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1037,28 +1038,28 @@ impl VulkanRenderer {
|
||||||
let mut load_clear = None;
|
let mut load_clear = None;
|
||||||
let mut manual_clear = None;
|
let mut manual_clear = None;
|
||||||
let clear_rects = &memory.clear_rects[pass];
|
let clear_rects = &memory.clear_rects[pass];
|
||||||
if let Some(clear) = clear {
|
if let Some(clear) = clear
|
||||||
if clear_rects.is_not_empty() {
|
&& clear_rects.is_not_empty()
|
||||||
let color = memory
|
{
|
||||||
.color_transforms
|
let color = memory
|
||||||
.apply_to_color(clear_cd, target_cd, *clear);
|
.color_transforms
|
||||||
let clear_value = ClearValue {
|
.apply_to_color(clear_cd, target_cd, *clear);
|
||||||
color: ClearColorValue {
|
let clear_value = ClearValue {
|
||||||
float32: color.to_array(target_cd.transfer_function),
|
color: ClearColorValue {
|
||||||
},
|
float32: color.to_array(target_cd.transfer_function),
|
||||||
};
|
},
|
||||||
let use_load_clear = clear_rects.len() == 1 && {
|
};
|
||||||
let rect = &clear_rects[0].rect;
|
let use_load_clear = clear_rects.len() == 1 && {
|
||||||
rect.offset.x == 0
|
let rect = &clear_rects[0].rect;
|
||||||
&& rect.offset.y == 0
|
rect.offset.x == 0
|
||||||
&& rect.extent.width == target.width
|
&& rect.offset.y == 0
|
||||||
&& rect.extent.height == target.height
|
&& rect.extent.width == target.width
|
||||||
};
|
&& rect.extent.height == target.height
|
||||||
if use_load_clear {
|
};
|
||||||
load_clear = Some(clear_value);
|
if use_load_clear {
|
||||||
} else {
|
load_clear = Some(clear_value);
|
||||||
manual_clear = Some(clear_value);
|
} else {
|
||||||
}
|
manual_clear = Some(clear_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut rendering_attachment_info = RenderingAttachmentInfo::default()
|
let mut rendering_attachment_info = RenderingAttachmentInfo::default()
|
||||||
|
|
@ -1560,11 +1561,11 @@ impl VulkanRenderer {
|
||||||
if let Some(resv) = resv {
|
if let Some(resv) = resv {
|
||||||
resv.set_sync_file(self.buffer_resv_user, sync_file);
|
resv.set_sync_file(self.buffer_resv_user, sync_file);
|
||||||
} else if sync == ReleaseSync::Implicit {
|
} else if sync == ReleaseSync::Implicit {
|
||||||
if let VulkanImageMemory::DmaBuf(buf) = &img.ty {
|
if let VulkanImageMemory::DmaBuf(buf) = &img.ty
|
||||||
if let Err(e) = buf.template.dmabuf.import_sync_file(flag, sync_file) {
|
&& let Err(e) = buf.template.dmabuf.import_sync_file(flag, sync_file)
|
||||||
log::error!("Could not import sync file into dmabuf: {}", ErrorFmt(e));
|
{
|
||||||
log::warn!("Relying on implicit sync");
|
log::error!("Could not import sync file into dmabuf: {}", ErrorFmt(e));
|
||||||
}
|
log::warn!("Relying on implicit sync");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1577,20 +1578,18 @@ impl VulkanRenderer {
|
||||||
texture.resv.take(),
|
texture.resv.take(),
|
||||||
DMA_BUF_SYNC_READ,
|
DMA_BUF_SYNC_READ,
|
||||||
);
|
);
|
||||||
if attach_async_shm_sync_file {
|
if attach_async_shm_sync_file
|
||||||
if let VulkanImageMemory::Internal(shm) = &texture.tex.ty {
|
&& let VulkanImageMemory::Internal(shm) = &texture.tex.ty
|
||||||
if let Some(data) = &shm.async_data {
|
&& let Some(data) = &shm.async_data
|
||||||
data.last_gfx_use.set(Some(sync_file.clone()));
|
{
|
||||||
}
|
data.last_gfx_use.set(Some(sync_file.clone()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if attach_async_shm_sync_file {
|
if attach_async_shm_sync_file
|
||||||
if let VulkanImageMemory::Internal(shm) = &fb.ty {
|
&& let VulkanImageMemory::Internal(shm) = &fb.ty
|
||||||
if let Some(data) = &shm.async_data {
|
&& let Some(data) = &shm.async_data
|
||||||
data.last_gfx_use.set(Some(sync_file.clone()));
|
{
|
||||||
}
|
data.last_gfx_use.set(Some(sync_file.clone()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
import(fb, fb_release_sync, None, DMA_BUF_SYNC_WRITE);
|
import(fb, fb_release_sync, None, DMA_BUF_SYNC_WRITE);
|
||||||
}
|
}
|
||||||
|
|
@ -1750,10 +1749,10 @@ impl VulkanRenderer {
|
||||||
GfxApiOpt::FillRect(f) => (f.effective_color().is_opaque(), f.rect),
|
GfxApiOpt::FillRect(f) => (f.effective_color().is_opaque(), f.rect),
|
||||||
GfxApiOpt::CopyTexture(c) => {
|
GfxApiOpt::CopyTexture(c) => {
|
||||||
let opaque = 'opaque: {
|
let opaque = 'opaque: {
|
||||||
if let Some(a) = c.alpha {
|
if let Some(a) = c.alpha
|
||||||
if a < 1.0 {
|
&& a < 1.0
|
||||||
break 'opaque false;
|
{
|
||||||
}
|
break 'opaque false;
|
||||||
}
|
}
|
||||||
if !c.opaque {
|
if !c.opaque {
|
||||||
let tex = c.tex.as_vk(&self.device.device);
|
let tex = c.tex.as_vk(&self.device.device);
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@ impl VulkanShmImage {
|
||||||
damage: Option<&[Rect]>,
|
damage: Option<&[Rect]>,
|
||||||
) -> Result<(), VulkanError> {
|
) -> Result<(), VulkanError> {
|
||||||
img.renderer.check_defunct()?;
|
img.renderer.check_defunct()?;
|
||||||
if let Some(damage) = damage {
|
if let Some(damage) = damage
|
||||||
if damage.is_empty() {
|
&& damage.is_empty()
|
||||||
return Ok(());
|
{
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
let copy = |full: bool, off, x, y, width, height| {
|
let copy = |full: bool, off, x, y, width, height| {
|
||||||
let mut builder = BufferImageCopy2::default()
|
let mut builder = BufferImageCopy2::default()
|
||||||
|
|
@ -169,10 +169,10 @@ impl VulkanShmImage {
|
||||||
.dst_stage_mask(dsm)
|
.dst_stage_mask(dsm)
|
||||||
};
|
};
|
||||||
let mut transfer_queue_family_idx = img.renderer.device.graphics_queue_idx;
|
let mut transfer_queue_family_idx = img.renderer.device.graphics_queue_idx;
|
||||||
if use_transfer_queue {
|
if use_transfer_queue
|
||||||
if let Some(idx) = img.renderer.device.distinct_transfer_queue_family_idx {
|
&& let Some(idx) = img.renderer.device.distinct_transfer_queue_family_idx
|
||||||
transfer_queue_family_idx = idx;
|
{
|
||||||
}
|
transfer_queue_family_idx = idx;
|
||||||
}
|
}
|
||||||
let mut initial_image_barrier = image_barrier()
|
let mut initial_image_barrier = image_barrier()
|
||||||
.image(img.image)
|
.image(img.image)
|
||||||
|
|
|
||||||
|
|
@ -102,13 +102,12 @@ impl ExtImageCopyCaptureFrameV1 {
|
||||||
let mut shm_staging = self.session.shm_staging.take();
|
let mut shm_staging = self.session.shm_staging.take();
|
||||||
match storage {
|
match storage {
|
||||||
WlBufferStorage::Shm { mem, stride } => {
|
WlBufferStorage::Shm { mem, stride } => {
|
||||||
if let Some(b) = &shm_bridge {
|
if let Some(b) = &shm_bridge
|
||||||
if b.physical_size() != buffer.rect.size()
|
&& (b.physical_size() != buffer.rect.size()
|
||||||
|| b.format() != buffer.format
|
|| b.format() != buffer.format
|
||||||
|| b.stride() != *stride
|
|| b.stride() != *stride)
|
||||||
{
|
{
|
||||||
shm_bridge = None;
|
shm_bridge = None;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let bridge = match shm_bridge {
|
let bridge = match shm_bridge {
|
||||||
Some(b) => b,
|
Some(b) => b,
|
||||||
|
|
@ -129,10 +128,10 @@ impl ExtImageCopyCaptureFrameV1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if let Some(s) = &shm_staging {
|
if let Some(s) = &shm_staging
|
||||||
if s.size() != bridge.staging_size() {
|
&& s.size() != bridge.staging_size()
|
||||||
shm_staging = None;
|
{
|
||||||
}
|
shm_staging = None;
|
||||||
}
|
}
|
||||||
let staging = match shm_staging {
|
let staging = match shm_staging {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
|
|
|
||||||
|
|
@ -125,10 +125,10 @@ impl ExtImageCopyCaptureSessionV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop_pending_frame(&self) {
|
fn stop_pending_frame(&self) {
|
||||||
if let Some(frame) = self.frame.get() {
|
if let Some(frame) = self.frame.get()
|
||||||
if let FrameStatus::Capturing | FrameStatus::Captured = self.status.get() {
|
&& let FrameStatus::Capturing | FrameStatus::Captured = self.status.get()
|
||||||
frame.fail(FrameFailureReason::Stopped);
|
{
|
||||||
}
|
frame.fail(FrameFailureReason::Stopped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,22 +223,22 @@ impl ExtImageCopyCaptureSessionV1 {
|
||||||
y_off: i32,
|
y_off: i32,
|
||||||
size: Option<(i32, i32)>,
|
size: Option<(i32, i32)>,
|
||||||
) {
|
) {
|
||||||
if self.status.get() == FrameStatus::Capturing {
|
if self.status.get() == FrameStatus::Capturing
|
||||||
if let Some(frame) = self.frame.get() {
|
&& let Some(frame) = self.frame.get()
|
||||||
frame.copy_texture(
|
{
|
||||||
on,
|
frame.copy_texture(
|
||||||
texture,
|
on,
|
||||||
cd,
|
texture,
|
||||||
resv,
|
cd,
|
||||||
acquire_sync,
|
resv,
|
||||||
release_sync,
|
acquire_sync,
|
||||||
render_hardware_cursors,
|
release_sync,
|
||||||
x_off,
|
render_hardware_cursors,
|
||||||
y_off,
|
x_off,
|
||||||
size,
|
y_off,
|
||||||
);
|
size,
|
||||||
return;
|
);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
self.force_capture.set(true);
|
self.force_capture.set(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,17 +64,17 @@ impl ExtSessionLockV1RequestHandler for ExtSessionLockV1 {
|
||||||
track!(new.client, new);
|
track!(new.client, new);
|
||||||
new.install()?;
|
new.install()?;
|
||||||
self.client.add_client_obj(&new)?;
|
self.client.add_client_obj(&new)?;
|
||||||
if !self.finished.get() {
|
if !self.finished.get()
|
||||||
if let Some(node) = output.global.node() {
|
&& let Some(node) = output.global.node()
|
||||||
if node.lock_surface.is_some() {
|
{
|
||||||
return Err(ExtSessionLockV1Error::OutputAlreadyLocked);
|
if node.lock_surface.is_some() {
|
||||||
}
|
return Err(ExtSessionLockV1Error::OutputAlreadyLocked);
|
||||||
node.set_lock_surface(Some(new.clone()));
|
|
||||||
let pos = node.global.pos.get();
|
|
||||||
new.change_extents(pos);
|
|
||||||
new.surface.set_output(&node);
|
|
||||||
self.client.state.tree_changed();
|
|
||||||
}
|
}
|
||||||
|
node.set_lock_surface(Some(new.clone()));
|
||||||
|
let pos = node.global.pos.get();
|
||||||
|
new.change_extents(pos);
|
||||||
|
new.surface.set_output(&node);
|
||||||
|
self.client.state.tree_changed();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -414,10 +414,9 @@ pub fn destroy_data_offer<T: IpcVtable>(offer: &T::Offer) {
|
||||||
if src_data.offers.is_empty()
|
if src_data.offers.is_empty()
|
||||||
&& src_data.role.get() == Role::Dnd
|
&& src_data.role.get() == Role::Dnd
|
||||||
&& data.shared.state.get().contains(OFFER_STATE_DROPPED)
|
&& data.shared.state.get().contains(OFFER_STATE_DROPPED)
|
||||||
|
&& let Some(seat) = src_data.seat.take()
|
||||||
{
|
{
|
||||||
if let Some(seat) = src_data.seat.take() {
|
T::unset(&seat, data.shared.role.get());
|
||||||
T::unset(&seat, data.shared.role.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,13 @@ impl WlDataOffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_source_actions(&self) {
|
pub fn send_source_actions(&self) {
|
||||||
if let Some(src) = self.data.source.get() {
|
if let Some(src) = self.data.source.get()
|
||||||
if let Some(source_actions) = src.source_data().actions.get() {
|
&& let Some(source_actions) = src.source_data().actions.get()
|
||||||
self.client.event(SourceActions {
|
{
|
||||||
self_id: self.id,
|
self.client.event(SourceActions {
|
||||||
source_actions,
|
self_id: self.id,
|
||||||
})
|
source_actions,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,51 +136,51 @@ impl JayInput {
|
||||||
.map(uapi::as_bytes)
|
.map(uapi::as_bytes)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
});
|
});
|
||||||
if let Some(output) = data.data.output.get() {
|
if let Some(output) = data.data.output.get()
|
||||||
if let Some(output) = output.get() {
|
&& let Some(output) = output.get()
|
||||||
self.client.event(InputDeviceOutput {
|
{
|
||||||
self_id: self.id,
|
self.client.event(InputDeviceOutput {
|
||||||
id: data.id.raw(),
|
self_id: self.id,
|
||||||
output: &output.connector.name,
|
id: data.id.raw(),
|
||||||
});
|
output: &output.connector.name,
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
if self.version >= CALIBRATION_MATRIX_SINCE {
|
if self.version >= CALIBRATION_MATRIX_SINCE
|
||||||
if let Some(m) = dev.calibration_matrix() {
|
&& let Some(m) = dev.calibration_matrix()
|
||||||
self.client.event(CalibrationMatrix {
|
{
|
||||||
self_id: self.id,
|
self.client.event(CalibrationMatrix {
|
||||||
m00: m[0][0],
|
self_id: self.id,
|
||||||
m01: m[0][1],
|
m00: m[0][0],
|
||||||
m02: m[0][2],
|
m01: m[0][1],
|
||||||
m10: m[1][0],
|
m02: m[0][2],
|
||||||
m11: m[1][1],
|
m10: m[1][0],
|
||||||
m12: m[1][2],
|
m11: m[1][1],
|
||||||
});
|
m12: m[1][2],
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
if self.version >= CLICK_METHOD_SINCE {
|
if self.version >= CLICK_METHOD_SINCE
|
||||||
if let Some(click_method) = dev.click_method() {
|
&& let Some(click_method) = dev.click_method()
|
||||||
self.client.event(ClickMethod {
|
{
|
||||||
self_id: self.id,
|
self.client.event(ClickMethod {
|
||||||
click_method: match click_method {
|
self_id: self.id,
|
||||||
InputDeviceClickMethod::None => LIBINPUT_CONFIG_CLICK_METHOD_NONE.0,
|
click_method: match click_method {
|
||||||
InputDeviceClickMethod::Clickfinger => {
|
InputDeviceClickMethod::None => LIBINPUT_CONFIG_CLICK_METHOD_NONE.0,
|
||||||
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER.0
|
InputDeviceClickMethod::Clickfinger => {
|
||||||
}
|
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER.0
|
||||||
InputDeviceClickMethod::ButtonAreas => {
|
}
|
||||||
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS.0
|
InputDeviceClickMethod::ButtonAreas => {
|
||||||
}
|
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS.0
|
||||||
},
|
}
|
||||||
});
|
},
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
if self.version >= MIDDLE_BUTTON_EMULATION_SINCE {
|
if self.version >= MIDDLE_BUTTON_EMULATION_SINCE
|
||||||
if let Some(middle_button_emulation) = dev.middle_button_emulation_enabled() {
|
&& let Some(middle_button_emulation) = dev.middle_button_emulation_enabled()
|
||||||
self.client.event(MiddleButtonEmulation {
|
{
|
||||||
self_id: self.id,
|
self.client.event(MiddleButtonEmulation {
|
||||||
middle_button_emulation_enabled: middle_button_emulation as _,
|
self_id: self.id,
|
||||||
});
|
middle_button_emulation_enabled: middle_button_emulation as _,
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -404,10 +404,10 @@ impl JayInputRequestHandler for JayInput {
|
||||||
let seat = self.seat(req.name)?;
|
let seat = self.seat(req.name)?;
|
||||||
self.send_seat(&seat);
|
self.send_seat(&seat);
|
||||||
for dev in self.client.state.input_device_handlers.borrow().values() {
|
for dev in self.client.state.input_device_handlers.borrow().values() {
|
||||||
if let Some(attached) = dev.data.seat.get() {
|
if let Some(attached) = dev.data.seat.get()
|
||||||
if attached.id() == seat.id() {
|
&& attached.id() == seat.id()
|
||||||
self.send_input_device(dev);
|
{
|
||||||
}
|
self.send_input_device(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -216,10 +216,10 @@ impl JayRandr {
|
||||||
fn get_device(&self, name: &str) -> Option<Rc<DrmDevData>> {
|
fn get_device(&self, name: &str) -> Option<Rc<DrmDevData>> {
|
||||||
let mut candidates = vec![];
|
let mut candidates = vec![];
|
||||||
for dev in self.client.state.drm_devs.lock().values() {
|
for dev in self.client.state.drm_devs.lock().values() {
|
||||||
if let Some(node) = &dev.devnode {
|
if let Some(node) = &dev.devnode
|
||||||
if node.ends_with(name) {
|
&& node.ends_with(name)
|
||||||
candidates.push(dev.clone());
|
{
|
||||||
}
|
candidates.push(dev.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if candidates.len() == 1 {
|
if candidates.len() == 1 {
|
||||||
|
|
|
||||||
|
|
@ -56,27 +56,27 @@ impl JayReexec {
|
||||||
let _ = waitpid(pid, 0);
|
let _ = waitpid(pid, 0);
|
||||||
}
|
}
|
||||||
Forked::Child { .. } => {
|
Forked::Child { .. } => {
|
||||||
if let Ok(f) = fork_with_pidfd(false) {
|
if let Ok(f) = fork_with_pidfd(false)
|
||||||
if let Forked::Child { .. } = f {
|
&& let Forked::Child { .. } = f
|
||||||
drop(p2);
|
{
|
||||||
fds.sort_by_key(|fd| fd.raw());
|
drop(p2);
|
||||||
let c2_dup = fds.last().unwrap().raw() + 1;
|
fds.sort_by_key(|fd| fd.raw());
|
||||||
let c1_dup = c2_dup + 1;
|
let c2_dup = fds.last().unwrap().raw() + 1;
|
||||||
let _ = dup2(c1.raw(), c1_dup);
|
let c1_dup = c2_dup + 1;
|
||||||
let _ = dup2(c2.raw(), c2_dup);
|
let _ = dup2(c1.raw(), c1_dup);
|
||||||
for (idx, fd) in fds.iter().enumerate() {
|
let _ = dup2(c2.raw(), c2_dup);
|
||||||
let _ = dup2(fd.raw(), idx as _);
|
for (idx, fd) in fds.iter().enumerate() {
|
||||||
}
|
let _ = dup2(fd.raw(), idx as _);
|
||||||
let c2_dup_dup = fds.len() as _;
|
|
||||||
let _ = dup2(c2_dup, c2_dup_dup);
|
|
||||||
let _ = close_range(c2_dup_dup as c::c_uint + 1, !0, 0);
|
|
||||||
let mut pollfd = c::pollfd {
|
|
||||||
fd: c2_dup_dup,
|
|
||||||
events: 0,
|
|
||||||
revents: 0,
|
|
||||||
};
|
|
||||||
let _ = uapi::poll(from_mut(&mut pollfd), -1);
|
|
||||||
}
|
}
|
||||||
|
let c2_dup_dup = fds.len() as _;
|
||||||
|
let _ = dup2(c2_dup, c2_dup_dup);
|
||||||
|
let _ = close_range(c2_dup_dup as c::c_uint + 1, !0, 0);
|
||||||
|
let mut pollfd = c::pollfd {
|
||||||
|
fd: c2_dup_dup,
|
||||||
|
events: 0,
|
||||||
|
revents: 0,
|
||||||
|
};
|
||||||
|
let _ = uapi::poll(from_mut(&mut pollfd), -1);
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
c::_exit(0);
|
c::_exit(0);
|
||||||
|
|
|
||||||
|
|
@ -655,10 +655,8 @@ impl JayScreencastRequestHandler for JayScreencast {
|
||||||
slf.schedule_realloc_or_reconfigure();
|
slf.schedule_realloc_or_reconfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
if capture_rules_changed {
|
if capture_rules_changed && let Some(Target::Output(o)) = self.target.get() {
|
||||||
if let Some(Target::Output(o)) = self.target.get() {
|
o.screencast_changed();
|
||||||
o.screencast_changed();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.running.get() {
|
if self.running.get() {
|
||||||
|
|
|
||||||
|
|
@ -158,10 +158,8 @@ impl WlBuffer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let had_texture = self.reset_gfx_objects(surface);
|
let had_texture = self.reset_gfx_objects(surface);
|
||||||
if had_texture {
|
if had_texture && let Some(surface) = surface {
|
||||||
if let Some(surface) = surface {
|
self.update_texture_or_log(surface, true);
|
||||||
self.update_texture_or_log(surface, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,19 +232,17 @@ impl WlBuffer {
|
||||||
};
|
};
|
||||||
match storage {
|
match storage {
|
||||||
WlBufferStorage::Shm { mem, stride } => {
|
WlBufferStorage::Shm { mem, stride } => {
|
||||||
if sync_shm {
|
if sync_shm && let Some(ctx) = self.client.state.render_ctx.get() {
|
||||||
if let Some(ctx) = self.client.state.render_ctx.get() {
|
let tex = ctx.async_shmem_texture(
|
||||||
let tex = ctx.async_shmem_texture(
|
self.format,
|
||||||
self.format,
|
self.width,
|
||||||
self.width,
|
self.height,
|
||||||
self.height,
|
*stride,
|
||||||
*stride,
|
&self.client.state.cpu_worker,
|
||||||
&self.client.state.cpu_worker,
|
)?;
|
||||||
)?;
|
mem.access(|mem| tex.clone().sync_upload(mem, Region::new2(self.rect)))??;
|
||||||
mem.access(|mem| tex.clone().sync_upload(mem, Region::new2(self.rect)))??;
|
surface.shm_textures.front().tex.set(Some(tex));
|
||||||
surface.shm_textures.front().tex.set(Some(tex));
|
surface.shm_textures.front().damage.clear();
|
||||||
surface.shm_textures.front().damage.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WlBufferStorage::Dmabuf { img, tex, .. } => {
|
WlBufferStorage::Dmabuf { img, tex, .. } => {
|
||||||
|
|
|
||||||
|
|
@ -442,14 +442,14 @@ impl WlSeatGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn maybe_constrain_pointer_node(&self) {
|
fn maybe_constrain_pointer_node(&self) {
|
||||||
if let Some(pn) = self.pointer_node() {
|
if let Some(pn) = self.pointer_node()
|
||||||
if let Some(surface) = pn.node_into_surface() {
|
&& let Some(surface) = pn.node_into_surface()
|
||||||
let (mut x, mut y) = self.pointer_cursor.position();
|
{
|
||||||
let (sx, sy) = surface.buffer_abs_pos.get().position();
|
let (mut x, mut y) = self.pointer_cursor.position();
|
||||||
x -= Fixed::from_int(sx);
|
let (sx, sy) = surface.buffer_abs_pos.get().position();
|
||||||
y -= Fixed::from_int(sy);
|
x -= Fixed::from_int(sx);
|
||||||
self.maybe_constrain(&surface, x, y);
|
y -= Fixed::from_int(sy);
|
||||||
}
|
self.maybe_constrain(&surface, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -513,10 +513,10 @@ impl WlSeatGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_kb_state(&self, keymap: &Rc<KbvmMap>) -> Rc<RefCell<KbvmState>> {
|
pub fn get_kb_state(&self, keymap: &Rc<KbvmMap>) -> Rc<RefCell<KbvmState>> {
|
||||||
if let Some(weak) = self.kb_states.get(&keymap.id) {
|
if let Some(weak) = self.kb_states.get(&keymap.id)
|
||||||
if let Some(state) = weak.upgrade() {
|
&& let Some(state) = weak.upgrade()
|
||||||
return state;
|
{
|
||||||
}
|
return state;
|
||||||
}
|
}
|
||||||
self.kb_states
|
self.kb_states
|
||||||
.lock()
|
.lock()
|
||||||
|
|
@ -548,13 +548,12 @@ impl WlSeatGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_mono(&self, mono: bool) {
|
pub fn set_mono(&self, mono: bool) {
|
||||||
if let Some(tl) = self.keyboard_node.get().node_toplevel() {
|
if let Some(tl) = self.keyboard_node.get().node_toplevel()
|
||||||
if let Some(parent) = tl.tl_data().parent.get() {
|
&& let Some(parent) = tl.tl_data().parent.get()
|
||||||
if let Some(container) = parent.node_into_container() {
|
&& let Some(container) = parent.node_into_container()
|
||||||
let node = if mono { Some(tl.deref()) } else { None };
|
{
|
||||||
container.set_mono(node);
|
let node = if mono { Some(tl.deref()) } else { None };
|
||||||
}
|
container.set_mono(node);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -573,12 +572,11 @@ impl WlSeatGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn focus_parent(self: &Rc<Self>) {
|
pub fn focus_parent(self: &Rc<Self>) {
|
||||||
if let Some(tl) = self.keyboard_node.get().node_toplevel() {
|
if let Some(tl) = self.keyboard_node.get().node_toplevel()
|
||||||
if let Some(parent) = tl.tl_data().parent.get() {
|
&& let Some(parent) = tl.tl_data().parent.get()
|
||||||
if let Some(tl) = parent.node_toplevel() {
|
&& let Some(tl) = parent.node_toplevel()
|
||||||
self.focus_node(tl);
|
{
|
||||||
}
|
self.focus_node(tl);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -642,12 +640,11 @@ impl WlSeatGlobal {
|
||||||
|
|
||||||
pub fn move_focused(self: &Rc<Self>, direction: Direction) {
|
pub fn move_focused(self: &Rc<Self>, direction: Direction) {
|
||||||
let kb_node = self.keyboard_node.get();
|
let kb_node = self.keyboard_node.get();
|
||||||
if let Some(tl) = kb_node.node_toplevel() {
|
if let Some(tl) = kb_node.node_toplevel()
|
||||||
if let Some(parent) = tl.tl_data().parent.get() {
|
&& let Some(parent) = tl.tl_data().parent.get()
|
||||||
if let Some(c) = parent.node_into_container() {
|
&& let Some(c) = parent.node_into_container()
|
||||||
c.move_child(tl, direction);
|
{
|
||||||
}
|
c.move_child(tl, direction);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -662,10 +659,10 @@ impl WlSeatGlobal {
|
||||||
X: ipc::IpcVtable<Device = XIpcDevice>,
|
X: ipc::IpcVtable<Device = XIpcDevice>,
|
||||||
S: DynDataSource,
|
S: DynDataSource,
|
||||||
{
|
{
|
||||||
if let (Some(new), Some(old)) = (&src, &field.get()) {
|
if let (Some(new), Some(old)) = (&src, &field.get())
|
||||||
if new.source_data().id == old.source_data().id {
|
&& new.source_data().id == old.source_data().id
|
||||||
return Ok(());
|
{
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
if let Some(new) = &src {
|
if let Some(new) = &src {
|
||||||
ipc::attach_seat(&**new, self, ipc::Role::Selection)?;
|
ipc::attach_seat(&**new, self, ipc::Role::Selection)?;
|
||||||
|
|
@ -753,10 +750,10 @@ impl WlSeatGlobal {
|
||||||
if let Some(serial) = serial {
|
if let Some(serial) = serial {
|
||||||
self.selection_serial.set(serial);
|
self.selection_serial.set(serial);
|
||||||
}
|
}
|
||||||
if let Some(selection) = &selection {
|
if let Some(selection) = &selection
|
||||||
if selection.toplevel_drag.is_some() {
|
&& selection.toplevel_drag.is_some()
|
||||||
return Err(WlSeatError::OfferHasDrag);
|
{
|
||||||
}
|
return Err(WlSeatError::OfferHasDrag);
|
||||||
}
|
}
|
||||||
self.set_selection(selection)
|
self.set_selection(selection)
|
||||||
}
|
}
|
||||||
|
|
@ -784,10 +781,10 @@ impl WlSeatGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn may_modify_primary_selection(&self, client: &Rc<Client>, serial: Option<u64>) -> bool {
|
pub fn may_modify_primary_selection(&self, client: &Rc<Client>, serial: Option<u64>) -> bool {
|
||||||
if let Some(serial) = serial {
|
if let Some(serial) = serial
|
||||||
if serial < self.primary_selection_serial.get() {
|
&& serial < self.primary_selection_serial.get()
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
self.keyboard_node.get().node_client_id() == Some(client.id)
|
self.keyboard_node.get().node_client_id() == Some(client.id)
|
||||||
|| self.pointer_node().and_then(|n| n.node_client_id()) == Some(client.id)
|
|| self.pointer_node().and_then(|n| n.node_client_id()) == Some(client.id)
|
||||||
|
|
@ -935,10 +932,10 @@ impl WlSeatGlobal {
|
||||||
if let Some(icon) = self.dnd_icon() {
|
if let Some(icon) = self.dnd_icon() {
|
||||||
icon.surface().set_visible(visible);
|
icon.surface().set_visible(visible);
|
||||||
}
|
}
|
||||||
if let Some(tl_drag) = self.toplevel_drag() {
|
if let Some(tl_drag) = self.toplevel_drag()
|
||||||
if let Some(tl) = tl_drag.toplevel.get() {
|
&& let Some(tl) = tl_drag.toplevel.get()
|
||||||
tl.tl_set_visible(visible);
|
{
|
||||||
}
|
tl.tl_set_visible(visible);
|
||||||
}
|
}
|
||||||
if let Some(im) = self.input_method.get() {
|
if let Some(im) = self.input_method.get() {
|
||||||
for (_, popup) in &im.popups {
|
for (_, popup) in &im.popups {
|
||||||
|
|
@ -1086,10 +1083,10 @@ impl CursorUserOwner for WlSeatGlobal {
|
||||||
if let Some(dnd) = self.pointer_owner.dnd_icon() {
|
if let Some(dnd) = self.pointer_owner.dnd_icon() {
|
||||||
dnd.surface().set_output(output);
|
dnd.surface().set_output(output);
|
||||||
}
|
}
|
||||||
if let Some(drag) = self.pointer_owner.toplevel_drag() {
|
if let Some(drag) = self.pointer_owner.toplevel_drag()
|
||||||
if let Some(tl) = drag.toplevel.get() {
|
&& let Some(tl) = drag.toplevel.get()
|
||||||
tl.xdg.set_output(output);
|
{
|
||||||
}
|
tl.xdg.set_output(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1161,20 +1158,20 @@ impl WlSeatRequestHandler for WlSeat {
|
||||||
.global
|
.global
|
||||||
.pointer_node()
|
.pointer_node()
|
||||||
.and_then(|n| n.node_into_surface());
|
.and_then(|n| n.node_into_surface());
|
||||||
if let Some(surface) = surface {
|
if let Some(surface) = surface
|
||||||
if surface.client.id == self.client.id {
|
&& surface.client.id == self.client.id
|
||||||
let (x, y) = self.global.pointer_cursor.position();
|
{
|
||||||
let (x_int, y_int) = surface
|
let (x, y) = self.global.pointer_cursor.position();
|
||||||
.buffer_abs_pos
|
let (x_int, y_int) = surface
|
||||||
.get()
|
.buffer_abs_pos
|
||||||
.translate(x.round_down(), y.round_down());
|
.get()
|
||||||
p.send_enter(
|
.translate(x.round_down(), y.round_down());
|
||||||
self.client.next_serial(),
|
p.send_enter(
|
||||||
surface.id,
|
self.client.next_serial(),
|
||||||
x.apply_fract(x_int),
|
surface.id,
|
||||||
y.apply_fract(y_int),
|
x.apply_fract(x_int),
|
||||||
);
|
y.apply_fract(y_int),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -1184,14 +1181,14 @@ impl WlSeatRequestHandler for WlSeat {
|
||||||
track!(self.client, p);
|
track!(self.client, p);
|
||||||
self.client.add_client_obj(&p)?;
|
self.client.add_client_obj(&p)?;
|
||||||
self.keyboards.set(req.id, p.clone());
|
self.keyboards.set(req.id, p.clone());
|
||||||
if let Some(surface) = self.global.keyboard_node.get().node_into_surface() {
|
if let Some(surface) = self.global.keyboard_node.get().node_into_surface()
|
||||||
if surface.client.id == self.client.id {
|
&& surface.client.id == self.client.id
|
||||||
p.enter(
|
{
|
||||||
self.client.next_serial(),
|
p.enter(
|
||||||
surface.id,
|
self.client.next_serial(),
|
||||||
&self.global.seat_kb_state.get().borrow().kb_state,
|
surface.id,
|
||||||
);
|
&self.global.seat_kb_state.get().borrow().kb_state,
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
if self.version >= REPEAT_INFO_SINCE {
|
if self.version >= REPEAT_INFO_SINCE {
|
||||||
let (rate, delay) = self.global.repeat_rate.get();
|
let (rate, delay) = self.global.repeat_rate.get();
|
||||||
|
|
@ -1277,10 +1274,10 @@ pub fn collect_kb_foci(node: Rc<dyn Node>) -> SmallVec<[Rc<WlSeatGlobal>; 3]> {
|
||||||
impl DeviceHandlerData {
|
impl DeviceHandlerData {
|
||||||
pub fn set_seat(&self, seat: Option<Rc<WlSeatGlobal>>) {
|
pub fn set_seat(&self, seat: Option<Rc<WlSeatGlobal>>) {
|
||||||
if let Some(new) = &seat {
|
if let Some(new) = &seat {
|
||||||
if let Some(old) = self.seat.get() {
|
if let Some(old) = self.seat.get()
|
||||||
if old.id() == new.id() {
|
&& old.id() == new.id()
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if self.seat.is_none() {
|
if self.seat.is_none() {
|
||||||
|
|
@ -1340,10 +1337,10 @@ impl DeviceHandlerData {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_rect(&self, state: &State) -> Rect {
|
pub fn get_rect(&self, state: &State) -> Rect {
|
||||||
if let Some(output) = self.output.get() {
|
if let Some(output) = self.output.get()
|
||||||
if let Some(output) = output.get() {
|
&& let Some(output) = output.get()
|
||||||
return output.pos.get();
|
{
|
||||||
}
|
return output.pos.get();
|
||||||
}
|
}
|
||||||
state.root.extents.get()
|
state.root.extents.get()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -524,10 +524,10 @@ impl WlSeatGlobal {
|
||||||
ei_seat.handle_motion_abs(time_usec, x, y);
|
ei_seat.handle_motion_abs(time_usec, x, y);
|
||||||
});
|
});
|
||||||
let (x, y) = self.set_pointer_cursor_position(x, y);
|
let (x, y) = self.set_pointer_cursor_position(x, y);
|
||||||
if let Some(c) = self.constraint.get() {
|
if let Some(c) = self.constraint.get()
|
||||||
if c.ty == ConstraintType::Lock || !c.contains(x.round_down(), y.round_down()) {
|
&& (c.ty == ConstraintType::Lock || !c.contains(x.round_down(), y.round_down()))
|
||||||
c.deactivate(false);
|
{
|
||||||
}
|
c.deactivate(false);
|
||||||
}
|
}
|
||||||
self.state.for_each_seat_tester(|t| {
|
self.state.for_each_seat_tester(|t| {
|
||||||
t.send_pointer_abs(self.id, time_usec, x, y);
|
t.send_pointer_abs(self.id, time_usec, x, y);
|
||||||
|
|
@ -839,16 +839,16 @@ impl WlSeatGlobal {
|
||||||
if sym == self.revert_key.get().0 && mods == 0 {
|
if sym == self.revert_key.get().0 && mods == 0 {
|
||||||
revert_pointer_to_default = true;
|
revert_pointer_to_default = true;
|
||||||
}
|
}
|
||||||
if !self.state.lock.locked.get() {
|
if !self.state.lock.locked.get()
|
||||||
if let Some(key_mods) = scs.get(&sym) {
|
&& let Some(key_mods) = scs.get(&sym)
|
||||||
for (key_mods, mask) in key_mods {
|
{
|
||||||
if mods & mask == key_mods {
|
for (key_mods, mask) in key_mods {
|
||||||
shortcuts.push(InvokedShortcut {
|
if mods & mask == key_mods {
|
||||||
unmasked_mods: Modifiers(mods),
|
shortcuts.push(InvokedShortcut {
|
||||||
effective_mods: Modifiers(key_mods),
|
unmasked_mods: Modifiers(mods),
|
||||||
sym: KeySym(sym),
|
effective_mods: Modifiers(key_mods),
|
||||||
});
|
sym: KeySym(sym),
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1169,10 +1169,8 @@ impl WlSeatGlobal {
|
||||||
p.send_button(serial, time, button, state)
|
p.send_button(serial, time, button, state)
|
||||||
});
|
});
|
||||||
self.surface_pointer_frame(surface);
|
self.surface_pointer_frame(surface);
|
||||||
if pressed {
|
if pressed && let Some(node) = surface.get_focus_node() {
|
||||||
if let Some(node) = surface.get_focus_node() {
|
self.focus_node_with_serial(node, serial);
|
||||||
self.focus_node_with_serial(node, serial);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1225,10 +1223,10 @@ impl WlSeatGlobal {
|
||||||
impl WlSeatGlobal {
|
impl WlSeatGlobal {
|
||||||
pub fn motion_surface(&self, n: &WlSurface, x: Fixed, y: Fixed) {
|
pub fn motion_surface(&self, n: &WlSurface, x: Fixed, y: Fixed) {
|
||||||
'send_motion: {
|
'send_motion: {
|
||||||
if let Some(constraint) = self.constraint.get() {
|
if let Some(constraint) = self.constraint.get()
|
||||||
if constraint.ty == ConstraintType::Lock {
|
&& constraint.ty == ConstraintType::Lock
|
||||||
break 'send_motion;
|
{
|
||||||
}
|
break 'send_motion;
|
||||||
}
|
}
|
||||||
let time = (self.pos_time_usec.get() / 1000) as u32;
|
let time = (self.pos_time_usec.get() / 1000) as u32;
|
||||||
self.surface_pointer_event(Version::ALL, n, |p| p.send_motion(time, x, y));
|
self.surface_pointer_event(Version::ALL, n, |p| p.send_motion(time, x, y));
|
||||||
|
|
@ -1299,10 +1297,10 @@ impl WlSeatGlobal {
|
||||||
// Unfocus callbacks
|
// Unfocus callbacks
|
||||||
impl WlSeatGlobal {
|
impl WlSeatGlobal {
|
||||||
pub fn unfocus_surface(&self, surface: &WlSurface) {
|
pub fn unfocus_surface(&self, surface: &WlSurface) {
|
||||||
if let Some(ti) = self.text_input.take() {
|
if let Some(ti) = self.text_input.take()
|
||||||
if let Some(con) = ti.connection.get() {
|
&& let Some(con) = ti.connection.get()
|
||||||
con.disconnect(TextDisconnectReason::FocusLost);
|
{
|
||||||
}
|
con.disconnect(TextDisconnectReason::FocusLost);
|
||||||
}
|
}
|
||||||
if let Some(tis) = self.text_inputs.borrow().get(&surface.client.id) {
|
if let Some(tis) = self.text_inputs.borrow().get(&surface.client.id) {
|
||||||
for ti in tis.lock().values() {
|
for ti in tis.lock().values() {
|
||||||
|
|
|
||||||
|
|
@ -530,10 +530,8 @@ impl PointerOwner for DndPointerOwner {
|
||||||
}
|
}
|
||||||
target.node_on_dnd_leave(&self.dnd);
|
target.node_on_dnd_leave(&self.dnd);
|
||||||
target.node_seat_state().remove_dnd_target(seat);
|
target.node_seat_state().remove_dnd_target(seat);
|
||||||
if !should_drop {
|
if !should_drop && let Some(src) = &self.dnd.src {
|
||||||
if let Some(src) = &self.dnd.src {
|
ipc::detach_seat(&**src, seat);
|
||||||
ipc::detach_seat(&**src, seat);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if let Some(icon) = self.icon.get() {
|
if let Some(icon) = self.icon.get() {
|
||||||
icon.disable();
|
icon.disable();
|
||||||
|
|
|
||||||
|
|
@ -97,17 +97,16 @@ impl WlSeatGlobal {
|
||||||
group_idx: u32,
|
group_idx: u32,
|
||||||
mode: u32,
|
mode: u32,
|
||||||
) {
|
) {
|
||||||
if let Some(pad) = self.tablet.pads.get(&pad) {
|
if let Some(pad) = self.tablet.pads.get(&pad)
|
||||||
if let Some(group) = pad.groups.get(group_idx as usize) {
|
&& let Some(group) = pad.groups.get(group_idx as usize)
|
||||||
if group.mode.replace(mode) != mode {
|
&& group.mode.replace(mode) != mode
|
||||||
self.state.for_each_seat_tester(|t| {
|
{
|
||||||
t.send_tablet_pad_mode_switch(self.id, pad.dev, time_usec, group_idx, mode)
|
self.state.for_each_seat_tester(|t| {
|
||||||
});
|
t.send_tablet_pad_mode_switch(self.id, pad.dev, time_usec, group_idx, mode)
|
||||||
if pad.tablet.is_some() {
|
});
|
||||||
let node = pad.node.get();
|
if pad.tablet.is_some() {
|
||||||
node.node_on_tablet_pad_mode_switch(&pad, group, time_usec, mode);
|
let node = pad.node.get();
|
||||||
}
|
node.node_on_tablet_pad_mode_switch(&pad, group, time_usec, mode);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -141,11 +140,11 @@ impl WlSeatGlobal {
|
||||||
self.state.for_each_seat_tester(|t| {
|
self.state.for_each_seat_tester(|t| {
|
||||||
t.send_tablet_pad_ring(self.id, pad.dev, time_usec, ring, source, angle)
|
t.send_tablet_pad_ring(self.id, pad.dev, time_usec, ring, source, angle)
|
||||||
});
|
});
|
||||||
if pad.tablet.is_some() {
|
if pad.tablet.is_some()
|
||||||
if let Some(ring) = pad.rings.get(ring as usize) {
|
&& let Some(ring) = pad.rings.get(ring as usize)
|
||||||
let node = self.keyboard_node.get();
|
{
|
||||||
node.node_on_tablet_pad_ring(&pad, ring, source, angle, time_usec);
|
let node = self.keyboard_node.get();
|
||||||
}
|
node.node_on_tablet_pad_ring(&pad, ring, source, angle, time_usec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,11 +161,11 @@ impl WlSeatGlobal {
|
||||||
self.state.for_each_seat_tester(|t| {
|
self.state.for_each_seat_tester(|t| {
|
||||||
t.send_tablet_pad_strip(self.id, pad.dev, time_usec, strip, source, position)
|
t.send_tablet_pad_strip(self.id, pad.dev, time_usec, strip, source, position)
|
||||||
});
|
});
|
||||||
if pad.tablet.is_some() {
|
if pad.tablet.is_some()
|
||||||
if let Some(strip) = pad.strips.get(strip as usize) {
|
&& let Some(strip) = pad.strips.get(strip as usize)
|
||||||
let node = pad.node.get();
|
{
|
||||||
node.node_on_tablet_pad_strip(&pad, strip, source, position, time_usec);
|
let node = pad.node.get();
|
||||||
}
|
node.node_on_tablet_pad_strip(&pad, strip, source, position, time_usec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -182,11 +181,11 @@ impl WlSeatGlobal {
|
||||||
self.state.for_each_seat_tester(|t| {
|
self.state.for_each_seat_tester(|t| {
|
||||||
t.send_tablet_pad_dial(self.id, pad.dev, time_usec, value120, dial)
|
t.send_tablet_pad_dial(self.id, pad.dev, time_usec, value120, dial)
|
||||||
});
|
});
|
||||||
if pad.tablet.is_some() {
|
if pad.tablet.is_some()
|
||||||
if let Some(dial) = pad.dials.get(dial as usize) {
|
&& let Some(dial) = pad.dials.get(dial as usize)
|
||||||
let node = self.keyboard_node.get();
|
{
|
||||||
node.node_on_tablet_pad_dial(&pad, dial, value120, time_usec);
|
let node = self.keyboard_node.get();
|
||||||
}
|
node.node_on_tablet_pad_dial(&pad, dial, value120, time_usec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -258,12 +258,12 @@ impl TabletTool {
|
||||||
tool.send_motion(x, y);
|
tool.send_motion(x, y);
|
||||||
tool.send_frame(time);
|
tool.send_frame(time);
|
||||||
});
|
});
|
||||||
if let Some(changes) = changes {
|
if let Some(changes) = changes
|
||||||
if changes.down == Some(true) {
|
&& changes.down == Some(true)
|
||||||
n.client.focus_stealing_serial.set(Some(serial.get()));
|
{
|
||||||
if let Some(node) = n.get_focus_node() {
|
n.client.focus_stealing_serial.set(Some(serial.get()));
|
||||||
self.tablet.seat.focus_node_with_serial(node, serial.get());
|
if let Some(node) = n.get_focus_node() {
|
||||||
}
|
self.tablet.seat.focus_node_with_serial(node, serial.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,10 @@ impl ZwpTabletSeatV2 {
|
||||||
obj.send_name(&tablet.name);
|
obj.send_name(&tablet.name);
|
||||||
obj.send_id(tablet.vid, tablet.pid);
|
obj.send_id(tablet.vid, tablet.pid);
|
||||||
obj.send_path(&tablet.path);
|
obj.send_path(&tablet.path);
|
||||||
if obj.version >= BUSTYPE_SINCE {
|
if obj.version >= BUSTYPE_SINCE
|
||||||
if let Some(bustype) = tablet.bustype {
|
&& let Some(bustype) = tablet.bustype
|
||||||
obj.send_bustype(bustype);
|
{
|
||||||
}
|
obj.send_bustype(bustype);
|
||||||
}
|
}
|
||||||
obj.send_done();
|
obj.send_done();
|
||||||
tablet.bindings.add(self, &obj);
|
tablet.bindings.add(self, &obj);
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,11 @@ impl ZwpTextInputManagerV3RequestHandler for ZwpTextInputManagerV3 {
|
||||||
.entry(self.client.id)
|
.entry(self.client.id)
|
||||||
.or_default()
|
.or_default()
|
||||||
.set(req.id, ti.clone());
|
.set(req.id, ti.clone());
|
||||||
if let Some(surface) = seat.global.keyboard_node.get().node_into_surface() {
|
if let Some(surface) = seat.global.keyboard_node.get().node_into_surface()
|
||||||
if surface.client.id == self.client.id {
|
&& surface.client.id == self.client.id
|
||||||
ti.send_enter(&surface);
|
{
|
||||||
ti.send_done();
|
ti.send_enter(&surface);
|
||||||
}
|
ti.send_done();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -252,11 +252,11 @@ impl ZwpTextInputV3RequestHandler for ZwpTextInputV3 {
|
||||||
}
|
}
|
||||||
let con = self.connection.get();
|
let con = self.connection.get();
|
||||||
if let Some(val) = pending.cursor_rect {
|
if let Some(val) = pending.cursor_rect {
|
||||||
if state.cursor_rectangle != val {
|
if state.cursor_rectangle != val
|
||||||
if let Some(con) = &con {
|
&& let Some(con) = &con
|
||||||
for (_, popup) in &con.input_method.popups {
|
{
|
||||||
popup.schedule_positioning();
|
for (_, popup) in &con.input_method.popups {
|
||||||
}
|
popup.schedule_positioning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.cursor_rectangle = val;
|
state.cursor_rectangle = val;
|
||||||
|
|
@ -282,10 +282,8 @@ impl ZwpTextInputV3RequestHandler for ZwpTextInputV3 {
|
||||||
}
|
}
|
||||||
state.surrounding_text = val;
|
state.surrounding_text = val;
|
||||||
}
|
}
|
||||||
if sent_any {
|
if sent_any && let Some(con) = &con {
|
||||||
if let Some(con) = &con {
|
con.input_method.send_done();
|
||||||
con.input_method.send_done();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -854,10 +854,10 @@ impl WlSurface {
|
||||||
ss.surface.set_toplevel(tl.clone());
|
ss.surface.set_toplevel(tl.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.seat_state.is_active() {
|
if self.seat_state.is_active()
|
||||||
if let Some(tl) = &tl {
|
&& let Some(tl) = &tl
|
||||||
tl.tl_surface_active_changed(true);
|
{
|
||||||
}
|
tl.tl_surface_active_changed(true);
|
||||||
}
|
}
|
||||||
self.toplevel.set(tl);
|
self.toplevel.set(tl);
|
||||||
}
|
}
|
||||||
|
|
@ -977,14 +977,14 @@ impl WlSurface {
|
||||||
if let Some(fs) = self.fractional_scale.get() {
|
if let Some(fs) = self.fractional_scale.get() {
|
||||||
fs.send_preferred_scale();
|
fs.send_preferred_scale();
|
||||||
}
|
}
|
||||||
if let Some(xsurface) = self.ext.get().into_xsurface() {
|
if let Some(xsurface) = self.ext.get().into_xsurface()
|
||||||
if let Some(window) = xsurface.xwindow.get() {
|
&& let Some(window) = xsurface.xwindow.get()
|
||||||
self.client
|
{
|
||||||
.state
|
self.client
|
||||||
.xwayland
|
.state
|
||||||
.queue
|
.xwayland
|
||||||
.push(XWaylandEvent::Configure(window));
|
.queue
|
||||||
}
|
.push(XWaylandEvent::Configure(window));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1152,14 +1152,12 @@ impl WlSurface {
|
||||||
viewport_changed = true;
|
viewport_changed = true;
|
||||||
self.src_rect.set(src_rect);
|
self.src_rect.set(src_rect);
|
||||||
}
|
}
|
||||||
if viewport_changed {
|
if viewport_changed
|
||||||
if let Some(rect) = self.src_rect.get() {
|
&& let Some(rect) = self.src_rect.get()
|
||||||
if self.dst_size.is_none() {
|
&& self.dst_size.is_none()
|
||||||
if !rect[2].is_integer() || !rect[3].is_integer() {
|
&& (!rect[2].is_integer() || !rect[3].is_integer())
|
||||||
return Err(WlSurfaceError::NonIntegerViewportSize);
|
{
|
||||||
}
|
return Err(WlSurfaceError::NonIntegerViewportSize);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let mut color_description_changed = false;
|
let mut color_description_changed = false;
|
||||||
if let Some(desc) = pending.color_description.take() {
|
if let Some(desc) = pending.color_description.take() {
|
||||||
|
|
@ -1360,10 +1358,10 @@ impl WlSurface {
|
||||||
self.is_opaque.set(is_opaque);
|
self.is_opaque.set(is_opaque);
|
||||||
}
|
}
|
||||||
let mut tearing_changed = false;
|
let mut tearing_changed = false;
|
||||||
if let Some(tearing) = pending.tearing.take() {
|
if let Some(tearing) = pending.tearing.take()
|
||||||
if self.tearing.replace(tearing) != tearing {
|
&& self.tearing.replace(tearing) != tearing
|
||||||
tearing_changed = true;
|
{
|
||||||
}
|
tearing_changed = true;
|
||||||
}
|
}
|
||||||
if let Some(content_type) = pending.content_type.take() {
|
if let Some(content_type) = pending.content_type.take() {
|
||||||
self.content_type.set(content_type);
|
self.content_type.set(content_type);
|
||||||
|
|
@ -1437,12 +1435,11 @@ impl WlSurface {
|
||||||
pending.surface_damage.clear();
|
pending.surface_damage.clear();
|
||||||
pending.damage_full = false;
|
pending.damage_full = false;
|
||||||
pending.fifo_barrier_wait = false;
|
pending.fifo_barrier_wait = false;
|
||||||
if tearing_changed {
|
if tearing_changed
|
||||||
if let Some(tl) = self.toplevel.get() {
|
&& let Some(tl) = self.toplevel.get()
|
||||||
if tl.tl_data().is_fullscreen.get() {
|
&& tl.tl_data().is_fullscreen.get()
|
||||||
self.output.get().update_presentation_type();
|
{
|
||||||
}
|
self.output.get().update_presentation_type();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.commit_version.fetch_add(1);
|
self.commit_version.fetch_add(1);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -1878,14 +1875,14 @@ impl Node for WlSurface {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn node_on_focus(self: Rc<Self>, seat: &WlSeatGlobal) {
|
fn node_on_focus(self: Rc<Self>, seat: &WlSeatGlobal) {
|
||||||
if let Some(xsurface) = self.ext.get().into_xsurface() {
|
if let Some(xsurface) = self.ext.get().into_xsurface()
|
||||||
if let Some(window) = xsurface.xwindow.get() {
|
&& let Some(window) = xsurface.xwindow.get()
|
||||||
self.client
|
{
|
||||||
.state
|
self.client
|
||||||
.xwayland
|
.state
|
||||||
.queue
|
.xwayland
|
||||||
.push(XWaylandEvent::Activate(window.data.clone()));
|
.queue
|
||||||
}
|
.push(XWaylandEvent::Activate(window.data.clone()));
|
||||||
}
|
}
|
||||||
seat.focus_surface(&self);
|
seat.focus_surface(&self);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -604,10 +604,10 @@ fn schedule_async_upload(
|
||||||
};
|
};
|
||||||
let back = surface.shm_textures.back();
|
let back = surface.shm_textures.back();
|
||||||
let mut back_tex_opt = back.tex.get();
|
let mut back_tex_opt = back.tex.get();
|
||||||
if let Some(back_tex) = &back_tex_opt {
|
if let Some(back_tex) = &back_tex_opt
|
||||||
if !back_tex.compatible_with(buf.format, buf.rect.width(), buf.rect.height(), *stride) {
|
&& !back_tex.compatible_with(buf.format, buf.rect.width(), buf.rect.height(), *stride)
|
||||||
back_tex_opt = None;
|
{
|
||||||
}
|
back_tex_opt = None;
|
||||||
}
|
}
|
||||||
let damage_full = || {
|
let damage_full = || {
|
||||||
back.damage.clear();
|
back.damage.clear();
|
||||||
|
|
@ -643,10 +643,10 @@ fn schedule_async_upload(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut staging_opt = surface.shm_staging.get();
|
let mut staging_opt = surface.shm_staging.get();
|
||||||
if let Some(staging) = &staging_opt {
|
if let Some(staging) = &staging_opt
|
||||||
if staging.size() != back_tex.staging_size() {
|
&& staging.size() != back_tex.staging_size()
|
||||||
staging_opt = None;
|
{
|
||||||
}
|
staging_opt = None;
|
||||||
}
|
}
|
||||||
let staging = match staging_opt {
|
let staging = match staging_opt {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
|
|
@ -682,11 +682,11 @@ impl CommitDataCollector {
|
||||||
if buffer.is_shm() {
|
if buffer.is_shm() {
|
||||||
self.shm_uploads += 1;
|
self.shm_uploads += 1;
|
||||||
}
|
}
|
||||||
if !pending.explicit_sync {
|
if !pending.explicit_sync
|
||||||
if let Some(dmabuf) = &buffer.dmabuf {
|
&& let Some(dmabuf) = &buffer.dmabuf
|
||||||
for plane in &dmabuf.planes {
|
{
|
||||||
self.implicit_dmabufs.push(plane.fd.clone());
|
for plane in &dmabuf.planes {
|
||||||
}
|
self.implicit_dmabufs.push(plane.fd.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,13 +79,12 @@ impl ExtSessionLockSurfaceV1RequestHandler for ExtSessionLockSurfaceV1 {
|
||||||
|
|
||||||
impl ExtSessionLockSurfaceV1 {
|
impl ExtSessionLockSurfaceV1 {
|
||||||
pub fn destroy_node(&self) {
|
pub fn destroy_node(&self) {
|
||||||
if let Some(output) = &self.output.node() {
|
if let Some(output) = &self.output.node()
|
||||||
if let Some(ls) = output.lock_surface.get() {
|
&& let Some(ls) = output.lock_surface.get()
|
||||||
if ls.node_id == self.node_id {
|
&& ls.node_id == self.node_id
|
||||||
output.set_lock_surface(None);
|
{
|
||||||
self.client.state.tree_changed();
|
output.set_lock_surface(None);
|
||||||
}
|
self.client.state.tree_changed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.surface.destroy_node();
|
self.surface.destroy_node();
|
||||||
self.seat_state.destroy_node(self);
|
self.seat_state.destroy_node(self);
|
||||||
|
|
|
||||||
|
|
@ -248,12 +248,12 @@ impl<T: TrayItem> SurfaceExt for T {
|
||||||
}
|
}
|
||||||
if data.surface.buffer.is_some() {
|
if data.surface.buffer.is_some() {
|
||||||
data.surface.set_visible(data.visible.get());
|
data.surface.set_visible(data.visible.get());
|
||||||
if let Some(node) = data.output.node() {
|
if let Some(node) = data.output.node()
|
||||||
if !data.attached.replace(true) {
|
&& !data.attached.replace(true)
|
||||||
let link = node.tray_items.add_last(self.clone());
|
{
|
||||||
data.linked_node.set(Some(link));
|
let link = node.tray_items.add_last(self.clone());
|
||||||
node.update_tray_positions();
|
data.linked_node.set(Some(link));
|
||||||
}
|
node.update_tray_positions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -260,10 +260,10 @@ impl WlSubsurface {
|
||||||
fn on_desync(&self) -> Result<(), WlSurfaceError> {
|
fn on_desync(&self) -> Result<(), WlSurfaceError> {
|
||||||
let committed = &mut *self.parent.pending.borrow_mut();
|
let committed = &mut *self.parent.pending.borrow_mut();
|
||||||
let committed = committed.subsurfaces.get_mut(&self.unique_id);
|
let committed = committed.subsurfaces.get_mut(&self.unique_id);
|
||||||
if let Some(ps) = committed {
|
if let Some(ps) = committed
|
||||||
if let Some(mut state) = ps.pending.state.take() {
|
&& let Some(mut state) = ps.pending.state.take()
|
||||||
self.surface.apply_state(&mut state)?;
|
{
|
||||||
}
|
self.surface.apply_state(&mut state)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,10 @@ impl SurfaceExt for XSurface {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn focus_node(&self) -> Option<Rc<dyn Node>> {
|
fn focus_node(&self) -> Option<Rc<dyn Node>> {
|
||||||
if let Some(xwindow) = self.xwindow.get() {
|
if let Some(xwindow) = self.xwindow.get()
|
||||||
if xwindow.tl_accepts_keyboard_focus() {
|
&& xwindow.tl_accepts_keyboard_focus()
|
||||||
return Some(xwindow.x.surface.clone());
|
{
|
||||||
}
|
return Some(xwindow.x.surface.clone());
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,10 +183,10 @@ impl XwindowData {
|
||||||
|
|
||||||
pub fn title_changed(&self) {
|
pub fn title_changed(&self) {
|
||||||
let title = self.info.title.borrow_mut();
|
let title = self.info.title.borrow_mut();
|
||||||
if let Some(w) = self.window.get() {
|
if let Some(w) = self.window.get()
|
||||||
if let Some(p) = w.toplevel_data.parent.get() {
|
&& let Some(p) = w.toplevel_data.parent.get()
|
||||||
p.node_child_title_changed(w.deref(), title.as_deref().unwrap_or(""));
|
{
|
||||||
}
|
p.node_child_title_changed(w.deref(), title.as_deref().unwrap_or(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,12 +110,12 @@ impl XdgPopupParent for Popup {
|
||||||
let state = &surface.client.state;
|
let state = &surface.client.state;
|
||||||
if surface.buffer.is_some() {
|
if surface.buffer.is_some() {
|
||||||
let mut any_set = false;
|
let mut any_set = false;
|
||||||
if wl.is_none() {
|
if wl.is_none()
|
||||||
if let Some(ws) = self.parent.workspace.get() {
|
&& let Some(ws) = self.parent.workspace.get()
|
||||||
self.popup.xdg.set_workspace(&ws);
|
{
|
||||||
*wl = Some(ws.stacked.add_last(self.popup.clone()));
|
self.popup.xdg.set_workspace(&ws);
|
||||||
any_set = true;
|
*wl = Some(ws.stacked.add_last(self.popup.clone()));
|
||||||
}
|
any_set = true;
|
||||||
}
|
}
|
||||||
if dl.is_none() {
|
if dl.is_none() {
|
||||||
*dl = Some(
|
*dl = Some(
|
||||||
|
|
@ -453,10 +453,10 @@ impl XdgSurface {
|
||||||
new_extents = new_extents.intersect(geometry);
|
new_extents = new_extents.intersect(geometry);
|
||||||
}
|
}
|
||||||
self.extents.set(new_extents);
|
self.extents.set(new_extents);
|
||||||
if old_extents != new_extents {
|
if old_extents != new_extents
|
||||||
if let Some(ext) = self.ext.get() {
|
&& let Some(ext) = self.ext.get()
|
||||||
ext.extents_changed();
|
{
|
||||||
}
|
ext.extents_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -518,22 +518,22 @@ impl SurfaceExt for XdgSurface {
|
||||||
self: Rc<Self>,
|
self: Rc<Self>,
|
||||||
pending: &mut PendingState,
|
pending: &mut PendingState,
|
||||||
) -> Result<(), WlSurfaceError> {
|
) -> Result<(), WlSurfaceError> {
|
||||||
if !self.have_initial_commit.get() {
|
if !self.have_initial_commit.get()
|
||||||
if let Some(ext) = self.ext.get() {
|
&& let Some(ext) = self.ext.get()
|
||||||
ext.initial_configure()?;
|
{
|
||||||
self.do_send_configure();
|
ext.initial_configure()?;
|
||||||
self.have_initial_commit.set(true);
|
self.do_send_configure();
|
||||||
}
|
self.have_initial_commit.set(true);
|
||||||
}
|
}
|
||||||
if let Some(pending) = &mut pending.xdg_surface {
|
if let Some(pending) = &mut pending.xdg_surface
|
||||||
if let Some(geometry) = pending.geometry.take() {
|
&& let Some(geometry) = pending.geometry.take()
|
||||||
let prev = self.geometry.replace(Some(geometry));
|
{
|
||||||
if prev != Some(geometry) {
|
let prev = self.geometry.replace(Some(geometry));
|
||||||
self.update_extents();
|
if prev != Some(geometry) {
|
||||||
self.update_surface_position();
|
self.update_extents();
|
||||||
if let Some(ext) = self.ext.get() {
|
self.update_surface_position();
|
||||||
ext.geometry_changed();
|
if let Some(ext) = self.ext.get() {
|
||||||
}
|
ext.geometry_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -371,10 +371,10 @@ impl StackedNode for XdgPopup {
|
||||||
|
|
||||||
fn stacked_set_visible(&self, visible: bool) {
|
fn stacked_set_visible(&self, visible: bool) {
|
||||||
if visible {
|
if visible {
|
||||||
if let Some(parent) = self.parent.get() {
|
if let Some(parent) = self.parent.get()
|
||||||
if !parent.visible() {
|
&& !parent.visible()
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.set_visible(visible);
|
self.set_visible(visible);
|
||||||
|
|
|
||||||
|
|
@ -433,11 +433,9 @@ impl XdgToplevel {
|
||||||
fn map_tiled(self: &Rc<Self>) {
|
fn map_tiled(self: &Rc<Self>) {
|
||||||
self.state.map_tiled(self.clone());
|
self.state.map_tiled(self.clone());
|
||||||
let fullscreen = self.states.borrow().contains(&STATE_FULLSCREEN);
|
let fullscreen = self.states.borrow().contains(&STATE_FULLSCREEN);
|
||||||
if fullscreen {
|
if fullscreen && let Some(ws) = self.xdg.workspace.get() {
|
||||||
if let Some(ws) = self.xdg.workspace.get() {
|
self.toplevel_data
|
||||||
self.toplevel_data
|
.set_fullscreen2(&self.state, self.clone(), &ws);
|
||||||
.set_fullscreen2(&self.state, self.clone(), &ws);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -470,26 +468,26 @@ impl XdgToplevel {
|
||||||
}
|
}
|
||||||
let surface = &self.xdg.surface;
|
let surface = &self.xdg.surface;
|
||||||
let should_be_mapped = surface.buffer.is_some();
|
let should_be_mapped = surface.buffer.is_some();
|
||||||
if let Some(drag) = self.drag.get() {
|
if let Some(drag) = self.drag.get()
|
||||||
if drag.is_ongoing() {
|
&& drag.is_ongoing()
|
||||||
if should_be_mapped {
|
{
|
||||||
if !self.is_mapped.replace(true) {
|
if should_be_mapped {
|
||||||
if let Some(seat) = drag.source.data.seat.get() {
|
if !self.is_mapped.replace(true) {
|
||||||
self.xdg.set_output(&seat.get_output());
|
if let Some(seat) = drag.source.data.seat.get() {
|
||||||
}
|
self.xdg.set_output(&seat.get_output());
|
||||||
self.toplevel_data.broadcast(self.clone());
|
|
||||||
self.tl_set_visible(self.state.root_visible());
|
|
||||||
self.xdg.damage();
|
|
||||||
}
|
|
||||||
self.extents_changed();
|
|
||||||
} else {
|
|
||||||
if self.is_mapped.replace(false) {
|
|
||||||
self.tl_set_visible(false);
|
|
||||||
self.xdg.damage();
|
|
||||||
}
|
}
|
||||||
|
self.toplevel_data.broadcast(self.clone());
|
||||||
|
self.tl_set_visible(self.state.root_visible());
|
||||||
|
self.xdg.damage();
|
||||||
|
}
|
||||||
|
self.extents_changed();
|
||||||
|
} else {
|
||||||
|
if self.is_mapped.replace(false) {
|
||||||
|
self.tl_set_visible(false);
|
||||||
|
self.xdg.damage();
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if self.is_mapped.replace(should_be_mapped) == should_be_mapped {
|
if self.is_mapped.replace(should_be_mapped) == should_be_mapped {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -384,10 +384,10 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.exclusive_size.replace(exclusive_size) != exclusive_size {
|
if self.exclusive_size.replace(exclusive_size) != exclusive_size
|
||||||
if let Some(output) = self.output.node.get() {
|
&& let Some(output) = self.output.node.get()
|
||||||
output.update_exclusive_zones();
|
{
|
||||||
}
|
output.update_exclusive_zones();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -422,10 +422,10 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
if height == 0 && !anchor.contains(TOP | BOTTOM) {
|
if height == 0 && !anchor.contains(TOP | BOTTOM) {
|
||||||
return Err(ZwlrLayerSurfaceV1Error::HeightZero);
|
return Err(ZwlrLayerSurfaceV1Error::HeightZero);
|
||||||
}
|
}
|
||||||
if let Some(ee) = self.exclusive_edge.get() {
|
if let Some(ee) = self.exclusive_edge.get()
|
||||||
if !self.anchor.get().contains(ee) {
|
&& !self.anchor.get().contains(ee)
|
||||||
return Err(ZwlrLayerSurfaceV1Error::ExclusiveEdgeNotAnchored);
|
{
|
||||||
}
|
return Err(ZwlrLayerSurfaceV1Error::ExclusiveEdgeNotAnchored);
|
||||||
}
|
}
|
||||||
self.configure();
|
self.configure();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -539,10 +539,10 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
self.seat_state.destroy_node(self);
|
self.seat_state.destroy_node(self);
|
||||||
self.client.state.tree_changed();
|
self.client.state.tree_changed();
|
||||||
self.last_configure.take();
|
self.last_configure.take();
|
||||||
if self.exclusive_size.take().is_not_empty() {
|
if self.exclusive_size.take().is_not_empty()
|
||||||
if let Some(node) = self.output.node() {
|
&& let Some(node) = self.output.node()
|
||||||
node.update_exclusive_zones();
|
{
|
||||||
}
|
node.update_exclusive_zones();
|
||||||
}
|
}
|
||||||
for popup in self.popups.lock().drain_values() {
|
for popup in self.popups.lock().drain_values() {
|
||||||
popup.popup.destroy_node();
|
popup.popup.destroy_node();
|
||||||
|
|
|
||||||
|
|
@ -136,19 +136,19 @@ impl ExtWorkspaceGroupHandleV1RequestHandler for ExtWorkspaceGroupHandleV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||||
if let Some(manager) = self.manager.get() {
|
if let Some(manager) = self.manager.get()
|
||||||
if let Some(node) = self.output.node() {
|
&& let Some(node) = self.output.node()
|
||||||
let mut sent_any = false;
|
{
|
||||||
for ws in node.workspaces.iter() {
|
let mut sent_any = false;
|
||||||
if let Some(ws) = ws.ext_workspaces.get(&self.manager_id) {
|
for ws in node.workspaces.iter() {
|
||||||
self.send_workspace_leave(&ws);
|
if let Some(ws) = ws.ext_workspaces.get(&self.manager_id) {
|
||||||
sent_any = true;
|
self.send_workspace_leave(&ws);
|
||||||
}
|
sent_any = true;
|
||||||
}
|
|
||||||
if sent_any {
|
|
||||||
manager.schedule_done();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if sent_any {
|
||||||
|
manager.schedule_done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.detach();
|
self.detach();
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
|
|
|
||||||
|
|
@ -77,10 +77,10 @@ impl ExtWorkspaceHandleV1 {
|
||||||
};
|
};
|
||||||
let mut state = 0;
|
let mut state = 0;
|
||||||
let output = ws.output.get();
|
let output = ws.output.get();
|
||||||
if let Some(active) = output.workspace.get() {
|
if let Some(active) = output.workspace.get()
|
||||||
if active.id == ws.id {
|
&& active.id == ws.id
|
||||||
state |= STATE_ACTIVE;
|
{
|
||||||
}
|
state |= STATE_ACTIVE;
|
||||||
}
|
}
|
||||||
if ws.attention_requests.active() {
|
if ws.attention_requests.active() {
|
||||||
state |= STATE_URGENT;
|
state |= STATE_URGENT;
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ impl WpDrmLeaseDeviceV1Global {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for c in dev.connectors.lock().keys() {
|
for c in dev.connectors.lock().keys() {
|
||||||
if let Some(o) = client.state.outputs.get(c) {
|
if let Some(o) = client.state.outputs.get(c)
|
||||||
if o.monitor_info.non_desktop {
|
&& o.monitor_info.non_desktop
|
||||||
obj.create_connector(&o);
|
{
|
||||||
}
|
obj.create_connector(&o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ impl XdgActivationTokenV1RequestHandler for XdgActivationTokenV1 {
|
||||||
let token = activation_token();
|
let token = activation_token();
|
||||||
self.client.state.activation_tokens.set(token, ());
|
self.client.state.activation_tokens.set(token, ());
|
||||||
let mut tokens = self.client.activation_tokens.borrow_mut();
|
let mut tokens = self.client.activation_tokens.borrow_mut();
|
||||||
if tokens.len() >= MAX_TOKENS_PER_CLIENT {
|
if tokens.len() >= MAX_TOKENS_PER_CLIENT
|
||||||
if let Some(oldest) = tokens.pop_front() {
|
&& let Some(oldest) = tokens.pop_front()
|
||||||
self.client.state.activation_tokens.remove(&oldest);
|
{
|
||||||
}
|
self.client.state.activation_tokens.remove(&oldest);
|
||||||
}
|
}
|
||||||
tokens.push_back(token);
|
tokens.push_back(token);
|
||||||
self.send_done(token);
|
self.send_done(token);
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,11 @@ impl XdgToplevelDragV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(&self, renderer: &mut Renderer<'_>, cursor_rect: &Rect, x: i32, y: i32) {
|
pub fn render(&self, renderer: &mut Renderer<'_>, cursor_rect: &Rect, x: i32, y: i32) {
|
||||||
if let Some(tl) = self.toplevel.get() {
|
if let Some(tl) = self.toplevel.get()
|
||||||
if tl.xdg.surface.buffer.get().is_some() {
|
&& tl.xdg.surface.buffer.get().is_some()
|
||||||
let (x, y) = cursor_rect.translate(x - self.x_off.get(), y - self.y_off.get());
|
{
|
||||||
renderer.render_xdg_surface(&tl.xdg, x, y, None)
|
let (x, y) = cursor_rect.translate(x - self.x_off.get(), y - self.y_off.get());
|
||||||
}
|
renderer.render_xdg_surface(&tl.xdg, x, y, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,17 +133,17 @@ impl XdgToplevelDragV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn finish_drag(&self, seat: &Rc<WlSeatGlobal>) {
|
pub fn finish_drag(&self, seat: &Rc<WlSeatGlobal>) {
|
||||||
if self.source.data.was_used() {
|
if self.source.data.was_used()
|
||||||
if let Some(tl) = self.toplevel.get() {
|
&& let Some(tl) = self.toplevel.get()
|
||||||
let output = seat.get_output();
|
{
|
||||||
let (x, y) = seat.pointer_cursor().position();
|
let output = seat.get_output();
|
||||||
tl.drag.take();
|
let (x, y) = seat.pointer_cursor().position();
|
||||||
tl.after_toplevel_drag(
|
tl.drag.take();
|
||||||
&output,
|
tl.after_toplevel_drag(
|
||||||
x.round_down() - self.x_off.get(),
|
&output,
|
||||||
y.round_down() - self.y_off.get(),
|
x.round_down() - self.x_off.get(),
|
||||||
);
|
y.round_down() - self.y_off.get(),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
self.detach();
|
self.detach();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,16 +111,14 @@ impl ZwlrScreencopyFrameV1 {
|
||||||
return Err(ZwlrScreencopyFrameV1Error::InvalidBufferFormat);
|
return Err(ZwlrScreencopyFrameV1Error::InvalidBufferFormat);
|
||||||
}
|
}
|
||||||
buffer.update_framebuffer()?;
|
buffer.update_framebuffer()?;
|
||||||
if let Some(WlBufferStorage::Shm { stride, .. }) = buffer.storage.borrow_mut().deref() {
|
if let Some(WlBufferStorage::Shm { stride, .. }) = buffer.storage.borrow_mut().deref()
|
||||||
if *stride != self.rect.width() * 4 {
|
&& *stride != self.rect.width() * 4
|
||||||
return Err(ZwlrScreencopyFrameV1Error::InvalidBufferStride);
|
{
|
||||||
}
|
return Err(ZwlrScreencopyFrameV1Error::InvalidBufferStride);
|
||||||
}
|
}
|
||||||
self.buffer.set(Some(buffer));
|
self.buffer.set(Some(buffer));
|
||||||
if !with_damage {
|
if !with_damage && let Some(global) = self.output.get() {
|
||||||
if let Some(global) = self.output.get() {
|
global.connector.damage();
|
||||||
global.connector.damage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.with_damage.set(with_damage);
|
self.with_damage.set(with_damage);
|
||||||
node.screencopies
|
node.screencopies
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,15 @@ impl ZwpLinuxDmabufV1Global {
|
||||||
});
|
});
|
||||||
track!(client, obj);
|
track!(client, obj);
|
||||||
client.add_client_obj(&obj)?;
|
client.add_client_obj(&obj)?;
|
||||||
if version < FEEDBACK_SINCE_VERSION {
|
if version < FEEDBACK_SINCE_VERSION
|
||||||
if let Some(ctx) = client.state.render_ctx.get() {
|
&& let Some(ctx) = client.state.render_ctx.get()
|
||||||
let formats = ctx.formats();
|
{
|
||||||
for format in formats.values() {
|
let formats = ctx.formats();
|
||||||
obj.send_format(format.format.drm);
|
for format in formats.values() {
|
||||||
if version >= MODIFIERS_SINCE_VERSION {
|
obj.send_format(format.format.drm);
|
||||||
for &modifier in &format.read_modifiers {
|
if version >= MODIFIERS_SINCE_VERSION {
|
||||||
obj.send_modifier(format.format.drm, modifier);
|
for &modifier in &format.read_modifiers {
|
||||||
}
|
obj.send_modifier(format.format.drm, modifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -249,17 +249,17 @@ where
|
||||||
}
|
}
|
||||||
let node = 'node: {
|
let node = 'node: {
|
||||||
for f in &files {
|
for f in &files {
|
||||||
if let Some(file) = f.file_name() {
|
if let Some(file) = f.file_name()
|
||||||
if file.as_bytes().starts_with_str("renderD") {
|
&& file.as_bytes().starts_with_str("renderD")
|
||||||
break 'node f;
|
{
|
||||||
}
|
break 'node f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for f in &files {
|
for f in &files {
|
||||||
if let Some(file) = f.file_name() {
|
if let Some(file) = f.file_name()
|
||||||
if file.as_bytes().starts_with_str("card") {
|
&& file.as_bytes().starts_with_str("card")
|
||||||
break 'node f;
|
{
|
||||||
}
|
break 'node f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Err(TestBackendError::NoDrmNode);
|
return Err(TestBackendError::NoDrmNode);
|
||||||
|
|
|
||||||
|
|
@ -533,23 +533,23 @@ impl PwClientNode {
|
||||||
if let Some(mt) = obj.get_param(SPA_FORMAT_VIDEO_size.0)? {
|
if let Some(mt) = obj.get_param(SPA_FORMAT_VIDEO_size.0)? {
|
||||||
format.video_size = Some(mt.pod.get_rectangle()?);
|
format.video_size = Some(mt.pod.get_rectangle()?);
|
||||||
}
|
}
|
||||||
if let Some(mt) = obj.get_param(SPA_FORMAT_VIDEO_format.0)? {
|
if let Some(mt) = obj.get_param(SPA_FORMAT_VIDEO_format.0)?
|
||||||
if let Some(fmt) = pw_formats().get(&SpaVideoFormat(mt.pod.get_id()?)) {
|
&& let Some(fmt) = pw_formats().get(&SpaVideoFormat(mt.pod.get_id()?))
|
||||||
format.format = Some(*fmt);
|
{
|
||||||
}
|
format.format = Some(*fmt);
|
||||||
}
|
}
|
||||||
if let Some(mt) = obj.get_param(SPA_FORMAT_VIDEO_modifier.0)? {
|
if let Some(mt) = obj.get_param(SPA_FORMAT_VIDEO_modifier.0)?
|
||||||
if let PwPod::Choice(mods) = mt.pod {
|
&& let PwPod::Choice(mods) = mt.pod
|
||||||
let mut p1 = mods.elements.elements;
|
{
|
||||||
p1.read_pod_body_packed(PW_TYPE_Long, 8)?;
|
let mut p1 = mods.elements.elements;
|
||||||
while p1.len() > 0 {
|
p1.read_pod_body_packed(PW_TYPE_Long, 8)?;
|
||||||
let modifier = p1.read_pod_body_packed(PW_TYPE_Long, 8)?;
|
while p1.len() > 0 {
|
||||||
if let PwPod::Long(modifier) = modifier {
|
let modifier = p1.read_pod_body_packed(PW_TYPE_Long, 8)?;
|
||||||
format
|
if let PwPod::Long(modifier) = modifier {
|
||||||
.modifiers
|
format
|
||||||
.get_or_insert_default_ext()
|
.modifiers
|
||||||
.push(modifier as u64);
|
.get_or_insert_default_ext()
|
||||||
}
|
.push(modifier as u64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,11 @@ impl PwCore {
|
||||||
let mut p2 = s1.fields;
|
let mut p2 = s1.fields;
|
||||||
let id = p2.read_uint()?;
|
let id = p2.read_uint()?;
|
||||||
let seq = p2.read_uint()?;
|
let seq = p2.read_uint()?;
|
||||||
if let Some(obj) = self.con.objects.get(&id) {
|
if let Some(obj) = self.con.objects.get(&id)
|
||||||
if obj.data().sync_id.get() <= seq {
|
&& obj.data().sync_id.get() <= seq
|
||||||
obj.data().sync_id.set(seq);
|
{
|
||||||
obj.done();
|
obj.data().sync_id.set(seq);
|
||||||
}
|
obj.done();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -177,13 +177,14 @@ impl<'a> PwParser<'a> {
|
||||||
|
|
||||||
pub fn read_value(&mut self) -> Result<PwPod<'a>, PwParserError> {
|
pub fn read_value(&mut self) -> Result<PwPod<'a>, PwParserError> {
|
||||||
let mut v = self.read_pod();
|
let mut v = self.read_pod();
|
||||||
if let Ok(PwPod::Choice(v)) = &mut v {
|
if let Ok(PwPod::Choice(v)) = &mut v
|
||||||
if v.ty == PW_CHOICE_None && v.elements.n_elements > 0 {
|
&& v.ty == PW_CHOICE_None
|
||||||
return v
|
&& v.elements.n_elements > 0
|
||||||
.elements
|
{
|
||||||
.elements
|
return v
|
||||||
.read_pod_body_packed(v.elements.ty, v.elements.child_len);
|
.elements
|
||||||
}
|
.elements
|
||||||
|
.read_pod_body_packed(v.elements.ty, v.elements.child_len);
|
||||||
}
|
}
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1202,13 +1202,14 @@ impl<'a> PwPod<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_value(mut self) -> Result<PwPod<'a>, PwParserError> {
|
pub fn get_value(mut self) -> Result<PwPod<'a>, PwParserError> {
|
||||||
if let PwPod::Choice(v) = &mut self {
|
if let PwPod::Choice(v) = &mut self
|
||||||
if v.ty == PW_CHOICE_None && v.elements.n_elements > 0 {
|
&& v.ty == PW_CHOICE_None
|
||||||
return v
|
&& v.elements.n_elements > 0
|
||||||
.elements
|
{
|
||||||
.elements
|
return v
|
||||||
.read_pod_body_packed(v.elements.ty, v.elements.child_len);
|
.elements
|
||||||
}
|
.elements
|
||||||
|
.read_pod_body_packed(v.elements.ty, v.elements.child_len);
|
||||||
}
|
}
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -325,11 +325,11 @@ impl<'a> Debug for PwPodObject<'a> {
|
||||||
s.field("type", &self.ty);
|
s.field("type", &self.ty);
|
||||||
let name;
|
let name;
|
||||||
let mut id: &dyn Debug = &self.id;
|
let mut id: &dyn Debug = &self.id;
|
||||||
if let Some(d) = debugger {
|
if let Some(d) = debugger
|
||||||
if let Some(n) = d.id_name(self.id) {
|
&& let Some(n) = d.id_name(self.id)
|
||||||
name = n;
|
{
|
||||||
id = &name;
|
name = n;
|
||||||
}
|
id = &name;
|
||||||
}
|
}
|
||||||
s.field("id", id);
|
s.field("id", id);
|
||||||
s.field(
|
s.field(
|
||||||
|
|
|
||||||
|
|
@ -179,10 +179,10 @@ impl UsrJayRenderCtxOwner for PortalDisplay {
|
||||||
};
|
};
|
||||||
let dev_id = drm.dev();
|
let dev_id = drm.dev();
|
||||||
let mut render_ctx = None;
|
let mut render_ctx = None;
|
||||||
if let Some(ctx) = self.state.render_ctxs.get(&dev_id) {
|
if let Some(ctx) = self.state.render_ctxs.get(&dev_id)
|
||||||
if let Some(ctx) = ctx.upgrade() {
|
&& let Some(ctx) = ctx.upgrade()
|
||||||
render_ctx = Some(ctx);
|
{
|
||||||
}
|
render_ctx = Some(ctx);
|
||||||
}
|
}
|
||||||
if render_ctx.is_none() {
|
if render_ctx.is_none() {
|
||||||
let ctx = match create_gfx_context(
|
let ctx = match create_gfx_context(
|
||||||
|
|
@ -553,10 +553,10 @@ pub(super) async fn watch_displays(state: Rc<PortalState>) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for event in events {
|
for event in events {
|
||||||
if event.mask.contains(c::IN_CREATE) {
|
if event.mask.contains(c::IN_CREATE)
|
||||||
if let Ok(s) = std::str::from_utf8(event.name().as_ustr().as_bytes()) {
|
&& let Ok(s) = std::str::from_utf8(event.name().as_ustr().as_bytes())
|
||||||
maybe_add_display(&state, s).await;
|
{
|
||||||
}
|
maybe_add_display(&state, s).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -353,18 +353,18 @@ impl StartedScreencast {
|
||||||
return Err(BufferAllocationError::NoRenderContext);
|
return Err(BufferAllocationError::NoRenderContext);
|
||||||
};
|
};
|
||||||
let mut usage = BO_USE_RENDERING;
|
let mut usage = BO_USE_RENDERING;
|
||||||
if let Some(sf) = &ctx.server_formats {
|
if let Some(sf) = &ctx.server_formats
|
||||||
if let Some(format) = sf.get(&format.drm) {
|
&& let Some(format) = sf.get(&format.drm)
|
||||||
let no_render_usage = modifiers.iter().all(|m| {
|
{
|
||||||
format
|
let no_render_usage = modifiers.iter().all(|m| {
|
||||||
.write_modifiers
|
format
|
||||||
.get(m)
|
.write_modifiers
|
||||||
.map(|w| !w.needs_render_usage)
|
.get(m)
|
||||||
.unwrap_or(false)
|
.map(|w| !w.needs_render_usage)
|
||||||
});
|
.unwrap_or(false)
|
||||||
if no_render_usage {
|
});
|
||||||
usage = BufferUsage::none();
|
if no_render_usage {
|
||||||
}
|
usage = BufferUsage::none();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let buffer = ctx.ctx.ctx.allocator().create_bo(
|
let buffer = ctx.ctx.ctx.allocator().create_bo(
|
||||||
|
|
|
||||||
140
src/renderer.rs
140
src/renderer.rs
|
|
@ -56,10 +56,10 @@ impl Renderer<'_> {
|
||||||
|
|
||||||
pub fn render_output(&mut self, output: &OutputNode, x: i32, y: i32) {
|
pub fn render_output(&mut self, output: &OutputNode, x: i32, y: i32) {
|
||||||
if self.state.lock.locked.get() {
|
if self.state.lock.locked.get() {
|
||||||
if let Some(surface) = output.lock_surface.get() {
|
if let Some(surface) = output.lock_surface.get()
|
||||||
if surface.surface.buffer.is_some() {
|
&& surface.surface.buffer.is_some()
|
||||||
self.render_surface(&surface.surface, x, y, None);
|
{
|
||||||
}
|
self.render_surface(&surface.surface, x, y, None);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -134,25 +134,25 @@ impl Renderer<'_> {
|
||||||
self.state.color_manager.srgb_srgb(),
|
self.state.color_manager.srgb_srgb(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if let Some(status) = &rd.status {
|
if let Some(status) = &rd.status
|
||||||
if let Some(texture) = status.tex.texture() {
|
&& let Some(texture) = status.tex.texture()
|
||||||
let (x, y) = self.base.scale_point(x + status.tex_x, y);
|
{
|
||||||
self.base.render_texture(
|
let (x, y) = self.base.scale_point(x + status.tex_x, y);
|
||||||
&texture,
|
self.base.render_texture(
|
||||||
None,
|
&texture,
|
||||||
x,
|
None,
|
||||||
y,
|
x,
|
||||||
None,
|
y,
|
||||||
None,
|
None,
|
||||||
scale,
|
None,
|
||||||
Some(&bar_bg),
|
scale,
|
||||||
None,
|
Some(&bar_bg),
|
||||||
AcquireSync::None,
|
None,
|
||||||
ReleaseSync::None,
|
AcquireSync::None,
|
||||||
false,
|
ReleaseSync::None,
|
||||||
srgb_srgb,
|
false,
|
||||||
);
|
srgb_srgb,
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
for item in output.tray_items.iter() {
|
for item in output.tray_items.iter() {
|
||||||
let data = item.data();
|
let data = item.data();
|
||||||
|
|
@ -185,13 +185,13 @@ impl Renderer<'_> {
|
||||||
render_layer!(output.layers[2]);
|
render_layer!(output.layers[2]);
|
||||||
render_layer!(output.layers[3]);
|
render_layer!(output.layers[3]);
|
||||||
render_stacked!(self.state.root.stacked_above_layers);
|
render_stacked!(self.state.root.stacked_above_layers);
|
||||||
if let Some(ws) = output.workspace.get() {
|
if let Some(ws) = output.workspace.get()
|
||||||
if ws.render_highlight.get() > 0 {
|
&& ws.render_highlight.get() > 0
|
||||||
let color = self.state.theme.colors.highlight.get();
|
{
|
||||||
let bounds = ws.position.get().at_point(x, y + th + 1);
|
let color = self.state.theme.colors.highlight.get();
|
||||||
self.base.ops.push(GfxApiOpt::Sync);
|
let bounds = ws.position.get().at_point(x, y + th + 1);
|
||||||
self.base.fill_boxes(&[bounds], &color, srgb);
|
self.base.ops.push(GfxApiOpt::Sync);
|
||||||
}
|
self.base.fill_boxes(&[bounds], &color, srgb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,27 +214,27 @@ impl Renderer<'_> {
|
||||||
&Color::from_srgba_straight(20, 20, 20, 255),
|
&Color::from_srgba_straight(20, 20, 20, 255),
|
||||||
&self.state.color_manager.srgb_srgb().linear,
|
&self.state.color_manager.srgb_srgb().linear,
|
||||||
);
|
);
|
||||||
if let Some(tex) = placeholder.textures.borrow().get(&self.base.scale) {
|
if let Some(tex) = placeholder.textures.borrow().get(&self.base.scale)
|
||||||
if let Some(texture) = tex.texture() {
|
&& let Some(texture) = tex.texture()
|
||||||
let (tex_width, tex_height) = texture.size();
|
{
|
||||||
let x = x + (pos.width() - tex_width) / 2;
|
let (tex_width, tex_height) = texture.size();
|
||||||
let y = y + (pos.height() - tex_height) / 2;
|
let x = x + (pos.width() - tex_width) / 2;
|
||||||
self.base.render_texture(
|
let y = y + (pos.height() - tex_height) / 2;
|
||||||
&texture,
|
self.base.render_texture(
|
||||||
None,
|
&texture,
|
||||||
x,
|
None,
|
||||||
y,
|
x,
|
||||||
None,
|
y,
|
||||||
None,
|
None,
|
||||||
self.base.scale,
|
None,
|
||||||
bounds,
|
self.base.scale,
|
||||||
None,
|
bounds,
|
||||||
AcquireSync::None,
|
None,
|
||||||
ReleaseSync::None,
|
AcquireSync::None,
|
||||||
false,
|
ReleaseSync::None,
|
||||||
self.state.color_manager.srgb_srgb(),
|
false,
|
||||||
);
|
self.state.color_manager.srgb_srgb(),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
self.render_tl_aux(placeholder.tl_data(), bounds, true);
|
self.render_tl_aux(placeholder.tl_data(), bounds, true);
|
||||||
}
|
}
|
||||||
|
|
@ -560,25 +560,25 @@ impl Renderer<'_> {
|
||||||
}
|
}
|
||||||
x1 += th;
|
x1 += th;
|
||||||
}
|
}
|
||||||
if let Some(title) = floating.title_textures.borrow().get(&self.base.scale) {
|
if let Some(title) = floating.title_textures.borrow().get(&self.base.scale)
|
||||||
if let Some(texture) = title.texture() {
|
&& let Some(texture) = title.texture()
|
||||||
let (x, y) = self.base.scale_point(x1, y1);
|
{
|
||||||
self.base.render_texture(
|
let (x, y) = self.base.scale_point(x1, y1);
|
||||||
&texture,
|
self.base.render_texture(
|
||||||
None,
|
&texture,
|
||||||
x,
|
None,
|
||||||
y,
|
x,
|
||||||
None,
|
y,
|
||||||
None,
|
None,
|
||||||
self.base.scale,
|
None,
|
||||||
Some(&bounds),
|
self.base.scale,
|
||||||
None,
|
Some(&bounds),
|
||||||
AcquireSync::None,
|
None,
|
||||||
ReleaseSync::None,
|
AcquireSync::None,
|
||||||
false,
|
ReleaseSync::None,
|
||||||
srgb_srgb,
|
false,
|
||||||
);
|
srgb_srgb,
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
let body = Rect::new_sized(
|
let body = Rect::new_sized(
|
||||||
x + bw,
|
x + bw,
|
||||||
|
|
|
||||||
|
|
@ -199,10 +199,10 @@ impl RendererBase<'_> {
|
||||||
let mut target_x = [x, x + twidth];
|
let mut target_x = [x, x + twidth];
|
||||||
let mut target_y = [y, y + theight];
|
let mut target_y = [y, y + theight];
|
||||||
|
|
||||||
if let Some(bounds) = bounds {
|
if let Some(bounds) = bounds
|
||||||
if bound_target(&mut target_x, &mut target_y, &mut texcoord, bounds) {
|
&& bound_target(&mut target_x, &mut target_y, &mut texcoord, bounds)
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let target = FramebufferRect::new(
|
let target = FramebufferRect::new(
|
||||||
|
|
|
||||||
93
src/state.rs
93
src/state.rs
|
|
@ -500,20 +500,20 @@ impl State {
|
||||||
}
|
}
|
||||||
if self.render_ctx.is_none() {
|
if self.render_ctx.is_none() {
|
||||||
for dev in self.drm_devs.lock().values() {
|
for dev in self.drm_devs.lock().values() {
|
||||||
if let Ok(version) = dev.dev.version() {
|
if let Ok(version) = dev.dev.version()
|
||||||
if version.name.contains_str("nvidia") {
|
&& version.name.contains_str("nvidia")
|
||||||
continue;
|
{
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
dev.make_render_device();
|
dev.make_render_device();
|
||||||
if self.render_ctx.is_some() {
|
if self.render_ctx.is_some() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.render_ctx.is_none() {
|
if self.render_ctx.is_none()
|
||||||
if let Some(dev) = self.drm_devs.lock().values().next() {
|
&& let Some(dev) = self.drm_devs.lock().values().next()
|
||||||
dev.make_render_device();
|
{
|
||||||
}
|
dev.make_render_device();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -600,20 +600,21 @@ impl State {
|
||||||
cursor_user_groups.render_ctx_changed();
|
cursor_user_groups.render_ctx_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ctx) = &ctx {
|
if let Some(ctx) = &ctx
|
||||||
if !self.render_ctx_ever_initialized.replace(true) {
|
&& !self.render_ctx_ever_initialized.replace(true)
|
||||||
self.add_global(&Rc::new(WlDrmGlobal::new(self.globals.name())));
|
{
|
||||||
self.add_global(&Rc::new(ZwpLinuxDmabufV1Global::new(self.globals.name())));
|
self.add_global(&Rc::new(WlDrmGlobal::new(self.globals.name())));
|
||||||
if let Some(ctx) = ctx.sync_obj_ctx() {
|
self.add_global(&Rc::new(ZwpLinuxDmabufV1Global::new(self.globals.name())));
|
||||||
if ctx.supports_async_wait() && self.explicit_sync_enabled.get() {
|
if let Some(ctx) = ctx.sync_obj_ctx()
|
||||||
self.add_global(&Rc::new(WpLinuxDrmSyncobjManagerV1Global::new(
|
&& ctx.supports_async_wait()
|
||||||
self.globals.name(),
|
&& self.explicit_sync_enabled.get()
|
||||||
)));
|
{
|
||||||
}
|
self.add_global(&Rc::new(WpLinuxDrmSyncobjManagerV1Global::new(
|
||||||
}
|
self.globals.name(),
|
||||||
if let Some(config) = self.config.get() {
|
)));
|
||||||
config.graphics_initialized();
|
}
|
||||||
}
|
if let Some(config) = self.config.get() {
|
||||||
|
config.graphics_initialized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -761,10 +762,10 @@ impl State {
|
||||||
let Some(seat) = seat else {
|
let Some(seat) = seat else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
if let Some(config) = self.config.get() {
|
if let Some(config) = self.config.get()
|
||||||
if !config.auto_focus(node.tl_data()) {
|
&& !config.auto_focus(node.tl_data())
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
node.node_do_focus(&seat, Direction::Unspecified);
|
node.node_do_focus(&seat, Direction::Unspecified);
|
||||||
}
|
}
|
||||||
|
|
@ -856,11 +857,11 @@ impl State {
|
||||||
if let Some(client) = client {
|
if let Some(client) = client {
|
||||||
'update_range: {
|
'update_range: {
|
||||||
let mut serials = client.serials.borrow_mut();
|
let mut serials = client.serials.borrow_mut();
|
||||||
if let Some(last) = serials.back_mut() {
|
if let Some(last) = serials.back_mut()
|
||||||
if last.hi.wrapping_add(1) == serial {
|
&& last.hi.wrapping_add(1) == serial
|
||||||
last.hi = serial;
|
{
|
||||||
break 'update_range;
|
last.hi = serial;
|
||||||
}
|
break 'update_range;
|
||||||
}
|
}
|
||||||
if serials.len() >= NUM_CACHED_SERIAL_RANGES {
|
if serials.len() >= NUM_CACHED_SERIAL_RANGES {
|
||||||
serials.pop_front();
|
serials.pop_front();
|
||||||
|
|
@ -1002,11 +1003,11 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn refresh_hardware_cursors(&self) {
|
pub fn refresh_hardware_cursors(&self) {
|
||||||
if let Some(g) = self.cursor_user_group_hardware_cursor.get() {
|
if let Some(g) = self.cursor_user_group_hardware_cursor.get()
|
||||||
if let Some(u) = g.active() {
|
&& let Some(u) = g.active()
|
||||||
u.update_hardware_cursor();
|
{
|
||||||
return;
|
u.update_hardware_cursor();
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
self.damage_hardware_cursors(false)
|
self.damage_hardware_cursors(false)
|
||||||
}
|
}
|
||||||
|
|
@ -1122,17 +1123,15 @@ impl State {
|
||||||
false,
|
false,
|
||||||
src_cd,
|
src_cd,
|
||||||
);
|
);
|
||||||
if render_hardware_cursors {
|
if render_hardware_cursors
|
||||||
if let Some(cursor_user_group) = self.cursor_user_group_hardware_cursor.get() {
|
&& let Some(cursor_user_group) = self.cursor_user_group_hardware_cursor.get()
|
||||||
if let Some(cursor_user) = cursor_user_group.active() {
|
&& let Some(cursor_user) = cursor_user_group.active()
|
||||||
if let Some(cursor) = cursor_user.get() {
|
&& let Some(cursor) = cursor_user.get()
|
||||||
let (mut x, mut y) = cursor_user.position();
|
{
|
||||||
x = x + x_off - Fixed::from_int(position.x1());
|
let (mut x, mut y) = cursor_user.position();
|
||||||
y = y + y_off - Fixed::from_int(position.y1());
|
x = x + x_off - Fixed::from_int(position.x1());
|
||||||
cursor.render(&mut renderer, x, y);
|
y = y + y_off - Fixed::from_int(position.y1());
|
||||||
}
|
cursor.render(&mut renderer, x, y);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
target.render(
|
target.render(
|
||||||
target_acquire_sync,
|
target_acquire_sync,
|
||||||
|
|
|
||||||
16
src/text.rs
16
src/text.rs
|
|
@ -504,10 +504,10 @@ impl CpuJob for RenderJob {
|
||||||
data.complete(Ok(()));
|
data.complete(Ok(()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Some(t) = &tex {
|
if let Some(t) = &tex
|
||||||
if !t.compatible_with(ARGB8888, rt.width, rt.height, rt.stride) {
|
&& !t.compatible_with(ARGB8888, rt.width, rt.height, rt.stride)
|
||||||
tex = None;
|
{
|
||||||
}
|
tex = None;
|
||||||
}
|
}
|
||||||
let tex = match tex {
|
let tex = match tex {
|
||||||
Some(t) => t,
|
Some(t) => t,
|
||||||
|
|
@ -527,10 +527,10 @@ impl CpuJob for RenderJob {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut staging_opt = data.staging.take();
|
let mut staging_opt = data.staging.take();
|
||||||
if let Some(staging) = &staging_opt {
|
if let Some(staging) = &staging_opt
|
||||||
if staging.size() != tex.staging_size() {
|
&& staging.size() != tex.staging_size()
|
||||||
staging_opt = None;
|
{
|
||||||
}
|
staging_opt = None;
|
||||||
}
|
}
|
||||||
let staging = match staging_opt {
|
let staging = match staging_opt {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
|
|
|
||||||
|
|
@ -593,12 +593,12 @@ impl ContainerNode {
|
||||||
if let Some(op) = &seat_state.op {
|
if let Some(op) = &seat_state.op {
|
||||||
match op.kind {
|
match op.kind {
|
||||||
SeatOpKind::Move => {
|
SeatOpKind::Move => {
|
||||||
if let CursorType::Seat(_) = id {
|
if let CursorType::Seat(_) = id
|
||||||
if self.state.ui_drag_threshold_reached((x, y), (op.x, op.y)) {
|
&& self.state.ui_drag_threshold_reached((x, y), (op.x, op.y))
|
||||||
let node = op.child.node.clone();
|
{
|
||||||
drop(seats);
|
let node = op.child.node.clone();
|
||||||
seat.start_tile_drag(&node);
|
drop(seats);
|
||||||
}
|
seat.start_tile_drag(&node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SeatOpKind::Resize {
|
SeatOpKind::Resize {
|
||||||
|
|
@ -1004,13 +1004,14 @@ impl ContainerNode {
|
||||||
pub fn move_child(self: Rc<Self>, child: Rc<dyn ToplevelNode>, direction: Direction) {
|
pub fn move_child(self: Rc<Self>, child: Rc<dyn ToplevelNode>, direction: Direction) {
|
||||||
// CASE 1: This is the only child of the container. Replace the container by the child.
|
// CASE 1: This is the only child of the container. Replace the container by the child.
|
||||||
if self.num_children.get() == 1 {
|
if self.num_children.get() == 1 {
|
||||||
if let Some(parent) = self.toplevel_data.parent.get() {
|
if let Some(parent) = self.toplevel_data.parent.get()
|
||||||
if !self.toplevel_data.is_fullscreen.get() && parent.cnode_accepts_child(&*child) {
|
&& !self.toplevel_data.is_fullscreen.get()
|
||||||
parent.cnode_replace_child(self.deref(), child.clone());
|
&& parent.cnode_accepts_child(&*child)
|
||||||
self.toplevel_data.parent.take();
|
{
|
||||||
self.child_nodes.borrow_mut().clear();
|
parent.cnode_replace_child(self.deref(), child.clone());
|
||||||
self.tl_destroy();
|
self.toplevel_data.parent.take();
|
||||||
}
|
self.child_nodes.borrow_mut().clear();
|
||||||
|
self.tl_destroy();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1028,17 +1029,17 @@ impl ContainerNode {
|
||||||
false => cc.next(),
|
false => cc.next(),
|
||||||
};
|
};
|
||||||
if let Some(neighbor) = neighbor {
|
if let Some(neighbor) = neighbor {
|
||||||
if let Some(cn) = neighbor.node.clone().node_into_container() {
|
if let Some(cn) = neighbor.node.clone().node_into_container()
|
||||||
if cn.cnode_accepts_child(&*child) {
|
&& cn.cnode_accepts_child(&*child)
|
||||||
if let Some(mc) = self.mono_child.get() {
|
{
|
||||||
if mc.node.node_id() == child.node_id() {
|
if let Some(mc) = self.mono_child.get()
|
||||||
self.activate_child2(&neighbor, true);
|
&& mc.node.node_id() == child.node_id()
|
||||||
}
|
{
|
||||||
}
|
self.activate_child2(&neighbor, true);
|
||||||
self.cnode_remove_child2(&*child, true);
|
|
||||||
cn.insert_child(child, direction);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
self.cnode_remove_child2(&*child, true);
|
||||||
|
cn.insert_child(child, direction);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
match prev {
|
match prev {
|
||||||
true => neighbor.prepend_existing(&cc),
|
true => neighbor.prepend_existing(&cc),
|
||||||
|
|
@ -1118,11 +1119,11 @@ impl ContainerNode {
|
||||||
let rect = Rect::new(0, 0, width, height).unwrap();
|
let rect = Rect::new(0, 0, width, height).unwrap();
|
||||||
node.content.set(rect);
|
node.content.set(rect);
|
||||||
node.position_content();
|
node.position_content();
|
||||||
if let Some(mono) = self.mono_child.get() {
|
if let Some(mono) = self.mono_child.get()
|
||||||
if mono.node.node_id() == node.node.node_id() {
|
&& mono.node.node_id() == node.node.node_id()
|
||||||
let body = self.mono_body.get();
|
{
|
||||||
self.mono_content.set(rect.at_point(body.x1(), body.y1()));
|
let body = self.mono_body.get();
|
||||||
}
|
self.mono_content.set(rect.at_point(body.x1(), body.y1()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1154,10 +1155,8 @@ impl ContainerNode {
|
||||||
if set || propagate {
|
if set || propagate {
|
||||||
self.toplevel_data.set_wants_attention(set);
|
self.toplevel_data.set_wants_attention(set);
|
||||||
}
|
}
|
||||||
if propagate {
|
if propagate && let Some(parent) = self.toplevel_data.parent.get() {
|
||||||
if let Some(parent) = self.toplevel_data.parent.get() {
|
parent.cnode_child_attention_request_changed(self, set);
|
||||||
parent.cnode_child_attention_request_changed(self, set);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1751,10 +1750,10 @@ impl Node for ContainerNode {
|
||||||
) {
|
) {
|
||||||
let id = CursorType::TabletTool(tool.id);
|
let id = CursorType::TabletTool(tool.id);
|
||||||
self.pointer_move(tool.seat(), id, tool.cursor(), x, y, false);
|
self.pointer_move(tool.seat(), id, tool.cursor(), x, y, false);
|
||||||
if let Some(changes) = changes {
|
if let Some(changes) = changes
|
||||||
if let Some(pressed) = changes.down {
|
&& let Some(pressed) = changes.down
|
||||||
self.button(id, tool.seat(), time_usec, pressed, BTN_LEFT);
|
{
|
||||||
}
|
self.button(id, tool.seat(), time_usec, pressed, BTN_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2047,14 +2046,13 @@ impl ContainingNode for ContainerNode {
|
||||||
if bottom_outside {
|
if bottom_outside {
|
||||||
y2 = new_y2.map(|v| v.max(y1.unwrap_or(pos.y1()) + th + 1));
|
y2 = new_y2.map(|v| v.max(y1.unwrap_or(pos.y1()) + th + 1));
|
||||||
}
|
}
|
||||||
if (x1.is_some() && x1 != Some(pos.x1()))
|
if ((x1.is_some() && x1 != Some(pos.x1()))
|
||||||
|| (x2.is_some() && x2 != Some(pos.x2()))
|
|| (x2.is_some() && x2 != Some(pos.x2()))
|
||||||
|| (y1.is_some() && y1 != Some(pos.y1()))
|
|| (y1.is_some() && y1 != Some(pos.y1()))
|
||||||
|| (y2.is_some() && y2 != Some(pos.y2()))
|
|| (y2.is_some() && y2 != Some(pos.y2())))
|
||||||
|
&& let Some(parent) = self.toplevel_data.parent.get()
|
||||||
{
|
{
|
||||||
if let Some(parent) = self.toplevel_data.parent.get() {
|
parent.cnode_resize_child(&*self, x1, y1, x2, y2);
|
||||||
parent.cnode_resize_child(&*self, x1, y1, x2, y2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -426,10 +426,8 @@ impl FloatNode {
|
||||||
if update_visible {
|
if update_visible {
|
||||||
self.stacked_set_visible(ws.float_visible());
|
self.stacked_set_visible(ws.float_visible());
|
||||||
}
|
}
|
||||||
if update_pinned {
|
if update_pinned && let Some(pl) = &*self.pinned_link.borrow_mut() {
|
||||||
if let Some(pl) = &*self.pinned_link.borrow_mut() {
|
ws.output.get().pinned.add_last_existing(pl);
|
||||||
ws.output.get().pinned.add_last_existing(pl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -588,10 +586,10 @@ impl FloatNode {
|
||||||
if !pressed {
|
if !pressed {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if cursor_data.op_type == OpType::Move {
|
if cursor_data.op_type == OpType::Move
|
||||||
if let Some(tl) = self.child.get() {
|
&& let Some(tl) = self.child.get()
|
||||||
tl.node_do_focus(seat, Direction::Unspecified);
|
{
|
||||||
}
|
tl.node_do_focus(seat, Direction::Unspecified);
|
||||||
}
|
}
|
||||||
if cursor_data.double_click_state.click(
|
if cursor_data.double_click_state.click(
|
||||||
&self.state,
|
&self.state,
|
||||||
|
|
@ -600,12 +598,11 @@ impl FloatNode {
|
||||||
cursor_data.y,
|
cursor_data.y,
|
||||||
) && cursor_data.op_type == OpType::Move
|
) && cursor_data.op_type == OpType::Move
|
||||||
&& !is_icon_press
|
&& !is_icon_press
|
||||||
|
&& let Some(tl) = self.child.get()
|
||||||
{
|
{
|
||||||
if let Some(tl) = self.child.get() {
|
drop(cursors);
|
||||||
drop(cursors);
|
toplevel_set_floating(&self.state, tl, false);
|
||||||
toplevel_set_floating(&self.state, tl, false);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
cursor_data.op_active = true;
|
cursor_data.op_active = true;
|
||||||
let pos = self.position.get();
|
let pos = self.position.get();
|
||||||
|
|
@ -830,16 +827,16 @@ impl Node for FloatNode {
|
||||||
y: Fixed,
|
y: Fixed,
|
||||||
) {
|
) {
|
||||||
self.pointer_move(CursorType::TabletTool(tool.id), tool.cursor(), x, y, false);
|
self.pointer_move(CursorType::TabletTool(tool.id), tool.cursor(), x, y, false);
|
||||||
if let Some(changes) = changes {
|
if let Some(changes) = changes
|
||||||
if let Some(pressed) = changes.down {
|
&& let Some(pressed) = changes.down
|
||||||
self.button(
|
{
|
||||||
CursorType::TabletTool(tool.id),
|
self.button(
|
||||||
tool.cursor(),
|
CursorType::TabletTool(tool.id),
|
||||||
tool.seat(),
|
tool.cursor(),
|
||||||
time_usec,
|
tool.seat(),
|
||||||
pressed,
|
time_usec,
|
||||||
);
|
pressed,
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1367,15 +1367,15 @@ impl Node for OutputNode {
|
||||||
usecase: FindTreeUsecase,
|
usecase: FindTreeUsecase,
|
||||||
) -> FindTreeResult {
|
) -> FindTreeResult {
|
||||||
if self.state.lock.locked.get() {
|
if self.state.lock.locked.get() {
|
||||||
if usecase != FindTreeUsecase::SelectToplevel {
|
if usecase != FindTreeUsecase::SelectToplevel
|
||||||
if let Some(ls) = self.lock_surface.get() {
|
&& let Some(ls) = self.lock_surface.get()
|
||||||
tree.push(FoundNode {
|
{
|
||||||
node: ls.clone(),
|
tree.push(FoundNode {
|
||||||
x,
|
node: ls.clone(),
|
||||||
y,
|
x,
|
||||||
});
|
y,
|
||||||
return ls.node_find_tree_at(x, y, tree, usecase);
|
});
|
||||||
}
|
return ls.node_find_tree_at(x, y, tree, usecase);
|
||||||
}
|
}
|
||||||
return FindTreeResult::AcceptsInput;
|
return FindTreeResult::AcceptsInput;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -444,10 +444,11 @@ impl ToplevelData {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.changed_properties.set(props | change);
|
self.changed_properties.set(props | change);
|
||||||
if props.is_none() && change.is_some() {
|
if props.is_none()
|
||||||
if let Some(node) = self.slf.upgrade() {
|
&& change.is_some()
|
||||||
mgr.changed(node);
|
&& let Some(node) = self.slf.upgrade()
|
||||||
}
|
{
|
||||||
|
mgr.changed(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -878,10 +879,10 @@ pub fn default_tile_drag_bounds<T: ToplevelNodeBase + ?Sized>(t: &T, split: Cont
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toplevel_parent_container(tl: &dyn ToplevelNode) -> Option<Rc<ContainerNode>> {
|
pub fn toplevel_parent_container(tl: &dyn ToplevelNode) -> Option<Rc<ContainerNode>> {
|
||||||
if let Some(parent) = tl.tl_data().parent.get() {
|
if let Some(parent) = tl.tl_data().parent.get()
|
||||||
if let Some(container) = parent.node_into_container() {
|
&& let Some(container) = parent.node_into_container()
|
||||||
return Some(container);
|
{
|
||||||
}
|
return Some(container);
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,10 +228,10 @@ impl WorkspaceNode {
|
||||||
} else {
|
} else {
|
||||||
node.tl_set_visible(false);
|
node.tl_set_visible(false);
|
||||||
}
|
}
|
||||||
if let Some(surface) = node.tl_scanout_surface() {
|
if let Some(surface) = node.tl_scanout_surface()
|
||||||
if let Some(fb) = self.output.get().global.connector.connector.drm_feedback() {
|
&& let Some(fb) = self.output.get().global.connector.connector.drm_feedback()
|
||||||
surface.send_feedback(&fb);
|
{
|
||||||
}
|
surface.send_feedback(&fb);
|
||||||
}
|
}
|
||||||
self.output.get().update_presentation_type();
|
self.output.get().update_presentation_type();
|
||||||
}
|
}
|
||||||
|
|
@ -242,10 +242,10 @@ impl WorkspaceNode {
|
||||||
if self.visible.get() {
|
if self.visible.get() {
|
||||||
self.output.get().fullscreen_changed();
|
self.output.get().fullscreen_changed();
|
||||||
}
|
}
|
||||||
if let Some(surface) = node.tl_scanout_surface() {
|
if let Some(surface) = node.tl_scanout_surface()
|
||||||
if let Some(fb) = surface.client.state.drm_feedback.get() {
|
&& let Some(fb) = surface.client.state.drm_feedback.get()
|
||||||
surface.send_feedback(&fb);
|
{
|
||||||
}
|
surface.send_feedback(&fb);
|
||||||
}
|
}
|
||||||
self.output.get().update_presentation_type();
|
self.output.get().update_presentation_type();
|
||||||
}
|
}
|
||||||
|
|
@ -376,36 +376,36 @@ impl Node for WorkspaceNode {
|
||||||
|
|
||||||
impl ContainingNode for WorkspaceNode {
|
impl ContainingNode for WorkspaceNode {
|
||||||
fn cnode_replace_child(self: Rc<Self>, old: &dyn Node, new: Rc<dyn ToplevelNode>) {
|
fn cnode_replace_child(self: Rc<Self>, old: &dyn Node, new: Rc<dyn ToplevelNode>) {
|
||||||
if let Some(container) = self.container.get() {
|
if let Some(container) = self.container.get()
|
||||||
if container.node_id() == old.node_id() {
|
&& container.node_id() == old.node_id()
|
||||||
let new = match new.node_into_container() {
|
{
|
||||||
Some(c) => c,
|
let new = match new.node_into_container() {
|
||||||
_ => {
|
Some(c) => c,
|
||||||
log::error!("cnode_replace_child called with non-container new");
|
_ => {
|
||||||
return;
|
log::error!("cnode_replace_child called with non-container new");
|
||||||
}
|
return;
|
||||||
};
|
}
|
||||||
self.set_container(&new);
|
};
|
||||||
return;
|
self.set_container(&new);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
log::error!("Trying to replace child that's not a child");
|
log::error!("Trying to replace child that's not a child");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cnode_remove_child2(self: Rc<Self>, child: &dyn Node, _preserve_focus: bool) {
|
fn cnode_remove_child2(self: Rc<Self>, child: &dyn Node, _preserve_focus: bool) {
|
||||||
if let Some(container) = self.container.get() {
|
if let Some(container) = self.container.get()
|
||||||
if container.node_id() == child.node_id() {
|
&& container.node_id() == child.node_id()
|
||||||
self.discard_child_properties(&*container);
|
{
|
||||||
self.container.set(None);
|
self.discard_child_properties(&*container);
|
||||||
self.state.damage(self.position.get());
|
self.container.set(None);
|
||||||
return;
|
self.state.damage(self.position.get());
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
if let Some(fs) = self.fullscreen.get() {
|
if let Some(fs) = self.fullscreen.get()
|
||||||
if fs.node_id() == child.node_id() {
|
&& fs.node_id() == child.node_id()
|
||||||
self.remove_fullscreen_node();
|
{
|
||||||
return;
|
self.remove_fullscreen_node();
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
log::error!("Trying to remove child that's not a child");
|
log::error!("Trying to remove child that's not a child");
|
||||||
}
|
}
|
||||||
|
|
@ -436,10 +436,10 @@ pub fn move_ws_to_output(
|
||||||
config: WsMoveConfig,
|
config: WsMoveConfig,
|
||||||
) {
|
) {
|
||||||
let source = ws.output.get();
|
let source = ws.output.get();
|
||||||
if let Some(visible) = source.workspace.get() {
|
if let Some(visible) = source.workspace.get()
|
||||||
if visible.id == ws.id {
|
&& visible.id == ws.id
|
||||||
source.workspace.take();
|
{
|
||||||
}
|
source.workspace.take();
|
||||||
}
|
}
|
||||||
let mut new_source_ws = None;
|
let mut new_source_ws = None;
|
||||||
if !config.source_is_destroyed && !source.is_dummy && source.workspace.is_none() {
|
if !config.source_is_destroyed && !source.is_dummy && source.workspace.is_none() {
|
||||||
|
|
@ -459,11 +459,11 @@ pub fn move_ws_to_output(
|
||||||
}
|
}
|
||||||
ws.set_output(&target);
|
ws.set_output(&target);
|
||||||
'link: {
|
'link: {
|
||||||
if let Some(before) = config.before {
|
if let Some(before) = config.before
|
||||||
if let Some(link) = &*before.output_link.borrow() {
|
&& let Some(link) = &*before.output_link.borrow()
|
||||||
link.prepend_existing(ws);
|
{
|
||||||
break 'link;
|
link.prepend_existing(ws);
|
||||||
}
|
break 'link;
|
||||||
}
|
}
|
||||||
target.workspaces.add_last_existing(&ws);
|
target.workspaces.add_last_existing(&ws);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ impl AsyncEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trigger(&self) {
|
pub fn trigger(&self) {
|
||||||
if self.triggers.fetch_add(1) == 0 {
|
if self.triggers.fetch_add(1) == 0
|
||||||
if let Some(waker) = self.waker.take() {
|
&& let Some(waker) = self.waker.take()
|
||||||
waker.wake();
|
{
|
||||||
}
|
waker.wake();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,13 +133,12 @@ pub fn double_fork() -> Result<Option<OwnedFd>, ForkerError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ensure_reaper() -> c::pid_t {
|
pub fn ensure_reaper() -> c::pid_t {
|
||||||
if let Ok(id) = env::var(REAPER_VAR) {
|
if let Ok(id) = env::var(REAPER_VAR)
|
||||||
if let Ok(id) = c::pid_t::from_str(&id) {
|
&& let Ok(id) = c::pid_t::from_str(&id)
|
||||||
if uapi::getppid() == id {
|
&& uapi::getppid() == id
|
||||||
set_deathsig();
|
{
|
||||||
return id;
|
set_deathsig();
|
||||||
}
|
return id;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let reaper_pid = uapi::getpid();
|
let reaper_pid = uapi::getpid();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
||||||
|
|
@ -165,10 +165,8 @@ fn reopen(fd: c::c_int, need_primary: bool) -> Result<Rc<OwnedFd>, DrmError> {
|
||||||
if get_node_type_from_fd(fd).map_err(DrmError::GetDeviceType)? == NodeType::Render {
|
if get_node_type_from_fd(fd).map_err(DrmError::GetDeviceType)? == NodeType::Render {
|
||||||
break 'path uapi::format_ustr!("/proc/self/fd/{}", fd);
|
break 'path uapi::format_ustr!("/proc/self/fd/{}", fd);
|
||||||
}
|
}
|
||||||
if !need_primary {
|
if !need_primary && let Ok(path) = render_node_name(fd) {
|
||||||
if let Ok(path) = render_node_name(fd) {
|
break 'path path;
|
||||||
break 'path path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
device_node_name(fd)?
|
device_node_name(fd)?
|
||||||
};
|
};
|
||||||
|
|
@ -441,10 +439,10 @@ impl DrmMaster {
|
||||||
Err(e) => return Err(DrmError::GemHandle(e)),
|
Err(e) => return Err(DrmError::GemHandle(e)),
|
||||||
};
|
};
|
||||||
let mut handles = self.gem_handles.borrow_mut();
|
let mut handles = self.gem_handles.borrow_mut();
|
||||||
if let Some(h) = handles.get(&handle) {
|
if let Some(h) = handles.get(&handle)
|
||||||
if let Some(h) = h.upgrade() {
|
&& let Some(h) = h.upgrade()
|
||||||
return Ok(h);
|
{
|
||||||
}
|
return Ok(h);
|
||||||
}
|
}
|
||||||
let h = Rc::new(GemHandle {
|
let h = Rc::new(GemHandle {
|
||||||
master: self.clone(),
|
master: self.clone(),
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,11 @@ impl JaySelectToplevelEventHandler for UsrJaySelectToplevel {
|
||||||
Some(tl)
|
Some(tl)
|
||||||
};
|
};
|
||||||
'send: {
|
'send: {
|
||||||
if self.version >= ID_SINCE {
|
if self.version >= ID_SINCE
|
||||||
if let Some(tl) = tl {
|
&& let Some(tl) = tl
|
||||||
tl.owner.set(Some(slf.clone()));
|
{
|
||||||
break 'send;
|
tl.owner.set(Some(slf.clone()));
|
||||||
}
|
break 'send;
|
||||||
}
|
}
|
||||||
self.send(tl);
|
self.send(tl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,10 @@ impl ZwpLinuxDmabufV1EventHandler for UsrLinuxDmabuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn modifier(&self, ev: Modifier, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
fn modifier(&self, ev: Modifier, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||||
if let Some(owner) = self.owner.get() {
|
if let Some(owner) = self.owner.get()
|
||||||
if let Some(format) = formats().get(&ev.format) {
|
&& let Some(format) = formats().get(&ev.format)
|
||||||
owner.modifier(format, ev.modifier);
|
{
|
||||||
}
|
owner.modifier(format, ev.modifier);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,13 +102,13 @@ impl Incoming {
|
||||||
Some(e) => XconError::ExtensionError(e, code),
|
Some(e) => XconError::ExtensionError(e, code),
|
||||||
_ => XconError::CoreError(code),
|
_ => XconError::CoreError(code),
|
||||||
};
|
};
|
||||||
if let Some(first) = reply_handlers.front() {
|
if let Some(first) = reply_handlers.front()
|
||||||
if first.serial() == serial {
|
&& first.serial() == serial
|
||||||
let handler = reply_handlers.pop_front().unwrap();
|
{
|
||||||
drop(reply_handlers);
|
let handler = reply_handlers.pop_front().unwrap();
|
||||||
handler.handle_error(e);
|
drop(reply_handlers);
|
||||||
break 'handle_error;
|
handler.handle_error(e);
|
||||||
}
|
break 'handle_error;
|
||||||
}
|
}
|
||||||
log::error!(
|
log::error!(
|
||||||
"Received an error with no corresponding handler: {}",
|
"Received an error with no corresponding handler: {}",
|
||||||
|
|
@ -116,36 +116,32 @@ impl Incoming {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
1 => {
|
1 => {
|
||||||
if let Some(first) = reply_handlers.front() {
|
if let Some(first) = reply_handlers.front()
|
||||||
if first.serial() == serial {
|
&& first.serial() == serial
|
||||||
let handler = reply_handlers.pop_front().unwrap();
|
{
|
||||||
drop(reply_handlers);
|
let handler = reply_handlers.pop_front().unwrap();
|
||||||
let mut fds = vec![];
|
drop(reply_handlers);
|
||||||
if handler.has_fds() {
|
let mut fds = vec![];
|
||||||
let num_fds = msg_buf[1] as usize;
|
if handler.has_fds() {
|
||||||
if self.incoming.fds.len() < num_fds {
|
let num_fds = msg_buf[1] as usize;
|
||||||
return Err(XconError::MissingFds);
|
if self.incoming.fds.len() < num_fds {
|
||||||
}
|
return Err(XconError::MissingFds);
|
||||||
fds.extend(self.incoming.fds.drain(..num_fds));
|
|
||||||
}
|
}
|
||||||
let length =
|
fds.extend(self.incoming.fds.drain(..num_fds));
|
||||||
u32::from_ne_bytes([msg_buf[4], msg_buf[5], msg_buf[6], msg_buf[7]])
|
|
||||||
as usize;
|
|
||||||
if length > MAX_LENGTH_UNITS {
|
|
||||||
return Err(XconError::ExcessiveMessageSize);
|
|
||||||
}
|
|
||||||
let length = length * 4;
|
|
||||||
self.incoming.fill_msg_buf(length, &mut msg_buf).await?;
|
|
||||||
let mut parser = unsafe {
|
|
||||||
let msg_buf = mem::transmute::<&[u8], &'static [u8]>(&msg_buf[..]);
|
|
||||||
Parser::new(msg_buf, fds)
|
|
||||||
};
|
|
||||||
handler.handle_result(
|
|
||||||
&self.socket,
|
|
||||||
&mut parser,
|
|
||||||
mem::take(&mut msg_buf),
|
|
||||||
)?;
|
|
||||||
}
|
}
|
||||||
|
let length =
|
||||||
|
u32::from_ne_bytes([msg_buf[4], msg_buf[5], msg_buf[6], msg_buf[7]])
|
||||||
|
as usize;
|
||||||
|
if length > MAX_LENGTH_UNITS {
|
||||||
|
return Err(XconError::ExcessiveMessageSize);
|
||||||
|
}
|
||||||
|
let length = length * 4;
|
||||||
|
self.incoming.fill_msg_buf(length, &mut msg_buf).await?;
|
||||||
|
let mut parser = unsafe {
|
||||||
|
let msg_buf = mem::transmute::<&[u8], &'static [u8]>(&msg_buf[..]);
|
||||||
|
Parser::new(msg_buf, fds)
|
||||||
|
};
|
||||||
|
handler.handle_result(&self.socket, &mut parser, mem::take(&mut msg_buf))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ev => 'handle_event: {
|
ev => 'handle_event: {
|
||||||
|
|
|
||||||
|
|
@ -185,10 +185,10 @@ impl<T: XIpc> SelectionData<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn seat_removed(&self, id: SeatId) {
|
fn seat_removed(&self, id: SeatId) {
|
||||||
if let Some(offer) = self.active_offer.get() {
|
if let Some(offer) = self.active_offer.get()
|
||||||
if offer.offer.get_seat().id() == id {
|
&& offer.offer.get_seat().id() == id
|
||||||
self.active_offer.take();
|
{
|
||||||
}
|
self.active_offer.take();
|
||||||
}
|
}
|
||||||
self.offers.remove(&id);
|
self.offers.remove(&id);
|
||||||
self.sources.remove(&id);
|
self.sources.remove(&id);
|
||||||
|
|
@ -782,10 +782,10 @@ impl Wm {
|
||||||
destroy_data_offer::<T>(&offer);
|
destroy_data_offer::<T>(&offer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if !enhanced.active.replace(true) {
|
if !enhanced.active.replace(true)
|
||||||
if let Some(old) = sd.active_offer.set(Some(enhanced)) {
|
&& let Some(old) = sd.active_offer.set(Some(enhanced))
|
||||||
old.active.set(false);
|
{
|
||||||
}
|
old.active.set(false);
|
||||||
}
|
}
|
||||||
let so = SetSelectionOwner {
|
let so = SetSelectionOwner {
|
||||||
owner: sd.win.get(),
|
owner: sd.win.get(),
|
||||||
|
|
@ -895,11 +895,11 @@ impl Wm {
|
||||||
seat: SeatId,
|
seat: SeatId,
|
||||||
source: DataSourceId,
|
source: DataSourceId,
|
||||||
) {
|
) {
|
||||||
if let Some(cur) = sd.sources.get(&seat) {
|
if let Some(cur) = sd.sources.get(&seat)
|
||||||
if cur.source_data().id == source {
|
&& cur.source_data().id == source
|
||||||
sd.sources.remove(&seat);
|
{
|
||||||
destroy_data_source::<T>(&cur);
|
sd.sources.remove(&seat);
|
||||||
}
|
destroy_data_source::<T>(&cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1010,12 +1010,12 @@ impl Wm {
|
||||||
// log::info!("xwm or => return");
|
// log::info!("xwm or => return");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if initiator == Initiator::X {
|
if initiator == Initiator::X
|
||||||
if let Some(window) = window.window.get() {
|
&& let Some(window) = window.window.get()
|
||||||
let seats = self.state.globals.seats.lock();
|
{
|
||||||
for seat in seats.values() {
|
let seats = self.state.globals.seats.lock();
|
||||||
seat.focus_toplevel(window.clone());
|
for seat in seats.values() {
|
||||||
}
|
seat.focus_toplevel(window.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if send_to_x {
|
if send_to_x {
|
||||||
|
|
@ -1237,15 +1237,15 @@ impl Wm {
|
||||||
if let Some(old) = data.parent.take() {
|
if let Some(old) = data.parent.take() {
|
||||||
old.children.remove(&data.window_id);
|
old.children.remove(&data.window_id);
|
||||||
}
|
}
|
||||||
if let Some(w) = buf.first() {
|
if let Some(w) = buf.first()
|
||||||
if let Some(w) = self.windows.get(w) {
|
&& let Some(w) = self.windows.get(w)
|
||||||
if data.is_ancestor_of(w.clone()) {
|
{
|
||||||
log::error!("Cannot set WM_TRANSIENT_FOR because it would create a cycle");
|
if data.is_ancestor_of(w.clone()) {
|
||||||
return;
|
log::error!("Cannot set WM_TRANSIENT_FOR because it would create a cycle");
|
||||||
}
|
return;
|
||||||
w.children.set(data.window_id, data.clone());
|
|
||||||
data.parent.set(Some(w.clone()));
|
|
||||||
}
|
}
|
||||||
|
w.children.set(data.window_id, data.clone());
|
||||||
|
data.parent.set(Some(w.clone()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1506,11 +1506,11 @@ impl Wm {
|
||||||
};
|
};
|
||||||
if let Ok(res) = self.c.call(&c).await {
|
if let Ok(res) = self.c.call(&c).await {
|
||||||
for id in res.get().ids.iter() {
|
for id in res.get().ids.iter() {
|
||||||
if id.spec.mask.contains(RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID) {
|
if id.spec.mask.contains(RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID)
|
||||||
if let Some(first) = id.value.first() {
|
&& let Some(first) = id.value.first()
|
||||||
data.info.pid.set(Some(*first));
|
{
|
||||||
break;
|
data.info.pid.set(Some(*first));
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1886,21 +1886,20 @@ impl Wm {
|
||||||
let new_window = self.windows.get(&event.event);
|
let new_window = self.windows.get(&event.event);
|
||||||
let mut focus_window = self.focus_window.as_ref();
|
let mut focus_window = self.focus_window.as_ref();
|
||||||
let mut send_to_x = true;
|
let mut send_to_x = true;
|
||||||
if let Some(window) = new_window {
|
if let Some(window) = new_window
|
||||||
if let Some(w) = window.window.get() {
|
&& let Some(w) = window.window.get()
|
||||||
if let Some(prev) = focus_window {
|
&& let Some(prev) = focus_window
|
||||||
let prev_pid = prev.info.pid.get();
|
{
|
||||||
let new_pid = window.info.pid.get();
|
let prev_pid = prev.info.pid.get();
|
||||||
if prev_pid.is_some()
|
let new_pid = window.info.pid.get();
|
||||||
&& prev_pid == new_pid
|
if prev_pid.is_some()
|
||||||
&& revent.serial() >= self.last_input_serial
|
&& prev_pid == new_pid
|
||||||
&& w.x.surface.node_visible()
|
&& revent.serial() >= self.last_input_serial
|
||||||
{
|
&& w.x.surface.node_visible()
|
||||||
// log::info!("xwm ACCEPT");
|
{
|
||||||
focus_window = new_window;
|
// log::info!("xwm ACCEPT");
|
||||||
send_to_x = false;
|
focus_window = new_window;
|
||||||
}
|
send_to_x = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let fw = focus_window.cloned();
|
let fw = focus_window.cloned();
|
||||||
|
|
@ -2132,13 +2131,12 @@ impl Wm {
|
||||||
|
|
||||||
fn update_override_redirect(&self, data: &Rc<XwindowData>, or: u8) {
|
fn update_override_redirect(&self, data: &Rc<XwindowData>, or: u8) {
|
||||||
let or = or != 0;
|
let or = or != 0;
|
||||||
if data.info.override_redirect.replace(or) != or {
|
if data.info.override_redirect.replace(or) != or
|
||||||
// log::info!("xwin {} or {}", data.window_id, or);
|
&& let Some(window) = data.window.get()
|
||||||
if let Some(window) = data.window.get() {
|
{
|
||||||
window.tl_destroy();
|
window.tl_destroy();
|
||||||
window.update_toplevel();
|
window.update_toplevel();
|
||||||
window.map_status_changed();
|
window.map_status_changed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2283,10 +2281,10 @@ impl Wm {
|
||||||
Some(d) => d,
|
Some(d) => d,
|
||||||
_ => return Ok(()),
|
_ => return Ok(()),
|
||||||
};
|
};
|
||||||
if let Some(window) = data.window.get() {
|
if let Some(window) = data.window.get()
|
||||||
if window.is_mapped() {
|
&& window.is_mapped()
|
||||||
return Ok(());
|
{
|
||||||
}
|
return Ok(());
|
||||||
}
|
}
|
||||||
let de = data.info.pending_extents.get();
|
let de = data.info.pending_extents.get();
|
||||||
let mut x1 = de.x1();
|
let mut x1 = de.x1();
|
||||||
|
|
@ -2346,11 +2344,11 @@ impl Wm {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_minimize_requested(&self, data: &Rc<XwindowData>) -> bool {
|
async fn handle_minimize_requested(&self, data: &Rc<XwindowData>) -> bool {
|
||||||
if let Some(w) = data.window.get() {
|
if let Some(w) = data.window.get()
|
||||||
if w.toplevel_data.active_surfaces.active() {
|
&& w.toplevel_data.active_surfaces.active()
|
||||||
self.set_wm_state(data, ICCCM_WM_STATE_NORMAL).await;
|
{
|
||||||
return false;
|
self.set_wm_state(data, ICCCM_WM_STATE_NORMAL).await;
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
self.set_wm_state(data, ICCCM_WM_STATE_ICONIC).await;
|
self.set_wm_state(data, ICCCM_WM_STATE_ICONIC).await;
|
||||||
true
|
true
|
||||||
|
|
@ -2461,10 +2459,10 @@ impl Wm {
|
||||||
minimized = self.handle_minimize_requested(data).await;
|
minimized = self.handle_minimize_requested(data).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if fullscreen != data.info.fullscreen.get() {
|
if fullscreen != data.info.fullscreen.get()
|
||||||
if let Some(w) = data.window.get() {
|
&& let Some(w) = data.window.get()
|
||||||
w.tl_set_fullscreen(fullscreen, None);
|
{
|
||||||
}
|
w.tl_set_fullscreen(fullscreen, None);
|
||||||
}
|
}
|
||||||
data.info.fullscreen.set(fullscreen);
|
data.info.fullscreen.set(fullscreen);
|
||||||
data.info.maximized_horz.set(maximized_horz);
|
data.info.maximized_horz.set(maximized_horz);
|
||||||
|
|
|
||||||
|
|
@ -340,10 +340,10 @@ impl Parser for ConfigParser<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut window_management_key = None;
|
let mut window_management_key = None;
|
||||||
if let Some(value) = window_management_key_val {
|
if let Some(value) = window_management_key_val
|
||||||
if let Some(key) = parse_modified_keysym_str(self.0, value.span, value.value) {
|
&& let Some(key) = parse_modified_keysym_str(self.0, value.span, value.value)
|
||||||
window_management_key = Some(key);
|
{
|
||||||
}
|
window_management_key = Some(key);
|
||||||
}
|
}
|
||||||
let mut vrr = None;
|
let mut vrr = None;
|
||||||
if let Some(value) = vrr_val {
|
if let Some(value) = vrr_val {
|
||||||
|
|
|
||||||
|
|
@ -387,35 +387,35 @@ impl DrmDeviceMatch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(syspath) = syspath {
|
if let Some(syspath) = syspath
|
||||||
if d.syspath() != *syspath {
|
&& d.syspath() != *syspath
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(devnode) = devnode {
|
if let Some(devnode) = devnode
|
||||||
if d.devnode() != *devnode {
|
&& d.devnode() != *devnode
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(model) = model_name {
|
if let Some(model) = model_name
|
||||||
if d.model() != *model {
|
&& d.model() != *model
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(vendor) = vendor_name {
|
if let Some(vendor) = vendor_name
|
||||||
if d.vendor() != *vendor {
|
&& d.vendor() != *vendor
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(vendor) = vendor {
|
if let Some(vendor) = vendor
|
||||||
if d.pci_id().vendor != *vendor {
|
&& d.pci_id().vendor != *vendor
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(model) = model {
|
if let Some(model) = model
|
||||||
if d.pci_id().model != *model {
|
&& d.pci_id().model != *model
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -449,10 +449,10 @@ impl InputMatch {
|
||||||
is_gesture,
|
is_gesture,
|
||||||
is_switch,
|
is_switch,
|
||||||
} => {
|
} => {
|
||||||
if let Some(name) = name {
|
if let Some(name) = name
|
||||||
if d.name() != *name {
|
&& d.name() != *name
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(tag) = tag {
|
if let Some(tag) = tag {
|
||||||
let matches = apply_recursive_match(
|
let matches = apply_recursive_match(
|
||||||
|
|
@ -466,22 +466,22 @@ impl InputMatch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(syspath) = syspath {
|
if let Some(syspath) = syspath
|
||||||
if d.syspath() != *syspath {
|
&& d.syspath() != *syspath
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(devnode) = devnode {
|
if let Some(devnode) = devnode
|
||||||
if d.devnode() != *devnode {
|
&& d.devnode() != *devnode
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
macro_rules! check_cap {
|
macro_rules! check_cap {
|
||||||
($is:expr, $cap:ident) => {
|
($is:expr, $cap:ident) => {
|
||||||
if let Some(is) = *$is {
|
if let Some(is) = *$is
|
||||||
if d.has_capability(jay_config::input::capability::$cap) != is {
|
&& d.has_capability(jay_config::input::capability::$cap) != is
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -527,10 +527,10 @@ impl Input {
|
||||||
if let Some(v) = self.transform_matrix {
|
if let Some(v) = self.transform_matrix {
|
||||||
c.set_transform_matrix(v);
|
c.set_transform_matrix(v);
|
||||||
}
|
}
|
||||||
if let Some(v) = &self.keymap {
|
if let Some(v) = &self.keymap
|
||||||
if let Some(km) = state.get_keymap(v) {
|
&& let Some(km) = state.get_keymap(v)
|
||||||
c.set_keymap(km);
|
{
|
||||||
}
|
c.set_keymap(km);
|
||||||
}
|
}
|
||||||
if let Some(output) = &self.output {
|
if let Some(output) = &self.output {
|
||||||
if let Some(output) = output {
|
if let Some(output) = output {
|
||||||
|
|
@ -590,25 +590,25 @@ impl OutputMatch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(connector) = &connector {
|
if let Some(connector) = &connector
|
||||||
if c.name() != *connector {
|
&& c.name() != *connector
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(serial_number) = &serial_number {
|
if let Some(serial_number) = &serial_number
|
||||||
if c.serial_number() != *serial_number {
|
&& c.serial_number() != *serial_number
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(manufacturer) = &manufacturer {
|
if let Some(manufacturer) = &manufacturer
|
||||||
if c.manufacturer() != *manufacturer {
|
&& c.manufacturer() != *manufacturer
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(model) = &model {
|
if let Some(model) = &model
|
||||||
if c.model() != *model {
|
&& c.model() != *model
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -624,10 +624,10 @@ impl ConnectorMatch {
|
||||||
match self {
|
match self {
|
||||||
ConnectorMatch::Any(m) => m.iter().any(|m| m.matches(c)),
|
ConnectorMatch::Any(m) => m.iter().any(|m| m.matches(c)),
|
||||||
ConnectorMatch::All { connector } => {
|
ConnectorMatch::All { connector } => {
|
||||||
if let Some(connector) = &connector {
|
if let Some(connector) = &connector
|
||||||
if c.name() != *connector {
|
&& c.name() != *connector
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -679,10 +679,10 @@ impl Output {
|
||||||
c.set_vrr_cursor_hz(hz);
|
c.set_vrr_cursor_hz(hz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(tearing) = &self.tearing {
|
if let Some(tearing) = &self.tearing
|
||||||
if let Some(mode) = tearing.mode {
|
&& let Some(mode) = tearing.mode
|
||||||
c.set_tearing_mode(mode);
|
{
|
||||||
}
|
c.set_tearing_mode(mode);
|
||||||
}
|
}
|
||||||
if let Some(format) = self.format {
|
if let Some(format) = self.format {
|
||||||
c.set_format(format);
|
c.set_format(format);
|
||||||
|
|
@ -858,10 +858,10 @@ impl State {
|
||||||
let actions = actions.clone();
|
let actions = actions.clone();
|
||||||
dev.on_switch_event(move |ev| {
|
dev.on_switch_event(move |ev| {
|
||||||
for (match_, actions) in &*actions {
|
for (match_, actions) in &*actions {
|
||||||
if match_.matches(dev, &state) {
|
if match_.matches(dev, &state)
|
||||||
if let Some(action) = actions.get(&ev) {
|
&& let Some(action) = actions.get(&ev)
|
||||||
action();
|
{
|
||||||
}
|
action();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1214,10 +1214,10 @@ fn load_config(initial_load: bool, persistent: &Rc<PersistentState>) {
|
||||||
set_vrr_cursor_hz(hz);
|
set_vrr_cursor_hz(hz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(tearing) = config.tearing {
|
if let Some(tearing) = config.tearing
|
||||||
if let Some(mode) = tearing.mode {
|
&& let Some(mode) = tearing.mode
|
||||||
set_tearing_mode(mode);
|
{
|
||||||
}
|
set_tearing_mode(mode);
|
||||||
}
|
}
|
||||||
set_libei_socket_enabled(config.libei.enable_socket.unwrap_or(false));
|
set_libei_socket_enabled(config.libei.enable_socket.unwrap_or(false));
|
||||||
if let Some(enabled) = config.ui_drag.enabled {
|
if let Some(enabled) = config.ui_drag.enabled {
|
||||||
|
|
@ -1226,20 +1226,20 @@ fn load_config(initial_load: bool, persistent: &Rc<PersistentState>) {
|
||||||
if let Some(threshold) = config.ui_drag.threshold {
|
if let Some(threshold) = config.ui_drag.threshold {
|
||||||
set_ui_drag_threshold(threshold);
|
set_ui_drag_threshold(threshold);
|
||||||
}
|
}
|
||||||
if let Some(xwayland) = config.xwayland {
|
if let Some(xwayland) = config.xwayland
|
||||||
if let Some(mode) = xwayland.scaling_mode {
|
&& let Some(mode) = xwayland.scaling_mode
|
||||||
set_x_scaling_mode(mode);
|
{
|
||||||
}
|
set_x_scaling_mode(mode);
|
||||||
}
|
}
|
||||||
if let Some(cm) = config.color_management {
|
if let Some(cm) = config.color_management
|
||||||
if let Some(enabled) = cm.enabled {
|
&& let Some(enabled) = cm.enabled
|
||||||
set_color_management_enabled(enabled);
|
{
|
||||||
}
|
set_color_management_enabled(enabled);
|
||||||
}
|
}
|
||||||
if let Some(float) = config.float {
|
if let Some(float) = config.float
|
||||||
if let Some(show) = float.show_pin_icon {
|
&& let Some(show) = float.show_pin_icon
|
||||||
set_show_float_pin_icon(show);
|
{
|
||||||
}
|
set_show_float_pin_icon(show);
|
||||||
}
|
}
|
||||||
if let Some(key) = config.pointer_revert_key {
|
if let Some(key) = config.pointer_revert_key {
|
||||||
persistent.seat.set_pointer_revert_key(key);
|
persistent.seat.set_pointer_revert_key(key);
|
||||||
|
|
|
||||||
|
|
@ -179,16 +179,14 @@ impl<'a> Parser<'a, '_> {
|
||||||
b'u' => 4,
|
b'u' => 4,
|
||||||
_ => 8,
|
_ => 8,
|
||||||
};
|
};
|
||||||
if s.len() - pos >= len {
|
if s.len() - pos >= len
|
||||||
if let Ok(s) = std::str::from_utf8(&s[pos..pos + len]) {
|
&& let Ok(s) = std::str::from_utf8(&s[pos..pos + len])
|
||||||
if let Ok(n) = u32::from_str_radix(s, 16) {
|
&& let Ok(n) = u32::from_str_radix(s, 16)
|
||||||
if let Some(c) = char::from_u32(n) {
|
&& let Some(c) = char::from_u32(n)
|
||||||
pos += len;
|
{
|
||||||
let _ = write!(res, "{c}");
|
pos += len;
|
||||||
break 'unicode;
|
let _ = write!(res, "{c}");
|
||||||
}
|
break 'unicode;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
res.extend_from_slice(&s[pos - 2..]);
|
res.extend_from_slice(&s[pos - 2..]);
|
||||||
}
|
}
|
||||||
|
|
@ -322,11 +320,11 @@ impl<'a> Parser<'a, '_> {
|
||||||
fn parse_table_header(&mut self) -> Result<(Spanned<Key>, bool), Spanned<ParserError>> {
|
fn parse_table_header(&mut self) -> Result<(Spanned<Key>, bool), Spanned<ParserError>> {
|
||||||
let lo = self.next(false)?.span.lo;
|
let lo = self.next(false)?.span.lo;
|
||||||
let mut append = false;
|
let mut append = false;
|
||||||
if let Some(token) = self.lexer.peek(false) {
|
if let Some(token) = self.lexer.peek(false)
|
||||||
if token.value == Token::LeftBracket {
|
&& token.value == Token::LeftBracket
|
||||||
let _ = self.next(false);
|
{
|
||||||
append = true;
|
let _ = self.next(false);
|
||||||
}
|
append = true;
|
||||||
}
|
}
|
||||||
let key = self.parse_key()?;
|
let key = self.parse_key()?;
|
||||||
let mut hi = self.parse_exact(Token::RightBracket, false)?.hi;
|
let mut hi = self.parse_exact(Token::RightBracket, false)?.hi;
|
||||||
|
|
@ -366,21 +364,19 @@ impl<'a> Parser<'a, '_> {
|
||||||
if let RawEntryMut::Occupied(mut old) =
|
if let RawEntryMut::Occupied(mut old) =
|
||||||
dst.raw_entry_mut_v1().from_key(key.value.as_str())
|
dst.raw_entry_mut_v1().from_key(key.value.as_str())
|
||||||
{
|
{
|
||||||
if append_last {
|
if append_last && let Value::Array(array) = &mut old.get_mut().value {
|
||||||
if let Value::Array(array) = &mut old.get_mut().value {
|
array.push(value);
|
||||||
array.push(value);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if let Value::Table(old) = &mut old.get_mut().value {
|
if let Value::Table(old) = &mut old.get_mut().value
|
||||||
if let Value::Table(new) = value.value {
|
&& let Value::Table(new) = value.value
|
||||||
for (k, v) in new {
|
{
|
||||||
let mut keys = Key::new();
|
for (k, v) in new {
|
||||||
keys.push_back(k);
|
let mut keys = Key::new();
|
||||||
self.insert(old, &mut keys, v, false, false);
|
keys.push_back(k);
|
||||||
}
|
self.insert(old, &mut keys, v, false, false);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
self.error_handler
|
self.error_handler
|
||||||
.redefinition(ParserError::Redefined.spanned(key.span), old.key().span);
|
.redefinition(ParserError::Redefined.spanned(key.span), old.key().span);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue