chore: clippy
This commit is contained in:
parent
c13e52da04
commit
2ca99c670a
59 changed files with 1974 additions and 2137 deletions
|
|
@ -49,8 +49,9 @@ pub struct ScrollConfig {
|
||||||
pub scroll_factor: Option<f64>,
|
pub scroll_factor: Option<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum DeviceState {
|
pub enum DeviceState {
|
||||||
|
#[default]
|
||||||
Enabled,
|
Enabled,
|
||||||
Disabled,
|
Disabled,
|
||||||
DisabledOnExternalMouse,
|
DisabledOnExternalMouse,
|
||||||
|
|
@ -63,12 +64,6 @@ pub enum TouchpadOverride {
|
||||||
ForceDisable,
|
ForceDisable,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DeviceState {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Enabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct TapConfig {
|
pub struct TapConfig {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
|
|
|
||||||
|
|
@ -204,20 +204,20 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(blocklist) = dev_list_var("COSMIC_DRM_BLOCK_DEVICES") {
|
if let Some(blocklist) = dev_list_var("COSMIC_DRM_BLOCK_DEVICES")
|
||||||
if let Ok(node) = DrmNode::from_dev_id(dev) {
|
&& let Ok(node) = DrmNode::from_dev_id(dev)
|
||||||
let node = node
|
{
|
||||||
.node_with_type(NodeType::Render)
|
let node = node
|
||||||
.and_then(|res| res.ok())
|
.node_with_type(NodeType::Render)
|
||||||
.unwrap_or(node);
|
.and_then(|res| res.ok())
|
||||||
for ident in blocklist {
|
.unwrap_or(node);
|
||||||
if ident.matches(&node) {
|
for ident in blocklist {
|
||||||
info!(
|
if ident.matches(&node) {
|
||||||
"Skipping device {} due to COSMIC_DRM_BLOCK_DEVICE list.",
|
info!(
|
||||||
path.display()
|
"Skipping device {} due to COSMIC_DRM_BLOCK_DEVICE list.",
|
||||||
);
|
path.display()
|
||||||
return Ok(Vec::new());
|
);
|
||||||
}
|
return Ok(Vec::new());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -271,10 +271,10 @@ impl State {
|
||||||
notifier,
|
notifier,
|
||||||
move |event, metadata, state: &mut State| match event {
|
move |event, metadata, state: &mut State| match event {
|
||||||
DrmEvent::VBlank(crtc) => {
|
DrmEvent::VBlank(crtc) => {
|
||||||
if let Some(device) = state.backend.kms().drm_devices.get_mut(&drm_node) {
|
if let Some(device) = state.backend.kms().drm_devices.get_mut(&drm_node)
|
||||||
if let Some(surface) = device.inner.surfaces.get_mut(&crtc) {
|
&& let Some(surface) = device.inner.surfaces.get_mut(&crtc)
|
||||||
surface.on_vblank(metadata.take());
|
{
|
||||||
}
|
surface.on_vblank(metadata.take());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrmEvent::Error(err) => {
|
DrmEvent::Error(err) => {
|
||||||
|
|
@ -676,10 +676,10 @@ impl LockedDevice<'_> {
|
||||||
|
|
||||||
let mut compositor = compositor.lock().unwrap();
|
let mut compositor = compositor.lock().unwrap();
|
||||||
compositor.render_frame(renderer, &elements, CLEAR_COLOR, FrameFlags::empty())?;
|
compositor.render_frame(renderer, &elements, CLEAR_COLOR, FrameFlags::empty())?;
|
||||||
if let Err(err) = compositor.commit_frame() {
|
if let Err(err) = compositor.commit_frame()
|
||||||
if !matches!(err, FrameError::EmptyFrame) {
|
&& !matches!(err, FrameError::EmptyFrame)
|
||||||
return Err(err.into());
|
{
|
||||||
}
|
return Err(err.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,17 @@ pub fn display_configuration(
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|conn| device.get_connector(*conn, true).ok())
|
.flat_map(|conn| device.get_connector(*conn, true).ok())
|
||||||
{
|
{
|
||||||
if let Some(enc) = conn.current_encoder() {
|
if let Some(enc) = conn.current_encoder()
|
||||||
if let Some(crtc) = device.get_encoder(enc)?.crtc() {
|
&& let Some(crtc) = device.get_encoder(enc)?.crtc()
|
||||||
// If is is connected we found a mapping
|
{
|
||||||
if conn.state() == ConnectorState::Connected {
|
// If is is connected we found a mapping
|
||||||
map.insert(conn.handle(), Some(crtc));
|
if conn.state() == ConnectorState::Connected {
|
||||||
// If not, the user just unplugged something,
|
map.insert(conn.handle(), Some(crtc));
|
||||||
// or the drm master did not cleanup?
|
// If not, the user just unplugged something,
|
||||||
// Well, I guess we cleanup after them.
|
// or the drm master did not cleanup?
|
||||||
} else {
|
// Well, I guess we cleanup after them.
|
||||||
cleanup.push(crtc);
|
} else {
|
||||||
}
|
cleanup.push(crtc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -81,12 +81,11 @@ pub fn display_configuration(
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|conn| device.get_connector(*conn, false).ok())
|
.flat_map(|conn| device.get_connector(*conn, false).ok())
|
||||||
.filter(|conn| {
|
.filter(|conn| {
|
||||||
if let Some(enc) = conn.current_encoder() {
|
if let Some(enc) = conn.current_encoder()
|
||||||
if let Ok(enc) = device.get_encoder(enc) {
|
&& let Ok(enc) = device.get_encoder(enc)
|
||||||
if let Some(crtc) = enc.crtc() {
|
&& let Some(crtc) = enc.crtc()
|
||||||
return cleanup.contains(&crtc);
|
{
|
||||||
}
|
return cleanup.contains(&crtc);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -230,14 +230,14 @@ fn determine_primary_gpu(
|
||||||
drm_devices: &IndexMap<DrmNode, Device>,
|
drm_devices: &IndexMap<DrmNode, Device>,
|
||||||
seat: String,
|
seat: String,
|
||||||
) -> Result<Option<DrmNode>> {
|
) -> Result<Option<DrmNode>> {
|
||||||
if let Some(device) = dev_var("COSMIC_RENDER_DEVICE") {
|
if let Some(device) = dev_var("COSMIC_RENDER_DEVICE")
|
||||||
if let Some(node) = drm_devices.values().find_map(|dev| {
|
&& let Some(node) = drm_devices.values().find_map(|dev| {
|
||||||
device
|
device
|
||||||
.matches(&dev.inner.render_node)
|
.matches(&dev.inner.render_node)
|
||||||
.then_some(dev.inner.render_node)
|
.then_some(dev.inner.render_node)
|
||||||
}) {
|
})
|
||||||
return Ok(Some(node));
|
{
|
||||||
}
|
return Ok(Some(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to find builtin display
|
// try to find builtin display
|
||||||
|
|
@ -256,13 +256,12 @@ fn determine_primary_gpu(
|
||||||
|
|
||||||
// else try to find the boot gpu
|
// else try to find the boot gpu
|
||||||
let boot = determine_boot_gpu(seat);
|
let boot = determine_boot_gpu(seat);
|
||||||
if let Some(boot) = boot {
|
if let Some(boot) = boot
|
||||||
if drm_devices
|
&& drm_devices
|
||||||
.values()
|
.values()
|
||||||
.any(|dev| dev.inner.render_node == boot)
|
.any(|dev| dev.inner.render_node == boot)
|
||||||
{
|
{
|
||||||
return Ok(Some(boot));
|
return Ok(Some(boot));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// else just take the first
|
// else just take the first
|
||||||
|
|
@ -319,10 +318,9 @@ fn init_udev(
|
||||||
let backend = state.backend.kms();
|
let backend = state.backend.kms();
|
||||||
if matches!(event, UdevEvent::Added { .. } | UdevEvent::Removed { .. })
|
if matches!(event, UdevEvent::Added { .. } | UdevEvent::Removed { .. })
|
||||||
&& backend.primary_node.read().unwrap().is_none()
|
&& backend.primary_node.read().unwrap().is_none()
|
||||||
|
&& let Err(err) = state.backend.kms().select_primary_gpu(&dh)
|
||||||
{
|
{
|
||||||
if let Err(err) = state.backend.kms().select_primary_gpu(&dh) {
|
warn!("Failed to determine a new primary gpu: {}", err);
|
||||||
warn!("Failed to determine a new primary gpu: {}", err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -462,18 +460,17 @@ impl KmsState {
|
||||||
if let Some(primary_node) = primary_node
|
if let Some(primary_node) = primary_node
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|node| node.node_with_type(NodeType::Primary).and_then(|x| x.ok()))
|
.and_then(|node| node.node_with_type(NodeType::Primary).and_then(|x| x.ok()))
|
||||||
|
&& let Some(device) = self.drm_devices.get(&primary_node)
|
||||||
{
|
{
|
||||||
if let Some(device) = self.drm_devices.get(&primary_node) {
|
let import_device = device.drm.device().device_fd().clone();
|
||||||
let import_device = device.drm.device().device_fd().clone();
|
if supports_syncobj_eventfd(&import_device) {
|
||||||
if supports_syncobj_eventfd(&import_device) {
|
if let Some(state) = self.syncobj_state.as_mut() {
|
||||||
if let Some(state) = self.syncobj_state.as_mut() {
|
state.update_device(import_device);
|
||||||
state.update_device(import_device);
|
} else {
|
||||||
} else {
|
let syncobj_state = DrmSyncobjState::new::<State>(dh, import_device);
|
||||||
let syncobj_state = DrmSyncobjState::new::<State>(dh, import_device);
|
self.syncobj_state = Some(syncobj_state);
|
||||||
self.syncobj_state = Some(syncobj_state);
|
|
||||||
}
|
|
||||||
return Ok(());
|
|
||||||
}
|
}
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -939,15 +936,15 @@ impl KmsGuard<'_> {
|
||||||
compositor
|
compositor
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(bpc) = output_config.0.max_bpc {
|
if let Some(bpc) = output_config.0.max_bpc
|
||||||
if let Err(err) = drm_helpers::set_max_bpc(drm.device(), conn, bpc) {
|
&& let Err(err) = drm_helpers::set_max_bpc(drm.device(), conn, bpc)
|
||||||
warn!(
|
{
|
||||||
?bpc,
|
warn!(
|
||||||
?err,
|
?bpc,
|
||||||
"Failed to set max_bpc on connector: {}",
|
?err,
|
||||||
surface.output.name()
|
"Failed to set max_bpc on connector: {}",
|
||||||
);
|
surface.output.name()
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let vrr = output_config.0.vrr;
|
let vrr = output_config.0.vrr;
|
||||||
|
|
|
||||||
|
|
@ -782,91 +782,90 @@ impl SurfaceThreadState {
|
||||||
// mark last frame completed
|
// mark last frame completed
|
||||||
if let Ok(Some(Some((mut feedback, frames, estimated_presentation_time)))) =
|
if let Ok(Some(Some((mut feedback, frames, estimated_presentation_time)))) =
|
||||||
compositor.frame_submitted()
|
compositor.frame_submitted()
|
||||||
|
&& self.mirroring.is_none()
|
||||||
{
|
{
|
||||||
if self.mirroring.is_none() {
|
let name = self.output.name();
|
||||||
let name = self.output.name();
|
let message = if let Some(presentation_time) = presentation_time {
|
||||||
let message = if let Some(presentation_time) = presentation_time {
|
let misprediction_s =
|
||||||
let misprediction_s =
|
presentation_time.as_secs_f64() - estimated_presentation_time.as_secs_f64();
|
||||||
presentation_time.as_secs_f64() - estimated_presentation_time.as_secs_f64();
|
tracy_client::Client::running().unwrap().plot(
|
||||||
tracy_client::Client::running().unwrap().plot(
|
self.presentation_misprediction_plot_name,
|
||||||
self.presentation_misprediction_plot_name,
|
misprediction_s * 1000.,
|
||||||
misprediction_s * 1000.,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
let now = Duration::from(now);
|
let now = Duration::from(now);
|
||||||
if presentation_time > now {
|
if presentation_time > now {
|
||||||
let diff = presentation_time - now;
|
let diff = presentation_time - now;
|
||||||
tracy_client::Client::running().unwrap().plot(
|
tracy_client::Client::running().unwrap().plot(
|
||||||
self.time_since_presentation_plot_name,
|
self.time_since_presentation_plot_name,
|
||||||
-diff.as_secs_f64() * 1000.,
|
-diff.as_secs_f64() * 1000.,
|
||||||
);
|
);
|
||||||
format!("vblank on {name}, presentation is {diff:?} later")
|
format!("vblank on {name}, presentation is {diff:?} later")
|
||||||
} else {
|
|
||||||
let diff = now - presentation_time;
|
|
||||||
tracy_client::Client::running().unwrap().plot(
|
|
||||||
self.time_since_presentation_plot_name,
|
|
||||||
diff.as_secs_f64() * 1000.,
|
|
||||||
);
|
|
||||||
format!("vblank on {name}, presentation was {diff:?} ago")
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
format!("vblank on {name}, presentation time unknown")
|
let diff = now - presentation_time;
|
||||||
};
|
tracy_client::Client::running().unwrap().plot(
|
||||||
|
self.time_since_presentation_plot_name,
|
||||||
|
diff.as_secs_f64() * 1000.,
|
||||||
|
);
|
||||||
|
format!("vblank on {name}, presentation was {diff:?} ago")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
format!("vblank on {name}, presentation time unknown")
|
||||||
|
};
|
||||||
|
tracy_client::Client::running()
|
||||||
|
.unwrap()
|
||||||
|
.message(&message, 0);
|
||||||
|
|
||||||
|
let (clock, flags) = if let Some(tp) = presentation_time {
|
||||||
|
(
|
||||||
|
tp.into(),
|
||||||
|
wp_presentation_feedback::Kind::Vsync
|
||||||
|
| wp_presentation_feedback::Kind::HwClock
|
||||||
|
| wp_presentation_feedback::Kind::HwCompletion,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(
|
||||||
|
now,
|
||||||
|
wp_presentation_feedback::Kind::Vsync
|
||||||
|
| wp_presentation_feedback::Kind::HwCompletion,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
let rate = self
|
||||||
|
.output
|
||||||
|
.current_mode()
|
||||||
|
.map(|mode| Duration::from_secs_f64(1_000.0 / mode.refresh as f64));
|
||||||
|
let refresh = match rate {
|
||||||
|
Some(rate)
|
||||||
|
if self
|
||||||
|
.compositor
|
||||||
|
.as_ref()
|
||||||
|
.is_some_and(|comp| comp.with_compositor(|c| c.vrr_enabled())) =>
|
||||||
|
{
|
||||||
|
Refresh::Variable(rate)
|
||||||
|
}
|
||||||
|
Some(rate) => Refresh::Fixed(rate),
|
||||||
|
None => Refresh::Unknown,
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(last_sequence) = self.last_sequence {
|
||||||
|
let delta = sequence as f64 - last_sequence as f64;
|
||||||
tracy_client::Client::running()
|
tracy_client::Client::running()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.message(&message, 0);
|
.plot(self.sequence_delta_plot_name, delta);
|
||||||
|
}
|
||||||
|
self.last_sequence = Some(sequence);
|
||||||
|
|
||||||
let (clock, flags) = if let Some(tp) = presentation_time {
|
feedback.presented(clock, refresh, sequence as u64, flags);
|
||||||
(
|
|
||||||
tp.into(),
|
|
||||||
wp_presentation_feedback::Kind::Vsync
|
|
||||||
| wp_presentation_feedback::Kind::HwClock
|
|
||||||
| wp_presentation_feedback::Kind::HwCompletion,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
(
|
|
||||||
now,
|
|
||||||
wp_presentation_feedback::Kind::Vsync
|
|
||||||
| wp_presentation_feedback::Kind::HwCompletion,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
let rate = self
|
self.timings.presented(clock);
|
||||||
.output
|
|
||||||
.current_mode()
|
|
||||||
.map(|mode| Duration::from_secs_f64(1_000.0 / mode.refresh as f64));
|
|
||||||
let refresh = match rate {
|
|
||||||
Some(rate)
|
|
||||||
if self
|
|
||||||
.compositor
|
|
||||||
.as_ref()
|
|
||||||
.is_some_and(|comp| comp.with_compositor(|c| c.vrr_enabled())) =>
|
|
||||||
{
|
|
||||||
Refresh::Variable(rate)
|
|
||||||
}
|
|
||||||
Some(rate) => Refresh::Fixed(rate),
|
|
||||||
None => Refresh::Unknown,
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(last_sequence) = self.last_sequence {
|
while let Ok(pending_image_copy_data) = frames.recv() {
|
||||||
let delta = sequence as f64 - last_sequence as f64;
|
pending_image_copy_data.send_success_when_ready(
|
||||||
tracy_client::Client::running()
|
self.output.current_transform(),
|
||||||
.unwrap()
|
&self.loop_handle,
|
||||||
.plot(self.sequence_delta_plot_name, delta);
|
clock,
|
||||||
}
|
);
|
||||||
self.last_sequence = Some(sequence);
|
|
||||||
|
|
||||||
feedback.presented(clock, refresh, sequence as u64, flags);
|
|
||||||
|
|
||||||
self.timings.presented(clock);
|
|
||||||
|
|
||||||
while let Ok(pending_image_copy_data) = frames.recv() {
|
|
||||||
pending_image_copy_data.send_success_when_ready(
|
|
||||||
self.output.current_transform(),
|
|
||||||
&self.loop_handle,
|
|
||||||
clock,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1077,11 +1076,11 @@ impl SurfaceThreadState {
|
||||||
// we can't use the elements after `compositor.render_frame`,
|
// we can't use the elements after `compositor.render_frame`,
|
||||||
// so let's collect everything we need for screencopy now
|
// so let's collect everything we need for screencopy now
|
||||||
let mut has_cursor_mode_none = false;
|
let mut has_cursor_mode_none = false;
|
||||||
let frames = self
|
let frames = if self.mirroring.is_none() {
|
||||||
.mirroring
|
take_screencopy_frames(&self.output, &elements, &mut has_cursor_mode_none)
|
||||||
.is_none()
|
} else {
|
||||||
.then(|| take_screencopy_frames(&self.output, &elements, &mut has_cursor_mode_none))
|
Default::default()
|
||||||
.unwrap_or_default();
|
};
|
||||||
|
|
||||||
// actual rendering
|
// actual rendering
|
||||||
let source_output = self
|
let source_output = self
|
||||||
|
|
@ -1312,10 +1311,10 @@ impl SurfaceThreadState {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
if frame_result.needs_sync() {
|
if frame_result.needs_sync()
|
||||||
if let PrimaryPlaneElement::Swapchain(elem) = &frame_result.primary_element {
|
&& let PrimaryPlaneElement::Swapchain(elem) = &frame_result.primary_element
|
||||||
elem.sync.wait()?;
|
{
|
||||||
}
|
elem.sync.wait()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
match compositor.queue_frame(feedback) {
|
match compositor.queue_frame(feedback) {
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,10 @@ pub fn init_backend_auto(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(inverted) = greeter_state.invert_colors {
|
if let Some(inverted) = greeter_state.invert_colors
|
||||||
if inverted != state.a11y_state().screen_inverted() {
|
&& inverted != state.a11y_state().screen_inverted()
|
||||||
state.request_screen_invert(inverted);
|
{
|
||||||
}
|
state.request_screen_invert(inverted);
|
||||||
}
|
}
|
||||||
|
|
||||||
if state
|
if state
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,8 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
let buf_translation = Matrix3::from_translation(Vector2::new(
|
let buf_translation = Matrix3::from_translation(Vector2::new(
|
||||||
(view.src.loc.x as f64 / buf_size.w as f64) as f32,
|
(view.src.loc.x / buf_size.w as f64) as f32,
|
||||||
(view.src.loc.y as f64 / buf_size.h as f64) as f32,
|
(view.src.loc.y / buf_size.h as f64) as f32,
|
||||||
));
|
));
|
||||||
|
|
||||||
let input_to_geo =
|
let input_to_geo =
|
||||||
|
|
|
||||||
|
|
@ -528,19 +528,17 @@ where
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !exclude_dnd_icon {
|
if !exclude_dnd_icon && let Some(dnd_icon) = get_dnd_icon(seat) {
|
||||||
if let Some(dnd_icon) = get_dnd_icon(seat) {
|
elements.extend(
|
||||||
elements.extend(
|
cursor::draw_dnd_icon(
|
||||||
cursor::draw_dnd_icon(
|
renderer,
|
||||||
renderer,
|
&dnd_icon.surface,
|
||||||
&dnd_icon.surface,
|
(location + dnd_icon.offset.to_f64()).to_i32_round(),
|
||||||
(location + dnd_icon.offset.to_f64()).to_i32_round(),
|
scale,
|
||||||
scale,
|
)
|
||||||
)
|
.into_iter()
|
||||||
.into_iter()
|
.map(CosmicElement::Dnd),
|
||||||
.map(CosmicElement::Dnd),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let theme = theme.cosmic();
|
let theme = theme.cosmic();
|
||||||
|
|
@ -1102,17 +1100,15 @@ impl PostprocessState {
|
||||||
if let (Some(tex), Some(tracker)) = (
|
if let (Some(tex), Some(tracker)) = (
|
||||||
self.cursor_texture.as_ref(),
|
self.cursor_texture.as_ref(),
|
||||||
self.cursor_damage_tracker.as_ref(),
|
self.cursor_damage_tracker.as_ref(),
|
||||||
) {
|
) && tex.format().is_some_and(|f| f == format)
|
||||||
if tex.format().is_some_and(|f| f == format)
|
&& tracker.mode()
|
||||||
&& tracker.mode()
|
== &(OutputModeSource::Static {
|
||||||
== &(OutputModeSource::Static {
|
size,
|
||||||
size,
|
scale,
|
||||||
scale,
|
transform: Transform::Normal,
|
||||||
transform: Transform::Normal,
|
})
|
||||||
})
|
{
|
||||||
{
|
return Ok(());
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let texture = Offscreen::<GlesTexture>::create_buffer(renderer, format, buffer_size)?;
|
let texture = Offscreen::<GlesTexture>::create_buffer(renderer, format, buffer_size)?;
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,10 @@ impl ShadowShader {
|
||||||
|
|
||||||
let mut geo = geo.to_f64();
|
let mut geo = geo.to_f64();
|
||||||
let fractional_pixel = scale.ceil() / scale;
|
let fractional_pixel = scale.ceil() / scale;
|
||||||
geo.loc.x = geo.loc.x + fractional_pixel;
|
geo.loc.x += fractional_pixel;
|
||||||
geo.loc.y = geo.loc.y + fractional_pixel;
|
geo.loc.y += fractional_pixel;
|
||||||
geo.size.w = geo.size.w - fractional_pixel * 2.;
|
geo.size.w -= fractional_pixel * 2.;
|
||||||
geo.size.h = geo.size.h - fractional_pixel * 2.;
|
geo.size.h -= fractional_pixel * 2.;
|
||||||
|
|
||||||
let user_data = Borrow::<GlesRenderer>::borrow(renderer.glow_renderer())
|
let user_data = Borrow::<GlesRenderer>::borrow(renderer.glow_renderer())
|
||||||
.egl_context()
|
.egl_context()
|
||||||
|
|
@ -125,7 +125,7 @@ impl ShadowShader {
|
||||||
.cast::<f32>()
|
.cast::<f32>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let window_geo_loc = Vector2::new(window_geo.loc.x as f64, window_geo.loc.y as f64);
|
let window_geo_loc = Vector2::new(window_geo.loc.x, window_geo.loc.y);
|
||||||
let window_input_to_geo = (Matrix3::from_nonuniform_scale(area_size.x, area_size.y)
|
let window_input_to_geo = (Matrix3::from_nonuniform_scale(area_size.x, area_size.y)
|
||||||
* Matrix3::from_translation(Vector2::new(
|
* Matrix3::from_translation(Vector2::new(
|
||||||
-window_geo_loc.x / area_size.x,
|
-window_geo_loc.x / area_size.x,
|
||||||
|
|
|
||||||
|
|
@ -517,24 +517,24 @@ where
|
||||||
impl State {
|
impl State {
|
||||||
pub fn process_x11_event(&mut self, event: InputEvent<X11Input>) {
|
pub fn process_x11_event(&mut self, event: InputEvent<X11Input>) {
|
||||||
// here we can handle special cases for x11 inputs, like mapping them to windows
|
// here we can handle special cases for x11 inputs, like mapping them to windows
|
||||||
if let InputEvent::PointerMotionAbsolute { event } = &event {
|
if let InputEvent::PointerMotionAbsolute { event } = &event
|
||||||
if let Some(window) = event.window() {
|
&& let Some(window) = event.window()
|
||||||
let output = self
|
{
|
||||||
.backend
|
let output = self
|
||||||
.x11()
|
.backend
|
||||||
.surfaces
|
.x11()
|
||||||
.iter()
|
.surfaces
|
||||||
.find(|surface| &surface.window == window.as_ref())
|
.iter()
|
||||||
.map(|surface| surface.output.clone())
|
.find(|surface| &surface.window == window.as_ref())
|
||||||
.unwrap();
|
.map(|surface| surface.output.clone())
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let device = event.device();
|
let device = event.device();
|
||||||
for seat in self.common.shell.read().seats.iter() {
|
for seat in self.common.shell.read().seats.iter() {
|
||||||
let devices = seat.user_data().get::<Devices>().unwrap();
|
let devices = seat.user_data().get::<Devices>().unwrap();
|
||||||
if devices.has_device(&device) {
|
if devices.has_device(&device) {
|
||||||
seat.set_active_output(&output);
|
seat.set_active_output(&output);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -142,70 +142,70 @@ pub fn update_device(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if let Some((accel, is_default)) = config!(|x| x.acceleration.as_ref()) {
|
if let Some((accel, is_default)) = config!(|x| x.acceleration.as_ref()) {
|
||||||
if let Some(profile) = accel.profile {
|
if let Some(profile) = accel.profile
|
||||||
if let Err(err) = device.config_accel_set_profile(profile) {
|
&& let Err(err) = device.config_accel_set_profile(profile)
|
||||||
config_set_error(device, "acceleration profile", profile, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "acceleration profile", profile, err, is_default);
|
||||||
}
|
}
|
||||||
if let Err(err) = device.config_accel_set_speed(accel.speed) {
|
if let Err(err) = device.config_accel_set_speed(accel.speed) {
|
||||||
config_set_error(device, "acceleration speed", accel.speed, err, is_default);
|
config_set_error(device, "acceleration speed", accel.speed, err, is_default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some((matrix, is_default)) = config!(|x| x.calibration) {
|
if let Some((matrix, is_default)) = config!(|x| x.calibration)
|
||||||
if let Err(err) = device.config_calibration_set_matrix(matrix) {
|
&& let Err(err) = device.config_calibration_set_matrix(matrix)
|
||||||
config_set_error(device, "calibration matrix", matrix, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "calibration matrix", matrix, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some((method, is_default)) = config!(|x| x.click_method) {
|
if let Some((method, is_default)) = config!(|x| x.click_method)
|
||||||
if let Err(err) = device.config_click_set_method(method) {
|
&& let Err(err) = device.config_click_set_method(method)
|
||||||
config_set_error(device, "click method", method, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "click method", method, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some((dwt, is_default)) = config!(|x| x.disable_while_typing) {
|
if let Some((dwt, is_default)) = config!(|x| x.disable_while_typing)
|
||||||
if let Err(err) = device.config_dwt_set_enabled(dwt) {
|
&& let Err(err) = device.config_dwt_set_enabled(dwt)
|
||||||
config_set_error(device, "disable-while-typing", dwt, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "disable-while-typing", dwt, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some((left, is_default)) = config!(|x| x.left_handed) {
|
if let Some((left, is_default)) = config!(|x| x.left_handed)
|
||||||
if let Err(err) = device.config_left_handed_set(left) {
|
&& let Err(err) = device.config_left_handed_set(left)
|
||||||
config_set_error(device, "left-handed", left, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "left-handed", left, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some((middle, is_default)) = config!(|x| x.middle_button_emulation) {
|
if let Some((middle, is_default)) = config!(|x| x.middle_button_emulation)
|
||||||
if let Err(err) = device.config_middle_emulation_set_enabled(middle) {
|
&& let Err(err) = device.config_middle_emulation_set_enabled(middle)
|
||||||
config_set_error(device, "middle-button-emulation", middle, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "middle-button-emulation", middle, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some((angle, is_default)) = config!(|x| x.rotation_angle) {
|
if let Some((angle, is_default)) = config!(|x| x.rotation_angle)
|
||||||
if let Err(err) = device.config_rotation_set_angle(angle) {
|
&& let Err(err) = device.config_rotation_set_angle(angle)
|
||||||
config_set_error(device, "rotation-angle", angle, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "rotation-angle", angle, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some((scroll, is_default)) = config!(|x| x.scroll_config.as_ref()) {
|
if let Some((scroll, is_default)) = config!(|x| x.scroll_config.as_ref()) {
|
||||||
if let Some(method) = scroll.method {
|
if let Some(method) = scroll.method
|
||||||
if let Err(err) = device.config_scroll_set_method(method) {
|
&& let Err(err) = device.config_scroll_set_method(method)
|
||||||
config_set_error(device, "scroll method", scroll, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "scroll method", scroll, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some(natural) = scroll.natural_scroll {
|
if let Some(natural) = scroll.natural_scroll
|
||||||
if let Err(err) = device.config_scroll_set_natural_scroll_enabled(natural) {
|
&& let Err(err) = device.config_scroll_set_natural_scroll_enabled(natural)
|
||||||
config_set_error(device, "natural scrolling", natural, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "natural scrolling", natural, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some(button) = scroll.scroll_button {
|
if let Some(button) = scroll.scroll_button
|
||||||
if let Err(err) = device.config_scroll_set_button(button) {
|
&& let Err(err) = device.config_scroll_set_button(button)
|
||||||
config_set_error(device, "scroll button", button, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "scroll button", button, err, is_default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some((tap, is_default)) = config!(|x| x.tap_config.as_ref()) {
|
if let Some((tap, is_default)) = config!(|x| x.tap_config.as_ref()) {
|
||||||
if let Err(err) = device.config_tap_set_enabled(tap.enabled) {
|
if let Err(err) = device.config_tap_set_enabled(tap.enabled) {
|
||||||
config_set_error(device, "tap-to-click", tap.enabled, err, is_default);
|
config_set_error(device, "tap-to-click", tap.enabled, err, is_default);
|
||||||
}
|
}
|
||||||
if let Some(button_map) = tap.button_map {
|
if let Some(button_map) = tap.button_map
|
||||||
if let Err(err) = device.config_tap_set_button_map(button_map) {
|
&& let Err(err) = device.config_tap_set_button_map(button_map)
|
||||||
config_set_error(device, "button map", button_map, err, is_default);
|
{
|
||||||
}
|
config_set_error(device, "button map", button_map, err, is_default);
|
||||||
}
|
}
|
||||||
if let Err(err) = device.config_tap_set_drag_enabled(tap.drag) {
|
if let Err(err) = device.config_tap_set_drag_enabled(tap.drag) {
|
||||||
config_set_error(device, "tap-drag", tap.drag, err, is_default);
|
config_set_error(device, "tap-drag", tap.drag, err, is_default);
|
||||||
|
|
|
||||||
|
|
@ -371,20 +371,20 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_filter_state(path: &Option<PathBuf>) -> ScreenFilter {
|
fn load_filter_state(path: &Option<PathBuf>) -> ScreenFilter {
|
||||||
if let Some(path) = path.as_ref() {
|
if let Some(path) = path.as_ref()
|
||||||
if path.exists() {
|
&& path.exists()
|
||||||
match ron::de::from_reader::<_, ScreenFilter>(
|
{
|
||||||
OpenOptions::new().read(true).open(path).unwrap(),
|
match ron::de::from_reader::<_, ScreenFilter>(
|
||||||
) {
|
OpenOptions::new().read(true).open(path).unwrap(),
|
||||||
Ok(config) => return config,
|
) {
|
||||||
Err(err) => {
|
Ok(config) => return config,
|
||||||
warn!(?err, "Failed to read screen_filter state, resetting..");
|
Err(err) => {
|
||||||
if let Err(err) = std::fs::remove_file(path) {
|
warn!(?err, "Failed to read screen_filter state, resetting..");
|
||||||
error!(?err, "Failed to remove screen_filter state.");
|
if let Err(err) = std::fs::remove_file(path) {
|
||||||
}
|
error!(?err, "Failed to remove screen_filter state.");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenFilter {
|
ScreenFilter {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use zbus::{
|
||||||
|
|
||||||
use super::name_owners::NameOwners;
|
use super::name_owners::NameOwners;
|
||||||
|
|
||||||
static ALLOWED_NAMES: &'static [WellKnownName] = &[WellKnownName::from_static_str_unchecked(
|
static ALLOWED_NAMES: &[WellKnownName] = &[WellKnownName::from_static_str_unchecked(
|
||||||
"org.gnome.Orca.KeyboardMonitor",
|
"org.gnome.Orca.KeyboardMonitor",
|
||||||
)];
|
)];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ impl NameOwners {
|
||||||
} else {
|
} else {
|
||||||
allowed_names
|
allowed_names
|
||||||
.iter()
|
.iter()
|
||||||
.any(|n| inner.name_owners.get(n).map(|x| x.as_ref()).flatten() == Some(name))
|
.any(|n| inner.name_owners.get(n).and_then(|x| x.as_ref()) == Some(name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,16 +188,15 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
Action::NextWorkspace => {
|
Action::NextWorkspace => {
|
||||||
if let Some(direction) = pattern.inferred_direction() {
|
if let Some(direction) = pattern.inferred_direction()
|
||||||
if ((direction == Direction::Left || direction == Direction::Right)
|
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Vertical)
|
== WorkspaceLayout::Vertical)
|
||||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Horizontal)
|
== WorkspaceLayout::Horizontal))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let next = to_next_workspace(
|
let next = to_next_workspace(
|
||||||
|
|
@ -234,16 +233,15 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
Action::PreviousWorkspace => {
|
Action::PreviousWorkspace => {
|
||||||
if let Some(direction) = pattern.inferred_direction() {
|
if let Some(direction) = pattern.inferred_direction()
|
||||||
if ((direction == Direction::Left || direction == Direction::Right)
|
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Vertical)
|
== WorkspaceLayout::Vertical)
|
||||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Horizontal)
|
== WorkspaceLayout::Horizontal))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let previous = to_previous_workspace(
|
let previous = to_previous_workspace(
|
||||||
|
|
@ -336,16 +334,15 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
x @ Action::MoveToNextWorkspace | x @ Action::SendToNextWorkspace => {
|
x @ Action::MoveToNextWorkspace | x @ Action::SendToNextWorkspace => {
|
||||||
if let Some(direction) = pattern.inferred_direction() {
|
if let Some(direction) = pattern.inferred_direction()
|
||||||
if ((direction == Direction::Left || direction == Direction::Right)
|
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Vertical)
|
== WorkspaceLayout::Vertical)
|
||||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Horizontal)
|
== WorkspaceLayout::Horizontal))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let Some(focused_output) = seat.focused_output() else {
|
let Some(focused_output) = seat.focused_output() else {
|
||||||
return;
|
return;
|
||||||
|
|
@ -420,16 +417,15 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
x @ Action::MoveToPreviousWorkspace | x @ Action::SendToPreviousWorkspace => {
|
x @ Action::MoveToPreviousWorkspace | x @ Action::SendToPreviousWorkspace => {
|
||||||
if let Some(direction) = pattern.inferred_direction() {
|
if let Some(direction) = pattern.inferred_direction()
|
||||||
if ((direction == Direction::Left || direction == Direction::Right)
|
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Vertical)
|
== WorkspaceLayout::Vertical)
|
||||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||||
== WorkspaceLayout::Horizontal)
|
== WorkspaceLayout::Horizontal))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let Some(focused_output) = seat.focused_output() else {
|
let Some(focused_output) = seat.focused_output() else {
|
||||||
return;
|
return;
|
||||||
|
|
@ -511,21 +507,18 @@ impl State {
|
||||||
if let Some(next_output) = next_output {
|
if let Some(next_output) = next_output {
|
||||||
let res = {
|
let res = {
|
||||||
let mut workspace_guard = self.common.workspace_state.update();
|
let mut workspace_guard = self.common.workspace_state.update();
|
||||||
if propagate {
|
if propagate
|
||||||
if let Some((serial, prev_output, prev_idx)) =
|
&& let Some((serial, prev_output, prev_idx)) =
|
||||||
shell.previous_workspace_idx.take()
|
shell.previous_workspace_idx.take()
|
||||||
{
|
&& seat.last_modifier_change().is_some_and(|s| s == serial)
|
||||||
if seat.last_modifier_change().is_some_and(|s| s == serial)
|
&& prev_output == current_output
|
||||||
&& prev_output == current_output
|
{
|
||||||
{
|
let _ = shell.activate(
|
||||||
let _ = shell.activate(
|
¤t_output,
|
||||||
¤t_output,
|
prev_idx,
|
||||||
prev_idx,
|
WorkspaceDelta::new_shortcut(),
|
||||||
WorkspaceDelta::new_shortcut(),
|
&mut workspace_guard,
|
||||||
&mut workspace_guard,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let idx = shell.workspaces.active_num(&next_output).1;
|
let idx = shell.workspaces.active_num(&next_output).1;
|
||||||
|
|
@ -607,19 +600,18 @@ impl State {
|
||||||
&self.common.event_loop_handle,
|
&self.common.event_loop_handle,
|
||||||
);
|
);
|
||||||
|
|
||||||
if is_move_action && propagate {
|
if is_move_action
|
||||||
if let Some((_, prev_output, prev_idx)) =
|
&& propagate
|
||||||
|
&& let Some((_, prev_output, prev_idx)) =
|
||||||
shell.previous_workspace_idx.take()
|
shell.previous_workspace_idx.take()
|
||||||
{
|
&& prev_output == focused_output
|
||||||
if prev_output == focused_output {
|
{
|
||||||
let _ = shell.activate(
|
let _ = shell.activate(
|
||||||
&focused_output,
|
&focused_output,
|
||||||
prev_idx,
|
prev_idx,
|
||||||
WorkspaceDelta::new_shortcut(),
|
WorkspaceDelta::new_shortcut(),
|
||||||
&mut workspace_guard,
|
&mut workspace_guard,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
};
|
};
|
||||||
|
|
@ -837,13 +829,12 @@ impl State {
|
||||||
let workspace = shell.active_space(¤t_output).unwrap();
|
let workspace = shell.active_space(¤t_output).unwrap();
|
||||||
if let Some(FocusTarget::Window(focused_window)) =
|
if let Some(FocusTarget::Window(focused_window)) =
|
||||||
workspace.focus_stack.get(seat).last()
|
workspace.focus_stack.get(seat).last()
|
||||||
|
&& workspace.is_tiled(&focused_window.active_window())
|
||||||
{
|
{
|
||||||
if workspace.is_tiled(&focused_window.active_window()) {
|
shell.set_overview_mode(
|
||||||
shell.set_overview_mode(
|
Some(Trigger::KeyboardMove(pattern.modifiers)),
|
||||||
Some(Trigger::KeyboardMove(pattern.modifiers)),
|
self.common.event_loop_handle.clone(),
|
||||||
self.common.event_loop_handle.clone(),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -858,17 +849,17 @@ impl State {
|
||||||
let workspace = shell.active_space_mut(&focused_output).unwrap();
|
let workspace = shell.active_space_mut(&focused_output).unwrap();
|
||||||
let keyboard_handle = seat.get_keyboard().unwrap();
|
let keyboard_handle = seat.get_keyboard().unwrap();
|
||||||
|
|
||||||
if let Some(focus) = keyboard_handle.current_focus() {
|
if let Some(focus) = keyboard_handle.current_focus()
|
||||||
if let Some(descriptor) = workspace.node_desc(focus) {
|
&& let Some(descriptor) = workspace.node_desc(focus)
|
||||||
let grab = SwapWindowGrab::new(seat.clone(), descriptor.clone());
|
{
|
||||||
drop(shell);
|
let grab = SwapWindowGrab::new(seat.clone(), descriptor.clone());
|
||||||
keyboard_handle.set_grab(self, grab, serial);
|
drop(shell);
|
||||||
let mut shell = self.common.shell.write();
|
keyboard_handle.set_grab(self, grab, serial);
|
||||||
shell.set_overview_mode(
|
let mut shell = self.common.shell.write();
|
||||||
Some(Trigger::KeyboardSwap(pattern, descriptor)),
|
shell.set_overview_mode(
|
||||||
self.common.event_loop_handle.clone(),
|
Some(Trigger::KeyboardSwap(pattern, descriptor)),
|
||||||
);
|
self.common.event_loop_handle.clone(),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,14 @@ impl GestureState {
|
||||||
fn push(&mut self, delta: f64, timestamp: Duration) {
|
fn push(&mut self, delta: f64, timestamp: Duration) {
|
||||||
// For the events that we care about, timestamps should always increase
|
// For the events that we care about, timestamps should always increase
|
||||||
// monotonically.
|
// monotonically.
|
||||||
if let Some(last) = self.history.back() {
|
if let Some(last) = self.history.back()
|
||||||
if timestamp < last.timestamp {
|
&& timestamp < last.timestamp
|
||||||
trace!(
|
{
|
||||||
"ignoring event with timestamp {timestamp:?} earlier than last {:?}",
|
trace!(
|
||||||
last.timestamp
|
"ignoring event with timestamp {timestamp:?} earlier than last {:?}",
|
||||||
);
|
last.timestamp
|
||||||
return;
|
);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.history.push_back(SwipeEvent { delta, timestamp });
|
self.history.push_back(SwipeEvent { delta, timestamp });
|
||||||
|
|
|
||||||
479
src/input/mod.rs
479
src/input/mod.rs
|
|
@ -493,51 +493,48 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If confined, don't move pointer if it would go outside surface or region
|
// If confined, don't move pointer if it would go outside surface or region
|
||||||
if pointer_confined {
|
if pointer_confined && let Some((surface, surface_loc)) = &under {
|
||||||
if let Some((surface, surface_loc)) = &under {
|
if new_under.as_ref().and_then(|(under, _)| under.wl_surface())
|
||||||
if new_under.as_ref().and_then(|(under, _)| under.wl_surface())
|
!= surface.wl_surface()
|
||||||
!= surface.wl_surface()
|
{
|
||||||
{
|
ptr.frame(self);
|
||||||
ptr.frame(self);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
match surface {
|
||||||
match surface {
|
PointerFocusTarget::WlSurface { surface, .. } => {
|
||||||
PointerFocusTarget::WlSurface { surface, .. } => {
|
if under_from_surface_tree(
|
||||||
if under_from_surface_tree(
|
surface,
|
||||||
surface,
|
position.as_logical() - surface_loc.to_f64(),
|
||||||
position.as_logical() - surface_loc.to_f64(),
|
(0, 0),
|
||||||
(0, 0),
|
WindowSurfaceType::ALL,
|
||||||
WindowSurfaceType::ALL,
|
)
|
||||||
)
|
.is_none()
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
ptr.frame(self);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PointerFocusTarget::X11Surface { surface, .. } => {
|
|
||||||
if surface
|
|
||||||
.surface_under(
|
|
||||||
position.as_logical() - surface_loc.to_f64(),
|
|
||||||
(0, 0),
|
|
||||||
WindowSurfaceType::ALL,
|
|
||||||
)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
ptr.frame(self);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
if let Some(region) = confine_region {
|
|
||||||
if !region
|
|
||||||
.contains((position.as_logical() - *surface_loc).to_i32_round())
|
|
||||||
{
|
{
|
||||||
ptr.frame(self);
|
ptr.frame(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PointerFocusTarget::X11Surface { surface, .. } => {
|
||||||
|
if surface
|
||||||
|
.surface_under(
|
||||||
|
position.as_logical() - surface_loc.to_f64(),
|
||||||
|
(0, 0),
|
||||||
|
WindowSurfaceType::ALL,
|
||||||
|
)
|
||||||
|
.is_none()
|
||||||
|
{
|
||||||
|
ptr.frame(self);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
if let Some(region) = confine_region
|
||||||
|
&& !region
|
||||||
|
.contains((position.as_logical() - *surface_loc).to_i32_round())
|
||||||
|
{
|
||||||
|
ptr.frame(self);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -722,99 +719,95 @@ impl State {
|
||||||
State::element_under(global_position, &output, &shell, &seat)
|
State::element_under(global_position, &output, &shell, &seat)
|
||||||
};
|
};
|
||||||
if let Some(target) = under {
|
if let Some(target) = under {
|
||||||
if let Some(surface) = target.toplevel().map(Cow::into_owned) {
|
if let Some(surface) = target.toplevel().map(Cow::into_owned)
|
||||||
if seat.get_keyboard().unwrap().modifier_state().logo
|
&& seat.get_keyboard().unwrap().modifier_state().logo
|
||||||
&& !shortcuts_inhibited
|
&& !shortcuts_inhibited
|
||||||
{
|
{
|
||||||
let seat_clone = seat.clone();
|
let seat_clone = seat.clone();
|
||||||
let mouse_button = PointerButtonEvent::button(&event);
|
let mouse_button = PointerButtonEvent::button(&event);
|
||||||
|
|
||||||
let mut supress_button = || {
|
let mut supress_button = || {
|
||||||
// If the logo is held then the pointer event is
|
// If the logo is held then the pointer event is
|
||||||
// aimed at the compositor and shouldn't be passed
|
// aimed at the compositor and shouldn't be passed
|
||||||
// to the application.
|
// to the application.
|
||||||
pass_event = false;
|
pass_event = false;
|
||||||
seat.supressed_buttons().add(button);
|
seat.supressed_buttons().add(button);
|
||||||
};
|
};
|
||||||
|
|
||||||
fn dispatch_grab<G: PointerGrab<State> + 'static>(
|
fn dispatch_grab<G: PointerGrab<State> + 'static>(
|
||||||
grab: Option<(G, smithay::input::pointer::Focus)>,
|
grab: Option<(G, smithay::input::pointer::Focus)>,
|
||||||
seat: Seat<State>,
|
seat: Seat<State>,
|
||||||
serial: Serial,
|
serial: Serial,
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
) {
|
) {
|
||||||
if let Some((target, focus)) = grab {
|
if let Some((target, focus)) = grab {
|
||||||
seat.modifiers_shortcut_queue().clear();
|
seat.modifiers_shortcut_queue().clear();
|
||||||
|
|
||||||
seat.get_pointer()
|
seat.get_pointer()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_grab(state, target, serial, focus);
|
.set_grab(state, target, serial, focus);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(mouse_button) = mouse_button {
|
if let Some(mouse_button) = mouse_button {
|
||||||
match mouse_button {
|
match mouse_button {
|
||||||
smithay::backend::input::MouseButton::Left => {
|
smithay::backend::input::MouseButton::Left => {
|
||||||
supress_button();
|
supress_button();
|
||||||
self.common.event_loop_handle.insert_idle(
|
self.common.event_loop_handle.insert_idle(
|
||||||
move |state| {
|
move |state| {
|
||||||
let mut shell = state.common.shell.write();
|
let mut shell = state.common.shell.write();
|
||||||
let res = shell.move_request(
|
let res = shell.move_request(
|
||||||
&surface,
|
&surface,
|
||||||
&seat_clone,
|
&seat_clone,
|
||||||
serial,
|
serial,
|
||||||
ReleaseMode::NoMouseButtons,
|
ReleaseMode::NoMouseButtons,
|
||||||
false,
|
false,
|
||||||
&state.common.config,
|
&state.common.config,
|
||||||
&state.common.event_loop_handle,
|
&state.common.event_loop_handle,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
drop(shell);
|
drop(shell);
|
||||||
dispatch_grab(
|
dispatch_grab(res, seat_clone, serial, state);
|
||||||
res, seat_clone, serial, state,
|
},
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
);
|
smithay::backend::input::MouseButton::Right => {
|
||||||
}
|
supress_button();
|
||||||
smithay::backend::input::MouseButton::Right => {
|
self.common.event_loop_handle.insert_idle(
|
||||||
supress_button();
|
move |state| {
|
||||||
self.common.event_loop_handle.insert_idle(
|
let mut shell = state.common.shell.write();
|
||||||
move |state| {
|
let Some(target_elem) =
|
||||||
let mut shell = state.common.shell.write();
|
shell.element_for_surface(&surface)
|
||||||
let Some(target_elem) =
|
else {
|
||||||
shell.element_for_surface(&surface)
|
return;
|
||||||
else {
|
};
|
||||||
return;
|
let Some(geom) = shell
|
||||||
};
|
.space_for(target_elem)
|
||||||
let Some(geom) = shell
|
.and_then(|f| {
|
||||||
.space_for(target_elem)
|
f.element_geometry(target_elem)
|
||||||
.and_then(|f| {
|
})
|
||||||
f.element_geometry(target_elem)
|
.or_else(|| {
|
||||||
})
|
shell
|
||||||
.or_else(|| {
|
.workspaces
|
||||||
shell
|
.sets
|
||||||
.workspaces
|
.get(&output)
|
||||||
.sets
|
.and_then(|set| {
|
||||||
.get(&output)
|
set.sticky_layer
|
||||||
.and_then(|set| {
|
.element_geometry(
|
||||||
set.sticky_layer
|
target_elem,
|
||||||
.element_geometry(
|
)
|
||||||
target_elem,
|
})
|
||||||
)
|
})
|
||||||
})
|
else {
|
||||||
})
|
return;
|
||||||
else {
|
};
|
||||||
return;
|
let geom = geom.to_f64();
|
||||||
};
|
let center =
|
||||||
let geom = geom.to_f64();
|
geom.loc + geom.size.downscale(2.0);
|
||||||
let center =
|
let offset =
|
||||||
geom.loc + geom.size.downscale(2.0);
|
center.to_global(&output) - global_position;
|
||||||
let offset = center.to_global(&output)
|
let edge =
|
||||||
- global_position;
|
match (offset.x > 0.0, offset.y > 0.0) {
|
||||||
let edge = match (
|
|
||||||
offset.x > 0.0,
|
|
||||||
offset.y > 0.0,
|
|
||||||
) {
|
|
||||||
(true, true) => ResizeEdge::TOP_LEFT,
|
(true, true) => ResizeEdge::TOP_LEFT,
|
||||||
(false, true) => ResizeEdge::TOP_RIGHT,
|
(false, true) => ResizeEdge::TOP_RIGHT,
|
||||||
(true, false) => {
|
(true, false) => {
|
||||||
|
|
@ -824,27 +817,24 @@ impl State {
|
||||||
ResizeEdge::BOTTOM_RIGHT
|
ResizeEdge::BOTTOM_RIGHT
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let res = shell.resize_request(
|
let res = shell.resize_request(
|
||||||
&surface,
|
&surface,
|
||||||
&seat_clone,
|
&seat_clone,
|
||||||
serial,
|
serial,
|
||||||
edge,
|
edge,
|
||||||
state
|
state
|
||||||
.common
|
.common
|
||||||
.config
|
.config
|
||||||
.cosmic_conf
|
.cosmic_conf
|
||||||
.edge_snap_threshold,
|
.edge_snap_threshold,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
drop(shell);
|
drop(shell);
|
||||||
dispatch_grab(
|
dispatch_grab(res, seat_clone, serial, state);
|
||||||
res, seat_clone, serial, state,
|
},
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -856,10 +846,9 @@ impl State {
|
||||||
let mut shell = self.common.shell.write();
|
let mut shell = self.common.shell.write();
|
||||||
if let Some(Trigger::Pointer(action_button)) =
|
if let Some(Trigger::Pointer(action_button)) =
|
||||||
shell.overview_mode().0.active_trigger()
|
shell.overview_mode().0.active_trigger()
|
||||||
|
&& *action_button == button
|
||||||
{
|
{
|
||||||
if *action_button == button {
|
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
std::mem::drop(shell);
|
std::mem::drop(shell);
|
||||||
};
|
};
|
||||||
|
|
@ -1016,10 +1005,9 @@ impl State {
|
||||||
let mut natural_scroll = false;
|
let mut natural_scroll = false;
|
||||||
if let Some(scroll_config) =
|
if let Some(scroll_config) =
|
||||||
&self.common.config.cosmic_conf.input_touchpad.scroll_config
|
&self.common.config.cosmic_conf.input_touchpad.scroll_config
|
||||||
|
&& let Some(natural) = scroll_config.natural_scroll
|
||||||
{
|
{
|
||||||
if let Some(natural) = scroll_config.natural_scroll {
|
natural_scroll = natural;
|
||||||
natural_scroll = natural;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
activate_action = match gesture_state.fingers {
|
activate_action = match gesture_state.fingers {
|
||||||
3 => None, // TODO: 3 finger gestures
|
3 => None, // TODO: 3 finger gestures
|
||||||
|
|
@ -1317,10 +1305,10 @@ impl State {
|
||||||
}
|
}
|
||||||
InputEvent::TouchUp { event, .. } => {
|
InputEvent::TouchUp { event, .. } => {
|
||||||
let mut shell = self.common.shell.write();
|
let mut shell = self.common.shell.write();
|
||||||
if let Some(Trigger::Touch(slot)) = shell.overview_mode().0.active_trigger() {
|
if let Some(Trigger::Touch(slot)) = shell.overview_mode().0.active_trigger()
|
||||||
if *slot == event.slot() {
|
&& *slot == event.slot()
|
||||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
{
|
||||||
}
|
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
let maybe_seat = shell.seats.for_device(&event.device()).cloned();
|
let maybe_seat = shell.seats.for_device(&event.device()).cloned();
|
||||||
|
|
@ -1621,37 +1609,33 @@ impl State {
|
||||||
// Leave move overview mode, if any modifier was released
|
// Leave move overview mode, if any modifier was released
|
||||||
if let Some(Trigger::KeyboardMove(action_modifiers)) =
|
if let Some(Trigger::KeyboardMove(action_modifiers)) =
|
||||||
shell.overview_mode().0.active_trigger()
|
shell.overview_mode().0.active_trigger()
|
||||||
{
|
&& ((action_modifiers.ctrl && !modifiers.ctrl)
|
||||||
if (action_modifiers.ctrl && !modifiers.ctrl)
|
|
||||||
|| (action_modifiers.alt && !modifiers.alt)
|
|| (action_modifiers.alt && !modifiers.alt)
|
||||||
|| (action_modifiers.logo && !modifiers.logo)
|
|| (action_modifiers.logo && !modifiers.logo)
|
||||||
|| (action_modifiers.shift && !modifiers.shift)
|
|| (action_modifiers.shift && !modifiers.shift))
|
||||||
{
|
{
|
||||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Leave swap overview mode, if any key was released
|
// Leave swap overview mode, if any key was released
|
||||||
if let Some(Trigger::KeyboardSwap(action_pattern, old_descriptor)) =
|
if let Some(Trigger::KeyboardSwap(action_pattern, old_descriptor)) =
|
||||||
shell.overview_mode().0.active_trigger()
|
shell.overview_mode().0.active_trigger()
|
||||||
{
|
&& ((action_pattern.modifiers.ctrl && !modifiers.ctrl)
|
||||||
if (action_pattern.modifiers.ctrl && !modifiers.ctrl)
|
|
||||||
|| (action_pattern.modifiers.alt && !modifiers.alt)
|
|| (action_pattern.modifiers.alt && !modifiers.alt)
|
||||||
|| (action_pattern.modifiers.logo && !modifiers.logo)
|
|| (action_pattern.modifiers.logo && !modifiers.logo)
|
||||||
|| (action_pattern.modifiers.shift && !modifiers.shift)
|
|| (action_pattern.modifiers.shift && !modifiers.shift)
|
||||||
|| (action_pattern.key.is_some()
|
|| (action_pattern.key.is_some()
|
||||||
&& key_matches(action_pattern.key.unwrap())
|
&& key_matches(action_pattern.key.unwrap())
|
||||||
&& event.state() == KeyState::Released)
|
&& event.state() == KeyState::Released))
|
||||||
{
|
{
|
||||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||||
|
|
||||||
self.keyboard_swap(
|
self.keyboard_swap(
|
||||||
seat,
|
seat,
|
||||||
&mut shell,
|
&mut shell,
|
||||||
old_descriptor,
|
old_descriptor,
|
||||||
current_focus,
|
current_focus,
|
||||||
&focused_output,
|
&focused_output,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leave or update resize mode, if modifiers changed or initial key was released
|
// Leave or update resize mode, if modifiers changed or initial key was released
|
||||||
|
|
@ -1832,13 +1816,13 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip released events for initially surpressed keys
|
// Skip released events for initially surpressed keys
|
||||||
if event.state() == KeyState::Released {
|
if event.state() == KeyState::Released
|
||||||
if let Some(tokens) = seat.supressed_keys().filter(&handle) {
|
&& let Some(tokens) = seat.supressed_keys().filter(&handle)
|
||||||
for token in tokens {
|
{
|
||||||
self.common.event_loop_handle.remove(token);
|
for token in tokens {
|
||||||
}
|
self.common.event_loop_handle.remove(token);
|
||||||
return FilterResult::Intercept(None);
|
|
||||||
}
|
}
|
||||||
|
return FilterResult::Intercept(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle VT switches
|
// Handle VT switches
|
||||||
|
|
@ -1944,41 +1928,40 @@ impl State {
|
||||||
if old_descriptor.handle != new_descriptor.handle {
|
if old_descriptor.handle != new_descriptor.handle {
|
||||||
let (mut old_w, mut other_w) =
|
let (mut old_w, mut other_w) =
|
||||||
spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
||||||
if let Some(old_workspace) = old_w.get_mut(0) {
|
if let Some(old_workspace) = old_w.get_mut(0)
|
||||||
if let Some(new_workspace) = other_w
|
&& let Some(new_workspace) = other_w
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.find(|w| w.handle == new_descriptor.handle)
|
.find(|w| w.handle == new_descriptor.handle)
|
||||||
|
{
|
||||||
{
|
{
|
||||||
{
|
let mut stack = new_workspace.focus_stack.get_mut(seat);
|
||||||
let mut stack = new_workspace.focus_stack.get_mut(seat);
|
for elem in old_descriptor.focus_stack.iter().flat_map(|node_id| {
|
||||||
for elem in old_descriptor.focus_stack.iter().flat_map(|node_id| {
|
old_workspace.tiling_layer.element_for_node(node_id)
|
||||||
old_workspace.tiling_layer.element_for_node(node_id)
|
}) {
|
||||||
}) {
|
stack.append(elem.clone());
|
||||||
stack.append(elem.clone());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
{
|
|
||||||
let mut stack = old_workspace.focus_stack.get_mut(seat);
|
|
||||||
for elem in new_descriptor.focus_stack.iter().flat_map(|node_id| {
|
|
||||||
new_workspace.tiling_layer.element_for_node(node_id)
|
|
||||||
}) {
|
|
||||||
stack.append(elem.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(focus) = TilingLayout::swap_trees(
|
|
||||||
&mut old_workspace.tiling_layer,
|
|
||||||
Some(&mut new_workspace.tiling_layer),
|
|
||||||
old_descriptor,
|
|
||||||
&new_descriptor,
|
|
||||||
) {
|
|
||||||
let seat = seat.clone();
|
|
||||||
self.common.event_loop_handle.insert_idle(move |state| {
|
|
||||||
Shell::set_focus(state, Some(&focus), &seat, None, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
old_workspace.refresh_focus_stack();
|
|
||||||
new_workspace.refresh_focus_stack();
|
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
let mut stack = old_workspace.focus_stack.get_mut(seat);
|
||||||
|
for elem in new_descriptor.focus_stack.iter().flat_map(|node_id| {
|
||||||
|
new_workspace.tiling_layer.element_for_node(node_id)
|
||||||
|
}) {
|
||||||
|
stack.append(elem.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(focus) = TilingLayout::swap_trees(
|
||||||
|
&mut old_workspace.tiling_layer,
|
||||||
|
Some(&mut new_workspace.tiling_layer),
|
||||||
|
old_descriptor,
|
||||||
|
&new_descriptor,
|
||||||
|
) {
|
||||||
|
let seat = seat.clone();
|
||||||
|
self.common.event_loop_handle.insert_idle(move |state| {
|
||||||
|
Shell::set_focus(state, Some(&focus), &seat, None, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
old_workspace.refresh_focus_stack();
|
||||||
|
new_workspace.refresh_focus_stack();
|
||||||
}
|
}
|
||||||
} else if let Some(workspace) = spaces.find(|w| w.handle == new_descriptor.handle) {
|
} else if let Some(workspace) = spaces.find(|w| w.handle == new_descriptor.handle) {
|
||||||
if let Some(focus) = TilingLayout::swap_trees(
|
if let Some(focus) = TilingLayout::swap_trees(
|
||||||
|
|
@ -2002,36 +1985,34 @@ impl State {
|
||||||
let spaces = shell.workspaces.spaces_mut();
|
let spaces = shell.workspaces.spaces_mut();
|
||||||
let (mut old_w, mut other_w) =
|
let (mut old_w, mut other_w) =
|
||||||
spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
||||||
if let Some(old_workspace) = old_w.get_mut(0) {
|
if let Some(old_workspace) = old_w.get_mut(0)
|
||||||
if let Some(new_workspace) =
|
&& let Some(new_workspace) =
|
||||||
other_w.iter_mut().find(|w| w.handle == new_workspace)
|
other_w.iter_mut().find(|w| w.handle == new_workspace)
|
||||||
|
&& new_workspace.tiling_layer.windows().next().is_none()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
if new_workspace.tiling_layer.windows().next().is_none() {
|
let mut stack = new_workspace.focus_stack.get_mut(seat);
|
||||||
{
|
for elem in old_descriptor.focus_stack.iter().flat_map(|node_id| {
|
||||||
let mut stack = new_workspace.focus_stack.get_mut(seat);
|
old_workspace.tiling_layer.element_for_node(node_id)
|
||||||
for elem in old_descriptor.focus_stack.iter().flat_map(|node_id| {
|
}) {
|
||||||
old_workspace.tiling_layer.element_for_node(node_id)
|
stack.append(elem.clone());
|
||||||
}) {
|
|
||||||
stack.append(elem.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(focus) = TilingLayout::move_tree(
|
|
||||||
&mut old_workspace.tiling_layer,
|
|
||||||
&mut new_workspace.tiling_layer,
|
|
||||||
&new_workspace.handle,
|
|
||||||
seat,
|
|
||||||
new_workspace.focus_stack.get(seat).iter(),
|
|
||||||
old_descriptor.clone(),
|
|
||||||
None,
|
|
||||||
) {
|
|
||||||
let seat = seat.clone();
|
|
||||||
self.common.event_loop_handle.insert_idle(move |state| {
|
|
||||||
Shell::set_focus(state, Some(&focus), &seat, None, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
old_workspace.refresh_focus_stack();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let Some(focus) = TilingLayout::move_tree(
|
||||||
|
&mut old_workspace.tiling_layer,
|
||||||
|
&mut new_workspace.tiling_layer,
|
||||||
|
&new_workspace.handle,
|
||||||
|
seat,
|
||||||
|
new_workspace.focus_stack.get(seat).iter(),
|
||||||
|
old_descriptor.clone(),
|
||||||
|
None,
|
||||||
|
) {
|
||||||
|
let seat = seat.clone();
|
||||||
|
self.common.event_loop_handle.insert_idle(move |state| {
|
||||||
|
Shell::set_focus(state, Some(&focus), &seat, None, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
old_workspace.refresh_focus_stack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2136,10 +2117,9 @@ impl State {
|
||||||
.is_some_and(|geometry| {
|
.is_some_and(|geometry| {
|
||||||
geometry.contains(global_pos.to_local(output).to_i32_round())
|
geometry.contains(global_pos.to_local(output).to_i32_round())
|
||||||
})
|
})
|
||||||
|
&& let Some(element) = workspace.popup_element_under(location, seat)
|
||||||
{
|
{
|
||||||
if let Some(element) = workspace.popup_element_under(location, seat) {
|
return ControlFlow::Break(Ok(Some(element)));
|
||||||
return ControlFlow::Break(Ok(Some(element)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Stage::Workspace { workspace, offset } => {
|
Stage::Workspace { workspace, offset } => {
|
||||||
|
|
@ -2151,11 +2131,9 @@ impl State {
|
||||||
.is_some_and(|geometry| {
|
.is_some_and(|geometry| {
|
||||||
geometry.contains(global_pos.to_local(output).to_i32_round())
|
geometry.contains(global_pos.to_local(output).to_i32_round())
|
||||||
})
|
})
|
||||||
|
&& let Some(element) = workspace.toplevel_element_under(location, seat)
|
||||||
{
|
{
|
||||||
if let Some(element) = workspace.toplevel_element_under(location, seat)
|
return ControlFlow::Break(Ok(Some(element)));
|
||||||
{
|
|
||||||
return ControlFlow::Break(Ok(Some(element)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2199,12 +2177,11 @@ impl State {
|
||||||
|stage| {
|
|stage| {
|
||||||
match stage {
|
match stage {
|
||||||
Stage::ZoomUI => {
|
Stage::ZoomUI => {
|
||||||
if let Some(zoom_state) = shell.zoom_state() {
|
if let Some(zoom_state) = shell.zoom_state()
|
||||||
if let Some((target, loc)) =
|
&& let Some((target, loc)) =
|
||||||
zoom_state.surface_under(output, global_pos)
|
zoom_state.surface_under(output, global_pos)
|
||||||
{
|
{
|
||||||
return ControlFlow::Break(Ok(Some((target, loc))));
|
return ControlFlow::Break(Ok(Some((target, loc))));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Stage::SessionLock(lock_surface) => {
|
Stage::SessionLock(lock_surface) => {
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ pub fn setup_socket(handle: LoopHandle<State>, common: &Common) -> Result<()> {
|
||||||
stream.read_bytes = 0;
|
stream.read_bytes = 0;
|
||||||
match std::str::from_utf8(&stream.buffer) {
|
match std::str::from_utf8(&stream.buffer) {
|
||||||
Ok(message) => {
|
Ok(message) => {
|
||||||
match serde_json::from_str::<'_, Message>(&message) {
|
match serde_json::from_str::<'_, Message>(message) {
|
||||||
Ok(Message::SetEnv { .. }) => warn!("Got SetEnv from session? What is this?"),
|
Ok(Message::SetEnv { .. }) => warn!("Got SetEnv from session? What is this?"),
|
||||||
_ => warn!("Unknown session socket message, are you using incompatible cosmic-session and cosmic-comp versions?"),
|
_ => warn!("Unknown session socket message, are you using incompatible cosmic-session and cosmic-comp versions?"),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -602,10 +602,10 @@ impl CosmicStack {
|
||||||
let previous = p.previous_keyboard.swap(active, Ordering::SeqCst);
|
let previous = p.previous_keyboard.swap(active, Ordering::SeqCst);
|
||||||
if previous != active || p.reenter.swap(false, Ordering::SeqCst) {
|
if previous != active || p.reenter.swap(false, Ordering::SeqCst) {
|
||||||
let windows = p.windows.lock().unwrap();
|
let windows = p.windows.lock().unwrap();
|
||||||
if let Some(previous_surface) = windows.get(previous) {
|
if let Some(previous_surface) = windows.get(previous)
|
||||||
if previous != active {
|
&& previous != active
|
||||||
KeyboardTarget::leave(previous_surface, seat, data, serial);
|
{
|
||||||
}
|
KeyboardTarget::leave(previous_surface, seat, data, serial);
|
||||||
}
|
}
|
||||||
KeyboardTarget::enter(
|
KeyboardTarget::enter(
|
||||||
&windows[active],
|
&windows[active],
|
||||||
|
|
@ -685,15 +685,15 @@ impl CosmicStack {
|
||||||
if tiled && !appearance.shadow_tiled_windows {
|
if tiled && !appearance.shadow_tiled_windows {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let radii = round
|
let radii = if round {
|
||||||
.then(|| {
|
theme
|
||||||
theme
|
.cosmic()
|
||||||
.cosmic()
|
.radius_s()
|
||||||
.radius_s()
|
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
||||||
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
.map(|x| (x * scale as f32).round() as u8)
|
||||||
.map(|x| (x * scale as f32).round() as u8)
|
} else {
|
||||||
})
|
[0, 0, 0, 0]
|
||||||
.unwrap_or([0, 0, 0, 0]);
|
};
|
||||||
|
|
||||||
let mut geo = SpaceElement::geometry(&windows[active]).to_f64();
|
let mut geo = SpaceElement::geometry(&windows[active]).to_f64();
|
||||||
geo.size.h += TAB_HEIGHT as f64;
|
geo.size.h += TAB_HEIGHT as f64;
|
||||||
|
|
@ -857,37 +857,35 @@ impl CosmicStack {
|
||||||
if let Some(dragged_out) = self
|
if let Some(dragged_out) = self
|
||||||
.0
|
.0
|
||||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||||
{
|
&& let Some(surface) = self
|
||||||
if let Some(surface) = self
|
|
||||||
.0
|
.0
|
||||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||||
{
|
{
|
||||||
let seat = seat.clone();
|
let seat = seat.clone();
|
||||||
surface.try_force_undecorated(false);
|
surface.try_force_undecorated(false);
|
||||||
surface.send_configure();
|
surface.send_configure();
|
||||||
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
||||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
let res = state.common.shell.write().move_request(
|
let res = state.common.shell.write().move_request(
|
||||||
&surface,
|
&surface,
|
||||||
&seat,
|
&seat,
|
||||||
serial,
|
serial,
|
||||||
ReleaseMode::NoMouseButtons,
|
ReleaseMode::NoMouseButtons,
|
||||||
true,
|
true,
|
||||||
&state.common.config,
|
&state.common.config,
|
||||||
&state.common.event_loop_handle,
|
&state.common.event_loop_handle,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
if let Some((grab, focus)) = res {
|
if let Some((grab, focus)) = res {
|
||||||
if grab.is_touch_grab() {
|
if grab.is_touch_grab() {
|
||||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||||
} else {
|
} else {
|
||||||
seat.get_pointer()
|
seat.get_pointer()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_grab(state, grab, serial, focus);
|
.set_grab(state, grab, serial, focus);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1152,47 +1150,46 @@ impl Program for CosmicStackInternal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::TabMenu(idx) => {
|
Message::TabMenu(idx) => {
|
||||||
if let Some((seat, serial)) = last_seat.cloned() {
|
if let Some((seat, serial)) = last_seat.cloned()
|
||||||
if let Some(surface) = self.windows.lock().unwrap()[idx]
|
&& let Some(surface) = self.windows.lock().unwrap()[idx]
|
||||||
.wl_surface()
|
.wl_surface()
|
||||||
.map(Cow::into_owned)
|
.map(Cow::into_owned)
|
||||||
{
|
{
|
||||||
loop_handle.insert_idle(move |state| {
|
loop_handle.insert_idle(move |state| {
|
||||||
let shell = state.common.shell.read();
|
let shell = state.common.shell.read();
|
||||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
if let Some(mapped) = shell.element_for_surface(&surface).cloned()
|
||||||
if let Some(workspace) = shell.space_for(&mapped) {
|
&& let Some(workspace) = shell.space_for(&mapped)
|
||||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
{
|
||||||
return;
|
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||||
};
|
return;
|
||||||
let position = elem_geo.loc.to_global(&workspace.output);
|
};
|
||||||
|
let position = elem_geo.loc.to_global(&workspace.output);
|
||||||
|
|
||||||
let mut cursor = seat
|
let mut cursor = seat
|
||||||
.get_pointer()
|
.get_pointer()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.current_location()
|
.current_location()
|
||||||
.to_i32_round();
|
.to_i32_round();
|
||||||
cursor.y -= TAB_HEIGHT;
|
cursor.y -= TAB_HEIGHT;
|
||||||
let res = shell.menu_request(
|
let res = shell.menu_request(
|
||||||
false,
|
false,
|
||||||
&surface,
|
&surface,
|
||||||
&seat,
|
&seat,
|
||||||
serial,
|
serial,
|
||||||
cursor - position.as_logical(),
|
cursor - position.as_logical(),
|
||||||
false,
|
false,
|
||||||
&state.common.config,
|
&state.common.config,
|
||||||
&state.common.event_loop_handle,
|
&state.common.event_loop_handle,
|
||||||
);
|
);
|
||||||
|
|
||||||
std::mem::drop(shell);
|
std::mem::drop(shell);
|
||||||
if let Some((grab, focus)) = res {
|
if let Some((grab, focus)) = res {
|
||||||
seat.get_pointer()
|
seat.get_pointer()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_grab(state, grab, serial, focus);
|
.set_grab(state, grab, serial, focus);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
@ -1701,37 +1698,35 @@ impl PointerTarget<State> for CosmicStack {
|
||||||
if let Some(dragged_out) = self
|
if let Some(dragged_out) = self
|
||||||
.0
|
.0
|
||||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||||
{
|
&& let Some(surface) = self
|
||||||
if let Some(surface) = self
|
|
||||||
.0
|
.0
|
||||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||||
{
|
{
|
||||||
let seat = seat.clone();
|
let seat = seat.clone();
|
||||||
surface.try_force_undecorated(false);
|
surface.try_force_undecorated(false);
|
||||||
surface.send_configure();
|
surface.send_configure();
|
||||||
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
if let Some(surface) = surface.wl_surface().map(Cow::into_owned) {
|
||||||
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
let _ = data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
let res = state.common.shell.write().move_request(
|
let res = state.common.shell.write().move_request(
|
||||||
&surface,
|
&surface,
|
||||||
&seat,
|
&seat,
|
||||||
serial,
|
serial,
|
||||||
ReleaseMode::NoMouseButtons,
|
ReleaseMode::NoMouseButtons,
|
||||||
true,
|
true,
|
||||||
&state.common.config,
|
&state.common.config,
|
||||||
&state.common.event_loop_handle,
|
&state.common.event_loop_handle,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
if let Some((grab, focus)) = res {
|
if let Some((grab, focus)) = res {
|
||||||
if grab.is_touch_grab() {
|
if grab.is_touch_grab() {
|
||||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||||
} else {
|
} else {
|
||||||
seat.get_pointer()
|
seat.get_pointer()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_grab(state, grab, serial, focus);
|
.set_grab(state, grab, serial, focus);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -356,22 +356,20 @@ where
|
||||||
if matches!(
|
if matches!(
|
||||||
event,
|
event,
|
||||||
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
|
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
|
||||||
) {
|
) && let Some(message) = self.press_message.clone()
|
||||||
if let Some(message) = self.press_message.clone() {
|
{
|
||||||
shell.publish(message);
|
shell.publish(message);
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if matches!(
|
if matches!(
|
||||||
event,
|
event,
|
||||||
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Right))
|
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Right))
|
||||||
) {
|
) && let Some(message) = self.right_click_message.clone()
|
||||||
if let Some(message) = self.right_click_message.clone() {
|
{
|
||||||
shell.publish(message);
|
shell.publish(message);
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if matches!(
|
if matches!(
|
||||||
event,
|
event,
|
||||||
|
|
@ -379,7 +377,6 @@ where
|
||||||
) {
|
) {
|
||||||
shell.publish(Message::activate(self.idx));
|
shell.publish(Message::activate(self.idx));
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -270,10 +270,10 @@ impl State {
|
||||||
pub fn cleanup_old_animations(&mut self) {
|
pub fn cleanup_old_animations(&mut self) {
|
||||||
let start_time = Instant::now();
|
let start_time = Instant::now();
|
||||||
|
|
||||||
if let Some(animation) = self.scroll_animation.as_ref() {
|
if let Some(animation) = self.scroll_animation.as_ref()
|
||||||
if start_time.duration_since(animation.start_time) > SCROLL_ANIMATION_DURATION {
|
&& start_time.duration_since(animation.start_time) > SCROLL_ANIMATION_DURATION
|
||||||
self.scroll_animation.take();
|
{
|
||||||
}
|
self.scroll_animation.take();
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::discard_expired_tab_animations(&mut self.tab_animations, start_time);
|
Self::discard_expired_tab_animations(&mut self.tab_animations, start_time);
|
||||||
|
|
|
||||||
|
|
@ -693,15 +693,13 @@ impl CosmicSurface {
|
||||||
.primary_scanout_feedback
|
.primary_scanout_feedback
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap_or(&feedback.render_feedback)
|
.unwrap_or(&feedback.render_feedback)
|
||||||
|
} else if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||||
|
feedback
|
||||||
|
.overlay_scanout_feedback
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_or(&feedback.render_feedback)
|
||||||
} else {
|
} else {
|
||||||
if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
&feedback.render_feedback
|
||||||
feedback
|
|
||||||
.overlay_scanout_feedback
|
|
||||||
.as_ref()
|
|
||||||
.unwrap_or(&feedback.render_feedback)
|
|
||||||
} else {
|
|
||||||
&feedback.render_feedback
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -983,6 +981,6 @@ fn with_toplevel_state<T, F: FnOnce(Option<&smithay::wayland::shell::xdg::Toplev
|
||||||
if pending {
|
if pending {
|
||||||
toplevel.with_pending_state(|pending| cb(Some(pending)))
|
toplevel.with_pending_state(|pending| cb(Some(pending)))
|
||||||
} else {
|
} else {
|
||||||
toplevel.with_committed_state(|committed| cb(committed))
|
toplevel.with_committed_state(cb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -576,10 +576,8 @@ impl CosmicWindow {
|
||||||
*conf = *appearance;
|
*conf = *appearance;
|
||||||
if appearance.clip_floating_windows {
|
if appearance.clip_floating_windows {
|
||||||
p.window.set_tiled(true);
|
p.window.set_tiled(true);
|
||||||
} else {
|
} else if !p.tiled.load(Ordering::Acquire) {
|
||||||
if !p.tiled.load(Ordering::Acquire) {
|
p.window.set_tiled(false);
|
||||||
p.window.set_tiled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
p.window.send_configure();
|
p.window.send_configure();
|
||||||
}
|
}
|
||||||
|
|
@ -633,8 +631,8 @@ impl CosmicWindow {
|
||||||
&& !p.window.is_maximized(false);
|
&& !p.window.is_maximized(false);
|
||||||
let round =
|
let round =
|
||||||
(!is_tiled || appearance.clip_tiled_windows) && !p.window.is_maximized(false);
|
(!is_tiled || appearance.clip_tiled_windows) && !p.window.is_maximized(false);
|
||||||
let radii = round
|
let radii = if round {
|
||||||
.then(|| {
|
{
|
||||||
p.theme
|
p.theme
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -642,8 +640,10 @@ impl CosmicWindow {
|
||||||
.radius_s()
|
.radius_s()
|
||||||
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
||||||
.map(|x| x.round() as u8)
|
.map(|x| x.round() as u8)
|
||||||
})
|
}
|
||||||
.unwrap_or([0; 4]);
|
} else {
|
||||||
|
[0; 4]
|
||||||
|
};
|
||||||
|
|
||||||
match (has_ssd, clip) {
|
match (has_ssd, clip) {
|
||||||
(has_ssd, true) => {
|
(has_ssd, true) => {
|
||||||
|
|
@ -698,30 +698,30 @@ impl Program for CosmicWindowInternal {
|
||||||
) -> Task<Self::Message> {
|
) -> Task<Self::Message> {
|
||||||
match message {
|
match message {
|
||||||
Message::DragStart => {
|
Message::DragStart => {
|
||||||
if let Some((seat, serial)) = last_seat.cloned() {
|
if let Some((seat, serial)) = last_seat.cloned()
|
||||||
if let Some(surface) = self.window.wl_surface().map(Cow::into_owned) {
|
&& let Some(surface) = self.window.wl_surface().map(Cow::into_owned)
|
||||||
loop_handle.insert_idle(move |state| {
|
{
|
||||||
let res = state.common.shell.write().move_request(
|
loop_handle.insert_idle(move |state| {
|
||||||
&surface,
|
let res = state.common.shell.write().move_request(
|
||||||
&seat,
|
&surface,
|
||||||
serial,
|
&seat,
|
||||||
ReleaseMode::NoMouseButtons,
|
serial,
|
||||||
false,
|
ReleaseMode::NoMouseButtons,
|
||||||
&state.common.config,
|
false,
|
||||||
&state.common.event_loop_handle,
|
&state.common.config,
|
||||||
false,
|
&state.common.event_loop_handle,
|
||||||
);
|
false,
|
||||||
if let Some((grab, focus)) = res {
|
);
|
||||||
if grab.is_touch_grab() {
|
if let Some((grab, focus)) = res {
|
||||||
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
if grab.is_touch_grab() {
|
||||||
} else {
|
seat.get_touch().unwrap().set_grab(state, grab, serial);
|
||||||
seat.get_pointer()
|
} else {
|
||||||
.unwrap()
|
seat.get_pointer()
|
||||||
.set_grab(state, grab, serial, focus);
|
.unwrap()
|
||||||
}
|
.set_grab(state, grab, serial, focus);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::Minimize => {
|
Message::Minimize => {
|
||||||
|
|
@ -745,51 +745,51 @@ impl Program for CosmicWindowInternal {
|
||||||
}
|
}
|
||||||
Message::Close => self.window.close(),
|
Message::Close => self.window.close(),
|
||||||
Message::Menu => {
|
Message::Menu => {
|
||||||
if let Some((seat, serial)) = last_seat.cloned() {
|
if let Some((seat, serial)) = last_seat.cloned()
|
||||||
if let Some(surface) = self.window.wl_surface().map(Cow::into_owned) {
|
&& let Some(surface) = self.window.wl_surface().map(Cow::into_owned)
|
||||||
loop_handle.insert_idle(move |state| {
|
{
|
||||||
let shell = state.common.shell.read();
|
loop_handle.insert_idle(move |state| {
|
||||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
let shell = state.common.shell.read();
|
||||||
let position = if let Some((output, set)) =
|
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
||||||
shell.workspaces.sets.iter().find(|(_, set)| {
|
let position = if let Some((output, set)) =
|
||||||
set.sticky_layer.mapped().any(|m| m == &mapped)
|
shell.workspaces.sets.iter().find(|(_, set)| {
|
||||||
}) {
|
set.sticky_layer.mapped().any(|m| m == &mapped)
|
||||||
set.sticky_layer
|
}) {
|
||||||
.element_geometry(&mapped)
|
set.sticky_layer
|
||||||
.unwrap()
|
.element_geometry(&mapped)
|
||||||
.loc
|
.unwrap()
|
||||||
.to_global(output)
|
.loc
|
||||||
} else if let Some(workspace) = shell.space_for(&mapped) {
|
.to_global(output)
|
||||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
} else if let Some(workspace) = shell.space_for(&mapped) {
|
||||||
return;
|
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||||
};
|
|
||||||
elem_geo.loc.to_global(&workspace.output)
|
|
||||||
} else {
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
elem_geo.loc.to_global(&workspace.output)
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let pointer = seat.get_pointer().unwrap();
|
let pointer = seat.get_pointer().unwrap();
|
||||||
let mut cursor = pointer.current_location().to_i32_round();
|
let mut cursor = pointer.current_location().to_i32_round();
|
||||||
cursor.y -= SSD_HEIGHT;
|
cursor.y -= SSD_HEIGHT;
|
||||||
|
|
||||||
let res = shell.menu_request(
|
let res = shell.menu_request(
|
||||||
false,
|
false,
|
||||||
&surface,
|
&surface,
|
||||||
&seat,
|
&seat,
|
||||||
serial,
|
serial,
|
||||||
cursor - position.as_logical(),
|
cursor - position.as_logical(),
|
||||||
false,
|
false,
|
||||||
&state.common.config,
|
&state.common.config,
|
||||||
&state.common.event_loop_handle,
|
&state.common.event_loop_handle,
|
||||||
);
|
);
|
||||||
|
|
||||||
std::mem::drop(shell);
|
std::mem::drop(shell);
|
||||||
if let Some((grab, focus)) = res {
|
if let Some((grab, focus)) = res {
|
||||||
pointer.set_grab(state, grab, serial, focus);
|
pointer.set_grab(state, grab, serial, focus);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -238,10 +238,9 @@ impl Shell {
|
||||||
.user_data()
|
.user_data()
|
||||||
.get::<PopupGrabData>()
|
.get::<PopupGrabData>()
|
||||||
.and_then(|x| x.take())
|
.and_then(|x| x.take())
|
||||||
|
&& !popup_grab.has_ended()
|
||||||
{
|
{
|
||||||
if !popup_grab.has_ended() {
|
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -501,31 +500,28 @@ impl Common {
|
||||||
trace!("Wrong Window, focus fixup");
|
trace!("Wrong Window, focus fixup");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let KeyboardFocusTarget::Popup(_) = target {
|
if let KeyboardFocusTarget::Popup(_) = target
|
||||||
if let Some(popup_grab) = seat
|
&& let Some(popup_grab) = seat
|
||||||
.user_data()
|
.user_data()
|
||||||
.get::<PopupGrabData>()
|
.get::<PopupGrabData>()
|
||||||
.and_then(|x| x.take())
|
.and_then(|x| x.take())
|
||||||
{
|
&& !popup_grab.has_ended()
|
||||||
if !popup_grab.has_ended() {
|
&& let Some(new) = popup_grab.current_grab()
|
||||||
if let Some(new) = popup_grab.current_grab() {
|
{
|
||||||
trace!("restore focus to previous popup grab");
|
trace!("restore focus to previous popup grab");
|
||||||
std::mem::drop(shell);
|
std::mem::drop(shell);
|
||||||
// TODO: verify whether cursor should be updated at end of popup grab
|
// TODO: verify whether cursor should be updated at end of popup grab
|
||||||
update_focus_state(
|
update_focus_state(
|
||||||
seat,
|
seat,
|
||||||
Some(&new),
|
Some(&new),
|
||||||
state,
|
state,
|
||||||
Some(SERIAL_COUNTER.next_serial()),
|
Some(SERIAL_COUNTER.next_serial()),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
seat.user_data()
|
seat.user_data()
|
||||||
.get_or_insert::<PopupGrabData, _>(PopupGrabData::default)
|
.get_or_insert::<PopupGrabData, _>(PopupGrabData::default)
|
||||||
.set(Some(popup_grab));
|
.set(Some(popup_grab));
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
trace!("Surface dead, focus fixup");
|
trace!("Surface dead, focus fixup");
|
||||||
}
|
}
|
||||||
|
|
@ -547,10 +543,9 @@ impl Common {
|
||||||
.user_data()
|
.user_data()
|
||||||
.get::<PopupGrabData>()
|
.get::<PopupGrabData>()
|
||||||
.and_then(|x| x.take())
|
.and_then(|x| x.take())
|
||||||
|
&& !popup_grab.has_ended()
|
||||||
{
|
{
|
||||||
if !popup_grab.has_ended() {
|
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update keyboard focus
|
// update keyboard focus
|
||||||
|
|
@ -682,12 +677,12 @@ fn update_focus_target(
|
||||||
} else {
|
} else {
|
||||||
let workspace = shell.active_space(output).unwrap();
|
let workspace = shell.active_space(output).unwrap();
|
||||||
|
|
||||||
if let Some(Trigger::KeyboardSwap(_, desc)) = shell.overview_mode().0.active_trigger() {
|
if let Some(Trigger::KeyboardSwap(_, desc)) = shell.overview_mode().0.active_trigger()
|
||||||
if workspace.handle == desc.handle && workspace.tiling_layer.has_node(&desc.node) {
|
&& workspace.handle == desc.handle
|
||||||
if let Some(focus) = workspace.tiling_layer.node_desc_to_focus(desc) {
|
&& workspace.tiling_layer.has_node(&desc.node)
|
||||||
return Some(focus);
|
&& let Some(focus) = workspace.tiling_layer.node_desc_to_focus(desc)
|
||||||
}
|
{
|
||||||
}
|
return Some(focus);
|
||||||
}
|
}
|
||||||
|
|
||||||
workspace
|
workspace
|
||||||
|
|
|
||||||
|
|
@ -271,16 +271,16 @@ fn render_input_order_internal<R: 'static>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||||
if !has_fullscreen {
|
&& !has_fullscreen
|
||||||
// previous bottom layer popups
|
{
|
||||||
for (layer, popup, location) in layer_popups(output, Layer::Bottom, element_filter) {
|
// previous bottom layer popups
|
||||||
callback(Stage::LayerPopup {
|
for (layer, popup, location) in layer_popups(output, Layer::Bottom, element_filter) {
|
||||||
layer,
|
callback(Stage::LayerPopup {
|
||||||
popup: &popup,
|
layer,
|
||||||
location: location + offset.as_global(),
|
popup: &popup,
|
||||||
})?;
|
location: location + offset.as_global(),
|
||||||
}
|
})?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -295,17 +295,16 @@ fn render_input_order_internal<R: 'static>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||||
if !has_fullscreen {
|
&& !has_fullscreen
|
||||||
// previous background layer popups
|
{
|
||||||
for (layer, popup, location) in layer_popups(output, Layer::Background, element_filter)
|
// previous background layer popups
|
||||||
{
|
for (layer, popup, location) in layer_popups(output, Layer::Background, element_filter) {
|
||||||
callback(Stage::LayerPopup {
|
callback(Stage::LayerPopup {
|
||||||
layer,
|
layer,
|
||||||
popup: &popup,
|
popup: &popup,
|
||||||
location: location + offset.as_global(),
|
location: location + offset.as_global(),
|
||||||
})?;
|
})?;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -348,13 +347,13 @@ fn render_input_order_internal<R: 'static>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||||
if !has_fullscreen {
|
&& !has_fullscreen
|
||||||
// previous bottom layer
|
{
|
||||||
for (layer, mut location) in layer_surfaces(output, Layer::Bottom, element_filter) {
|
// previous bottom layer
|
||||||
location += offset.as_global();
|
for (layer, mut location) in layer_surfaces(output, Layer::Bottom, element_filter) {
|
||||||
callback(Stage::LayerSurface { layer, location })?;
|
location += offset.as_global();
|
||||||
}
|
callback(Stage::LayerSurface { layer, location })?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -366,13 +365,13 @@ fn render_input_order_internal<R: 'static>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||||
if !has_fullscreen {
|
&& !has_fullscreen
|
||||||
// previous background layer
|
{
|
||||||
for (layer, mut location) in layer_surfaces(output, Layer::Background, element_filter) {
|
// previous background layer
|
||||||
location += offset.as_global();
|
for (layer, mut location) in layer_surfaces(output, Layer::Background, element_filter) {
|
||||||
callback(Stage::LayerSurface { layer, location })?;
|
location += offset.as_global();
|
||||||
}
|
callback(Stage::LayerSurface { layer, location })?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,18 +63,18 @@ impl<G: PointerGrab<State>> PointerGrab<State> for DelayGrab<G> {
|
||||||
handle.motion(data, focus, event);
|
handle.motion(data, focus, event);
|
||||||
|
|
||||||
let distance = self.start_data.distance(event.location);
|
let distance = self.start_data.distance(event.location);
|
||||||
if distance >= 1. {
|
if distance >= 1.
|
||||||
if let Some(factory) = self.grab_factory.take() {
|
&& let Some(factory) = self.grab_factory.take()
|
||||||
let serial = self.serial.unwrap_or(event.serial);
|
{
|
||||||
let seat = self.seat.clone();
|
let serial = self.serial.unwrap_or(event.serial);
|
||||||
data.common.event_loop_handle.insert_idle(move |data| {
|
let seat = self.seat.clone();
|
||||||
if let Some((grab, focus)) = factory(data) {
|
data.common.event_loop_handle.insert_idle(move |data| {
|
||||||
seat.get_pointer()
|
if let Some((grab, focus)) = factory(data) {
|
||||||
.unwrap()
|
seat.get_pointer()
|
||||||
.set_grab(data, grab, serial, focus);
|
.unwrap()
|
||||||
}
|
.set_grab(data, grab, serial, focus);
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -232,16 +232,16 @@ impl<G: TouchGrab<State>> TouchGrab<State> for DelayGrab<G> {
|
||||||
handle.motion(data, focus, event, seq);
|
handle.motion(data, focus, event, seq);
|
||||||
|
|
||||||
let distance = self.start_data.distance(event.location);
|
let distance = self.start_data.distance(event.location);
|
||||||
if distance >= 1. {
|
if distance >= 1.
|
||||||
if let Some(factory) = self.grab_factory.take() {
|
&& let Some(factory) = self.grab_factory.take()
|
||||||
let seat = self.seat.clone();
|
{
|
||||||
let serial = self.serial.unwrap_or_else(|| SERIAL_COUNTER.next_serial());
|
let seat = self.seat.clone();
|
||||||
data.common.event_loop_handle.insert_idle(move |data| {
|
let serial = self.serial.unwrap_or_else(|| SERIAL_COUNTER.next_serial());
|
||||||
if let Some((grab, _)) = factory(data) {
|
data.common.event_loop_handle.insert_idle(move |data| {
|
||||||
seat.get_touch().unwrap().set_grab(data, grab, serial);
|
if let Some((grab, _)) = factory(data) {
|
||||||
}
|
seat.get_touch().unwrap().set_grab(data, grab, serial);
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,115 +260,112 @@ impl Program for ContextMenu {
|
||||||
// But right now we don't have any touch responsive menus with submenus
|
// But right now we don't have any touch responsive menus with submenus
|
||||||
}
|
}
|
||||||
Message::ItemEntered(idx, bounds) => {
|
Message::ItemEntered(idx, bounds) => {
|
||||||
if let Some(Item::Submenu { items, .. }) = self.items.get_mut(idx) {
|
if let Some(Item::Submenu { items, .. }) = self.items.get_mut(idx)
|
||||||
if let Some((seat, _)) = last_seat.cloned() {
|
&& let Some((seat, _)) = last_seat.cloned()
|
||||||
let items = items.clone();
|
{
|
||||||
let _ = loop_handle.insert_idle(move |state| {
|
let items = items.clone();
|
||||||
let grab_state = seat
|
let _ = loop_handle.insert_idle(move |state| {
|
||||||
.user_data()
|
let grab_state = seat
|
||||||
.get::<SeatMenuGrabState>()
|
.user_data()
|
||||||
.unwrap()
|
.get::<SeatMenuGrabState>()
|
||||||
.lock()
|
.unwrap()
|
||||||
.unwrap();
|
.lock()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
if let Some(grab_state) = &*grab_state {
|
if let Some(grab_state) = &*grab_state {
|
||||||
let mut elements = grab_state.elements.lock().unwrap();
|
let mut elements = grab_state.elements.lock().unwrap();
|
||||||
|
|
||||||
let position = elements.last().unwrap().position;
|
let position = elements.last().unwrap().position;
|
||||||
let element = IcedElement::new(
|
let element = IcedElement::new(
|
||||||
ContextMenu::new(items),
|
ContextMenu::new(items),
|
||||||
Size::default(),
|
Size::default(),
|
||||||
state.common.event_loop_handle.clone(),
|
state.common.event_loop_handle.clone(),
|
||||||
state.common.theme.clone(),
|
state.common.theme.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let min_size = element.minimum_size();
|
let min_size = element.minimum_size();
|
||||||
element.with_program(|p| {
|
element.with_program(|p| {
|
||||||
*p.row_width.lock().unwrap() = Some(min_size.w as f32);
|
*p.row_width.lock().unwrap() = Some(min_size.w as f32);
|
||||||
});
|
});
|
||||||
element.resize(min_size);
|
element.resize(min_size);
|
||||||
|
|
||||||
let output = seat.active_output();
|
let output = seat.active_output();
|
||||||
let position = [
|
let position = [
|
||||||
// to the right -> down
|
// to the right -> down
|
||||||
Rectangle::new(
|
Rectangle::new(
|
||||||
position
|
position
|
||||||
+ Point::from((
|
+ Point::from((
|
||||||
bounds.width.ceil() as i32,
|
bounds.width.ceil() as i32,
|
||||||
bounds.y.ceil() as i32,
|
bounds.y.ceil() as i32,
|
||||||
)),
|
)),
|
||||||
min_size.as_global(),
|
min_size.as_global(),
|
||||||
),
|
),
|
||||||
// to the right -> up
|
// to the right -> up
|
||||||
Rectangle::new(
|
Rectangle::new(
|
||||||
position
|
position
|
||||||
+ Point::from((
|
+ Point::from((
|
||||||
bounds.width.ceil() as i32,
|
bounds.width.ceil() as i32,
|
||||||
bounds.y.ceil() as i32
|
bounds.y.ceil() as i32 + bounds.height.ceil() as i32
|
||||||
+ bounds.height.ceil() as i32
|
- min_size.h,
|
||||||
- min_size.h,
|
)),
|
||||||
)),
|
min_size.as_global(),
|
||||||
min_size.as_global(),
|
),
|
||||||
),
|
// to the left -> down
|
||||||
// to the left -> down
|
Rectangle::new(
|
||||||
Rectangle::new(
|
position + Point::from((-min_size.w, bounds.y.ceil() as i32)),
|
||||||
position
|
min_size.as_global(),
|
||||||
+ Point::from((-min_size.w, bounds.y.ceil() as i32)),
|
),
|
||||||
min_size.as_global(),
|
// to the left -> up
|
||||||
),
|
Rectangle::new(
|
||||||
// to the left -> up
|
position
|
||||||
Rectangle::new(
|
+ Point::from((
|
||||||
position
|
-min_size.w,
|
||||||
+ Point::from((
|
bounds.y.ceil() as i32 + bounds.height.ceil() as i32
|
||||||
-min_size.w,
|
- min_size.h,
|
||||||
bounds.y.ceil() as i32
|
)),
|
||||||
+ bounds.height.ceil() as i32
|
min_size.as_global(),
|
||||||
- min_size.h,
|
),
|
||||||
)),
|
]
|
||||||
min_size.as_global(),
|
.iter()
|
||||||
),
|
.rev() // preference of max_by_key is backwards
|
||||||
]
|
.max_by_key(|rect| {
|
||||||
.iter()
|
output
|
||||||
.rev() // preference of max_by_key is backwards
|
.geometry()
|
||||||
.max_by_key(|rect| {
|
.intersection(**rect)
|
||||||
output
|
.map(|rect| rect.size.w * rect.size.h)
|
||||||
.geometry()
|
})
|
||||||
.intersection(**rect)
|
.unwrap()
|
||||||
.map(|rect| rect.size.w * rect.size.h)
|
.loc;
|
||||||
})
|
element.output_enter(&output, element.bbox());
|
||||||
.unwrap()
|
element.set_additional_scale(*grab_state.scale.lock().unwrap());
|
||||||
.loc;
|
|
||||||
element.output_enter(&output, element.bbox());
|
|
||||||
element.set_additional_scale(*grab_state.scale.lock().unwrap());
|
|
||||||
|
|
||||||
elements.push(Element {
|
elements.push(Element {
|
||||||
iced: element,
|
iced: element,
|
||||||
position,
|
position,
|
||||||
pointer_entered: false,
|
pointer_entered: false,
|
||||||
touch_entered: None,
|
touch_entered: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::ItemLeft(idx, _) => {
|
Message::ItemLeft(idx, _) => {
|
||||||
if let Some(Item::Submenu { .. }) = self.items.get_mut(idx) {
|
if let Some(Item::Submenu { .. }) = self.items.get_mut(idx)
|
||||||
if let Some((seat, _)) = last_seat.cloned() {
|
&& let Some((seat, _)) = last_seat.cloned()
|
||||||
let _ = loop_handle.insert_idle(move |_| {
|
{
|
||||||
let grab_state = seat
|
let _ = loop_handle.insert_idle(move |_| {
|
||||||
.user_data()
|
let grab_state = seat
|
||||||
.get::<SeatMenuGrabState>()
|
.user_data()
|
||||||
.unwrap()
|
.get::<SeatMenuGrabState>()
|
||||||
.lock()
|
.unwrap()
|
||||||
.unwrap();
|
.lock()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
if let Some(grab_state) = &*grab_state {
|
if let Some(grab_state) = &*grab_state {
|
||||||
let mut elements = grab_state.elements.lock().unwrap();
|
let mut elements = grab_state.elements.lock().unwrap();
|
||||||
elements.pop();
|
elements.pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -862,43 +862,43 @@ impl Drop for MoveGrab {
|
||||||
window_location.to_local(&workspace.output),
|
window_location.to_local(&workspace.output),
|
||||||
);
|
);
|
||||||
|
|
||||||
if matches!(previous, ManagedLayer::Floating) {
|
if matches!(previous, ManagedLayer::Floating)
|
||||||
if let Some(sz) = grab_state.snapping_zone {
|
&& let Some(sz) = grab_state.snapping_zone
|
||||||
if sz == SnappingZone::Maximize {
|
{
|
||||||
shell.maximize_toggle(
|
if sz == SnappingZone::Maximize {
|
||||||
&window,
|
shell.maximize_toggle(
|
||||||
&seat,
|
&window,
|
||||||
&state.common.event_loop_handle,
|
&seat,
|
||||||
);
|
&state.common.event_loop_handle,
|
||||||
} else {
|
);
|
||||||
let directions = match sz {
|
} else {
|
||||||
SnappingZone::Maximize => vec![],
|
let directions = match sz {
|
||||||
SnappingZone::Top => vec![Direction::Up],
|
SnappingZone::Maximize => vec![],
|
||||||
SnappingZone::TopLeft => {
|
SnappingZone::Top => vec![Direction::Up],
|
||||||
vec![Direction::Up, Direction::Left]
|
SnappingZone::TopLeft => {
|
||||||
}
|
vec![Direction::Up, Direction::Left]
|
||||||
SnappingZone::Left => vec![Direction::Left],
|
|
||||||
SnappingZone::BottomLeft => {
|
|
||||||
vec![Direction::Down, Direction::Left]
|
|
||||||
}
|
|
||||||
SnappingZone::Bottom => vec![Direction::Down],
|
|
||||||
SnappingZone::BottomRight => {
|
|
||||||
vec![Direction::Down, Direction::Right]
|
|
||||||
}
|
|
||||||
SnappingZone::Right => vec![Direction::Right],
|
|
||||||
SnappingZone::TopRight => {
|
|
||||||
vec![Direction::Up, Direction::Right]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for direction in directions {
|
|
||||||
workspace.floating_layer.move_element(
|
|
||||||
direction,
|
|
||||||
&seat,
|
|
||||||
ManagedLayer::Floating,
|
|
||||||
&theme,
|
|
||||||
&window,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
SnappingZone::Left => vec![Direction::Left],
|
||||||
|
SnappingZone::BottomLeft => {
|
||||||
|
vec![Direction::Down, Direction::Left]
|
||||||
|
}
|
||||||
|
SnappingZone::Bottom => vec![Direction::Down],
|
||||||
|
SnappingZone::BottomRight => {
|
||||||
|
vec![Direction::Down, Direction::Right]
|
||||||
|
}
|
||||||
|
SnappingZone::Right => vec![Direction::Right],
|
||||||
|
SnappingZone::TopRight => {
|
||||||
|
vec![Direction::Up, Direction::Right]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for direction in directions {
|
||||||
|
workspace.floating_layer.move_element(
|
||||||
|
direction,
|
||||||
|
&seat,
|
||||||
|
ManagedLayer::Floating,
|
||||||
|
&theme,
|
||||||
|
&window,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,10 +525,10 @@ impl ResizeSurfaceGrab {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Finish resizing.
|
// Finish resizing.
|
||||||
if let Some(ResizeState::WaitingForCommit(_)) = *resize_state {
|
if let Some(ResizeState::WaitingForCommit(_)) = *resize_state
|
||||||
if !window.is_resizing(false).unwrap_or(false) {
|
&& !window.is_resizing(false).unwrap_or(false)
|
||||||
*resize_state = None;
|
{
|
||||||
}
|
*resize_state = None;
|
||||||
}
|
}
|
||||||
std::mem::drop(resize_state);
|
std::mem::drop(resize_state);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -385,13 +385,12 @@ impl FloatingLayout {
|
||||||
} else {
|
} else {
|
||||||
self.animations.remove(&mapped);
|
self.animations.remove(&mapped);
|
||||||
}
|
}
|
||||||
if mapped.floating_tiled.lock().unwrap().take().is_some() {
|
if mapped.floating_tiled.lock().unwrap().take().is_some()
|
||||||
if let Some(state) = mapped.maximized_state.lock().unwrap().as_mut() {
|
&& let Some(state) = mapped.maximized_state.lock().unwrap().as_mut()
|
||||||
if let Some(real_old_geo) = *mapped.last_geometry.lock().unwrap() {
|
&& let Some(real_old_geo) = *mapped.last_geometry.lock().unwrap()
|
||||||
state.original_geometry = real_old_geo;
|
{
|
||||||
}
|
state.original_geometry = real_old_geo;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
self.space
|
self.space
|
||||||
.map_element(mapped, geometry.loc.as_logical(), true);
|
.map_element(mapped, geometry.loc.as_logical(), true);
|
||||||
self.space.refresh();
|
self.space.refresh();
|
||||||
|
|
@ -683,10 +682,10 @@ impl FloatingLayout {
|
||||||
mapped_geometry.size = last_size;
|
mapped_geometry.size = last_size;
|
||||||
}
|
}
|
||||||
} else if !window.is_maximized(true) {
|
} else if !window.is_maximized(true) {
|
||||||
if window.active_window().has_pending_changes() {
|
if window.active_window().has_pending_changes()
|
||||||
if let Some(pending_size) = window.pending_size() {
|
&& let Some(pending_size) = window.pending_size()
|
||||||
mapped_geometry.size = pending_size.as_local();
|
{
|
||||||
}
|
mapped_geometry.size = pending_size.as_local();
|
||||||
}
|
}
|
||||||
*window.last_geometry.lock().unwrap() = Some(mapped_geometry);
|
*window.last_geometry.lock().unwrap() = Some(mapped_geometry);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -452,53 +452,51 @@ impl TilingLayout {
|
||||||
mut sizes,
|
mut sizes,
|
||||||
}) = tiling_state
|
}) = tiling_state
|
||||||
{
|
{
|
||||||
if let Some(node) = parent.as_ref().and_then(|parent| tree.get_mut(parent).ok()) {
|
if let Some(node) = parent.as_ref().and_then(|parent| tree.get_mut(parent).ok())
|
||||||
if let Data::Group {
|
&& let Data::Group {
|
||||||
orientation: current_orientation,
|
orientation: current_orientation,
|
||||||
sizes: current_sizes,
|
sizes: current_sizes,
|
||||||
..
|
..
|
||||||
} = node.data_mut()
|
} = node.data_mut()
|
||||||
{
|
{
|
||||||
let parent_id = parent.unwrap();
|
let parent_id = parent.unwrap();
|
||||||
|
|
||||||
if *current_orientation == orientation && sizes.len() == current_sizes.len() + 1
|
if *current_orientation == orientation && sizes.len() == current_sizes.len() + 1 {
|
||||||
{
|
let previous_length: i32 = sizes.iter().copied().sum();
|
||||||
let previous_length: i32 = sizes.iter().copied().sum();
|
let new_length: i32 = current_sizes.iter().copied().sum();
|
||||||
let new_length: i32 = current_sizes.iter().copied().sum();
|
if previous_length != new_length {
|
||||||
if previous_length != new_length {
|
// rescale sizes
|
||||||
// rescale sizes
|
sizes.iter_mut().for_each(|len| {
|
||||||
sizes.iter_mut().for_each(|len| {
|
*len = (((*len as f64) / (previous_length as f64))
|
||||||
*len = (((*len as f64) / (previous_length as f64))
|
* (new_length as f64))
|
||||||
* (new_length as f64))
|
.round() as i32;
|
||||||
.round() as i32;
|
});
|
||||||
});
|
let sum: i32 = sizes.iter().sum();
|
||||||
let sum: i32 = sizes.iter().sum();
|
|
||||||
|
|
||||||
// fix rounding issues
|
// fix rounding issues
|
||||||
if sum != new_length {
|
if sum != new_length {
|
||||||
let diff = new_length - sum;
|
let diff = new_length - sum;
|
||||||
*sizes.last_mut().unwrap() += diff;
|
*sizes.last_mut().unwrap() += diff;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*current_sizes = sizes;
|
|
||||||
let new_node = Node::new(Data::Mapped {
|
|
||||||
mapped: window.clone(),
|
|
||||||
last_geometry: Rectangle::from_size((100, 100).into()),
|
|
||||||
minimize_rect: from,
|
|
||||||
});
|
|
||||||
let new_id = tree
|
|
||||||
.insert(new_node, InsertBehavior::UnderNode(&parent_id))
|
|
||||||
.unwrap();
|
|
||||||
tree.make_nth_sibling(&new_id, idx).unwrap();
|
|
||||||
*window.tiling_node_id.lock().unwrap() = Some(new_id);
|
|
||||||
|
|
||||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
|
||||||
self.queue
|
|
||||||
.push_tree(tree, MINIMIZE_ANIMATION_DURATION, blocker);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*current_sizes = sizes;
|
||||||
|
let new_node = Node::new(Data::Mapped {
|
||||||
|
mapped: window.clone(),
|
||||||
|
last_geometry: Rectangle::from_size((100, 100).into()),
|
||||||
|
minimize_rect: from,
|
||||||
|
});
|
||||||
|
let new_id = tree
|
||||||
|
.insert(new_node, InsertBehavior::UnderNode(&parent_id))
|
||||||
|
.unwrap();
|
||||||
|
tree.make_nth_sibling(&new_id, idx).unwrap();
|
||||||
|
*window.tiling_node_id.lock().unwrap() = Some(new_id);
|
||||||
|
|
||||||
|
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||||
|
self.queue
|
||||||
|
.push_tree(tree, MINIMIZE_ANIMATION_DURATION, blocker);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if sibling
|
if sibling
|
||||||
|
|
@ -1414,8 +1412,8 @@ impl TilingLayout {
|
||||||
let tiling_node_id = mapped.tiling_node_id.lock().unwrap().as_ref().cloned();
|
let tiling_node_id = mapped.tiling_node_id.lock().unwrap().as_ref().cloned();
|
||||||
let gaps = self.gaps();
|
let gaps = self.gaps();
|
||||||
|
|
||||||
if let Some(node_id) = tiling_node_id {
|
if let Some(node_id) = tiling_node_id
|
||||||
if self
|
&& self
|
||||||
.queue
|
.queue
|
||||||
.trees
|
.trees
|
||||||
.back()
|
.back()
|
||||||
|
|
@ -1424,21 +1422,20 @@ impl TilingLayout {
|
||||||
.get(&node_id)
|
.get(&node_id)
|
||||||
.map(|node| node.data().is_mapped(Some(mapped)))
|
.map(|node| node.data().is_mapped(Some(mapped)))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
let mut tree = self.queue.trees.back().unwrap().0.copy_clone();
|
let mut tree = self.queue.trees.back().unwrap().0.copy_clone();
|
||||||
|
|
||||||
TilingLayout::unmap_internal(&mut tree, &node_id);
|
TilingLayout::unmap_internal(&mut tree, &node_id);
|
||||||
|
|
||||||
let duration = if minimizing {
|
let duration = if minimizing {
|
||||||
MINIMIZE_ANIMATION_DURATION
|
MINIMIZE_ANIMATION_DURATION
|
||||||
} else {
|
} else {
|
||||||
ANIMATION_DURATION
|
ANIMATION_DURATION
|
||||||
};
|
};
|
||||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||||
self.queue.push_tree(tree, duration, blocker);
|
self.queue.push_tree(tree, duration, blocker);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
@ -1742,7 +1739,7 @@ impl TilingLayout {
|
||||||
_ => {
|
_ => {
|
||||||
// we want the middle
|
// we want the middle
|
||||||
let group_len = tree.get(&next_child_id).unwrap().data().len();
|
let group_len = tree.get(&next_child_id).unwrap().data().len();
|
||||||
if group_len % 2 == 0 {
|
if group_len.is_multiple_of(2) {
|
||||||
tree.make_nth_sibling(&node_id, group_len / 2).unwrap();
|
tree.make_nth_sibling(&node_id, group_len / 2).unwrap();
|
||||||
tree.get_mut(&next_child_id)
|
tree.get_mut(&next_child_id)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -1965,8 +1962,8 @@ impl TilingLayout {
|
||||||
if focus_subtree.is_some() {
|
if focus_subtree.is_some() {
|
||||||
let mut node_id = focus_subtree;
|
let mut node_id = focus_subtree;
|
||||||
while node_id.is_some() {
|
while node_id.is_some() {
|
||||||
if let Some(desc) = swap_desc.as_ref() {
|
if let Some(desc) = swap_desc.as_ref()
|
||||||
if let Some(replacement_id) = tree
|
&& let Some(replacement_id) = tree
|
||||||
.ancestor_ids(node_id.unwrap())
|
.ancestor_ids(node_id.unwrap())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.find(|anchestor| *anchestor == &desc.node)
|
.find(|anchestor| *anchestor == &desc.node)
|
||||||
|
|
@ -1975,31 +1972,30 @@ impl TilingLayout {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.find(|child| *child == &desc.node)
|
.find(|child| *child == &desc.node)
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
return match tree.get(replacement_id).unwrap().data() {
|
return match tree.get(replacement_id).unwrap().data() {
|
||||||
Data::Group { alive, .. } => {
|
Data::Group { alive, .. } => {
|
||||||
FocusResult::Some(KeyboardFocusTarget::Group(WindowGroup {
|
FocusResult::Some(KeyboardFocusTarget::Group(WindowGroup {
|
||||||
node: replacement_id.clone(),
|
node: replacement_id.clone(),
|
||||||
alive: Arc::downgrade(alive),
|
alive: Arc::downgrade(alive),
|
||||||
focus_stack: tree
|
focus_stack: tree
|
||||||
.children_ids(replacement_id)
|
.children_ids(replacement_id)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect(),
|
.collect(),
|
||||||
}))
|
}))
|
||||||
|
}
|
||||||
|
Data::Mapped { mapped, .. } => {
|
||||||
|
if mapped.is_stack()
|
||||||
|
&& desc.stack_window.is_none()
|
||||||
|
&& replacement_id == &desc.node
|
||||||
|
{
|
||||||
|
mapped.stack_ref().unwrap().focus_stack();
|
||||||
}
|
}
|
||||||
Data::Mapped { mapped, .. } => {
|
FocusResult::Some(KeyboardFocusTarget::Element(mapped.clone()))
|
||||||
if mapped.is_stack()
|
}
|
||||||
&& desc.stack_window.is_none()
|
_ => unreachable!(),
|
||||||
&& replacement_id == &desc.node
|
};
|
||||||
{
|
|
||||||
mapped.stack_ref().unwrap().focus_stack();
|
|
||||||
}
|
|
||||||
FocusResult::Some(KeyboardFocusTarget::Element(mapped.clone()))
|
|
||||||
}
|
|
||||||
_ => unreachable!(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match tree.get(node_id.unwrap()).unwrap().data() {
|
match tree.get(node_id.unwrap()).unwrap().data() {
|
||||||
|
|
@ -2098,40 +2094,38 @@ impl TilingLayout {
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut tree = self.queue.trees.back().unwrap().0.copy_clone();
|
let mut tree = self.queue.trees.back().unwrap().0.copy_clone();
|
||||||
if let Some((last_active, _)) = TilingLayout::currently_focused_node(&tree, target) {
|
if let Some((last_active, _)) = TilingLayout::currently_focused_node(&tree, target)
|
||||||
if let Some(group) = tree.get(&last_active).unwrap().parent().cloned() {
|
&& let Some(group) = tree.get(&last_active).unwrap().parent().cloned()
|
||||||
if let &mut Data::Group {
|
&& let &mut Data::Group {
|
||||||
ref mut orientation,
|
ref mut orientation,
|
||||||
ref mut sizes,
|
ref mut sizes,
|
||||||
ref last_geometry,
|
ref last_geometry,
|
||||||
..
|
..
|
||||||
} = tree.get_mut(&group).unwrap().data_mut()
|
} = tree.get_mut(&group).unwrap().data_mut()
|
||||||
{
|
{
|
||||||
let previous_length = match orientation {
|
let previous_length = match orientation {
|
||||||
Orientation::Horizontal => last_geometry.size.h,
|
Orientation::Horizontal => last_geometry.size.h,
|
||||||
Orientation::Vertical => last_geometry.size.w,
|
Orientation::Vertical => last_geometry.size.w,
|
||||||
};
|
};
|
||||||
let new_orientation = new_orientation.unwrap_or(!*orientation);
|
let new_orientation = new_orientation.unwrap_or(!*orientation);
|
||||||
let new_length = match new_orientation {
|
let new_length = match new_orientation {
|
||||||
Orientation::Horizontal => last_geometry.size.h,
|
Orientation::Horizontal => last_geometry.size.h,
|
||||||
Orientation::Vertical => last_geometry.size.w,
|
Orientation::Vertical => last_geometry.size.w,
|
||||||
};
|
};
|
||||||
|
|
||||||
sizes.iter_mut().for_each(|len| {
|
sizes.iter_mut().for_each(|len| {
|
||||||
*len = (((*len as f64) / (previous_length as f64)) * (new_length as f64))
|
*len = (((*len as f64) / (previous_length as f64)) * (new_length as f64)).round()
|
||||||
.round() as i32;
|
as i32;
|
||||||
});
|
});
|
||||||
let sum: i32 = sizes.iter().sum();
|
let sum: i32 = sizes.iter().sum();
|
||||||
if sum < new_length {
|
if sum < new_length {
|
||||||
*sizes.last_mut().unwrap() += new_length - sum;
|
*sizes.last_mut().unwrap() += new_length - sum;
|
||||||
}
|
|
||||||
|
|
||||||
*orientation = new_orientation;
|
|
||||||
|
|
||||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
|
||||||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*orientation = new_orientation;
|
||||||
|
|
||||||
|
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||||
|
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3371,21 +3365,20 @@ impl TilingLayout {
|
||||||
if matches!(
|
if matches!(
|
||||||
overview.active_trigger(),
|
overview.active_trigger(),
|
||||||
Some(Trigger::Pointer(_) | Trigger::Touch(_))
|
Some(Trigger::Pointer(_) | Trigger::Touch(_))
|
||||||
) {
|
) && location_f64.is_some()
|
||||||
if location_f64.is_some() {
|
{
|
||||||
let mut tree = tree.copy_clone();
|
let mut tree = tree.copy_clone();
|
||||||
tree.insert(
|
tree.insert(
|
||||||
Node::new(Data::Placeholder {
|
Node::new(Data::Placeholder {
|
||||||
id: Id::new(),
|
id: Id::new(),
|
||||||
last_geometry: Rectangle::from_size((100, 100).into()),
|
last_geometry: Rectangle::from_size((100, 100).into()),
|
||||||
type_: PlaceholderType::DropZone,
|
type_: PlaceholderType::DropZone,
|
||||||
}),
|
}),
|
||||||
InsertBehavior::AsRoot,
|
InsertBehavior::AsRoot,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
@ -4626,62 +4619,62 @@ where
|
||||||
geo.loc += (gap, gap).into();
|
geo.loc += (gap, gap).into();
|
||||||
geo.size -= (gap * 2, gap * 2).into();
|
geo.size -= (gap * 2, gap * 2).into();
|
||||||
|
|
||||||
if mouse_tiling.is_some() {
|
if mouse_tiling.is_some()
|
||||||
if let Some(PillIndicator::Outer(direction)) = pill_indicator {
|
&& let Some(PillIndicator::Outer(direction)) = pill_indicator
|
||||||
let (pill_geo, remaining_geo) = match direction {
|
{
|
||||||
Direction::Left => (
|
let (pill_geo, remaining_geo) = match direction {
|
||||||
Rectangle::new(
|
Direction::Left => (
|
||||||
(geo.loc.x, geo.loc.y).into(),
|
Rectangle::new(
|
||||||
(16, geo.size.h).into(),
|
(geo.loc.x, geo.loc.y).into(),
|
||||||
),
|
(16, geo.size.h).into(),
|
||||||
Rectangle::new(
|
|
||||||
(geo.loc.x + 48, geo.loc.y).into(),
|
|
||||||
(geo.size.w - 48, geo.size.h).into(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Direction::Up => (
|
Rectangle::new(
|
||||||
Rectangle::new(
|
(geo.loc.x + 48, geo.loc.y).into(),
|
||||||
(geo.loc.x, geo.loc.y).into(),
|
(geo.size.w - 48, geo.size.h).into(),
|
||||||
(geo.size.w, 16).into(),
|
|
||||||
),
|
|
||||||
Rectangle::new(
|
|
||||||
(geo.loc.x, geo.loc.y + 48).into(),
|
|
||||||
(geo.size.w, geo.size.h - 48).into(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Direction::Right => (
|
),
|
||||||
Rectangle::new(
|
Direction::Up => (
|
||||||
(geo.loc.x + geo.size.w - 16, geo.loc.y).into(),
|
Rectangle::new(
|
||||||
(16, geo.size.h).into(),
|
(geo.loc.x, geo.loc.y).into(),
|
||||||
),
|
(geo.size.w, 16).into(),
|
||||||
Rectangle::new(geo.loc, (geo.size.w - 48, geo.size.h).into()),
|
|
||||||
),
|
),
|
||||||
Direction::Down => (
|
Rectangle::new(
|
||||||
Rectangle::new(
|
(geo.loc.x, geo.loc.y + 48).into(),
|
||||||
(geo.loc.x, geo.loc.y + geo.size.h - 16).into(),
|
(geo.size.w, geo.size.h - 48).into(),
|
||||||
(geo.size.w, 16).into(),
|
|
||||||
),
|
|
||||||
Rectangle::new(geo.loc, (geo.size.w, geo.size.h - 48).into()),
|
|
||||||
),
|
),
|
||||||
};
|
),
|
||||||
|
Direction::Right => (
|
||||||
if let Some(renderer) = renderer.as_mut() {
|
Rectangle::new(
|
||||||
elements.push(
|
(geo.loc.x + geo.size.w - 16, geo.loc.y).into(),
|
||||||
BackdropShader::element(
|
(16, geo.size.h).into(),
|
||||||
*renderer,
|
),
|
||||||
backdrop_id.clone(),
|
Rectangle::new(geo.loc, (geo.size.w - 48, geo.size.h).into()),
|
||||||
pill_geo,
|
),
|
||||||
8.,
|
Direction::Down => (
|
||||||
alpha * 0.4,
|
Rectangle::new(
|
||||||
group_color,
|
(geo.loc.x, geo.loc.y + geo.size.h - 16).into(),
|
||||||
)
|
(geo.size.w, 16).into(),
|
||||||
.into(),
|
),
|
||||||
);
|
Rectangle::new(geo.loc, (geo.size.w, geo.size.h - 48).into()),
|
||||||
}
|
),
|
||||||
|
|
||||||
geo = remaining_geo;
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
if let Some(renderer) = renderer.as_mut() {
|
||||||
|
elements.push(
|
||||||
|
BackdropShader::element(
|
||||||
|
*renderer,
|
||||||
|
backdrop_id.clone(),
|
||||||
|
pill_geo,
|
||||||
|
8.,
|
||||||
|
alpha * 0.4,
|
||||||
|
group_color,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
geo = remaining_geo;
|
||||||
|
};
|
||||||
|
|
||||||
if matches!(swap_desc, Some(ref desc) if desc.node == node_id) {
|
if matches!(swap_desc, Some(ref desc) if desc.node == node_id) {
|
||||||
if let Some(renderer) = renderer.as_mut() {
|
if let Some(renderer) = renderer.as_mut() {
|
||||||
|
|
@ -4758,35 +4751,35 @@ where
|
||||||
(geo.loc.x, geo.loc.y + previous).into(),
|
(geo.loc.x, geo.loc.y + previous).into(),
|
||||||
(geo.size.w, *size).into(),
|
(geo.size.w, *size).into(),
|
||||||
);
|
);
|
||||||
if mouse_tiling.is_some() {
|
if mouse_tiling.is_some()
|
||||||
if let Some(PillIndicator::Inner(pill_idx)) = pill_indicator {
|
&& let Some(PillIndicator::Inner(pill_idx)) = pill_indicator
|
||||||
if *pill_idx == idx {
|
{
|
||||||
geo.size.h -= 32;
|
if *pill_idx == idx {
|
||||||
}
|
geo.size.h -= 32;
|
||||||
if idx
|
}
|
||||||
.checked_sub(1)
|
if idx
|
||||||
.map(|idx| idx == *pill_idx)
|
.checked_sub(1)
|
||||||
.unwrap_or(false)
|
.map(|idx| idx == *pill_idx)
|
||||||
{
|
.unwrap_or(false)
|
||||||
if let Some(renderer) = renderer.as_mut() {
|
{
|
||||||
elements.push(
|
if let Some(renderer) = renderer.as_mut() {
|
||||||
BackdropShader::element(
|
elements.push(
|
||||||
*renderer,
|
BackdropShader::element(
|
||||||
backdrop_id.clone(),
|
*renderer,
|
||||||
Rectangle::new(
|
backdrop_id.clone(),
|
||||||
(geo.loc.x, geo.loc.y - 8).into(),
|
Rectangle::new(
|
||||||
(geo.size.w, 16).into(),
|
(geo.loc.x, geo.loc.y - 8).into(),
|
||||||
),
|
(geo.size.w, 16).into(),
|
||||||
8.,
|
),
|
||||||
alpha * 0.4,
|
8.,
|
||||||
group_color,
|
alpha * 0.4,
|
||||||
)
|
group_color,
|
||||||
.into(),
|
)
|
||||||
);
|
.into(),
|
||||||
}
|
);
|
||||||
geo.loc.y += 32;
|
|
||||||
geo.size.h -= 32;
|
|
||||||
}
|
}
|
||||||
|
geo.loc.y += 32;
|
||||||
|
geo.size.h -= 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack.push((geo, depth + 1));
|
stack.push((geo, depth + 1));
|
||||||
|
|
@ -4800,35 +4793,35 @@ where
|
||||||
(geo.loc.x + previous, geo.loc.y).into(),
|
(geo.loc.x + previous, geo.loc.y).into(),
|
||||||
(*size, geo.size.h).into(),
|
(*size, geo.size.h).into(),
|
||||||
);
|
);
|
||||||
if mouse_tiling.is_some() {
|
if mouse_tiling.is_some()
|
||||||
if let Some(PillIndicator::Inner(pill_idx)) = pill_indicator {
|
&& let Some(PillIndicator::Inner(pill_idx)) = pill_indicator
|
||||||
if *pill_idx == idx {
|
{
|
||||||
geo.size.w -= 32;
|
if *pill_idx == idx {
|
||||||
}
|
geo.size.w -= 32;
|
||||||
if idx
|
}
|
||||||
.checked_sub(1)
|
if idx
|
||||||
.map(|idx| idx == *pill_idx)
|
.checked_sub(1)
|
||||||
.unwrap_or(false)
|
.map(|idx| idx == *pill_idx)
|
||||||
{
|
.unwrap_or(false)
|
||||||
if let Some(renderer) = renderer.as_mut() {
|
{
|
||||||
elements.push(
|
if let Some(renderer) = renderer.as_mut() {
|
||||||
BackdropShader::element(
|
elements.push(
|
||||||
*renderer,
|
BackdropShader::element(
|
||||||
backdrop_id.clone(),
|
*renderer,
|
||||||
Rectangle::new(
|
backdrop_id.clone(),
|
||||||
(geo.loc.x - 8, geo.loc.y).into(),
|
Rectangle::new(
|
||||||
(16, geo.size.h).into(),
|
(geo.loc.x - 8, geo.loc.y).into(),
|
||||||
),
|
(16, geo.size.h).into(),
|
||||||
8.,
|
),
|
||||||
alpha * 0.4,
|
8.,
|
||||||
group_color,
|
alpha * 0.4,
|
||||||
)
|
group_color,
|
||||||
.into(),
|
)
|
||||||
);
|
.into(),
|
||||||
}
|
);
|
||||||
geo.loc.x += 32;
|
|
||||||
geo.size.w -= 32;
|
|
||||||
}
|
}
|
||||||
|
geo.loc.x += 32;
|
||||||
|
geo.size.w -= 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack.push((geo, depth + 1));
|
stack.push((geo, depth + 1));
|
||||||
|
|
@ -5102,10 +5095,7 @@ where
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
shadow_elements
|
shadow_elements.into_iter().chain(elements).collect()
|
||||||
.into_iter()
|
|
||||||
.chain(elements.into_iter())
|
|
||||||
.collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_old_tree(
|
fn render_old_tree(
|
||||||
|
|
@ -5518,21 +5508,20 @@ where
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
})
|
})
|
||||||
.unwrap_or(false))
|
.unwrap_or(false))
|
||||||
|
&& let Some(swap) = swap_indicator.as_ref()
|
||||||
{
|
{
|
||||||
if let Some(swap) = swap_indicator.as_ref() {
|
swap.resize(geo.size.as_logical());
|
||||||
swap.resize(geo.size.as_logical());
|
swap.output_enter(output, output_geo.as_logical());
|
||||||
swap.output_enter(output, output_geo.as_logical());
|
swap_elements.extend(
|
||||||
swap_elements.extend(
|
swap.render_elements::<CosmicWindowRenderElement<R>>(
|
||||||
swap.render_elements::<CosmicWindowRenderElement<R>>(
|
renderer,
|
||||||
renderer,
|
geo.loc.as_logical().to_physical_precise_round(output_scale),
|
||||||
geo.loc.as_logical().to_physical_precise_round(output_scale),
|
output_scale.into(),
|
||||||
output_scale.into(),
|
alpha * overview.0.alpha().unwrap_or(1.0),
|
||||||
alpha * overview.0.alpha().unwrap_or(1.0),
|
)
|
||||||
)
|
.into_iter()
|
||||||
.into_iter()
|
.map(CosmicMappedRenderElement::from),
|
||||||
.map(CosmicMappedRenderElement::from),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5716,7 +5705,7 @@ where
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.chain(swap_elements)
|
.chain(swap_elements)
|
||||||
.chain(indicators.into_iter().map(Into::into))
|
.chain(indicators)
|
||||||
.chain(window_elements)
|
.chain(window_elements)
|
||||||
.chain(animating_window_elements)
|
.chain(animating_window_elements)
|
||||||
.chain(shadow_elements)
|
.chain(shadow_elements)
|
||||||
|
|
@ -5858,10 +5847,10 @@ fn render_new_tree(
|
||||||
(new_geo, percentage, false)
|
(new_geo, percentage, false)
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Data::Mapped { mapped, .. } = data {
|
if let Data::Mapped { mapped, .. } = data
|
||||||
if mapped.is_maximized(false) {
|
&& mapped.is_maximized(false)
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
processor(node_id, data, geo, original_geo, alpha, animating)
|
processor(node_id, data, geo, original_geo, alpha, animating)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
346
src/shell/mod.rs
346
src/shell/mod.rs
|
|
@ -479,7 +479,7 @@ impl WorkspaceSet {
|
||||||
appearance: AppearanceConfig,
|
appearance: AppearanceConfig,
|
||||||
) -> WorkspaceSet {
|
) -> WorkspaceSet {
|
||||||
let group_handle = state.create_workspace_group();
|
let group_handle = state.create_workspace_group();
|
||||||
let sticky_layer = FloatingLayout::new(theme.clone(), appearance.clone(), output);
|
let sticky_layer = FloatingLayout::new(theme.clone(), appearance, output);
|
||||||
|
|
||||||
WorkspaceSet {
|
WorkspaceSet {
|
||||||
previously_active: None,
|
previously_active: None,
|
||||||
|
|
@ -753,7 +753,7 @@ impl Workspaces {
|
||||||
autotile: config.cosmic_conf.autotile,
|
autotile: config.cosmic_conf.autotile,
|
||||||
autotile_behavior: config.cosmic_conf.autotile_behavior,
|
autotile_behavior: config.cosmic_conf.autotile_behavior,
|
||||||
theme,
|
theme,
|
||||||
appearance: config.cosmic_conf.appearance_settings.clone(),
|
appearance: config.cosmic_conf.appearance_settings,
|
||||||
persisted_workspaces: config.cosmic_conf.pinned_workspaces.clone(),
|
persisted_workspaces: config.cosmic_conf.pinned_workspaces.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1462,7 +1462,7 @@ impl Common {
|
||||||
let mut shell = self.shell.write();
|
let mut shell = self.shell.write();
|
||||||
let shell_ref = &mut *shell;
|
let shell_ref = &mut *shell;
|
||||||
shell_ref.active_hint = self.config.cosmic_conf.active_hint;
|
shell_ref.active_hint = self.config.cosmic_conf.active_hint;
|
||||||
shell_ref.appearance_conf = self.config.cosmic_conf.appearance_settings.clone();
|
shell_ref.appearance_conf = self.config.cosmic_conf.appearance_settings;
|
||||||
if let Some(zoom_state) = shell_ref.zoom_state.as_mut() {
|
if let Some(zoom_state) = shell_ref.zoom_state.as_mut() {
|
||||||
zoom_state.increment = self.config.cosmic_conf.accessibility_zoom.increment;
|
zoom_state.increment = self.config.cosmic_conf.accessibility_zoom.increment;
|
||||||
zoom_state.movement = self.config.cosmic_conf.accessibility_zoom.view_moves;
|
zoom_state.movement = self.config.cosmic_conf.accessibility_zoom.view_moves;
|
||||||
|
|
@ -1519,12 +1519,12 @@ impl Common {
|
||||||
let shell = self.shell.read();
|
let shell = self.shell.read();
|
||||||
|
|
||||||
for seat in shell.seats.iter() {
|
for seat in shell.seats.iter() {
|
||||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||||
let mapped = grab_state.element();
|
{
|
||||||
if mapped.active_window().wl_surface().as_deref() == Some(surface) {
|
let mapped = grab_state.element();
|
||||||
mapped.on_commit(surface);
|
if mapped.active_window().wl_surface().as_deref() == Some(surface) {
|
||||||
}
|
mapped.on_commit(surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1595,7 +1595,7 @@ impl Shell {
|
||||||
resize_mode: ResizeMode::None,
|
resize_mode: ResizeMode::None,
|
||||||
resize_state: None,
|
resize_state: None,
|
||||||
resize_indicator: None,
|
resize_indicator: None,
|
||||||
appearance_conf: config.cosmic_conf.appearance_settings.clone(),
|
appearance_conf: config.cosmic_conf.appearance_settings,
|
||||||
zoom_state: None,
|
zoom_state: None,
|
||||||
tiling_exceptions,
|
tiling_exceptions,
|
||||||
|
|
||||||
|
|
@ -1972,22 +1972,22 @@ impl Shell {
|
||||||
.filter(|seat| seat.active_output() == **o)
|
.filter(|seat| seat.active_output() == **o)
|
||||||
.any(|seat| {
|
.any(|seat| {
|
||||||
let cursor_status = seat.cursor_image_status();
|
let cursor_status = seat.cursor_image_status();
|
||||||
if let CursorImageStatus::Surface(s) = cursor_status {
|
if let CursorImageStatus::Surface(s) = cursor_status
|
||||||
if s == *surface {
|
&& s == *surface
|
||||||
return true;
|
{
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||||
for (window, _) in grab_state.element().windows() {
|
{
|
||||||
let mut matches = false;
|
for (window, _) in grab_state.element().windows() {
|
||||||
window.0.with_surfaces(|s, _| {
|
let mut matches = false;
|
||||||
matches |= s == surface;
|
window.0.with_surfaces(|s, _| {
|
||||||
});
|
matches |= s == surface;
|
||||||
if matches {
|
});
|
||||||
return true;
|
if matches {
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2216,18 +2216,18 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn overview_mode(&self) -> (OverviewMode, Option<SwapIndicator>) {
|
pub fn overview_mode(&self) -> (OverviewMode, Option<SwapIndicator>) {
|
||||||
if let OverviewMode::Started(trigger, timestamp) = &self.overview_mode {
|
if let OverviewMode::Started(trigger, timestamp) = &self.overview_mode
|
||||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||||
return (
|
{
|
||||||
OverviewMode::Active(trigger.clone()),
|
return (
|
||||||
self.swap_indicator.clone(),
|
OverviewMode::Active(trigger.clone()),
|
||||||
);
|
self.swap_indicator.clone(),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
if let OverviewMode::Ended(_, timestamp) = &self.overview_mode {
|
if let OverviewMode::Ended(_, timestamp) = &self.overview_mode
|
||||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||||
return (OverviewMode::None, None);
|
{
|
||||||
}
|
return (OverviewMode::None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
(self.overview_mode.clone(), self.swap_indicator.clone())
|
(self.overview_mode.clone(), self.swap_indicator.clone())
|
||||||
|
|
@ -2261,18 +2261,18 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resize_mode(&self) -> (ResizeMode, Option<ResizeIndicator>) {
|
pub fn resize_mode(&self) -> (ResizeMode, Option<ResizeIndicator>) {
|
||||||
if let ResizeMode::Started(binding, timestamp, direction) = &self.resize_mode {
|
if let ResizeMode::Started(binding, timestamp, direction) = &self.resize_mode
|
||||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||||
return (
|
{
|
||||||
ResizeMode::Active(binding.clone(), *direction),
|
return (
|
||||||
self.resize_indicator.clone(),
|
ResizeMode::Active(binding.clone(), *direction),
|
||||||
);
|
self.resize_indicator.clone(),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
if let ResizeMode::Ended(timestamp, _) = self.resize_mode {
|
if let ResizeMode::Ended(timestamp, _) = self.resize_mode
|
||||||
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
&& Instant::now().duration_since(timestamp) > ANIMATION_DURATION
|
||||||
return (ResizeMode::None, None);
|
{
|
||||||
}
|
return (ResizeMode::None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
(self.resize_mode.clone(), self.resize_indicator.clone())
|
(self.resize_mode.clone(), self.resize_indicator.clone())
|
||||||
|
|
@ -2299,7 +2299,7 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn appearance_config(&self) -> AppearanceConfig {
|
pub fn appearance_config(&self) -> AppearanceConfig {
|
||||||
self.appearance_conf.clone()
|
self.appearance_conf
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trigger_zoom(
|
pub fn trigger_zoom(
|
||||||
|
|
@ -2333,10 +2333,10 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut toggled = self.zoom_state.is_none();
|
let mut toggled = self.zoom_state.is_none();
|
||||||
if let Some(old_state) = self.zoom_state.as_ref() {
|
if let Some(old_state) = self.zoom_state.as_ref()
|
||||||
if &old_state.seat != seat {
|
&& &old_state.seat != seat
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for output in &outputs {
|
for output in &outputs {
|
||||||
|
|
@ -2766,18 +2766,16 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
let maybe_focused = workspace.focus_stack.get(&seat).iter().next().cloned();
|
let maybe_focused = workspace.focus_stack.get(&seat).iter().next().cloned();
|
||||||
if let Some(FocusTarget::Window(focused)) = maybe_focused {
|
if let Some(FocusTarget::Window(focused)) = maybe_focused
|
||||||
if (focused.is_stack() && !is_dialog && !should_be_maximized)
|
&& (focused.is_stack() && !is_dialog && !should_be_maximized)
|
||||||
&& !(workspace.is_tiled(&focused.active_window()) && floating_exception)
|
&& !(workspace.is_tiled(&focused.active_window()) && floating_exception)
|
||||||
{
|
{
|
||||||
focused.stack_ref().unwrap().add_window(window, None, None);
|
focused.stack_ref().unwrap().add_window(window, None, None);
|
||||||
if was_activated {
|
if was_activated {
|
||||||
workspace_state.add_workspace_state(&workspace_handle, WState::Urgent);
|
workspace_state.add_workspace_state(&workspace_handle, WState::Urgent);
|
||||||
}
|
|
||||||
return (workspace_output == seat.active_output()
|
|
||||||
&& active_handle == workspace_handle)
|
|
||||||
.then_some(KeyboardFocusTarget::Element(focused));
|
|
||||||
}
|
}
|
||||||
|
return (workspace_output == seat.active_output() && active_handle == workspace_handle)
|
||||||
|
.then_some(KeyboardFocusTarget::Element(focused));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mapped = CosmicMapped::from(CosmicWindow::new(
|
let mapped = CosmicMapped::from(CosmicWindow::new(
|
||||||
|
|
@ -3026,62 +3024,62 @@ impl Shell {
|
||||||
|
|
||||||
let spaces = self.workspaces.spaces_mut();
|
let spaces = self.workspaces.spaces_mut();
|
||||||
let (mut from_w, mut other_w) = spaces.partition::<Vec<_>, _>(|w| w.handle == from);
|
let (mut from_w, mut other_w) = spaces.partition::<Vec<_>, _>(|w| w.handle == from);
|
||||||
if let Some(from_workspace) = from_w.get_mut(0) {
|
if let Some(from_workspace) = from_w.get_mut(0)
|
||||||
if let Some(to_workspace) = other_w.iter_mut().find(|w| w.handle == to) {
|
&& let Some(to_workspace) = other_w.iter_mut().find(|w| w.handle == to)
|
||||||
{
|
{
|
||||||
let mut stack = to_workspace.focus_stack.get_mut(seat);
|
{
|
||||||
for elem in focus_stack.iter().flat_map(|node_id| {
|
let mut stack = to_workspace.focus_stack.get_mut(seat);
|
||||||
from_workspace.tiling_layer.element_for_node(node_id)
|
for elem in focus_stack.iter().flat_map(|node_id| {
|
||||||
}) {
|
from_workspace.tiling_layer.element_for_node(node_id)
|
||||||
stack.append(elem.clone());
|
}) {
|
||||||
}
|
stack.append(elem.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
if to_workspace.tiling_enabled {
|
|
||||||
for mapped in to_workspace
|
|
||||||
.mapped()
|
|
||||||
.filter(|m| m.maximized_state.lock().unwrap().is_some())
|
|
||||||
.cloned()
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.into_iter()
|
|
||||||
{
|
|
||||||
to_workspace.unmaximize_request(&mapped);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let res = TilingLayout::move_tree(
|
|
||||||
&mut from_workspace.tiling_layer,
|
|
||||||
&mut to_workspace.tiling_layer,
|
|
||||||
&to,
|
|
||||||
seat,
|
|
||||||
to_workspace.focus_stack.get(seat).iter(),
|
|
||||||
NodeDesc {
|
|
||||||
handle: from,
|
|
||||||
node,
|
|
||||||
stack_window: None,
|
|
||||||
focus_stack,
|
|
||||||
},
|
|
||||||
direction,
|
|
||||||
);
|
|
||||||
from_workspace.refresh_focus_stack();
|
|
||||||
to_workspace.refresh_focus_stack();
|
|
||||||
|
|
||||||
if !to_workspace.tiling_enabled {
|
|
||||||
to_workspace.tiling_enabled = true;
|
|
||||||
for mapped in to_workspace
|
|
||||||
.tiling_layer
|
|
||||||
.mapped()
|
|
||||||
.map(|(mapped, _)| mapped.clone())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.into_iter()
|
|
||||||
{
|
|
||||||
to_workspace.toggle_floating_window(seat, &mapped);
|
|
||||||
}
|
|
||||||
to_workspace.tiling_enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(res.zip(new_pos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if to_workspace.tiling_enabled {
|
||||||
|
for mapped in to_workspace
|
||||||
|
.mapped()
|
||||||
|
.filter(|m| m.maximized_state.lock().unwrap().is_some())
|
||||||
|
.cloned()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_iter()
|
||||||
|
{
|
||||||
|
to_workspace.unmaximize_request(&mapped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let res = TilingLayout::move_tree(
|
||||||
|
&mut from_workspace.tiling_layer,
|
||||||
|
&mut to_workspace.tiling_layer,
|
||||||
|
&to,
|
||||||
|
seat,
|
||||||
|
to_workspace.focus_stack.get(seat).iter(),
|
||||||
|
NodeDesc {
|
||||||
|
handle: from,
|
||||||
|
node,
|
||||||
|
stack_window: None,
|
||||||
|
focus_stack,
|
||||||
|
},
|
||||||
|
direction,
|
||||||
|
);
|
||||||
|
from_workspace.refresh_focus_stack();
|
||||||
|
to_workspace.refresh_focus_stack();
|
||||||
|
|
||||||
|
if !to_workspace.tiling_enabled {
|
||||||
|
to_workspace.tiling_enabled = true;
|
||||||
|
for mapped in to_workspace
|
||||||
|
.tiling_layer
|
||||||
|
.mapped()
|
||||||
|
.map(|(mapped, _)| mapped.clone())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_iter()
|
||||||
|
{
|
||||||
|
to_workspace.toggle_floating_window(seat, &mapped);
|
||||||
|
}
|
||||||
|
to_workspace.tiling_enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(res.zip(new_pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
|
@ -3155,12 +3153,10 @@ impl Shell {
|
||||||
was_maximized: previous.was_maximized(),
|
was_maximized: previous.was_maximized(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else if let FullscreenRestoreState::Tiling { workspace, .. }
|
||||||
if let FullscreenRestoreState::Tiling { workspace, .. }
|
| FullscreenRestoreState::Floating { workspace, .. } = previous
|
||||||
| FullscreenRestoreState::Floating { workspace, .. } = previous
|
{
|
||||||
{
|
*workspace = *to;
|
||||||
*workspace = *to;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3408,20 +3404,19 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_reactive_popups(&self, mapped: &CosmicMapped) {
|
pub fn update_reactive_popups(&self, mapped: &CosmicMapped) {
|
||||||
if let Some(workspace) = self.space_for(mapped) {
|
if let Some(workspace) = self.space_for(mapped)
|
||||||
if let Some(element_loc) = workspace
|
&& let Some(element_loc) = workspace
|
||||||
.element_geometry(mapped)
|
.element_geometry(mapped)
|
||||||
.map(|geo| geo.loc.to_global(&workspace.output))
|
.map(|geo| geo.loc.to_global(&workspace.output))
|
||||||
{
|
{
|
||||||
for (window, offset) in mapped.windows() {
|
for (window, offset) in mapped.windows() {
|
||||||
if let Some(toplevel) = window.0.toplevel() {
|
if let Some(toplevel) = window.0.toplevel() {
|
||||||
let window_geo_offset = window.geometry().loc.as_global();
|
let window_geo_offset = window.geometry().loc.as_global();
|
||||||
update_reactive_popups(
|
update_reactive_popups(
|
||||||
toplevel,
|
toplevel,
|
||||||
element_loc + offset.as_global() + window_geo_offset,
|
element_loc + offset.as_global() + window_geo_offset,
|
||||||
self.outputs(),
|
self.outputs(),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3744,12 +3739,11 @@ impl Shell {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
if mapped == old_mapped {
|
if mapped == old_mapped
|
||||||
if let Some(geo) = sticky_layer.unmap(&mapped, None) {
|
&& let Some(geo) = sticky_layer.unmap(&mapped, None)
|
||||||
if geo.size != elem_geo.size {
|
&& geo.size != elem_geo.size
|
||||||
new_size = Some(geo.size.as_logical());
|
{
|
||||||
}
|
new_size = Some(geo.size.as_logical());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(new_size) = new_size {
|
if let Some(new_size) = new_size {
|
||||||
|
|
@ -4404,47 +4398,47 @@ impl Shell {
|
||||||
.resize(&focused, direction, edge, amount)
|
.resize(&focused, direction, edge, amount)
|
||||||
{
|
{
|
||||||
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
||||||
} else if let Some(workspace) = self.workspaces.get_mut(idx, &output) {
|
} else if let Some(workspace) = self.workspaces.get_mut(idx, &output)
|
||||||
if workspace.resize(&focused, direction, edge, amount) {
|
&& workspace.resize(&focused, direction, edge, amount)
|
||||||
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
{
|
||||||
}
|
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn finish_resize(&mut self, direction: ResizeDirection, edge: ResizeEdge) {
|
pub fn finish_resize(&mut self, direction: ResizeDirection, edge: ResizeEdge) {
|
||||||
if let Some((old_focused, old_direction, old_edge, _, idx, output)) =
|
if let Some((old_focused, old_direction, old_edge, _, idx, output)) =
|
||||||
self.resize_state.take()
|
self.resize_state.take()
|
||||||
|
&& old_direction == direction
|
||||||
|
&& old_edge == edge
|
||||||
{
|
{
|
||||||
if old_direction == direction && old_edge == edge {
|
let Some(toplevel) = old_focused.toplevel() else {
|
||||||
let Some(toplevel) = old_focused.toplevel() else {
|
return;
|
||||||
return;
|
};
|
||||||
};
|
let Some(mapped) = self
|
||||||
let Some(mapped) = self
|
.workspaces
|
||||||
.workspaces
|
.sets
|
||||||
.sets
|
.values()
|
||||||
.values()
|
.find_map(|set| {
|
||||||
.find_map(|set| {
|
set.sticky_layer
|
||||||
set.sticky_layer
|
.mapped()
|
||||||
.mapped()
|
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||||
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
})
|
||||||
})
|
.cloned()
|
||||||
.cloned()
|
.or_else(|| {
|
||||||
.or_else(|| {
|
let workspace = self.workspaces.get(idx, &output).unwrap();
|
||||||
let workspace = self.workspaces.get(idx, &output).unwrap();
|
workspace
|
||||||
workspace
|
.mapped()
|
||||||
.mapped()
|
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
||||||
.find(|m| m.has_surface(&toplevel, WindowSurfaceType::TOPLEVEL))
|
.cloned()
|
||||||
.cloned()
|
})
|
||||||
})
|
else {
|
||||||
else {
|
return;
|
||||||
return;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
let mut resize_state = mapped.resize_state.lock().unwrap();
|
let mut resize_state = mapped.resize_state.lock().unwrap();
|
||||||
if let Some(ResizeState::Resizing(data)) = *resize_state {
|
if let Some(ResizeState::Resizing(data)) = *resize_state {
|
||||||
mapped.set_resizing(false);
|
mapped.set_resizing(false);
|
||||||
*resize_state = Some(ResizeState::WaitingForCommit(data));
|
*resize_state = Some(ResizeState::WaitingForCommit(data));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4520,10 +4514,8 @@ impl Shell {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
if was_maximized {
|
if was_maximized && let Some(KeyboardFocusTarget::Element(mapped)) = res.as_ref() {
|
||||||
if let Some(KeyboardFocusTarget::Element(mapped)) = res.as_ref() {
|
self.maximize_request(mapped, seat, false, loop_handle);
|
||||||
self.maximize_request(mapped, seat, false, loop_handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
|
||||||
|
|
@ -112,12 +112,12 @@ impl Devices {
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
map.insert(id, caps);
|
map.insert(id, caps);
|
||||||
|
|
||||||
if device.has_capability(DeviceCapability::Keyboard) {
|
if device.has_capability(DeviceCapability::Keyboard)
|
||||||
if let Some(device) = <dyn Any>::downcast_ref::<InputDevice>(device) {
|
&& let Some(device) = <dyn Any>::downcast_ref::<InputDevice>(device)
|
||||||
let mut device = device.clone();
|
{
|
||||||
device.led_update(led_state.into());
|
let mut device = device.clone();
|
||||||
self.keyboards.borrow_mut().push(device);
|
device.led_update(led_state.into());
|
||||||
}
|
self.keyboards.borrow_mut().push(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_caps
|
new_caps
|
||||||
|
|
@ -385,10 +385,10 @@ impl SeatExt for Seat<State> {
|
||||||
let lock = self.user_data().get::<Mutex<CursorImageStatus>>().unwrap();
|
let lock = self.user_data().get::<Mutex<CursorImageStatus>>().unwrap();
|
||||||
// Reset the cursor if the surface is no longer alive
|
// Reset the cursor if the surface is no longer alive
|
||||||
let mut cursor_status = lock.lock().unwrap();
|
let mut cursor_status = lock.lock().unwrap();
|
||||||
if let CursorImageStatus::Surface(ref surface) = *cursor_status {
|
if let CursorImageStatus::Surface(ref surface) = *cursor_status
|
||||||
if !surface.alive() {
|
&& !surface.alive()
|
||||||
*cursor_status = CursorImageStatus::default_named();
|
{
|
||||||
}
|
*cursor_status = CursorImageStatus::default_named();
|
||||||
}
|
}
|
||||||
cursor_status.clone()
|
cursor_status.clone()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -487,11 +487,9 @@ impl Workspace {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let move_mapped = if let Some(move_grab_state) = &*move_grab_state {
|
let move_mapped = (*move_grab_state)
|
||||||
Some(move_grab_state.element())
|
.as_ref()
|
||||||
} else {
|
.map(|move_grab_state| move_grab_state.element());
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let mapped = || {
|
let mapped = || {
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
|
|
@ -640,7 +638,7 @@ impl Workspace {
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
let was_snapped = mapped.floating_tiled.lock().unwrap().clone();
|
let was_snapped = *mapped.floating_tiled.lock().unwrap();
|
||||||
// unmaximize_request might have triggered a `floating_layer.refresh()`,
|
// unmaximize_request might have triggered a `floating_layer.refresh()`,
|
||||||
// which may have already removed a non-alive surface.
|
// which may have already removed a non-alive surface.
|
||||||
if let Some(floating_geometry) = self.floating_layer.unmap(mapped, None).or(was_maximized) {
|
if let Some(floating_geometry) = self.floating_layer.unmap(mapped, None).or(was_maximized) {
|
||||||
|
|
@ -695,18 +693,18 @@ impl Workspace {
|
||||||
|
|
||||||
let mapped = self.element_for_surface(surface)?;
|
let mapped = self.element_for_surface(surface)?;
|
||||||
let maybe_stack = mapped.stack_ref().filter(|s| s.len() > 1);
|
let maybe_stack = mapped.stack_ref().filter(|s| s.len() > 1);
|
||||||
if let Some(stack) = maybe_stack {
|
if let Some(stack) = maybe_stack
|
||||||
if stack.len() > 1 {
|
&& stack.len() > 1
|
||||||
let idx = stack.surfaces().position(|s| &s == surface);
|
{
|
||||||
let layer = if self.is_tiled(surface) {
|
let idx = stack.surfaces().position(|s| &s == surface);
|
||||||
ManagedLayer::Tiling
|
let layer = if self.is_tiled(surface) {
|
||||||
} else {
|
ManagedLayer::Tiling
|
||||||
ManagedLayer::Floating
|
} else {
|
||||||
};
|
ManagedLayer::Floating
|
||||||
return idx
|
};
|
||||||
.and_then(|idx| stack.remove_idx(idx))
|
return idx
|
||||||
.map(|s| (s, layer.into()));
|
.and_then(|idx| stack.remove_idx(idx))
|
||||||
}
|
.map(|s| (s, layer.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// we know mapped is no stack with more than one element now,
|
// we know mapped is no stack with more than one element now,
|
||||||
|
|
@ -774,25 +772,25 @@ impl Workspace {
|
||||||
let stack = self.focus_stack.get(seat);
|
let stack = self.focus_stack.get(seat);
|
||||||
let last_focused = stack.last();
|
let last_focused = stack.last();
|
||||||
|
|
||||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
if let Some(fullscreen) = self.fullscreen.as_ref()
|
||||||
if last_focused.is_some_and(
|
&& last_focused.is_some_and(
|
||||||
|t| matches!(t, FocusTarget::Fullscreen(f) if f == &fullscreen.surface),
|
|t| matches!(t, FocusTarget::Fullscreen(f) if f == &fullscreen.surface),
|
||||||
) && !fullscreen.is_animating()
|
)
|
||||||
{
|
&& !fullscreen.is_animating()
|
||||||
let geometry = self.fullscreen_geometry().unwrap();
|
{
|
||||||
return fullscreen_element_under(fullscreen, geometry);
|
let geometry = self.fullscreen_geometry().unwrap();
|
||||||
}
|
return fullscreen_element_under(fullscreen, geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.popup_element_under(location)
|
.popup_element_under(location)
|
||||||
.or_else(|| self.tiling_layer.popup_element_under(location))
|
.or_else(|| self.tiling_layer.popup_element_under(location))
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_))) {
|
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_)))
|
||||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
&& let Some(fullscreen) = self.fullscreen.as_ref()
|
||||||
let geometry = self.fullscreen_geometry().unwrap();
|
{
|
||||||
return fullscreen_element_under(fullscreen, geometry);
|
let geometry = self.fullscreen_geometry().unwrap();
|
||||||
}
|
return fullscreen_element_under(fullscreen, geometry);
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
|
|
@ -824,25 +822,25 @@ impl Workspace {
|
||||||
let stack = self.focus_stack.get(seat);
|
let stack = self.focus_stack.get(seat);
|
||||||
let last_focused = stack.last();
|
let last_focused = stack.last();
|
||||||
|
|
||||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
if let Some(fullscreen) = self.fullscreen.as_ref()
|
||||||
if last_focused.is_some_and(
|
&& last_focused.is_some_and(
|
||||||
|t| matches!(t, FocusTarget::Fullscreen(f) if f == &fullscreen.surface),
|
|t| matches!(t, FocusTarget::Fullscreen(f) if f == &fullscreen.surface),
|
||||||
) && !fullscreen.is_animating()
|
)
|
||||||
{
|
&& !fullscreen.is_animating()
|
||||||
let geometry = self.fullscreen_geometry().unwrap();
|
{
|
||||||
return fullscreen_element_under(fullscreen, geometry);
|
let geometry = self.fullscreen_geometry().unwrap();
|
||||||
}
|
return fullscreen_element_under(fullscreen, geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.floating_layer
|
self.floating_layer
|
||||||
.toplevel_element_under(location)
|
.toplevel_element_under(location)
|
||||||
.or_else(|| self.tiling_layer.toplevel_element_under(location))
|
.or_else(|| self.tiling_layer.toplevel_element_under(location))
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_))) {
|
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_)))
|
||||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
&& let Some(fullscreen) = self.fullscreen.as_ref()
|
||||||
let geometry = self.fullscreen_geometry().unwrap();
|
{
|
||||||
return fullscreen_element_under(fullscreen, geometry);
|
let geometry = self.fullscreen_geometry().unwrap();
|
||||||
}
|
return fullscreen_element_under(fullscreen, geometry);
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
|
|
@ -1071,7 +1069,7 @@ impl Workspace {
|
||||||
mapped.set_minimized(true);
|
mapped.set_minimized(true);
|
||||||
mapped.configure();
|
mapped.configure();
|
||||||
|
|
||||||
let was_snapped = mapped.floating_tiled.lock().unwrap().clone();
|
let was_snapped = *mapped.floating_tiled.lock().unwrap();
|
||||||
if let Some(geometry) = self.floating_layer.unmap(&mapped, Some(to)) {
|
if let Some(geometry) = self.floating_layer.unmap(&mapped, Some(to)) {
|
||||||
return Some(MinimizedWindow::Floating {
|
return Some(MinimizedWindow::Floating {
|
||||||
window: mapped,
|
window: mapped,
|
||||||
|
|
|
||||||
|
|
@ -232,24 +232,24 @@ impl ZoomState {
|
||||||
let active_output = self.seat.active_output();
|
let active_output = self.seat.active_output();
|
||||||
let output = output.unwrap_or(&active_output);
|
let output = output.unwrap_or(&active_output);
|
||||||
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
||||||
let res = output_state
|
|
||||||
|
output_state
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.animating_focal_point()
|
.animating_focal_point()
|
||||||
.to_global(output);
|
.to_global(output)
|
||||||
res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn current_focal_point(&self, output: Option<&Output>) -> Point<f64, Global> {
|
pub fn current_focal_point(&self, output: Option<&Output>) -> Point<f64, Global> {
|
||||||
let active_output = self.seat.active_output();
|
let active_output = self.seat.active_output();
|
||||||
let output = output.unwrap_or(&active_output);
|
let output = output.unwrap_or(&active_output);
|
||||||
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
||||||
let res = output_state
|
|
||||||
|
output_state
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.current_focal_point()
|
.current_focal_point()
|
||||||
.to_global(output);
|
.to_global(output)
|
||||||
res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_focal_point(
|
pub fn update_focal_point(
|
||||||
|
|
|
||||||
271
src/state.rs
271
src/state.rs
|
|
@ -655,9 +655,9 @@ impl State {
|
||||||
let cosmic_image_capture_source_state =
|
let cosmic_image_capture_source_state =
|
||||||
CosmicImageCaptureSourceState::new::<Self, _>(dh, client_not_sandboxed);
|
CosmicImageCaptureSourceState::new::<Self, _>(dh, client_not_sandboxed);
|
||||||
let output_capture_source_state =
|
let output_capture_source_state =
|
||||||
OutputCaptureSourceState::new_with_filter::<State, _>(&dh, client_not_sandboxed);
|
OutputCaptureSourceState::new_with_filter::<State, _>(dh, client_not_sandboxed);
|
||||||
let toplevel_capture_source_state =
|
let toplevel_capture_source_state =
|
||||||
ToplevelCaptureSourceState::new_with_filter::<State, _>(&dh, client_not_sandboxed);
|
ToplevelCaptureSourceState::new_with_filter::<State, _>(dh, client_not_sandboxed);
|
||||||
let image_copy_capture_state =
|
let image_copy_capture_state =
|
||||||
ImageCopyCaptureState::new_with_filter::<Self, _>(dh, client_not_sandboxed);
|
ImageCopyCaptureState::new_with_filter::<Self, _>(dh, client_not_sandboxed);
|
||||||
let shm_state =
|
let shm_state =
|
||||||
|
|
@ -681,7 +681,7 @@ impl State {
|
||||||
VirtualKeyboardManagerState::new::<State, _>(dh, client_not_sandboxed);
|
VirtualKeyboardManagerState::new::<State, _>(dh, client_not_sandboxed);
|
||||||
AlphaModifierState::new::<Self>(dh);
|
AlphaModifierState::new::<Self>(dh);
|
||||||
SinglePixelBufferState::new::<Self>(dh);
|
SinglePixelBufferState::new::<Self>(dh);
|
||||||
FixesState::new::<Self>(&dh);
|
FixesState::new::<Self>(dh);
|
||||||
|
|
||||||
let idle_notifier_state = IdleNotifierState::<Self>::new(dh, handle.clone());
|
let idle_notifier_state = IdleNotifierState::<Self>::new(dh, handle.clone());
|
||||||
let idle_inhibit_manager_state = IdleInhibitManagerState::new::<State>(dh);
|
let idle_inhibit_manager_state = IdleInhibitManagerState::new::<State>(dh);
|
||||||
|
|
@ -954,10 +954,10 @@ impl Common {
|
||||||
};
|
};
|
||||||
|
|
||||||
// lock surface
|
// lock surface
|
||||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||||
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
&& let Some(lock_surface) = session_lock.surfaces.get(output)
|
||||||
with_surfaces_surface_tree(lock_surface.wl_surface(), processor)
|
{
|
||||||
}
|
with_surfaces_surface_tree(lock_surface.wl_surface(), processor)
|
||||||
}
|
}
|
||||||
|
|
||||||
for seat in shell
|
for seat in shell
|
||||||
|
|
@ -973,11 +973,11 @@ impl Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
// grabs
|
// grabs
|
||||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||||
for (window, _) in grab_state.element().windows() {
|
{
|
||||||
window.with_surfaces(processor);
|
for (window, _) in grab_state.element().windows() {
|
||||||
}
|
window.with_surfaces(processor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1037,30 +1037,28 @@ impl Common {
|
||||||
) {
|
) {
|
||||||
let shell = self.shell.read();
|
let shell = self.shell.read();
|
||||||
|
|
||||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||||
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
&& let Some(lock_surface) = session_lock.surfaces.get(output)
|
||||||
if let Some(feedback) =
|
&& let Some(feedback) =
|
||||||
advertised_node_for_surface(lock_surface.wl_surface(), &self.display_handle)
|
advertised_node_for_surface(lock_surface.wl_surface(), &self.display_handle)
|
||||||
.and_then(&mut dmabuf_feedback)
|
.and_then(&mut dmabuf_feedback)
|
||||||
{
|
{
|
||||||
send_dmabuf_feedback_surface_tree(
|
send_dmabuf_feedback_surface_tree(
|
||||||
lock_surface.wl_surface(),
|
lock_surface.wl_surface(),
|
||||||
output,
|
output,
|
||||||
surface_primary_scanout_output,
|
surface_primary_scanout_output,
|
||||||
|surface, _| {
|
|surface, _| {
|
||||||
select_dmabuf_feedback(
|
select_dmabuf_feedback(
|
||||||
surface,
|
surface,
|
||||||
render_element_states,
|
render_element_states,
|
||||||
&feedback.render_feedback,
|
&feedback.render_feedback,
|
||||||
feedback
|
feedback
|
||||||
.primary_scanout_feedback
|
.primary_scanout_feedback
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap_or(&feedback.render_feedback),
|
.unwrap_or(&feedback.render_feedback),
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
for seat in shell
|
for seat in shell
|
||||||
|
|
@ -1070,71 +1068,69 @@ impl Common {
|
||||||
{
|
{
|
||||||
let cursor_status = seat.cursor_image_status();
|
let cursor_status = seat.cursor_image_status();
|
||||||
|
|
||||||
if let CursorImageStatus::Surface(wl_surface) = cursor_status {
|
if let CursorImageStatus::Surface(wl_surface) = cursor_status
|
||||||
if let Some(feedback) =
|
&& let Some(feedback) =
|
||||||
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
||||||
.and_then(&mut dmabuf_feedback)
|
.and_then(&mut dmabuf_feedback)
|
||||||
{
|
{
|
||||||
send_dmabuf_feedback_surface_tree(
|
send_dmabuf_feedback_surface_tree(
|
||||||
&wl_surface,
|
&wl_surface,
|
||||||
output,
|
output,
|
||||||
surface_primary_scanout_output,
|
surface_primary_scanout_output,
|
||||||
|surface, _| {
|
|surface, _| {
|
||||||
select_dmabuf_feedback(
|
select_dmabuf_feedback(
|
||||||
surface,
|
surface,
|
||||||
render_element_states,
|
render_element_states,
|
||||||
&feedback.render_feedback,
|
&feedback.render_feedback,
|
||||||
feedback
|
feedback
|
||||||
.overlay_scanout_feedback
|
.overlay_scanout_feedback
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap_or(&feedback.render_feedback),
|
.unwrap_or(&feedback.render_feedback),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(icon) = get_dnd_icon(seat) {
|
if let Some(icon) = get_dnd_icon(seat)
|
||||||
if let Some(feedback) =
|
&& let Some(feedback) =
|
||||||
advertised_node_for_surface(&icon.surface, &self.display_handle)
|
advertised_node_for_surface(&icon.surface, &self.display_handle)
|
||||||
.and_then(&mut dmabuf_feedback)
|
.and_then(&mut dmabuf_feedback)
|
||||||
{
|
{
|
||||||
send_dmabuf_feedback_surface_tree(
|
send_dmabuf_feedback_surface_tree(
|
||||||
&icon.surface,
|
&icon.surface,
|
||||||
output,
|
output,
|
||||||
surface_primary_scanout_output,
|
surface_primary_scanout_output,
|
||||||
|surface, _| {
|
|surface, _| {
|
||||||
select_dmabuf_feedback(
|
select_dmabuf_feedback(
|
||||||
surface,
|
surface,
|
||||||
render_element_states,
|
render_element_states,
|
||||||
&feedback.render_feedback,
|
&feedback.render_feedback,
|
||||||
feedback
|
feedback
|
||||||
.overlay_scanout_feedback
|
.overlay_scanout_feedback
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap_or(&feedback.render_feedback),
|
.unwrap_or(&feedback.render_feedback),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||||
for (window, _) in grab_state.element().windows() {
|
{
|
||||||
if let Some(feedback) = window
|
for (window, _) in grab_state.element().windows() {
|
||||||
.wl_surface()
|
if let Some(feedback) = window
|
||||||
.and_then(|wl_surface| {
|
.wl_surface()
|
||||||
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
.and_then(|wl_surface| {
|
||||||
})
|
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
||||||
.and_then(&mut dmabuf_feedback)
|
})
|
||||||
{
|
.and_then(&mut dmabuf_feedback)
|
||||||
window.send_dmabuf_feedback(
|
{
|
||||||
output,
|
window.send_dmabuf_feedback(
|
||||||
&feedback,
|
output,
|
||||||
render_element_states,
|
&feedback,
|
||||||
surface_primary_scanout_output,
|
render_element_states,
|
||||||
);
|
surface_primary_scanout_output,
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1167,21 +1163,20 @@ impl Common {
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(active) = shell.active_space(output) {
|
if let Some(active) = shell.active_space(output) {
|
||||||
if let Some(window) = active.get_fullscreen() {
|
if let Some(window) = active.get_fullscreen()
|
||||||
if let Some(feedback) = window
|
&& let Some(feedback) = window
|
||||||
.wl_surface()
|
.wl_surface()
|
||||||
.and_then(|wl_surface| {
|
.and_then(|wl_surface| {
|
||||||
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
||||||
})
|
})
|
||||||
.and_then(&mut dmabuf_feedback)
|
.and_then(&mut dmabuf_feedback)
|
||||||
{
|
{
|
||||||
window.send_dmabuf_feedback(
|
window.send_dmabuf_feedback(
|
||||||
output,
|
output,
|
||||||
&feedback,
|
&feedback,
|
||||||
render_element_states,
|
render_element_states,
|
||||||
surface_primary_scanout_output,
|
surface_primary_scanout_output,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
active.mapped().for_each(|mapped| {
|
active.mapped().for_each(|mapped| {
|
||||||
for (window, _) in mapped.windows() {
|
for (window, _) in mapped.windows() {
|
||||||
|
|
@ -1204,28 +1199,27 @@ impl Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.override_redirect_windows.iter().for_each(|or| {
|
shell.override_redirect_windows.iter().for_each(|or| {
|
||||||
if let Some(wl_surface) = or.wl_surface() {
|
if let Some(wl_surface) = or.wl_surface()
|
||||||
if let Some(feedback) =
|
&& let Some(feedback) =
|
||||||
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
||||||
.and_then(&mut dmabuf_feedback)
|
.and_then(&mut dmabuf_feedback)
|
||||||
{
|
{
|
||||||
send_dmabuf_feedback_surface_tree(
|
send_dmabuf_feedback_surface_tree(
|
||||||
&wl_surface,
|
&wl_surface,
|
||||||
output,
|
output,
|
||||||
surface_primary_scanout_output,
|
surface_primary_scanout_output,
|
||||||
|surface, _| {
|
|surface, _| {
|
||||||
select_dmabuf_feedback(
|
select_dmabuf_feedback(
|
||||||
surface,
|
surface,
|
||||||
render_element_states,
|
render_element_states,
|
||||||
&feedback.render_feedback,
|
&feedback.render_feedback,
|
||||||
feedback
|
feedback
|
||||||
.overlay_scanout_feedback
|
.overlay_scanout_feedback
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap_or(&feedback.render_feedback),
|
.unwrap_or(&feedback.render_feedback),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1280,10 +1274,11 @@ impl Common {
|
||||||
|
|
||||||
// If we already sent a frame callback to this surface this output refresh
|
// If we already sent a frame callback to this surface this output refresh
|
||||||
// cycle, don't send one again to prevent empty-damage commit busy loops.
|
// cycle, don't send one again to prevent empty-damage commit busy loops.
|
||||||
if let Some((last_output, last_sequence)) = &*last_sent_at {
|
if let Some((last_output, last_sequence)) = &*last_sent_at
|
||||||
if last_output == output && *last_sequence == sequence {
|
&& last_output == output
|
||||||
send = false;
|
&& *last_sequence == sequence
|
||||||
}
|
{
|
||||||
|
send = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if send {
|
if send {
|
||||||
|
|
@ -1306,16 +1301,10 @@ impl Common {
|
||||||
|
|
||||||
let shell = self.shell.read();
|
let shell = self.shell.read();
|
||||||
|
|
||||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||||
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
&& let Some(lock_surface) = session_lock.surfaces.get(output)
|
||||||
send_frames_surface_tree(
|
{
|
||||||
lock_surface.wl_surface(),
|
send_frames_surface_tree(lock_surface.wl_surface(), output, time, None, should_send);
|
||||||
output,
|
|
||||||
time,
|
|
||||||
None,
|
|
||||||
should_send,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for seat in shell
|
for seat in shell
|
||||||
|
|
@ -1335,11 +1324,11 @@ impl Common {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||||
for (window, _) in grab_state.element().windows() {
|
{
|
||||||
window.send_frame(output, time, throttle(&window), should_send);
|
for (window, _) in grab_state.element().windows() {
|
||||||
}
|
window.send_frame(output, time, throttle(&window), should_send);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,13 +449,13 @@ impl<P: Program + Send + 'static> IcedElementInternal<P> {
|
||||||
)
|
)
|
||||||
.1;
|
.1;
|
||||||
|
|
||||||
if let Some(action) = actions {
|
if let Some(action) = actions
|
||||||
if let Some(t) = into_stream(action) {
|
&& let Some(t) = into_stream(action)
|
||||||
let _ = self.scheduler.schedule(t.into_future().map(|f| match f.0 {
|
{
|
||||||
Some(Action::Output(msg)) => Some(msg),
|
let _ = self.scheduler.schedule(t.into_future().map(|f| match f.0 {
|
||||||
_ => None,
|
Some(Action::Output(msg)) => Some(msg),
|
||||||
}));
|
_ => None,
|
||||||
}
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,11 +145,11 @@ where
|
||||||
// for now :^)
|
// for now :^)
|
||||||
let temp_cache = user_interface.into_cache();
|
let temp_cache = user_interface.into_cache();
|
||||||
|
|
||||||
let tasks = Task::batch(messages.into_iter().map(|message| {
|
let tasks = Task::batch(
|
||||||
let task = self.program.update(message);
|
messages
|
||||||
|
.into_iter()
|
||||||
task
|
.map(|message| self.program.update(message)),
|
||||||
}));
|
);
|
||||||
|
|
||||||
let mut user_interface =
|
let mut user_interface =
|
||||||
build_user_interface(id, &mut self.program, temp_cache, renderer, bounds);
|
build_user_interface(id, &mut self.program, temp_cache, renderer, bounds);
|
||||||
|
|
@ -216,7 +216,5 @@ fn build_user_interface<'a, P: Program>(
|
||||||
) -> UserInterface<'a, P::Message, cosmic::Theme, cosmic::Renderer> {
|
) -> UserInterface<'a, P::Message, cosmic::Theme, cosmic::Renderer> {
|
||||||
let view = program.view();
|
let view = program.view();
|
||||||
|
|
||||||
let user_interface = UserInterface::build(view, size, cache, renderer);
|
UserInterface::build(view, size, cache, renderer)
|
||||||
|
|
||||||
user_interface
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ fn xdg_popup_ensure_initial_configure(popup: &PopupKind) {
|
||||||
|
|
||||||
fn layer_surface_check_inital_configure(surface: &LayerSurface) -> bool {
|
fn layer_surface_check_inital_configure(surface: &LayerSurface) -> bool {
|
||||||
// send the initial configure if relevant
|
// send the initial configure if relevant
|
||||||
let initial_configure_sent = with_states(surface.wl_surface(), |states| {
|
with_states(surface.wl_surface(), |states| {
|
||||||
states
|
states
|
||||||
.data_map
|
.data_map
|
||||||
.get::<Mutex<LayerSurfaceAttributes>>()
|
.get::<Mutex<LayerSurfaceAttributes>>()
|
||||||
|
|
@ -81,9 +81,7 @@ fn layer_surface_check_inital_configure(surface: &LayerSurface) -> bool {
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.initial_configure_sent
|
.initial_configure_sent
|
||||||
});
|
})
|
||||||
|
|
||||||
initial_configure_sent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn client_compositor_state(client: &Client) -> &CompositorClientState {
|
pub fn client_compositor_state(client: &Client) -> &CompositorClientState {
|
||||||
|
|
@ -195,23 +193,24 @@ impl CompositorHandler for State {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
if let Some(dmabuf) = maybe_dmabuf {
|
if let Some(dmabuf) = maybe_dmabuf {
|
||||||
if let Some(acquire_point) = acquire_point {
|
if let Some(acquire_point) = acquire_point
|
||||||
if let Ok((blocker, source)) = acquire_point.generate_blocker() {
|
&& let Ok((blocker, source)) = acquire_point.generate_blocker()
|
||||||
let client = surface.client().unwrap();
|
{
|
||||||
let res = state.common.event_loop_handle.insert_source(
|
let client = surface.client().unwrap();
|
||||||
source,
|
let res =
|
||||||
move |_, _, state| {
|
state
|
||||||
|
.common
|
||||||
|
.event_loop_handle
|
||||||
|
.insert_source(source, move |_, _, state| {
|
||||||
let dh = state.common.display_handle.clone();
|
let dh = state.common.display_handle.clone();
|
||||||
state
|
state
|
||||||
.client_compositor_state(&client)
|
.client_compositor_state(&client)
|
||||||
.blocker_cleared(state, &dh);
|
.blocker_cleared(state, &dh);
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
});
|
||||||
);
|
if res.is_ok() {
|
||||||
if res.is_ok() {
|
add_blocker(surface, blocker);
|
||||||
add_blocker(surface, blocker);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Ok((blocker, source)) = dmabuf.generate_blocker(Interest::READ) {
|
if let Ok((blocker, source)) = dmabuf.generate_blocker(Interest::READ) {
|
||||||
|
|
@ -379,35 +378,34 @@ impl State {
|
||||||
.pending_windows
|
.pending_windows
|
||||||
.iter()
|
.iter()
|
||||||
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface))
|
.find(|pending| pending.surface.wl_surface().as_deref() == Some(surface))
|
||||||
|
&& let Some(toplevel) = pending.surface.0.toplevel()
|
||||||
{
|
{
|
||||||
if let Some(toplevel) = pending.surface.0.toplevel() {
|
let initial_size = if let Some(output) = pending.fullscreen.as_ref() {
|
||||||
let initial_size = if let Some(output) = pending.fullscreen.as_ref() {
|
Some(output.geometry().size.as_logical())
|
||||||
Some(output.geometry().size.as_logical())
|
} else if pending.maximized {
|
||||||
} else if pending.maximized {
|
let active_output = shell.seats.last_active().active_output();
|
||||||
let active_output = shell.seats.last_active().active_output();
|
let zone = layer_map_for_output(&active_output).non_exclusive_zone();
|
||||||
let zone = layer_map_for_output(&active_output).non_exclusive_zone();
|
Some(zone.size)
|
||||||
Some(zone.size)
|
} else {
|
||||||
} else {
|
None
|
||||||
None
|
};
|
||||||
};
|
if toplevel_ensure_initial_configure(toplevel, initial_size)
|
||||||
if toplevel_ensure_initial_configure(toplevel, initial_size)
|
&& with_renderer_surface_state(surface, |state| state.buffer().is_some())
|
||||||
&& with_renderer_surface_state(surface, |state| state.buffer().is_some())
|
.unwrap_or(false)
|
||||||
.unwrap_or(false)
|
{
|
||||||
{
|
let window = pending.surface.clone();
|
||||||
let window = pending.surface.clone();
|
window.on_commit();
|
||||||
window.on_commit();
|
let res = shell.map_window(
|
||||||
let res = shell.map_window(
|
&window,
|
||||||
&window,
|
&mut self.common.toplevel_info_state,
|
||||||
&mut self.common.toplevel_info_state,
|
&mut self.common.workspace_state,
|
||||||
&mut self.common.workspace_state,
|
&self.common.event_loop_handle,
|
||||||
&self.common.event_loop_handle,
|
);
|
||||||
);
|
if let Some(target) = res {
|
||||||
if let Some(target) = res {
|
let seat = shell.seats.last_active().clone();
|
||||||
let seat = shell.seats.last_active().clone();
|
std::mem::drop(shell);
|
||||||
std::mem::drop(shell);
|
Shell::set_focus(self, Some(&target), &seat, None, true);
|
||||||
Shell::set_focus(self, Some(&target), &seat, None, true);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -417,17 +415,16 @@ impl State {
|
||||||
.iter()
|
.iter()
|
||||||
.find(|pending| pending.surface.wl_surface() == surface)
|
.find(|pending| pending.surface.wl_surface() == surface)
|
||||||
.map(|pending| pending.surface.clone())
|
.map(|pending| pending.surface.clone())
|
||||||
|
&& !layer_surface_check_inital_configure(&layer_surface)
|
||||||
{
|
{
|
||||||
if !layer_surface_check_inital_configure(&layer_surface) {
|
// compute initial dimensions by mapping
|
||||||
// compute initial dimensions by mapping
|
if let Some(target) = shell.map_layer(&layer_surface) {
|
||||||
if let Some(target) = shell.map_layer(&layer_surface) {
|
let seat = shell.seats.last_active().clone();
|
||||||
let seat = shell.seats.last_active().clone();
|
std::mem::drop(shell);
|
||||||
std::mem::drop(shell);
|
Shell::set_focus(self, Some(&target), &seat, None, false);
|
||||||
Shell::set_focus(self, Some(&target), &seat, None, false);
|
|
||||||
}
|
|
||||||
layer_surface.layer_surface().send_configure();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
layer_surface.layer_surface().send_configure();
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,12 @@ impl XdgDecorationHandler for State {
|
||||||
if let Some((window, _)) = mapped
|
if let Some((window, _)) = mapped
|
||||||
.windows()
|
.windows()
|
||||||
.find(|(window, _)| window.wl_surface().as_deref() == Some(toplevel.wl_surface()))
|
.find(|(window, _)| window.wl_surface().as_deref() == Some(toplevel.wl_surface()))
|
||||||
|
&& let Some(toplevel) = window.0.toplevel()
|
||||||
{
|
{
|
||||||
if let Some(toplevel) = window.0.toplevel() {
|
toplevel.with_pending_state(|state| {
|
||||||
toplevel.with_pending_state(|state| {
|
state.decoration_mode = Some(mode);
|
||||||
state.decoration_mode = Some(mode);
|
});
|
||||||
});
|
toplevel.send_configure();
|
||||||
toplevel.send_configure();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -91,14 +90,13 @@ impl XdgDecorationHandler for State {
|
||||||
if let Some((window, _)) = mapped
|
if let Some((window, _)) = mapped
|
||||||
.windows()
|
.windows()
|
||||||
.find(|(window, _)| window.wl_surface().as_deref() == Some(toplevel.wl_surface()))
|
.find(|(window, _)| window.wl_surface().as_deref() == Some(toplevel.wl_surface()))
|
||||||
|
&& let Some(toplevel) = window.0.toplevel()
|
||||||
{
|
{
|
||||||
if let Some(toplevel) = window.0.toplevel() {
|
PreferredDecorationMode::update(&window.0, Some(mode));
|
||||||
PreferredDecorationMode::update(&window.0, Some(mode));
|
toplevel.with_pending_state(|state| {
|
||||||
toplevel.with_pending_state(|state| {
|
state.decoration_mode = Some(mode);
|
||||||
state.decoration_mode = Some(mode);
|
});
|
||||||
});
|
toplevel.send_configure();
|
||||||
toplevel.send_configure();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toplevel.with_pending_state(|state| state.decoration_mode = Some(mode));
|
toplevel.with_pending_state(|state| state.decoration_mode = Some(mode));
|
||||||
|
|
@ -107,19 +105,17 @@ impl XdgDecorationHandler for State {
|
||||||
|
|
||||||
fn unset_mode(&mut self, toplevel: ToplevelSurface) {
|
fn unset_mode(&mut self, toplevel: ToplevelSurface) {
|
||||||
let shell = self.common.shell.read();
|
let shell = self.common.shell.read();
|
||||||
if let Some(mapped) = shell.element_for_surface(toplevel.wl_surface()) {
|
if let Some(mapped) = shell.element_for_surface(toplevel.wl_surface())
|
||||||
if let Some((window, _)) = mapped
|
&& let Some((window, _)) = mapped
|
||||||
.windows()
|
.windows()
|
||||||
.find(|(window, _)| window.wl_surface().as_deref() == Some(toplevel.wl_surface()))
|
.find(|(window, _)| window.wl_surface().as_deref() == Some(toplevel.wl_surface()))
|
||||||
{
|
&& let Some(toplevel) = window.0.toplevel()
|
||||||
if let Some(toplevel) = window.0.toplevel() {
|
{
|
||||||
PreferredDecorationMode::update(&window.0, None);
|
PreferredDecorationMode::update(&window.0, None);
|
||||||
toplevel.with_pending_state(|state| {
|
toplevel.with_pending_state(|state| {
|
||||||
state.decoration_mode = None;
|
state.decoration_mode = None;
|
||||||
});
|
});
|
||||||
toplevel.send_configure();
|
toplevel.send_configure();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,14 +79,12 @@ impl DmabufHandler for State {
|
||||||
feedback
|
feedback
|
||||||
.primary_scanout_feedback
|
.primary_scanout_feedback
|
||||||
.unwrap_or(feedback.render_feedback)
|
.unwrap_or(feedback.render_feedback)
|
||||||
|
} else if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||||
|
feedback
|
||||||
|
.overlay_scanout_feedback
|
||||||
|
.unwrap_or(feedback.render_feedback)
|
||||||
} else {
|
} else {
|
||||||
if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
feedback.render_feedback
|
||||||
feedback
|
|
||||||
.overlay_scanout_feedback
|
|
||||||
.unwrap_or(feedback.render_feedback)
|
|
||||||
} else {
|
|
||||||
feedback.render_feedback
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,22 +237,22 @@ impl ImageCopyCaptureHandler for State {
|
||||||
}
|
}
|
||||||
ImageCaptureSourceKind::Toplevel(mut toplevel) => {
|
ImageCaptureSourceKind::Toplevel(mut toplevel) => {
|
||||||
let shell = self.common.shell.read();
|
let shell = self.common.shell.read();
|
||||||
if let Some(element) = shell.element_for_surface(&toplevel) {
|
if let Some(element) = shell.element_for_surface(&toplevel)
|
||||||
if element.has_active_window(&toplevel) {
|
&& element.has_active_window(&toplevel)
|
||||||
if let Some(workspace) = shell.space_for(element) {
|
&& let Some(workspace) = shell.space_for(element)
|
||||||
if let Some(geometry) = workspace.element_geometry(element) {
|
&& let Some(geometry) = workspace.element_geometry(element)
|
||||||
let mut surface_geo = element.active_window_geometry().as_local();
|
{
|
||||||
surface_geo.loc += geometry.loc;
|
let mut surface_geo = element.active_window_geometry().as_local();
|
||||||
let global_geo = surface_geo.to_global(workspace.output());
|
surface_geo.loc += geometry.loc;
|
||||||
if global_geo.contains(pointer_loc) {
|
let global_geo = surface_geo.to_global(workspace.output());
|
||||||
let buffer_pos = (pointer_loc - global_geo.loc)
|
if global_geo.contains(pointer_loc) {
|
||||||
.as_logical()
|
let buffer_pos = (pointer_loc - global_geo.loc).as_logical().to_buffer(
|
||||||
.to_buffer(1, Transform::Normal, &toplevel.geometry().size);
|
1,
|
||||||
session.set_cursor_hotspot(hotspot);
|
Transform::Normal,
|
||||||
session.set_cursor_pos(Some(buffer_pos));
|
&toplevel.geometry().size,
|
||||||
}
|
);
|
||||||
}
|
session.set_cursor_hotspot(hotspot);
|
||||||
}
|
session.set_cursor_pos(Some(buffer_pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -577,18 +577,16 @@ pub fn render_window_to_buffer(
|
||||||
let pointer = seat.get_pointer().unwrap();
|
let pointer = seat.get_pointer().unwrap();
|
||||||
let pointer_loc = pointer.current_location().to_i32_round().as_global();
|
let pointer_loc = pointer.current_location().to_i32_round().as_global();
|
||||||
let mut location = None;
|
let mut location = None;
|
||||||
if let Some(element) = shell.element_for_surface(toplevel) {
|
if let Some(element) = shell.element_for_surface(toplevel)
|
||||||
if element.has_active_window(toplevel) {
|
&& element.has_active_window(toplevel)
|
||||||
if let Some(workspace) = shell.space_for(element) {
|
&& let Some(workspace) = shell.space_for(element)
|
||||||
if let Some(geometry) = workspace.element_geometry(element) {
|
&& let Some(geometry) = workspace.element_geometry(element)
|
||||||
let mut surface_geo = element.active_window_geometry().as_local();
|
{
|
||||||
surface_geo.loc += geometry.loc;
|
let mut surface_geo = element.active_window_geometry().as_local();
|
||||||
let global_geo = surface_geo.to_global(workspace.output());
|
surface_geo.loc += geometry.loc;
|
||||||
if global_geo.contains(pointer_loc) {
|
let global_geo = surface_geo.to_global(workspace.output());
|
||||||
location = Some((pointer_loc - global_geo.loc).as_logical().to_f64());
|
if global_geo.contains(pointer_loc) {
|
||||||
}
|
location = Some((pointer_loc - global_geo.loc).as_logical().to_f64());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::mem::drop(shell);
|
std::mem::drop(shell);
|
||||||
|
|
@ -620,19 +618,17 @@ pub fn render_window_to_buffer(
|
||||||
|
|
||||||
// TODO cosmic-workspaces wants to omit, but metadata cursor capture in portal should
|
// TODO cosmic-workspaces wants to omit, but metadata cursor capture in portal should
|
||||||
// still include dnd surface in window capture buffer?
|
// still include dnd surface in window capture buffer?
|
||||||
if draw_cursor {
|
if draw_cursor && let Some(dnd_icon) = get_dnd_icon(&seat) {
|
||||||
if let Some(dnd_icon) = get_dnd_icon(&seat) {
|
elements.extend(
|
||||||
elements.extend(
|
cursor::draw_dnd_icon(
|
||||||
cursor::draw_dnd_icon(
|
renderer,
|
||||||
renderer,
|
&dnd_icon.surface,
|
||||||
&dnd_icon.surface,
|
(location + dnd_icon.offset.to_f64()).to_i32_round(),
|
||||||
(location + dnd_icon.offset.to_f64()).to_i32_round(),
|
1.0,
|
||||||
1.0,
|
)
|
||||||
)
|
.into_iter()
|
||||||
.into_iter()
|
.map(WindowCaptureElement::from),
|
||||||
.map(WindowCaptureElement::from),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,8 @@ impl State {
|
||||||
*current_config = backup;
|
*current_config = backup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !test_only {
|
if !test_only
|
||||||
if let Err(err) = backend.apply_config_for_outputs(
|
&& let Err(err) = backend.apply_config_for_outputs(
|
||||||
false,
|
false,
|
||||||
&self.common.event_loop_handle,
|
&self.common.event_loop_handle,
|
||||||
self.common.config.dynamic_conf.screen_filter(),
|
self.common.config.dynamic_conf.screen_filter(),
|
||||||
|
|
@ -184,9 +184,9 @@ impl State {
|
||||||
&self.common.xdg_activation_state,
|
&self.common.xdg_activation_state,
|
||||||
self.common.startup_done.clone(),
|
self.common.startup_done.clone(),
|
||||||
&self.common.clock,
|
&self.common.clock,
|
||||||
) {
|
)
|
||||||
error!("Failed to reset output config: {:?}", err);
|
{
|
||||||
}
|
error!("Failed to reset output config: {:?}", err);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,9 @@ impl SelectionHandler for State {
|
||||||
.xwayland_state
|
.xwayland_state
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.and_then(|xstate| xstate.xwm.as_mut())
|
.and_then(|xstate| xstate.xwm.as_mut())
|
||||||
|
&& let Err(err) = xwm.send_selection(target, mime_type, fd)
|
||||||
{
|
{
|
||||||
if let Err(err) = xwm.send_selection(target, mime_type, fd) {
|
warn!(?err, "Failed to send selection (X11 -> Wayland).");
|
||||||
warn!(?err, "Failed to send selection (X11 -> Wayland).");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,14 @@ impl SessionLockHandler for State {
|
||||||
let mut shell = self.common.shell.write();
|
let mut shell = self.common.shell.write();
|
||||||
|
|
||||||
// Reject lock if sesion lock exists and is still valid
|
// Reject lock if sesion lock exists and is still valid
|
||||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||||
if self
|
&& self
|
||||||
.common
|
.common
|
||||||
.display_handle
|
.display_handle
|
||||||
.get_client(session_lock.ext_session_lock.id())
|
.get_client(session_lock.ext_session_lock.id())
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let ext_session_lock = locker.ext_session_lock().clone();
|
let ext_session_lock = locker.ext_session_lock().clone();
|
||||||
|
|
@ -55,17 +54,17 @@ impl SessionLockHandler for State {
|
||||||
|
|
||||||
fn new_surface(&mut self, lock_surface: LockSurface, wl_output: WlOutput) {
|
fn new_surface(&mut self, lock_surface: LockSurface, wl_output: WlOutput) {
|
||||||
let mut shell = self.common.shell.write();
|
let mut shell = self.common.shell.write();
|
||||||
if let Some(session_lock) = &mut shell.session_lock {
|
if let Some(session_lock) = &mut shell.session_lock
|
||||||
if let Some(output) = Output::from_resource(&wl_output) {
|
&& let Some(output) = Output::from_resource(&wl_output)
|
||||||
lock_surface.with_pending_state(|states| {
|
{
|
||||||
let size = output.geometry().size;
|
lock_surface.with_pending_state(|states| {
|
||||||
states.size = Some(Size::from((size.w as u32, size.h as u32)));
|
let size = output.geometry().size;
|
||||||
});
|
states.size = Some(Size::from((size.w as u32, size.h as u32)));
|
||||||
lock_surface.send_configure();
|
});
|
||||||
session_lock
|
lock_surface.send_configure();
|
||||||
.surfaces
|
session_lock
|
||||||
.insert(output.clone(), lock_surface.clone());
|
.surfaces
|
||||||
}
|
.insert(output.clone(), lock_surface.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,22 +113,21 @@ impl ToplevelManagementHandler for State {
|
||||||
// move pointer to window if it’s on a different monitor/output
|
// move pointer to window if it’s on a different monitor/output
|
||||||
if seat.active_output() != *output
|
if seat.active_output() != *output
|
||||||
&& self.common.config.cosmic_conf.cursor_follows_focus
|
&& self.common.config.cosmic_conf.cursor_follows_focus
|
||||||
|
&& let Some(new_pos) = new_pos
|
||||||
{
|
{
|
||||||
if let Some(new_pos) = new_pos {
|
seat.set_active_output(output);
|
||||||
seat.set_active_output(output);
|
if let Some(ptr) = seat.get_pointer() {
|
||||||
if let Some(ptr) = seat.get_pointer() {
|
let serial = SERIAL_COUNTER.next_serial();
|
||||||
let serial = SERIAL_COUNTER.next_serial();
|
ptr.motion(
|
||||||
ptr.motion(
|
self,
|
||||||
self,
|
None,
|
||||||
None,
|
&MotionEvent {
|
||||||
&MotionEvent {
|
location: new_pos.to_f64().as_logical(),
|
||||||
location: new_pos.to_f64().as_logical(),
|
serial,
|
||||||
serial,
|
time: self.common.clock.now().as_millis(),
|
||||||
time: self.common.clock.now().as_millis(),
|
},
|
||||||
},
|
);
|
||||||
);
|
ptr.frame(self);
|
||||||
ptr.frame(self);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ impl State {
|
||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
} else if let Some((workspace, _)) = shell.workspace_for_surface(&surface) {
|
} else if let Some((workspace, _)) = shell.workspace_for_surface(surface) {
|
||||||
let current_workspace = shell.active_space(¤t_output).unwrap();
|
let current_workspace = shell.active_space(¤t_output).unwrap();
|
||||||
if workspace == current_workspace.handle {
|
if workspace == current_workspace.handle {
|
||||||
let Some(target) = shell
|
let Some(target) = shell
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,7 @@ impl XdgShellHandler for State {
|
||||||
let mut shell = self.common.shell.write();
|
let mut shell = self.common.shell.write();
|
||||||
let seat = shell.seats.last_active().clone();
|
let seat = shell.seats.last_active().clone();
|
||||||
|
|
||||||
if shell
|
if !shell.pending_windows.iter().any(|w| w.surface == surface) {
|
||||||
.pending_windows
|
|
||||||
.iter()
|
|
||||||
.find(|w| &w.surface == &surface)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
let surface = CosmicSurface::from(surface);
|
let surface = CosmicSurface::from(surface);
|
||||||
shell.pending_windows.push(PendingWindow {
|
shell.pending_windows.push(PendingWindow {
|
||||||
surface,
|
surface,
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ pub fn update_reactive_popups<'a>(
|
||||||
for (popup, _) in PopupManager::popups_for_surface(toplevel.wl_surface()) {
|
for (popup, _) in PopupManager::popups_for_surface(toplevel.wl_surface()) {
|
||||||
match popup {
|
match popup {
|
||||||
PopupKind::Xdg(surface) => {
|
PopupKind::Xdg(surface) => {
|
||||||
let positioner = with_states(&surface.wl_surface(), |states| {
|
let positioner = with_states(surface.wl_surface(), |states| {
|
||||||
let mut guard = states.cached_state.get::<PopupCachedState>();
|
let mut guard = states.cached_state.get::<PopupCachedState>();
|
||||||
guard
|
guard
|
||||||
.current()
|
.current()
|
||||||
|
|
|
||||||
|
|
@ -204,10 +204,10 @@ where
|
||||||
state.request_screen_invert(inverted);
|
state.request_screen_invert(inverted);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(filter) = filter {
|
if let Ok(filter) = filter
|
||||||
if filter != state.a11y_state().screen_filter {
|
&& filter != state.a11y_state().screen_filter
|
||||||
state.request_screen_filter(filter);
|
{
|
||||||
}
|
state.request_screen_filter(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
|
||||||
|
|
@ -428,15 +428,13 @@ where
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
} {
|
} && inner.enabled
|
||||||
if inner.enabled
|
&& output
|
||||||
&& output
|
.current_mode()
|
||||||
.current_mode()
|
.map(|c| c == output_mode)
|
||||||
.map(|c| c == output_mode)
|
.unwrap_or(false)
|
||||||
.unwrap_or(false)
|
{
|
||||||
{
|
instance.obj.current_mode(mode);
|
||||||
instance.obj.current_mode(mode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -513,12 +511,11 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(extension_obj) = instance.extension_obj.as_ref() {
|
if let Some(extension_obj) = instance.extension_obj.as_ref()
|
||||||
if inner.enabled
|
&& inner.enabled
|
||||||
&& extension_obj.version() >= zcosmic_output_head_v1::EVT_XWAYLAND_PRIMARY_SINCE
|
&& extension_obj.version() >= zcosmic_output_head_v1::EVT_XWAYLAND_PRIMARY_SINCE
|
||||||
{
|
{
|
||||||
extension_obj.xwayland_primary(output.config().xwayland_primary as u32);
|
extension_obj.xwayland_primary(output.config().xwayland_primary as u32);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,13 @@ impl OutputPowerState {
|
||||||
let mut output_powers = mem::take(&mut state.output_power_state().output_powers);
|
let mut output_powers = mem::take(&mut state.output_power_state().output_powers);
|
||||||
for (output_power, old_mode) in output_powers.iter_mut() {
|
for (output_power, old_mode) in output_powers.iter_mut() {
|
||||||
let data = output_power.data::<OutputPowerData>().unwrap();
|
let data = output_power.data::<OutputPowerData>().unwrap();
|
||||||
if let Some(output) = data.output.upgrade() {
|
if let Some(output) = data.output.upgrade()
|
||||||
if let Some(on) = state.get_dpms(&output) {
|
&& let Some(on) = state.get_dpms(&output)
|
||||||
let mode = output_power_mode(on);
|
{
|
||||||
if mode != *old_mode {
|
let mode = output_power_mode(on);
|
||||||
output_power.mode(mode);
|
if mode != *old_mode {
|
||||||
*old_mode = mode;
|
output_power.mode(mode);
|
||||||
}
|
*old_mode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,16 +124,16 @@ impl OverlapNotifyState {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
if let Some(window_geo) = window.global_geometry() {
|
if let Some(window_geo) = window.global_geometry()
|
||||||
if let Some(intersection) = layer_geo.intersection(window_geo) {
|
&& let Some(intersection) = layer_geo.intersection(window_geo)
|
||||||
// relative to layer location
|
{
|
||||||
let region = Rectangle::new(
|
// relative to layer location
|
||||||
intersection.loc - layer_geo.loc,
|
let region = Rectangle::new(
|
||||||
intersection.size,
|
intersection.loc - layer_geo.loc,
|
||||||
)
|
intersection.size,
|
||||||
.as_logical();
|
)
|
||||||
new_snapshot.add_toplevel(window, region);
|
.as_logical();
|
||||||
}
|
new_snapshot.add_toplevel(window, region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,16 +238,15 @@ impl LayerOverlapNotificationDataInternal {
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
for toplevel in self.last_snapshot.toplevel_overlaps.keys() {
|
for toplevel in self.last_snapshot.toplevel_overlaps.keys() {
|
||||||
if !new_snapshot.toplevel_overlaps.contains_key(toplevel) {
|
if !new_snapshot.toplevel_overlaps.contains_key(toplevel)
|
||||||
if let Ok(toplevel) = toplevel.upgrade() {
|
&& let Ok(toplevel) = toplevel.upgrade()
|
||||||
if let Some(client) = toplevel.client() {
|
&& let Some(client) = toplevel.client()
|
||||||
for notification in notifications
|
{
|
||||||
.iter()
|
for notification in notifications
|
||||||
.filter(|n| n.client().is_some_and(|c| c == client))
|
.iter()
|
||||||
{
|
.filter(|n| n.client().is_some_and(|c| c == client))
|
||||||
notification.toplevel_leave(&toplevel);
|
{
|
||||||
}
|
notification.toplevel_leave(&toplevel);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -257,22 +256,20 @@ impl LayerOverlapNotificationDataInternal {
|
||||||
.toplevel_overlaps
|
.toplevel_overlaps
|
||||||
.get(toplevel)
|
.get(toplevel)
|
||||||
.is_some_and(|old_overlap| old_overlap == overlap)
|
.is_some_and(|old_overlap| old_overlap == overlap)
|
||||||
|
&& let Ok(toplevel) = toplevel.upgrade()
|
||||||
|
&& let Some(client) = toplevel.client()
|
||||||
{
|
{
|
||||||
if let Ok(toplevel) = toplevel.upgrade() {
|
for notification in notifications
|
||||||
if let Some(client) = toplevel.client() {
|
.iter()
|
||||||
for notification in notifications
|
.filter(|n| n.client().is_some_and(|c| c == client))
|
||||||
.iter()
|
{
|
||||||
.filter(|n| n.client().is_some_and(|c| c == client))
|
notification.toplevel_enter(
|
||||||
{
|
&toplevel,
|
||||||
notification.toplevel_enter(
|
overlap.loc.x,
|
||||||
&toplevel,
|
overlap.loc.y,
|
||||||
overlap.loc.x,
|
overlap.size.w,
|
||||||
overlap.loc.y,
|
overlap.size.h,
|
||||||
overlap.size.w,
|
);
|
||||||
overlap.size.h,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -574,10 +574,8 @@ where
|
||||||
instance.geometry(&wl_output, geo.loc.x, geo.loc.y, geo.size.w, geo.size.h);
|
instance.geometry(&wl_output, geo.loc.x, geo.loc.y, geo.size.w, geo.size.h);
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
} else if geometry_changed {
|
} else if geometry_changed && let Some(geo) = geometry {
|
||||||
if let Some(geo) = geometry {
|
instance.geometry(&wl_output, geo.loc.x, geo.loc.y, geo.size.w, geo.size.h);
|
||||||
instance.geometry(&wl_output, geo.loc.x, geo.loc.y, geo.size.w, geo.size.h);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -635,10 +633,10 @@ pub fn window_from_handle<W: Window + 'static>(handle: ZcosmicToplevelHandleV1)
|
||||||
.and_then(|state| state.lock().unwrap().window.clone())
|
.and_then(|state| state.lock().unwrap().window.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn window_from_ext<'a, W: Window + 'static, D>(
|
pub fn window_from_ext<W: Window + 'static, D>(
|
||||||
state: &'a D,
|
state: &D,
|
||||||
handle: ForeignToplevelHandle,
|
handle: ForeignToplevelHandle,
|
||||||
) -> Option<&'a W>
|
) -> Option<&W>
|
||||||
where
|
where
|
||||||
D: ToplevelInfoHandler<Window = W>,
|
D: ToplevelInfoHandler<Window = W>,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -258,10 +258,9 @@ where
|
||||||
let window = window_from_handle(toplevel).unwrap();
|
let window = window_from_handle(toplevel).unwrap();
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||||
|
&& let Some(output) = Output::from_resource(&output)
|
||||||
{
|
{
|
||||||
if let Some(output) = Output::from_resource(&output) {
|
state.move_to_workspace(dh, &window, workspace_handle, output);
|
||||||
state.move_to_workspace(dh, &window, workspace_handle, output);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|
|
||||||
|
|
@ -94,11 +94,10 @@ where
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|g| &g.workspaces)
|
.flat_map(|g| &g.workspaces)
|
||||||
.find(|w| w.ext_instances.contains(&workspace))
|
.find(|w| w.ext_instances.contains(&workspace))
|
||||||
|
&& let Ok(ext_mngr) = data.manager.upgrade()
|
||||||
{
|
{
|
||||||
if let Ok(ext_mngr) = data.manager.upgrade() {
|
send_workspace_to_client(&cosmic_workspace, workspace);
|
||||||
send_workspace_to_client(&cosmic_workspace, workspace);
|
ext_mngr.done();
|
||||||
ext_mngr.done();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -128,20 +127,18 @@ where
|
||||||
zcosmic_workspace_handle_v2::Request::Rename { name } => {
|
zcosmic_workspace_handle_v2::Request::Rename { name } => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||||
{
|
&& let Ok(manager) =
|
||||||
if let Ok(manager) =
|
|
||||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||||
{
|
{
|
||||||
let mut state = manager
|
let mut state = manager
|
||||||
.data::<WorkspaceManagerData>()
|
.data::<WorkspaceManagerData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
state.requests.push(Request::Rename {
|
state.requests.push(Request::Rename {
|
||||||
workspace: workspace_handle,
|
workspace: workspace_handle,
|
||||||
name,
|
name,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zcosmic_workspace_handle_v2::Request::SetTilingState {
|
zcosmic_workspace_handle_v2::Request::SetTilingState {
|
||||||
|
|
@ -149,58 +146,52 @@ where
|
||||||
} => {
|
} => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||||
{
|
&& let Ok(manager) =
|
||||||
if let Ok(manager) =
|
|
||||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||||
{
|
{
|
||||||
let mut state = manager
|
let mut state = manager
|
||||||
.data::<WorkspaceManagerData>()
|
.data::<WorkspaceManagerData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
state.requests.push(Request::SetTilingState {
|
state.requests.push(Request::SetTilingState {
|
||||||
workspace: workspace_handle,
|
workspace: workspace_handle,
|
||||||
state: tiling_state,
|
state: tiling_state,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zcosmic_workspace_handle_v2::Request::Pin => {
|
zcosmic_workspace_handle_v2::Request::Pin => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||||
{
|
&& let Ok(manager) =
|
||||||
if let Ok(manager) =
|
|
||||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||||
{
|
{
|
||||||
let mut state = manager
|
let mut state = manager
|
||||||
.data::<WorkspaceManagerData>()
|
.data::<WorkspaceManagerData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
state.requests.push(Request::SetPin {
|
state.requests.push(Request::SetPin {
|
||||||
workspace: workspace_handle,
|
workspace: workspace_handle,
|
||||||
pinned: true,
|
pinned: true,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zcosmic_workspace_handle_v2::Request::Unpin => {
|
zcosmic_workspace_handle_v2::Request::Unpin => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||||
{
|
&& let Ok(manager) =
|
||||||
if let Ok(manager) =
|
|
||||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||||
{
|
{
|
||||||
let mut state = manager
|
let mut state = manager
|
||||||
.data::<WorkspaceManagerData>()
|
.data::<WorkspaceManagerData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
state.requests.push(Request::SetPin {
|
state.requests.push(Request::SetPin {
|
||||||
workspace: workspace_handle,
|
workspace: workspace_handle,
|
||||||
pinned: false,
|
pinned: false,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zcosmic_workspace_handle_v2::Request::MoveBefore {
|
zcosmic_workspace_handle_v2::Request::MoveBefore {
|
||||||
|
|
@ -209,26 +200,22 @@ where
|
||||||
} => {
|
} => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||||
{
|
&& let Some(other_workspace) = state
|
||||||
if let Some(other_workspace) = state
|
|
||||||
.workspace_state()
|
.workspace_state()
|
||||||
.get_ext_workspace_handle(&other_workspace)
|
.get_ext_workspace_handle(&other_workspace)
|
||||||
{
|
&& let Ok(manager) =
|
||||||
if let Ok(manager) =
|
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
{
|
||||||
{
|
let mut state = manager
|
||||||
let mut state = manager
|
.data::<WorkspaceManagerData>()
|
||||||
.data::<WorkspaceManagerData>()
|
.unwrap()
|
||||||
.unwrap()
|
.lock()
|
||||||
.lock()
|
.unwrap();
|
||||||
.unwrap();
|
state.requests.push(Request::MoveBefore {
|
||||||
state.requests.push(Request::MoveBefore {
|
workspace: workspace_handle,
|
||||||
workspace: workspace_handle,
|
other_workspace,
|
||||||
other_workspace,
|
axis,
|
||||||
axis,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zcosmic_workspace_handle_v2::Request::MoveAfter {
|
zcosmic_workspace_handle_v2::Request::MoveAfter {
|
||||||
|
|
@ -237,26 +224,22 @@ where
|
||||||
} => {
|
} => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||||
{
|
&& let Some(other_workspace) = state
|
||||||
if let Some(other_workspace) = state
|
|
||||||
.workspace_state()
|
.workspace_state()
|
||||||
.get_ext_workspace_handle(&other_workspace)
|
.get_ext_workspace_handle(&other_workspace)
|
||||||
{
|
&& let Ok(manager) =
|
||||||
if let Ok(manager) =
|
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
{
|
||||||
{
|
let mut state = manager
|
||||||
let mut state = manager
|
.data::<WorkspaceManagerData>()
|
||||||
.data::<WorkspaceManagerData>()
|
.unwrap()
|
||||||
.unwrap()
|
.lock()
|
||||||
.lock()
|
.unwrap();
|
||||||
.unwrap();
|
state.requests.push(Request::MoveAfter {
|
||||||
state.requests.push(Request::MoveAfter {
|
workspace: workspace_handle,
|
||||||
workspace: workspace_handle,
|
other_workspace,
|
||||||
other_workspace,
|
axis,
|
||||||
axis,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zcosmic_workspace_handle_v2::Request::Destroy => {}
|
zcosmic_workspace_handle_v2::Request::Destroy => {}
|
||||||
|
|
|
||||||
|
|
@ -152,18 +152,17 @@ where
|
||||||
.iter()
|
.iter()
|
||||||
.find(|g| g.ext_instances.contains(obj))
|
.find(|g| g.ext_instances.contains(obj))
|
||||||
.map(|g| g.id)
|
.map(|g| g.id)
|
||||||
|
&& let Ok(manager) = data.manager.upgrade()
|
||||||
{
|
{
|
||||||
if let Ok(manager) = data.manager.upgrade() {
|
let mut state = manager
|
||||||
let mut state = manager
|
.data::<WorkspaceManagerData>()
|
||||||
.data::<WorkspaceManagerData>()
|
.unwrap()
|
||||||
.unwrap()
|
.lock()
|
||||||
.lock()
|
.unwrap();
|
||||||
.unwrap();
|
state.requests.push(Request::Create {
|
||||||
state.requests.push(Request::Create {
|
in_group: WorkspaceGroupHandle { id },
|
||||||
in_group: WorkspaceGroupHandle { id },
|
name: workspace,
|
||||||
name: workspace,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ext_workspace_group_handle_v1::Request::Destroy => {
|
ext_workspace_group_handle_v1::Request::Destroy => {
|
||||||
|
|
@ -204,68 +203,62 @@ where
|
||||||
ext_workspace_handle_v1::Request::Activate => {
|
ext_workspace_handle_v1::Request::Activate => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(obj)
|
state.workspace_state().get_ext_workspace_handle(obj)
|
||||||
|
&& let Ok(manager) = data.manager.upgrade()
|
||||||
{
|
{
|
||||||
if let Ok(manager) = data.manager.upgrade() {
|
let mut state = manager
|
||||||
let mut state = manager
|
.data::<WorkspaceManagerData>()
|
||||||
.data::<WorkspaceManagerData>()
|
.unwrap()
|
||||||
.unwrap()
|
.lock()
|
||||||
.lock()
|
.unwrap();
|
||||||
.unwrap();
|
state.requests.push(Request::Activate(workspace_handle));
|
||||||
state.requests.push(Request::Activate(workspace_handle));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ext_workspace_handle_v1::Request::Deactivate => {
|
ext_workspace_handle_v1::Request::Deactivate => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(obj)
|
state.workspace_state().get_ext_workspace_handle(obj)
|
||||||
|
&& let Ok(manager) = data.manager.upgrade()
|
||||||
{
|
{
|
||||||
if let Ok(manager) = data.manager.upgrade() {
|
let mut state = manager
|
||||||
let mut state = manager
|
.data::<WorkspaceManagerData>()
|
||||||
.data::<WorkspaceManagerData>()
|
.unwrap()
|
||||||
.unwrap()
|
.lock()
|
||||||
.lock()
|
.unwrap();
|
||||||
.unwrap();
|
state.requests.push(Request::Deactivate(workspace_handle));
|
||||||
state.requests.push(Request::Deactivate(workspace_handle));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ext_workspace_handle_v1::Request::Remove => {
|
ext_workspace_handle_v1::Request::Remove => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(obj)
|
state.workspace_state().get_ext_workspace_handle(obj)
|
||||||
|
&& let Ok(manager) = data.manager.upgrade()
|
||||||
{
|
{
|
||||||
if let Ok(manager) = data.manager.upgrade() {
|
let mut state = manager
|
||||||
let mut state = manager
|
.data::<WorkspaceManagerData>()
|
||||||
.data::<WorkspaceManagerData>()
|
.unwrap()
|
||||||
.unwrap()
|
.lock()
|
||||||
.lock()
|
.unwrap();
|
||||||
.unwrap();
|
state.requests.push(Request::Remove(workspace_handle));
|
||||||
state.requests.push(Request::Remove(workspace_handle));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ext_workspace_handle_v1::Request::Assign { workspace_group } => {
|
ext_workspace_handle_v1::Request::Assign { workspace_group } => {
|
||||||
if let Some(workspace_handle) =
|
if let Some(workspace_handle) =
|
||||||
state.workspace_state().get_ext_workspace_handle(obj)
|
state.workspace_state().get_ext_workspace_handle(obj)
|
||||||
{
|
&& let Some(group_id) = state
|
||||||
if let Some(group_id) = state
|
|
||||||
.workspace_state()
|
.workspace_state()
|
||||||
.groups
|
.groups
|
||||||
.iter()
|
.iter()
|
||||||
.find(|g| g.ext_instances.contains(&workspace_group))
|
.find(|g| g.ext_instances.contains(&workspace_group))
|
||||||
.map(|g| g.id)
|
.map(|g| g.id)
|
||||||
{
|
&& let Ok(manager) = data.manager.upgrade()
|
||||||
if let Ok(manager) = data.manager.upgrade() {
|
{
|
||||||
let mut state = manager
|
let mut state = manager
|
||||||
.data::<WorkspaceManagerData>()
|
.data::<WorkspaceManagerData>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
state.requests.push(Request::Assign {
|
state.requests.push(Request::Assign {
|
||||||
workspace: workspace_handle,
|
workspace: workspace_handle,
|
||||||
group: WorkspaceGroupHandle { id: group_id },
|
group: WorkspaceGroupHandle { id: group_id },
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ext_workspace_handle_v1::Request::Destroy => {
|
ext_workspace_handle_v1::Request::Destroy => {
|
||||||
|
|
@ -491,10 +484,10 @@ where
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if handle_state.ext_id.is_none() {
|
if handle_state.ext_id.is_none()
|
||||||
if let Some(id) = workspace.ext_id.clone() {
|
&& let Some(id) = workspace.ext_id.clone()
|
||||||
instance.id(id);
|
{
|
||||||
}
|
instance.id(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(cosmic_v2_handle) = handle_state
|
if let Some(cosmic_v2_handle) = handle_state
|
||||||
|
|
|
||||||
101
src/xwayland.rs
101
src/xwayland.rs
|
|
@ -85,10 +85,10 @@ fn xrdb_thread(rx: Receiver<(String, u32)>, display: u32) {
|
||||||
"Xcursor.theme: {}\nXcursor.size: {}\n",
|
"Xcursor.theme: {}\nXcursor.size: {}\n",
|
||||||
cursor_theme, cursor_size,
|
cursor_theme, cursor_size,
|
||||||
);
|
);
|
||||||
if let Some(mut stdin) = child.stdin.take() {
|
if let Some(mut stdin) = child.stdin.take()
|
||||||
if let Err(err) = stdin.write_all(resources.as_bytes()) {
|
&& let Err(err) = stdin.write_all(resources.as_bytes())
|
||||||
warn!("Failed to update xresources: {}", err);
|
{
|
||||||
}
|
warn!("Failed to update xresources: {}", err);
|
||||||
}
|
}
|
||||||
match child.wait() {
|
match child.wait() {
|
||||||
Ok(code) if code.success() => {}
|
Ok(code) if code.success() => {}
|
||||||
|
|
@ -346,25 +346,23 @@ impl Common {
|
||||||
self.xwayland_reset_eavesdropping(serial);
|
self.xwayland_reset_eavesdropping(serial);
|
||||||
|
|
||||||
let xstate = self.xwayland_state.as_mut().unwrap();
|
let xstate = self.xwayland_state.as_mut().unwrap();
|
||||||
if let Some(mime_types) = xstate.clipboard_selection_dirty.take() {
|
if let Some(mime_types) = xstate.clipboard_selection_dirty.take()
|
||||||
if let Err(err) = xstate
|
&& let Err(err) = xstate
|
||||||
.xwm
|
.xwm
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.new_selection(SelectionTarget::Clipboard, Some(mime_types))
|
.new_selection(SelectionTarget::Clipboard, Some(mime_types))
|
||||||
{
|
{
|
||||||
warn!(?err, "Failed to set Xwayland clipboard selection.");
|
warn!(?err, "Failed to set Xwayland clipboard selection.");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if let Some(mime_types) = xstate.primary_selection_dirty.take() {
|
if let Some(mime_types) = xstate.primary_selection_dirty.take()
|
||||||
if let Err(err) = xstate
|
&& let Err(err) = xstate
|
||||||
.xwm
|
.xwm
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.new_selection(SelectionTarget::Primary, Some(mime_types))
|
.new_selection(SelectionTarget::Primary, Some(mime_types))
|
||||||
{
|
{
|
||||||
warn!(?err, "Failed to set Xwayland clipboard selection.");
|
warn!(?err, "Failed to set Xwayland clipboard selection.");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -650,16 +648,15 @@ impl Common {
|
||||||
}
|
}
|
||||||
XwaylandDescaling::Fractional => {
|
XwaylandDescaling::Fractional => {
|
||||||
let shell = self.shell.read();
|
let shell = self.shell.read();
|
||||||
let val =
|
|
||||||
if let Some(output) = shell.outputs().find(|o| o.config().xwayland_primary) {
|
if let Some(output) = shell.outputs().find(|o| o.config().xwayland_primary) {
|
||||||
output.current_scale().fractional_scale().max(1f64)
|
output.current_scale().fractional_scale().max(1f64)
|
||||||
} else {
|
} else {
|
||||||
shell
|
shell
|
||||||
.outputs()
|
.outputs()
|
||||||
.map(|o| o.current_scale().fractional_scale())
|
.map(|o| o.current_scale().fractional_scale())
|
||||||
.fold(1f64, |acc, val| acc.max(val))
|
.fold(1f64, |acc, val| acc.max(val))
|
||||||
};
|
}
|
||||||
val
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let (_, cursor_size) = load_cursor_env();
|
let (_, cursor_size) = load_cursor_env();
|
||||||
|
|
@ -710,10 +707,14 @@ impl Common {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(_) = xwayland.xrdb_thread.send((
|
if xwayland
|
||||||
cosmic::icon_theme::default(),
|
.xrdb_thread
|
||||||
(new_scale * cursor_size as f64).round() as u32,
|
.send((
|
||||||
)) {
|
cosmic::icon_theme::default(),
|
||||||
|
(new_scale * cursor_size as f64).round() as u32,
|
||||||
|
))
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
warn!("xrdb thread died");
|
warn!("xrdb thread died");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -756,14 +757,13 @@ impl Common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(xstate) = self.xwayland_state.as_mut() {
|
if let Some(xstate) = self.xwayland_state.as_mut()
|
||||||
if let Some(xwm) = xstate.xwm.as_mut() {
|
&& let Some(xwm) = xstate.xwm.as_mut()
|
||||||
if let Err(err) = xwm.set_randr_primary_output(xwayland_primary_output.as_ref()) {
|
&& let Err(err) = xwm.set_randr_primary_output(xwayland_primary_output.as_ref())
|
||||||
warn!("Failed to set xwayland primary output: {}", err);
|
{
|
||||||
return;
|
warn!("Failed to set xwayland primary output: {}", err);
|
||||||
};
|
return;
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
self.output_configuration_state.update();
|
self.output_configuration_state.update();
|
||||||
}
|
}
|
||||||
|
|
@ -808,12 +808,7 @@ impl XwmHandler for State {
|
||||||
*context,
|
*context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if shell
|
if !shell.pending_windows.iter().any(|w| w.surface == window) {
|
||||||
.pending_windows
|
|
||||||
.iter()
|
|
||||||
.find(|w| w.surface == window)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
let surface = CosmicSurface::from(window);
|
let surface = CosmicSurface::from(window);
|
||||||
shell.pending_windows.push(PendingWindow {
|
shell.pending_windows.push(PendingWindow {
|
||||||
surface,
|
surface,
|
||||||
|
|
@ -835,17 +830,14 @@ impl XwmHandler for State {
|
||||||
if let std::collections::hash_map::Entry::Vacant(e) = shell
|
if let std::collections::hash_map::Entry::Vacant(e) = shell
|
||||||
.pending_activations
|
.pending_activations
|
||||||
.entry(crate::shell::ActivationKey::X11(surface.window_id()))
|
.entry(crate::shell::ActivationKey::X11(surface.window_id()))
|
||||||
|
&& let Some(startup_id) = window.x11_surface().and_then(|x| x.startup_id())
|
||||||
|
&& let Some(context) = self
|
||||||
|
.common
|
||||||
|
.xdg_activation_state
|
||||||
|
.data_for_token(&XdgActivationToken::from(startup_id))
|
||||||
|
.and_then(|data| data.user_data.get::<ActivationContext>())
|
||||||
{
|
{
|
||||||
if let Some(startup_id) = window.x11_surface().and_then(|x| x.startup_id()) {
|
e.insert(*context);
|
||||||
if let Some(context) = self
|
|
||||||
.common
|
|
||||||
.xdg_activation_state
|
|
||||||
.data_for_token(&XdgActivationToken::from(startup_id))
|
|
||||||
.and_then(|data| data.user_data.get::<ActivationContext>())
|
|
||||||
{
|
|
||||||
e.insert(*context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let res = shell.map_window(
|
let res = shell.map_window(
|
||||||
&window,
|
&window,
|
||||||
|
|
@ -881,11 +873,10 @@ impl XwmHandler for State {
|
||||||
let seat = shell.seats.last_active().clone();
|
let seat = shell.seats.last_active().clone();
|
||||||
if let Some(pending) =
|
if let Some(pending) =
|
||||||
shell.unmap_surface(&window, &seat, &mut self.common.toplevel_info_state)
|
shell.unmap_surface(&window, &seat, &mut self.common.toplevel_info_state)
|
||||||
&& shell
|
&& !shell
|
||||||
.pending_windows
|
.pending_windows
|
||||||
.iter()
|
.iter()
|
||||||
.find(|w| &w.surface == &pending.surface)
|
.any(|w| w.surface == pending.surface)
|
||||||
.is_none()
|
|
||||||
{
|
{
|
||||||
shell.pending_windows.push(pending);
|
shell.pending_windows.push(pending);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue