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>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub enum DeviceState {
|
||||
#[default]
|
||||
Enabled,
|
||||
Disabled,
|
||||
DisabledOnExternalMouse,
|
||||
|
|
@ -63,12 +64,6 @@ pub enum TouchpadOverride {
|
|||
ForceDisable,
|
||||
}
|
||||
|
||||
impl Default for DeviceState {
|
||||
fn default() -> Self {
|
||||
Self::Enabled
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TapConfig {
|
||||
pub enabled: bool,
|
||||
|
|
|
|||
|
|
@ -204,8 +204,9 @@ impl State {
|
|||
}
|
||||
}
|
||||
}
|
||||
if let Some(blocklist) = dev_list_var("COSMIC_DRM_BLOCK_DEVICES") {
|
||||
if let Ok(node) = DrmNode::from_dev_id(dev) {
|
||||
if let Some(blocklist) = dev_list_var("COSMIC_DRM_BLOCK_DEVICES")
|
||||
&& let Ok(node) = DrmNode::from_dev_id(dev)
|
||||
{
|
||||
let node = node
|
||||
.node_with_type(NodeType::Render)
|
||||
.and_then(|res| res.ok())
|
||||
|
|
@ -220,7 +221,6 @@ impl State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let fd = DrmDeviceFd::new(DeviceFd::from(
|
||||
self.backend
|
||||
|
|
@ -271,12 +271,12 @@ impl State {
|
|||
notifier,
|
||||
move |event, metadata, state: &mut State| match event {
|
||||
DrmEvent::VBlank(crtc) => {
|
||||
if let Some(device) = state.backend.kms().drm_devices.get_mut(&drm_node) {
|
||||
if let Some(surface) = device.inner.surfaces.get_mut(&crtc) {
|
||||
if let Some(device) = state.backend.kms().drm_devices.get_mut(&drm_node)
|
||||
&& let Some(surface) = device.inner.surfaces.get_mut(&crtc)
|
||||
{
|
||||
surface.on_vblank(metadata.take());
|
||||
}
|
||||
}
|
||||
}
|
||||
DrmEvent::Error(err) => {
|
||||
warn!(?err, "Failed to read events of device {:?}.", dev);
|
||||
}
|
||||
|
|
@ -676,13 +676,13 @@ impl LockedDevice<'_> {
|
|||
|
||||
let mut compositor = compositor.lock().unwrap();
|
||||
compositor.render_frame(renderer, &elements, CLEAR_COLOR, FrameFlags::empty())?;
|
||||
if let Err(err) = compositor.commit_frame() {
|
||||
if !matches!(err, FrameError::EmptyFrame) {
|
||||
if let Err(err) = compositor.commit_frame()
|
||||
&& !matches!(err, FrameError::EmptyFrame)
|
||||
{
|
||||
return Err(err.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,9 @@ pub fn display_configuration(
|
|||
.iter()
|
||||
.flat_map(|conn| device.get_connector(*conn, true).ok())
|
||||
{
|
||||
if let Some(enc) = conn.current_encoder() {
|
||||
if let Some(crtc) = device.get_encoder(enc)?.crtc() {
|
||||
if let Some(enc) = conn.current_encoder()
|
||||
&& let Some(crtc) = device.get_encoder(enc)?.crtc()
|
||||
{
|
||||
// If is is connected we found a mapping
|
||||
if conn.state() == ConnectorState::Connected {
|
||||
map.insert(conn.handle(), Some(crtc));
|
||||
|
|
@ -45,7 +46,6 @@ pub fn display_configuration(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// But just in case we try to match all remaining connectors.
|
||||
for conn in connectors
|
||||
|
|
@ -81,13 +81,12 @@ pub fn display_configuration(
|
|||
.iter()
|
||||
.flat_map(|conn| device.get_connector(*conn, false).ok())
|
||||
.filter(|conn| {
|
||||
if let Some(enc) = conn.current_encoder() {
|
||||
if let Ok(enc) = device.get_encoder(enc) {
|
||||
if let Some(crtc) = enc.crtc() {
|
||||
if let Some(enc) = conn.current_encoder()
|
||||
&& let Ok(enc) = device.get_encoder(enc)
|
||||
&& let Some(crtc) = enc.crtc()
|
||||
{
|
||||
return cleanup.contains(&crtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
})
|
||||
.map(|info| info.handle())
|
||||
|
|
|
|||
|
|
@ -230,15 +230,15 @@ fn determine_primary_gpu(
|
|||
drm_devices: &IndexMap<DrmNode, Device>,
|
||||
seat: String,
|
||||
) -> Result<Option<DrmNode>> {
|
||||
if let Some(device) = dev_var("COSMIC_RENDER_DEVICE") {
|
||||
if let Some(node) = drm_devices.values().find_map(|dev| {
|
||||
if let Some(device) = dev_var("COSMIC_RENDER_DEVICE")
|
||||
&& let Some(node) = drm_devices.values().find_map(|dev| {
|
||||
device
|
||||
.matches(&dev.inner.render_node)
|
||||
.then_some(dev.inner.render_node)
|
||||
}) {
|
||||
})
|
||||
{
|
||||
return Ok(Some(node));
|
||||
}
|
||||
}
|
||||
|
||||
// try to find builtin display
|
||||
for dev in drm_devices.values() {
|
||||
|
|
@ -256,14 +256,13 @@ fn determine_primary_gpu(
|
|||
|
||||
// else try to find the boot gpu
|
||||
let boot = determine_boot_gpu(seat);
|
||||
if let Some(boot) = boot {
|
||||
if drm_devices
|
||||
if let Some(boot) = boot
|
||||
&& drm_devices
|
||||
.values()
|
||||
.any(|dev| dev.inner.render_node == boot)
|
||||
{
|
||||
return Ok(Some(boot));
|
||||
}
|
||||
}
|
||||
|
||||
// else just take the first
|
||||
Ok(drm_devices
|
||||
|
|
@ -319,12 +318,11 @@ fn init_udev(
|
|||
let backend = state.backend.kms();
|
||||
if matches!(event, UdevEvent::Added { .. } | UdevEvent::Removed { .. })
|
||||
&& 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(err) = state.refresh_output_config() {
|
||||
warn!("Unable to load output config: {}", err);
|
||||
|
|
@ -462,8 +460,8 @@ impl KmsState {
|
|||
if let Some(primary_node) = primary_node
|
||||
.as_ref()
|
||||
.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();
|
||||
if supports_syncobj_eventfd(&import_device) {
|
||||
if let Some(state) = self.syncobj_state.as_mut() {
|
||||
|
|
@ -475,7 +473,6 @@ impl KmsState {
|
|||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(old_state) = self.syncobj_state.take() {
|
||||
dh.remove_global::<State>(old_state.into_global());
|
||||
|
|
@ -939,8 +936,9 @@ impl KmsGuard<'_> {
|
|||
compositor
|
||||
};
|
||||
|
||||
if let Some(bpc) = output_config.0.max_bpc {
|
||||
if let Err(err) = drm_helpers::set_max_bpc(drm.device(), conn, bpc) {
|
||||
if let Some(bpc) = output_config.0.max_bpc
|
||||
&& let Err(err) = drm_helpers::set_max_bpc(drm.device(), conn, bpc)
|
||||
{
|
||||
warn!(
|
||||
?bpc,
|
||||
?err,
|
||||
|
|
@ -948,7 +946,6 @@ impl KmsGuard<'_> {
|
|||
surface.output.name()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let vrr = output_config.0.vrr;
|
||||
std::mem::drop(output_config);
|
||||
|
|
|
|||
|
|
@ -782,8 +782,8 @@ impl SurfaceThreadState {
|
|||
// mark last frame completed
|
||||
if let Ok(Some(Some((mut feedback, frames, estimated_presentation_time)))) =
|
||||
compositor.frame_submitted()
|
||||
&& self.mirroring.is_none()
|
||||
{
|
||||
if self.mirroring.is_none() {
|
||||
let name = self.output.name();
|
||||
let message = if let Some(presentation_time) = presentation_time {
|
||||
let misprediction_s =
|
||||
|
|
@ -868,7 +868,6 @@ impl SurfaceThreadState {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let redraw_needed = match mem::replace(&mut self.state, QueueState::Idle) {
|
||||
QueueState::Idle => unreachable!(),
|
||||
|
|
@ -1077,11 +1076,11 @@ impl SurfaceThreadState {
|
|||
// we can't use the elements after `compositor.render_frame`,
|
||||
// so let's collect everything we need for screencopy now
|
||||
let mut has_cursor_mode_none = false;
|
||||
let frames = self
|
||||
.mirroring
|
||||
.is_none()
|
||||
.then(|| take_screencopy_frames(&self.output, &elements, &mut has_cursor_mode_none))
|
||||
.unwrap_or_default();
|
||||
let frames = if self.mirroring.is_none() {
|
||||
take_screencopy_frames(&self.output, &elements, &mut has_cursor_mode_none)
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
|
||||
// actual rendering
|
||||
let source_output = self
|
||||
|
|
@ -1312,11 +1311,11 @@ impl SurfaceThreadState {
|
|||
None
|
||||
};
|
||||
|
||||
if frame_result.needs_sync() {
|
||||
if let PrimaryPlaneElement::Swapchain(elem) = &frame_result.primary_element {
|
||||
if frame_result.needs_sync()
|
||||
&& let PrimaryPlaneElement::Swapchain(elem) = &frame_result.primary_element
|
||||
{
|
||||
elem.sync.wait()?;
|
||||
}
|
||||
}
|
||||
|
||||
match compositor.queue_frame(feedback) {
|
||||
x @ Ok(()) | x @ Err(FrameError::EmptyFrame) => {
|
||||
|
|
|
|||
|
|
@ -103,11 +103,11 @@ pub fn init_backend_auto(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(inverted) = greeter_state.invert_colors {
|
||||
if inverted != state.a11y_state().screen_inverted() {
|
||||
if let Some(inverted) = greeter_state.invert_colors
|
||||
&& inverted != state.a11y_state().screen_inverted()
|
||||
{
|
||||
state.request_screen_invert(inverted);
|
||||
}
|
||||
}
|
||||
|
||||
if state
|
||||
.common
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ where
|
|||
};
|
||||
|
||||
let buf_translation = Matrix3::from_translation(Vector2::new(
|
||||
(view.src.loc.x as f64 / buf_size.w as f64) as f32,
|
||||
(view.src.loc.y as f64 / buf_size.h as f64) as f32,
|
||||
(view.src.loc.x / buf_size.w as f64) as f32,
|
||||
(view.src.loc.y / buf_size.h as f64) as f32,
|
||||
));
|
||||
|
||||
let input_to_geo =
|
||||
|
|
|
|||
|
|
@ -528,8 +528,7 @@ where
|
|||
);
|
||||
}
|
||||
|
||||
if !exclude_dnd_icon {
|
||||
if let Some(dnd_icon) = get_dnd_icon(seat) {
|
||||
if !exclude_dnd_icon && let Some(dnd_icon) = get_dnd_icon(seat) {
|
||||
elements.extend(
|
||||
cursor::draw_dnd_icon(
|
||||
renderer,
|
||||
|
|
@ -541,7 +540,6 @@ where
|
|||
.map(CosmicElement::Dnd),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let theme = theme.cosmic();
|
||||
if let Some(grab_elements) = seat
|
||||
|
|
@ -1102,8 +1100,7 @@ impl PostprocessState {
|
|||
if let (Some(tex), Some(tracker)) = (
|
||||
self.cursor_texture.as_ref(),
|
||||
self.cursor_damage_tracker.as_ref(),
|
||||
) {
|
||||
if tex.format().is_some_and(|f| f == format)
|
||||
) && tex.format().is_some_and(|f| f == format)
|
||||
&& tracker.mode()
|
||||
== &(OutputModeSource::Static {
|
||||
size,
|
||||
|
|
@ -1113,7 +1110,6 @@ impl PostprocessState {
|
|||
{
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
let texture = Offscreen::<GlesTexture>::create_buffer(renderer, format, buffer_size)?;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ impl ShadowShader {
|
|||
|
||||
let mut geo = geo.to_f64();
|
||||
let fractional_pixel = scale.ceil() / scale;
|
||||
geo.loc.x = geo.loc.x + fractional_pixel;
|
||||
geo.loc.y = geo.loc.y + fractional_pixel;
|
||||
geo.size.w = geo.size.w - fractional_pixel * 2.;
|
||||
geo.size.h = geo.size.h - fractional_pixel * 2.;
|
||||
geo.loc.x += fractional_pixel;
|
||||
geo.loc.y += fractional_pixel;
|
||||
geo.size.w -= fractional_pixel * 2.;
|
||||
geo.size.h -= fractional_pixel * 2.;
|
||||
|
||||
let user_data = Borrow::<GlesRenderer>::borrow(renderer.glow_renderer())
|
||||
.egl_context()
|
||||
|
|
@ -125,7 +125,7 @@ impl ShadowShader {
|
|||
.cast::<f32>()
|
||||
.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)
|
||||
* Matrix3::from_translation(Vector2::new(
|
||||
-window_geo_loc.x / area_size.x,
|
||||
|
|
|
|||
|
|
@ -517,8 +517,9 @@ where
|
|||
impl State {
|
||||
pub fn process_x11_event(&mut self, event: InputEvent<X11Input>) {
|
||||
// here we can handle special cases for x11 inputs, like mapping them to windows
|
||||
if let InputEvent::PointerMotionAbsolute { event } = &event {
|
||||
if let Some(window) = event.window() {
|
||||
if let InputEvent::PointerMotionAbsolute { event } = &event
|
||||
&& let Some(window) = event.window()
|
||||
{
|
||||
let output = self
|
||||
.backend
|
||||
.x11()
|
||||
|
|
@ -536,7 +537,6 @@ impl State {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.process_input_event(event);
|
||||
|
|
|
|||
|
|
@ -142,71 +142,71 @@ pub fn update_device(
|
|||
);
|
||||
}
|
||||
if let Some((accel, is_default)) = config!(|x| x.acceleration.as_ref()) {
|
||||
if let Some(profile) = accel.profile {
|
||||
if let Err(err) = device.config_accel_set_profile(profile) {
|
||||
if let Some(profile) = accel.profile
|
||||
&& let Err(err) = device.config_accel_set_profile(profile)
|
||||
{
|
||||
config_set_error(device, "acceleration profile", profile, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Err(err) = device.config_accel_set_speed(accel.speed) {
|
||||
config_set_error(device, "acceleration speed", accel.speed, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some((matrix, is_default)) = config!(|x| x.calibration) {
|
||||
if let Err(err) = device.config_calibration_set_matrix(matrix) {
|
||||
if let Some((matrix, is_default)) = config!(|x| x.calibration)
|
||||
&& let Err(err) = device.config_calibration_set_matrix(matrix)
|
||||
{
|
||||
config_set_error(device, "calibration matrix", matrix, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some((method, is_default)) = config!(|x| x.click_method) {
|
||||
if let Err(err) = device.config_click_set_method(method) {
|
||||
if let Some((method, is_default)) = config!(|x| x.click_method)
|
||||
&& let Err(err) = device.config_click_set_method(method)
|
||||
{
|
||||
config_set_error(device, "click method", method, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some((dwt, is_default)) = config!(|x| x.disable_while_typing) {
|
||||
if let Err(err) = device.config_dwt_set_enabled(dwt) {
|
||||
if let Some((dwt, is_default)) = config!(|x| x.disable_while_typing)
|
||||
&& let Err(err) = device.config_dwt_set_enabled(dwt)
|
||||
{
|
||||
config_set_error(device, "disable-while-typing", dwt, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some((left, is_default)) = config!(|x| x.left_handed) {
|
||||
if let Err(err) = device.config_left_handed_set(left) {
|
||||
if let Some((left, is_default)) = config!(|x| x.left_handed)
|
||||
&& let Err(err) = device.config_left_handed_set(left)
|
||||
{
|
||||
config_set_error(device, "left-handed", left, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some((middle, is_default)) = config!(|x| x.middle_button_emulation) {
|
||||
if let Err(err) = device.config_middle_emulation_set_enabled(middle) {
|
||||
if let Some((middle, is_default)) = config!(|x| x.middle_button_emulation)
|
||||
&& let Err(err) = device.config_middle_emulation_set_enabled(middle)
|
||||
{
|
||||
config_set_error(device, "middle-button-emulation", middle, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some((angle, is_default)) = config!(|x| x.rotation_angle) {
|
||||
if let Err(err) = device.config_rotation_set_angle(angle) {
|
||||
if let Some((angle, is_default)) = config!(|x| x.rotation_angle)
|
||||
&& let Err(err) = device.config_rotation_set_angle(angle)
|
||||
{
|
||||
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(method) = scroll.method {
|
||||
if let Err(err) = device.config_scroll_set_method(method) {
|
||||
if let Some(method) = scroll.method
|
||||
&& let Err(err) = device.config_scroll_set_method(method)
|
||||
{
|
||||
config_set_error(device, "scroll method", scroll, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some(natural) = scroll.natural_scroll {
|
||||
if let Err(err) = device.config_scroll_set_natural_scroll_enabled(natural) {
|
||||
if let Some(natural) = scroll.natural_scroll
|
||||
&& let Err(err) = device.config_scroll_set_natural_scroll_enabled(natural)
|
||||
{
|
||||
config_set_error(device, "natural scrolling", natural, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Some(button) = scroll.scroll_button {
|
||||
if let Err(err) = device.config_scroll_set_button(button) {
|
||||
if let Some(button) = scroll.scroll_button
|
||||
&& let Err(err) = device.config_scroll_set_button(button)
|
||||
{
|
||||
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 Err(err) = device.config_tap_set_enabled(tap.enabled) {
|
||||
config_set_error(device, "tap-to-click", tap.enabled, err, is_default);
|
||||
}
|
||||
if let Some(button_map) = tap.button_map {
|
||||
if let Err(err) = device.config_tap_set_button_map(button_map) {
|
||||
if let Some(button_map) = tap.button_map
|
||||
&& let Err(err) = device.config_tap_set_button_map(button_map)
|
||||
{
|
||||
config_set_error(device, "button map", button_map, err, is_default);
|
||||
}
|
||||
}
|
||||
if let Err(err) = device.config_tap_set_drag_enabled(tap.drag) {
|
||||
config_set_error(device, "tap-drag", tap.drag, err, is_default);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,8 +371,9 @@ impl Config {
|
|||
}
|
||||
|
||||
fn load_filter_state(path: &Option<PathBuf>) -> ScreenFilter {
|
||||
if let Some(path) = path.as_ref() {
|
||||
if path.exists() {
|
||||
if let Some(path) = path.as_ref()
|
||||
&& path.exists()
|
||||
{
|
||||
match ron::de::from_reader::<_, ScreenFilter>(
|
||||
OpenOptions::new().read(true).open(path).unwrap(),
|
||||
) {
|
||||
|
|
@ -385,7 +386,6 @@ impl Config {
|
|||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
ScreenFilter {
|
||||
inverted: false,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use zbus::{
|
|||
|
||||
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",
|
||||
)];
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ impl NameOwners {
|
|||
} else {
|
||||
allowed_names
|
||||
.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,17 +188,16 @@ impl State {
|
|||
}
|
||||
|
||||
Action::NextWorkspace => {
|
||||
if let Some(direction) = pattern.inferred_direction() {
|
||||
if ((direction == Direction::Left || direction == Direction::Right)
|
||||
if let Some(direction) = pattern.inferred_direction()
|
||||
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Vertical)
|
||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Horizontal)
|
||||
== WorkspaceLayout::Horizontal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let next = to_next_workspace(
|
||||
&mut self.common.shell.write(),
|
||||
|
|
@ -234,17 +233,16 @@ impl State {
|
|||
}
|
||||
|
||||
Action::PreviousWorkspace => {
|
||||
if let Some(direction) = pattern.inferred_direction() {
|
||||
if ((direction == Direction::Left || direction == Direction::Right)
|
||||
if let Some(direction) = pattern.inferred_direction()
|
||||
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Vertical)
|
||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Horizontal)
|
||||
== WorkspaceLayout::Horizontal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let previous = to_previous_workspace(
|
||||
&mut self.common.shell.write(),
|
||||
|
|
@ -336,17 +334,16 @@ impl State {
|
|||
}
|
||||
|
||||
x @ Action::MoveToNextWorkspace | x @ Action::SendToNextWorkspace => {
|
||||
if let Some(direction) = pattern.inferred_direction() {
|
||||
if ((direction == Direction::Left || direction == Direction::Right)
|
||||
if let Some(direction) = pattern.inferred_direction()
|
||||
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Vertical)
|
||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Horizontal)
|
||||
== WorkspaceLayout::Horizontal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
let Some(focused_output) = seat.focused_output() else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -420,17 +417,16 @@ impl State {
|
|||
}
|
||||
|
||||
x @ Action::MoveToPreviousWorkspace | x @ Action::SendToPreviousWorkspace => {
|
||||
if let Some(direction) = pattern.inferred_direction() {
|
||||
if ((direction == Direction::Left || direction == Direction::Right)
|
||||
if let Some(direction) = pattern.inferred_direction()
|
||||
&& (((direction == Direction::Left || direction == Direction::Right)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Vertical)
|
||||
|| ((direction == Direction::Up || direction == Direction::Down)
|
||||
&& self.common.config.cosmic_conf.workspaces.workspace_layout
|
||||
== WorkspaceLayout::Horizontal)
|
||||
== WorkspaceLayout::Horizontal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
let Some(focused_output) = seat.focused_output() else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -511,11 +507,10 @@ impl State {
|
|||
if let Some(next_output) = next_output {
|
||||
let res = {
|
||||
let mut workspace_guard = self.common.workspace_state.update();
|
||||
if propagate {
|
||||
if let Some((serial, prev_output, prev_idx)) =
|
||||
if propagate
|
||||
&& let Some((serial, prev_output, prev_idx)) =
|
||||
shell.previous_workspace_idx.take()
|
||||
{
|
||||
if seat.last_modifier_change().is_some_and(|s| s == serial)
|
||||
&& seat.last_modifier_change().is_some_and(|s| s == serial)
|
||||
&& prev_output == current_output
|
||||
{
|
||||
let _ = shell.activate(
|
||||
|
|
@ -525,8 +520,6 @@ impl State {
|
|||
&mut workspace_guard,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let idx = shell.workspaces.active_num(&next_output).1;
|
||||
let res = shell.activate(
|
||||
|
|
@ -607,11 +600,12 @@ impl State {
|
|||
&self.common.event_loop_handle,
|
||||
);
|
||||
|
||||
if is_move_action && propagate {
|
||||
if let Some((_, prev_output, prev_idx)) =
|
||||
if is_move_action
|
||||
&& propagate
|
||||
&& let Some((_, prev_output, prev_idx)) =
|
||||
shell.previous_workspace_idx.take()
|
||||
&& prev_output == focused_output
|
||||
{
|
||||
if prev_output == focused_output {
|
||||
let _ = shell.activate(
|
||||
&focused_output,
|
||||
prev_idx,
|
||||
|
|
@ -619,8 +613,6 @@ impl State {
|
|||
&mut workspace_guard,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
res
|
||||
};
|
||||
|
||||
|
|
@ -837,8 +829,8 @@ impl State {
|
|||
let workspace = shell.active_space(¤t_output).unwrap();
|
||||
if let Some(FocusTarget::Window(focused_window)) =
|
||||
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(
|
||||
Some(Trigger::KeyboardMove(pattern.modifiers)),
|
||||
self.common.event_loop_handle.clone(),
|
||||
|
|
@ -847,7 +839,6 @@ impl State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Action::SwapWindow => {
|
||||
let Some(focused_output) = seat.focused_output() else {
|
||||
|
|
@ -858,8 +849,9 @@ impl State {
|
|||
let workspace = shell.active_space_mut(&focused_output).unwrap();
|
||||
let keyboard_handle = seat.get_keyboard().unwrap();
|
||||
|
||||
if let Some(focus) = keyboard_handle.current_focus() {
|
||||
if let Some(descriptor) = workspace.node_desc(focus) {
|
||||
if let Some(focus) = keyboard_handle.current_focus()
|
||||
&& let Some(descriptor) = workspace.node_desc(focus)
|
||||
{
|
||||
let grab = SwapWindowGrab::new(seat.clone(), descriptor.clone());
|
||||
drop(shell);
|
||||
keyboard_handle.set_grab(self, grab, serial);
|
||||
|
|
@ -870,7 +862,6 @@ impl State {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Action::Minimize => {
|
||||
let mut shell = self.common.shell.write();
|
||||
|
|
|
|||
|
|
@ -73,15 +73,15 @@ impl GestureState {
|
|||
fn push(&mut self, delta: f64, timestamp: Duration) {
|
||||
// For the events that we care about, timestamps should always increase
|
||||
// monotonically.
|
||||
if let Some(last) = self.history.back() {
|
||||
if timestamp < last.timestamp {
|
||||
if let Some(last) = self.history.back()
|
||||
&& timestamp < last.timestamp
|
||||
{
|
||||
trace!(
|
||||
"ignoring event with timestamp {timestamp:?} earlier than last {:?}",
|
||||
last.timestamp
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
self.history.push_back(SwipeEvent { delta, timestamp });
|
||||
self.delta += delta;
|
||||
|
|
|
|||
|
|
@ -493,8 +493,7 @@ impl State {
|
|||
}
|
||||
|
||||
// If confined, don't move pointer if it would go outside surface or region
|
||||
if pointer_confined {
|
||||
if let Some((surface, surface_loc)) = &under {
|
||||
if pointer_confined && let Some((surface, surface_loc)) = &under {
|
||||
if new_under.as_ref().and_then(|(under, _)| under.wl_surface())
|
||||
!= surface.wl_surface()
|
||||
{
|
||||
|
|
@ -530,16 +529,14 @@ impl State {
|
|||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(region) = confine_region {
|
||||
if !region
|
||||
if let Some(region) = confine_region
|
||||
&& !region
|
||||
.contains((position.as_logical() - *surface_loc).to_i32_round())
|
||||
{
|
||||
ptr.frame(self);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
ptr.motion(
|
||||
|
|
@ -722,8 +719,8 @@ impl State {
|
|||
State::element_under(global_position, &output, &shell, &seat)
|
||||
};
|
||||
if let Some(target) = under {
|
||||
if let Some(surface) = target.toplevel().map(Cow::into_owned) {
|
||||
if seat.get_keyboard().unwrap().modifier_state().logo
|
||||
if let Some(surface) = target.toplevel().map(Cow::into_owned)
|
||||
&& seat.get_keyboard().unwrap().modifier_state().logo
|
||||
&& !shortcuts_inhibited
|
||||
{
|
||||
let seat_clone = seat.clone();
|
||||
|
|
@ -770,9 +767,7 @@ impl State {
|
|||
false,
|
||||
);
|
||||
drop(shell);
|
||||
dispatch_grab(
|
||||
res, seat_clone, serial, state,
|
||||
);
|
||||
dispatch_grab(res, seat_clone, serial, state);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -809,12 +804,10 @@ impl State {
|
|||
let geom = geom.to_f64();
|
||||
let center =
|
||||
geom.loc + geom.size.downscale(2.0);
|
||||
let offset = center.to_global(&output)
|
||||
- global_position;
|
||||
let edge = match (
|
||||
offset.x > 0.0,
|
||||
offset.y > 0.0,
|
||||
) {
|
||||
let offset =
|
||||
center.to_global(&output) - global_position;
|
||||
let edge =
|
||||
match (offset.x > 0.0, offset.y > 0.0) {
|
||||
(true, true) => ResizeEdge::TOP_LEFT,
|
||||
(false, true) => ResizeEdge::TOP_RIGHT,
|
||||
(true, false) => {
|
||||
|
|
@ -837,9 +830,7 @@ impl State {
|
|||
false,
|
||||
);
|
||||
drop(shell);
|
||||
dispatch_grab(
|
||||
res, seat_clone, serial, state,
|
||||
);
|
||||
dispatch_grab(res, seat_clone, serial, state);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -847,7 +838,6 @@ impl State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Shell::set_focus(self, Some(&target), &seat, Some(serial), false);
|
||||
}
|
||||
|
|
@ -856,11 +846,10 @@ impl State {
|
|||
let mut shell = self.common.shell.write();
|
||||
if let Some(Trigger::Pointer(action_button)) =
|
||||
shell.overview_mode().0.active_trigger()
|
||||
&& *action_button == button
|
||||
{
|
||||
if *action_button == button {
|
||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||
}
|
||||
}
|
||||
std::mem::drop(shell);
|
||||
};
|
||||
|
||||
|
|
@ -1016,11 +1005,10 @@ impl State {
|
|||
let mut natural_scroll = false;
|
||||
if let Some(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;
|
||||
}
|
||||
}
|
||||
activate_action = match gesture_state.fingers {
|
||||
3 => None, // TODO: 3 finger gestures
|
||||
4 => {
|
||||
|
|
@ -1317,11 +1305,11 @@ impl State {
|
|||
}
|
||||
InputEvent::TouchUp { event, .. } => {
|
||||
let mut shell = self.common.shell.write();
|
||||
if let Some(Trigger::Touch(slot)) = shell.overview_mode().0.active_trigger() {
|
||||
if *slot == event.slot() {
|
||||
if let Some(Trigger::Touch(slot)) = shell.overview_mode().0.active_trigger()
|
||||
&& *slot == event.slot()
|
||||
{
|
||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||
}
|
||||
}
|
||||
|
||||
let maybe_seat = shell.seats.for_device(&event.device()).cloned();
|
||||
if let Some(seat) = maybe_seat {
|
||||
|
|
@ -1621,26 +1609,23 @@ impl State {
|
|||
// Leave move overview mode, if any modifier was released
|
||||
if let Some(Trigger::KeyboardMove(action_modifiers)) =
|
||||
shell.overview_mode().0.active_trigger()
|
||||
{
|
||||
if (action_modifiers.ctrl && !modifiers.ctrl)
|
||||
&& ((action_modifiers.ctrl && !modifiers.ctrl)
|
||||
|| (action_modifiers.alt && !modifiers.alt)
|
||||
|| (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());
|
||||
}
|
||||
}
|
||||
// Leave swap overview mode, if any key was released
|
||||
if let Some(Trigger::KeyboardSwap(action_pattern, old_descriptor)) =
|
||||
shell.overview_mode().0.active_trigger()
|
||||
{
|
||||
if (action_pattern.modifiers.ctrl && !modifiers.ctrl)
|
||||
&& ((action_pattern.modifiers.ctrl && !modifiers.ctrl)
|
||||
|| (action_pattern.modifiers.alt && !modifiers.alt)
|
||||
|| (action_pattern.modifiers.logo && !modifiers.logo)
|
||||
|| (action_pattern.modifiers.shift && !modifiers.shift)
|
||||
|| (action_pattern.key.is_some()
|
||||
&& 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());
|
||||
|
||||
|
|
@ -1652,7 +1637,6 @@ impl State {
|
|||
&focused_output,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Leave or update resize mode, if modifiers changed or initial key was released
|
||||
if let Some(action_pattern) = shell.resize_mode().0.active_binding() {
|
||||
|
|
@ -1832,14 +1816,14 @@ impl State {
|
|||
}
|
||||
|
||||
// Skip released events for initially surpressed keys
|
||||
if event.state() == KeyState::Released {
|
||||
if let Some(tokens) = seat.supressed_keys().filter(&handle) {
|
||||
if event.state() == KeyState::Released
|
||||
&& let Some(tokens) = seat.supressed_keys().filter(&handle)
|
||||
{
|
||||
for token in tokens {
|
||||
self.common.event_loop_handle.remove(token);
|
||||
}
|
||||
return FilterResult::Intercept(None);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle VT switches
|
||||
if event.state() == KeyState::Pressed
|
||||
|
|
@ -1944,8 +1928,8 @@ impl State {
|
|||
if old_descriptor.handle != new_descriptor.handle {
|
||||
let (mut old_w, mut other_w) =
|
||||
spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
||||
if let Some(old_workspace) = old_w.get_mut(0) {
|
||||
if let Some(new_workspace) = other_w
|
||||
if let Some(old_workspace) = old_w.get_mut(0)
|
||||
&& let Some(new_workspace) = other_w
|
||||
.iter_mut()
|
||||
.find(|w| w.handle == new_descriptor.handle)
|
||||
{
|
||||
|
|
@ -1979,7 +1963,6 @@ impl State {
|
|||
old_workspace.refresh_focus_stack();
|
||||
new_workspace.refresh_focus_stack();
|
||||
}
|
||||
}
|
||||
} else if let Some(workspace) = spaces.find(|w| w.handle == new_descriptor.handle) {
|
||||
if let Some(focus) = TilingLayout::swap_trees(
|
||||
&mut workspace.tiling_layer,
|
||||
|
|
@ -2002,11 +1985,11 @@ impl State {
|
|||
let spaces = shell.workspaces.spaces_mut();
|
||||
let (mut old_w, mut other_w) =
|
||||
spaces.partition::<Vec<_>, _>(|w| w.handle == old_descriptor.handle);
|
||||
if let Some(old_workspace) = old_w.get_mut(0) {
|
||||
if let Some(new_workspace) =
|
||||
if let Some(old_workspace) = old_w.get_mut(0)
|
||||
&& let Some(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| {
|
||||
|
|
@ -2034,8 +2017,6 @@ impl State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[profiling::function]
|
||||
pub fn element_under(
|
||||
|
|
@ -2136,12 +2117,11 @@ impl State {
|
|||
.is_some_and(|geometry| {
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Stage::Workspace { workspace, offset } => {
|
||||
let location = global_pos + offset.as_global().to_f64();
|
||||
let output = workspace.output();
|
||||
|
|
@ -2151,14 +2131,12 @@ impl State {
|
|||
.is_some_and(|geometry| {
|
||||
geometry.contains(global_pos.to_local(output).to_i32_round())
|
||||
})
|
||||
{
|
||||
if let Some(element) = workspace.toplevel_element_under(location, seat)
|
||||
&& let Some(element) = workspace.toplevel_element_under(location, seat)
|
||||
{
|
||||
return ControlFlow::Break(Ok(Some(element)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ControlFlow::Continue(())
|
||||
},
|
||||
)
|
||||
|
|
@ -2199,14 +2177,13 @@ impl State {
|
|||
|stage| {
|
||||
match stage {
|
||||
Stage::ZoomUI => {
|
||||
if let Some(zoom_state) = shell.zoom_state() {
|
||||
if let Some((target, loc)) =
|
||||
if let Some(zoom_state) = shell.zoom_state()
|
||||
&& let Some((target, loc)) =
|
||||
zoom_state.surface_under(output, global_pos)
|
||||
{
|
||||
return ControlFlow::Break(Ok(Some((target, loc))));
|
||||
}
|
||||
}
|
||||
}
|
||||
Stage::SessionLock(lock_surface) => {
|
||||
return ControlFlow::Break(Ok(lock_surface.and_then(|surface| {
|
||||
let location = output_geo.loc;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ pub fn setup_socket(handle: LoopHandle<State>, common: &Common) -> Result<()> {
|
|||
stream.read_bytes = 0;
|
||||
match std::str::from_utf8(&stream.buffer) {
|
||||
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?"),
|
||||
_ => warn!("Unknown session socket message, are you using incompatible cosmic-session and cosmic-comp versions?"),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -602,11 +602,11 @@ impl CosmicStack {
|
|||
let previous = p.previous_keyboard.swap(active, Ordering::SeqCst);
|
||||
if previous != active || p.reenter.swap(false, Ordering::SeqCst) {
|
||||
let windows = p.windows.lock().unwrap();
|
||||
if let Some(previous_surface) = windows.get(previous) {
|
||||
if previous != active {
|
||||
if let Some(previous_surface) = windows.get(previous)
|
||||
&& previous != active
|
||||
{
|
||||
KeyboardTarget::leave(previous_surface, seat, data, serial);
|
||||
}
|
||||
}
|
||||
KeyboardTarget::enter(
|
||||
&windows[active],
|
||||
seat,
|
||||
|
|
@ -685,15 +685,15 @@ impl CosmicStack {
|
|||
if tiled && !appearance.shadow_tiled_windows {
|
||||
return None;
|
||||
}
|
||||
let radii = round
|
||||
.then(|| {
|
||||
let radii = if round {
|
||||
theme
|
||||
.cosmic()
|
||||
.radius_s()
|
||||
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
||||
.map(|x| (x * scale as f32).round() as u8)
|
||||
})
|
||||
.unwrap_or([0, 0, 0, 0]);
|
||||
} else {
|
||||
[0, 0, 0, 0]
|
||||
};
|
||||
|
||||
let mut geo = SpaceElement::geometry(&windows[active]).to_f64();
|
||||
geo.size.h += TAB_HEIGHT as f64;
|
||||
|
|
@ -857,8 +857,7 @@ impl CosmicStack {
|
|||
if let Some(dragged_out) = self
|
||||
.0
|
||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||
{
|
||||
if let Some(surface) = self
|
||||
&& let Some(surface) = self
|
||||
.0
|
||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||
{
|
||||
|
|
@ -890,7 +889,6 @@ impl CosmicStack {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn min_size(&self) -> Option<Size<i32, Logical>> {
|
||||
self.surfaces()
|
||||
|
|
@ -1152,15 +1150,16 @@ impl Program for CosmicStackInternal {
|
|||
}
|
||||
}
|
||||
Message::TabMenu(idx) => {
|
||||
if let Some((seat, serial)) = last_seat.cloned() {
|
||||
if let Some(surface) = self.windows.lock().unwrap()[idx]
|
||||
if let Some((seat, serial)) = last_seat.cloned()
|
||||
&& let Some(surface) = self.windows.lock().unwrap()[idx]
|
||||
.wl_surface()
|
||||
.map(Cow::into_owned)
|
||||
{
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let shell = state.common.shell.read();
|
||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
||||
if let Some(workspace) = shell.space_for(&mapped) {
|
||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned()
|
||||
&& let Some(workspace) = shell.space_for(&mapped)
|
||||
{
|
||||
let Some(elem_geo) = workspace.element_geometry(&mapped) else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -1190,11 +1189,9 @@ impl Program for CosmicStackInternal {
|
|||
.set_grab(state, grab, serial, focus);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
Task::none()
|
||||
|
|
@ -1701,8 +1698,7 @@ impl PointerTarget<State> for CosmicStack {
|
|||
if let Some(dragged_out) = self
|
||||
.0
|
||||
.with_program(|p| p.potential_drag.lock().unwrap().take())
|
||||
{
|
||||
if let Some(surface) = self
|
||||
&& let Some(surface) = self
|
||||
.0
|
||||
.with_program(|p| p.windows.lock().unwrap().get(dragged_out).cloned())
|
||||
{
|
||||
|
|
@ -1734,7 +1730,6 @@ impl PointerTarget<State> for CosmicStack {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn gesture_swipe_begin(
|
||||
&self,
|
||||
|
|
|
|||
|
|
@ -356,30 +356,27 @@ where
|
|||
if matches!(
|
||||
event,
|
||||
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
|
||||
) {
|
||||
if let Some(message) = self.press_message.clone() {
|
||||
) && let Some(message) = self.press_message.clone()
|
||||
{
|
||||
shell.publish(message);
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if matches!(
|
||||
event,
|
||||
event::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Right))
|
||||
) {
|
||||
if let Some(message) = self.right_click_message.clone() {
|
||||
) && let Some(message) = self.right_click_message.clone()
|
||||
{
|
||||
shell.publish(message);
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if matches!(
|
||||
event,
|
||||
event::Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
||||
) {
|
||||
shell.publish(Message::activate(self.idx));
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,11 +270,11 @@ impl State {
|
|||
pub fn cleanup_old_animations(&mut self) {
|
||||
let start_time = Instant::now();
|
||||
|
||||
if let Some(animation) = self.scroll_animation.as_ref() {
|
||||
if start_time.duration_since(animation.start_time) > SCROLL_ANIMATION_DURATION {
|
||||
if let Some(animation) = self.scroll_animation.as_ref()
|
||||
&& start_time.duration_since(animation.start_time) > SCROLL_ANIMATION_DURATION
|
||||
{
|
||||
self.scroll_animation.take();
|
||||
}
|
||||
}
|
||||
|
||||
Self::discard_expired_tab_animations(&mut self.tab_animations, start_time);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -693,8 +693,7 @@ impl CosmicSurface {
|
|||
.primary_scanout_feedback
|
||||
.as_ref()
|
||||
.unwrap_or(&feedback.render_feedback)
|
||||
} else {
|
||||
if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||
} else if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||
feedback
|
||||
.overlay_scanout_feedback
|
||||
.as_ref()
|
||||
|
|
@ -702,7 +701,6 @@ impl CosmicSurface {
|
|||
} else {
|
||||
&feedback.render_feedback
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -983,6 +981,6 @@ fn with_toplevel_state<T, F: FnOnce(Option<&smithay::wayland::shell::xdg::Toplev
|
|||
if pending {
|
||||
toplevel.with_pending_state(|pending| cb(Some(pending)))
|
||||
} else {
|
||||
toplevel.with_committed_state(|committed| cb(committed))
|
||||
toplevel.with_committed_state(cb)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -576,11 +576,9 @@ impl CosmicWindow {
|
|||
*conf = *appearance;
|
||||
if appearance.clip_floating_windows {
|
||||
p.window.set_tiled(true);
|
||||
} else {
|
||||
if !p.tiled.load(Ordering::Acquire) {
|
||||
} else if !p.tiled.load(Ordering::Acquire) {
|
||||
p.window.set_tiled(false);
|
||||
}
|
||||
}
|
||||
p.window.send_configure();
|
||||
}
|
||||
})
|
||||
|
|
@ -633,8 +631,8 @@ impl CosmicWindow {
|
|||
&& !p.window.is_maximized(false);
|
||||
let round =
|
||||
(!is_tiled || appearance.clip_tiled_windows) && !p.window.is_maximized(false);
|
||||
let radii = round
|
||||
.then(|| {
|
||||
let radii = if round {
|
||||
{
|
||||
p.theme
|
||||
.lock()
|
||||
.unwrap()
|
||||
|
|
@ -642,8 +640,10 @@ impl CosmicWindow {
|
|||
.radius_s()
|
||||
.map(|x| if x < 4.0 { x } else { x + 4.0 })
|
||||
.map(|x| x.round() as u8)
|
||||
})
|
||||
.unwrap_or([0; 4]);
|
||||
}
|
||||
} else {
|
||||
[0; 4]
|
||||
};
|
||||
|
||||
match (has_ssd, clip) {
|
||||
(has_ssd, true) => {
|
||||
|
|
@ -698,8 +698,9 @@ impl Program for CosmicWindowInternal {
|
|||
) -> Task<Self::Message> {
|
||||
match message {
|
||||
Message::DragStart => {
|
||||
if let Some((seat, serial)) = last_seat.cloned() {
|
||||
if let Some(surface) = self.window.wl_surface().map(Cow::into_owned) {
|
||||
if let Some((seat, serial)) = last_seat.cloned()
|
||||
&& 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(
|
||||
&surface,
|
||||
|
|
@ -723,7 +724,6 @@ impl Program for CosmicWindowInternal {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::Minimize => {
|
||||
if let Some(surface) = self.window.wl_surface().map(Cow::into_owned) {
|
||||
loop_handle.insert_idle(move |state| {
|
||||
|
|
@ -745,8 +745,9 @@ impl Program for CosmicWindowInternal {
|
|||
}
|
||||
Message::Close => self.window.close(),
|
||||
Message::Menu => {
|
||||
if let Some((seat, serial)) = last_seat.cloned() {
|
||||
if let Some(surface) = self.window.wl_surface().map(Cow::into_owned) {
|
||||
if let Some((seat, serial)) = last_seat.cloned()
|
||||
&& let Some(surface) = self.window.wl_surface().map(Cow::into_owned)
|
||||
{
|
||||
loop_handle.insert_idle(move |state| {
|
||||
let shell = state.common.shell.read();
|
||||
if let Some(mapped) = shell.element_for_surface(&surface).cloned() {
|
||||
|
|
@ -792,7 +793,6 @@ impl Program for CosmicWindowInternal {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,13 +238,12 @@ impl Shell {
|
|||
.user_data()
|
||||
.get::<PopupGrabData>()
|
||||
.and_then(|x| x.take())
|
||||
&& !popup_grab.has_ended()
|
||||
{
|
||||
if !popup_grab.has_ended() {
|
||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn update_active(&mut self) {
|
||||
// update activate status
|
||||
|
|
@ -501,14 +500,14 @@ impl Common {
|
|||
trace!("Wrong Window, focus fixup");
|
||||
}
|
||||
} else {
|
||||
if let KeyboardFocusTarget::Popup(_) = target {
|
||||
if let Some(popup_grab) = seat
|
||||
if let KeyboardFocusTarget::Popup(_) = target
|
||||
&& let Some(popup_grab) = seat
|
||||
.user_data()
|
||||
.get::<PopupGrabData>()
|
||||
.and_then(|x| x.take())
|
||||
&& !popup_grab.has_ended()
|
||||
&& let Some(new) = popup_grab.current_grab()
|
||||
{
|
||||
if !popup_grab.has_ended() {
|
||||
if let Some(new) = popup_grab.current_grab() {
|
||||
trace!("restore focus to previous popup grab");
|
||||
std::mem::drop(shell);
|
||||
// TODO: verify whether cursor should be updated at end of popup grab
|
||||
|
|
@ -524,9 +523,6 @@ impl Common {
|
|||
.set(Some(popup_grab));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
trace!("Surface dead, focus fixup");
|
||||
}
|
||||
} else {
|
||||
|
|
@ -547,11 +543,10 @@ impl Common {
|
|||
.user_data()
|
||||
.get::<PopupGrabData>()
|
||||
.and_then(|x| x.take())
|
||||
&& !popup_grab.has_ended()
|
||||
{
|
||||
if !popup_grab.has_ended() {
|
||||
popup_grab.ungrab(PopupUngrabStrategy::All);
|
||||
}
|
||||
}
|
||||
|
||||
// update keyboard focus
|
||||
let target = update_focus_target(&shell, seat, &output);
|
||||
|
|
@ -682,13 +677,13 @@ fn update_focus_target(
|
|||
} else {
|
||||
let workspace = shell.active_space(output).unwrap();
|
||||
|
||||
if let Some(Trigger::KeyboardSwap(_, desc)) = shell.overview_mode().0.active_trigger() {
|
||||
if workspace.handle == desc.handle && workspace.tiling_layer.has_node(&desc.node) {
|
||||
if let Some(focus) = workspace.tiling_layer.node_desc_to_focus(desc) {
|
||||
if let Some(Trigger::KeyboardSwap(_, desc)) = shell.overview_mode().0.active_trigger()
|
||||
&& workspace.handle == desc.handle
|
||||
&& workspace.tiling_layer.has_node(&desc.node)
|
||||
&& let Some(focus) = workspace.tiling_layer.node_desc_to_focus(desc)
|
||||
{
|
||||
return Some(focus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workspace
|
||||
.focus_stack
|
||||
|
|
|
|||
|
|
@ -271,8 +271,9 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous bottom layer popups
|
||||
for (layer, popup, location) in layer_popups(output, Layer::Bottom, element_filter) {
|
||||
callback(Stage::LayerPopup {
|
||||
|
|
@ -282,7 +283,6 @@ fn render_input_order_internal<R: 'static>(
|
|||
})?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !has_fullscreen {
|
||||
// background layer popups
|
||||
|
|
@ -295,11 +295,11 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
// previous background layer popups
|
||||
for (layer, popup, location) in layer_popups(output, Layer::Background, element_filter)
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous background layer popups
|
||||
for (layer, popup, location) in layer_popups(output, Layer::Background, element_filter) {
|
||||
callback(Stage::LayerPopup {
|
||||
layer,
|
||||
popup: &popup,
|
||||
|
|
@ -307,7 +307,6 @@ fn render_input_order_internal<R: 'static>(
|
|||
})?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !has_focused_fullscreen {
|
||||
// top-layer shell
|
||||
|
|
@ -348,15 +347,15 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous bottom layer
|
||||
for (layer, mut location) in layer_surfaces(output, Layer::Bottom, element_filter) {
|
||||
location += offset.as_global();
|
||||
callback(Stage::LayerSurface { layer, location })?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !has_fullscreen {
|
||||
// background layer
|
||||
|
|
@ -366,15 +365,15 @@ fn render_input_order_internal<R: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref() {
|
||||
if !has_fullscreen {
|
||||
if let Some((_, has_fullscreen, offset)) = previous.as_ref()
|
||||
&& !has_fullscreen
|
||||
{
|
||||
// previous background layer
|
||||
for (layer, mut location) in layer_surfaces(output, Layer::Background, element_filter) {
|
||||
location += offset.as_global();
|
||||
callback(Stage::LayerSurface { layer, location })?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@ impl<G: PointerGrab<State>> PointerGrab<State> for DelayGrab<G> {
|
|||
handle.motion(data, focus, event);
|
||||
|
||||
let distance = self.start_data.distance(event.location);
|
||||
if distance >= 1. {
|
||||
if let Some(factory) = self.grab_factory.take() {
|
||||
if distance >= 1.
|
||||
&& let Some(factory) = self.grab_factory.take()
|
||||
{
|
||||
let serial = self.serial.unwrap_or(event.serial);
|
||||
let seat = self.seat.clone();
|
||||
data.common.event_loop_handle.insert_idle(move |data| {
|
||||
|
|
@ -76,7 +77,6 @@ impl<G: PointerGrab<State>> PointerGrab<State> for DelayGrab<G> {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn relative_motion(
|
||||
&mut self,
|
||||
|
|
@ -232,8 +232,9 @@ impl<G: TouchGrab<State>> TouchGrab<State> for DelayGrab<G> {
|
|||
handle.motion(data, focus, event, seq);
|
||||
|
||||
let distance = self.start_data.distance(event.location);
|
||||
if distance >= 1. {
|
||||
if let Some(factory) = self.grab_factory.take() {
|
||||
if distance >= 1.
|
||||
&& let Some(factory) = self.grab_factory.take()
|
||||
{
|
||||
let seat = self.seat.clone();
|
||||
let serial = self.serial.unwrap_or_else(|| SERIAL_COUNTER.next_serial());
|
||||
data.common.event_loop_handle.insert_idle(move |data| {
|
||||
|
|
@ -243,7 +244,6 @@ impl<G: TouchGrab<State>> TouchGrab<State> for DelayGrab<G> {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn frame(&mut self, data: &mut State, handle: &mut TouchInnerHandle<'_, State>, seq: Serial) {
|
||||
handle.frame(data, seq)
|
||||
|
|
|
|||
|
|
@ -260,8 +260,9 @@ impl Program for ContextMenu {
|
|||
// But right now we don't have any touch responsive menus with submenus
|
||||
}
|
||||
Message::ItemEntered(idx, bounds) => {
|
||||
if let Some(Item::Submenu { items, .. }) = self.items.get_mut(idx) {
|
||||
if let Some((seat, _)) = last_seat.cloned() {
|
||||
if let Some(Item::Submenu { items, .. }) = self.items.get_mut(idx)
|
||||
&& let Some((seat, _)) = last_seat.cloned()
|
||||
{
|
||||
let items = items.clone();
|
||||
let _ = loop_handle.insert_idle(move |state| {
|
||||
let grab_state = seat
|
||||
|
|
@ -304,16 +305,14 @@ impl Program for ContextMenu {
|
|||
position
|
||||
+ Point::from((
|
||||
bounds.width.ceil() as i32,
|
||||
bounds.y.ceil() as i32
|
||||
+ bounds.height.ceil() as i32
|
||||
bounds.y.ceil() as i32 + bounds.height.ceil() as i32
|
||||
- min_size.h,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the left -> down
|
||||
Rectangle::new(
|
||||
position
|
||||
+ Point::from((-min_size.w, bounds.y.ceil() as i32)),
|
||||
position + Point::from((-min_size.w, bounds.y.ceil() as i32)),
|
||||
min_size.as_global(),
|
||||
),
|
||||
// to the left -> up
|
||||
|
|
@ -321,8 +320,7 @@ impl Program for ContextMenu {
|
|||
position
|
||||
+ Point::from((
|
||||
-min_size.w,
|
||||
bounds.y.ceil() as i32
|
||||
+ bounds.height.ceil() as i32
|
||||
bounds.y.ceil() as i32 + bounds.height.ceil() as i32
|
||||
- min_size.h,
|
||||
)),
|
||||
min_size.as_global(),
|
||||
|
|
@ -351,10 +349,10 @@ impl Program for ContextMenu {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::ItemLeft(idx, _) => {
|
||||
if let Some(Item::Submenu { .. }) = self.items.get_mut(idx) {
|
||||
if let Some((seat, _)) = last_seat.cloned() {
|
||||
if let Some(Item::Submenu { .. }) = self.items.get_mut(idx)
|
||||
&& let Some((seat, _)) = last_seat.cloned()
|
||||
{
|
||||
let _ = loop_handle.insert_idle(move |_| {
|
||||
let grab_state = seat
|
||||
.user_data()
|
||||
|
|
@ -370,7 +368,6 @@ impl Program for ContextMenu {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Task::none()
|
||||
|
|
|
|||
|
|
@ -862,8 +862,9 @@ impl Drop for MoveGrab {
|
|||
window_location.to_local(&workspace.output),
|
||||
);
|
||||
|
||||
if matches!(previous, ManagedLayer::Floating) {
|
||||
if let Some(sz) = grab_state.snapping_zone {
|
||||
if matches!(previous, ManagedLayer::Floating)
|
||||
&& let Some(sz) = grab_state.snapping_zone
|
||||
{
|
||||
if sz == SnappingZone::Maximize {
|
||||
shell.maximize_toggle(
|
||||
&window,
|
||||
|
|
@ -901,7 +902,6 @@ impl Drop for MoveGrab {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some((window, location.to_global(&output)))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,11 +525,11 @@ impl ResizeSurfaceGrab {
|
|||
};
|
||||
|
||||
// Finish resizing.
|
||||
if let Some(ResizeState::WaitingForCommit(_)) = *resize_state {
|
||||
if !window.is_resizing(false).unwrap_or(false) {
|
||||
if let Some(ResizeState::WaitingForCommit(_)) = *resize_state
|
||||
&& !window.is_resizing(false).unwrap_or(false)
|
||||
{
|
||||
*resize_state = None;
|
||||
}
|
||||
}
|
||||
std::mem::drop(resize_state);
|
||||
|
||||
if let Some(new_location) = new_location {
|
||||
|
|
|
|||
|
|
@ -385,13 +385,12 @@ impl FloatingLayout {
|
|||
} else {
|
||||
self.animations.remove(&mapped);
|
||||
}
|
||||
if mapped.floating_tiled.lock().unwrap().take().is_some() {
|
||||
if let Some(state) = mapped.maximized_state.lock().unwrap().as_mut() {
|
||||
if let Some(real_old_geo) = *mapped.last_geometry.lock().unwrap() {
|
||||
if mapped.floating_tiled.lock().unwrap().take().is_some()
|
||||
&& let Some(state) = mapped.maximized_state.lock().unwrap().as_mut()
|
||||
&& let Some(real_old_geo) = *mapped.last_geometry.lock().unwrap()
|
||||
{
|
||||
state.original_geometry = real_old_geo;
|
||||
}
|
||||
};
|
||||
}
|
||||
self.space
|
||||
.map_element(mapped, geometry.loc.as_logical(), true);
|
||||
self.space.refresh();
|
||||
|
|
@ -683,11 +682,11 @@ impl FloatingLayout {
|
|||
mapped_geometry.size = last_size;
|
||||
}
|
||||
} else if !window.is_maximized(true) {
|
||||
if window.active_window().has_pending_changes() {
|
||||
if let Some(pending_size) = window.pending_size() {
|
||||
if window.active_window().has_pending_changes()
|
||||
&& let Some(pending_size) = window.pending_size()
|
||||
{
|
||||
mapped_geometry.size = pending_size.as_local();
|
||||
}
|
||||
}
|
||||
*window.last_geometry.lock().unwrap() = Some(mapped_geometry);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -452,8 +452,8 @@ impl TilingLayout {
|
|||
mut sizes,
|
||||
}) = tiling_state
|
||||
{
|
||||
if let Some(node) = parent.as_ref().and_then(|parent| tree.get_mut(parent).ok()) {
|
||||
if let Data::Group {
|
||||
if let Some(node) = parent.as_ref().and_then(|parent| tree.get_mut(parent).ok())
|
||||
&& let Data::Group {
|
||||
orientation: current_orientation,
|
||||
sizes: current_sizes,
|
||||
..
|
||||
|
|
@ -461,8 +461,7 @@ impl TilingLayout {
|
|||
{
|
||||
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 new_length: i32 = current_sizes.iter().copied().sum();
|
||||
if previous_length != new_length {
|
||||
|
|
@ -499,7 +498,6 @@ impl TilingLayout {
|
|||
.push_tree(tree, MINIMIZE_ANIMATION_DURATION, blocker);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if sibling
|
||||
.as_ref()
|
||||
|
|
@ -1414,8 +1412,8 @@ impl TilingLayout {
|
|||
let tiling_node_id = mapped.tiling_node_id.lock().unwrap().as_ref().cloned();
|
||||
let gaps = self.gaps();
|
||||
|
||||
if let Some(node_id) = tiling_node_id {
|
||||
if self
|
||||
if let Some(node_id) = tiling_node_id
|
||||
&& self
|
||||
.queue
|
||||
.trees
|
||||
.back()
|
||||
|
|
@ -1439,7 +1437,6 @@ impl TilingLayout {
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
|
@ -1742,7 +1739,7 @@ impl TilingLayout {
|
|||
_ => {
|
||||
// we want the middle
|
||||
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.get_mut(&next_child_id)
|
||||
.unwrap()
|
||||
|
|
@ -1965,8 +1962,8 @@ impl TilingLayout {
|
|||
if focus_subtree.is_some() {
|
||||
let mut node_id = focus_subtree;
|
||||
while node_id.is_some() {
|
||||
if let Some(desc) = swap_desc.as_ref() {
|
||||
if let Some(replacement_id) = tree
|
||||
if let Some(desc) = swap_desc.as_ref()
|
||||
&& let Some(replacement_id) = tree
|
||||
.ancestor_ids(node_id.unwrap())
|
||||
.unwrap()
|
||||
.find(|anchestor| *anchestor == &desc.node)
|
||||
|
|
@ -2000,7 +1997,6 @@ impl TilingLayout {
|
|||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
match tree.get(node_id.unwrap()).unwrap().data() {
|
||||
Data::Group { orientation, .. } if orientation == &main_orientation => {
|
||||
|
|
@ -2098,9 +2094,9 @@ impl TilingLayout {
|
|||
};
|
||||
|
||||
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(group) = tree.get(&last_active).unwrap().parent().cloned() {
|
||||
if let &mut Data::Group {
|
||||
if let Some((last_active, _)) = TilingLayout::currently_focused_node(&tree, target)
|
||||
&& let Some(group) = tree.get(&last_active).unwrap().parent().cloned()
|
||||
&& let &mut Data::Group {
|
||||
ref mut orientation,
|
||||
ref mut sizes,
|
||||
ref last_geometry,
|
||||
|
|
@ -2118,8 +2114,8 @@ impl TilingLayout {
|
|||
};
|
||||
|
||||
sizes.iter_mut().for_each(|len| {
|
||||
*len = (((*len as f64) / (previous_length as f64)) * (new_length as f64))
|
||||
.round() as i32;
|
||||
*len = (((*len as f64) / (previous_length as f64)) * (new_length as f64)).round()
|
||||
as i32;
|
||||
});
|
||||
let sum: i32 = sizes.iter().sum();
|
||||
if sum < new_length {
|
||||
|
|
@ -2132,8 +2128,6 @@ impl TilingLayout {
|
|||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn toggle_stacking(
|
||||
&mut self,
|
||||
|
|
@ -3371,8 +3365,8 @@ impl TilingLayout {
|
|||
if matches!(
|
||||
overview.active_trigger(),
|
||||
Some(Trigger::Pointer(_) | Trigger::Touch(_))
|
||||
) {
|
||||
if location_f64.is_some() {
|
||||
) && location_f64.is_some()
|
||||
{
|
||||
let mut tree = tree.copy_clone();
|
||||
tree.insert(
|
||||
Node::new(Data::Placeholder {
|
||||
|
|
@ -3386,7 +3380,6 @@ impl TilingLayout {
|
|||
let blocker = TilingLayout::update_positions(&self.output, &mut tree, gaps);
|
||||
self.queue.push_tree(tree, ANIMATION_DURATION, blocker);
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
@ -4626,8 +4619,9 @@ where
|
|||
geo.loc += (gap, gap).into();
|
||||
geo.size -= (gap * 2, gap * 2).into();
|
||||
|
||||
if mouse_tiling.is_some() {
|
||||
if let Some(PillIndicator::Outer(direction)) = pill_indicator {
|
||||
if mouse_tiling.is_some()
|
||||
&& let Some(PillIndicator::Outer(direction)) = pill_indicator
|
||||
{
|
||||
let (pill_geo, remaining_geo) = match direction {
|
||||
Direction::Left => (
|
||||
Rectangle::new(
|
||||
|
|
@ -4681,7 +4675,6 @@ where
|
|||
|
||||
geo = remaining_geo;
|
||||
};
|
||||
}
|
||||
|
||||
if matches!(swap_desc, Some(ref desc) if desc.node == node_id) {
|
||||
if let Some(renderer) = renderer.as_mut() {
|
||||
|
|
@ -4758,8 +4751,9 @@ where
|
|||
(geo.loc.x, geo.loc.y + previous).into(),
|
||||
(geo.size.w, *size).into(),
|
||||
);
|
||||
if mouse_tiling.is_some() {
|
||||
if let Some(PillIndicator::Inner(pill_idx)) = pill_indicator {
|
||||
if mouse_tiling.is_some()
|
||||
&& let Some(PillIndicator::Inner(pill_idx)) = pill_indicator
|
||||
{
|
||||
if *pill_idx == idx {
|
||||
geo.size.h -= 32;
|
||||
}
|
||||
|
|
@ -4788,7 +4782,6 @@ where
|
|||
geo.size.h -= 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
stack.push((geo, depth + 1));
|
||||
}
|
||||
}
|
||||
|
|
@ -4800,8 +4793,9 @@ where
|
|||
(geo.loc.x + previous, geo.loc.y).into(),
|
||||
(*size, geo.size.h).into(),
|
||||
);
|
||||
if mouse_tiling.is_some() {
|
||||
if let Some(PillIndicator::Inner(pill_idx)) = pill_indicator {
|
||||
if mouse_tiling.is_some()
|
||||
&& let Some(PillIndicator::Inner(pill_idx)) = pill_indicator
|
||||
{
|
||||
if *pill_idx == idx {
|
||||
geo.size.w -= 32;
|
||||
}
|
||||
|
|
@ -4830,7 +4824,6 @@ where
|
|||
geo.size.w -= 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
stack.push((geo, depth + 1));
|
||||
}
|
||||
}
|
||||
|
|
@ -5102,10 +5095,7 @@ where
|
|||
},
|
||||
);
|
||||
|
||||
shadow_elements
|
||||
.into_iter()
|
||||
.chain(elements.into_iter())
|
||||
.collect()
|
||||
shadow_elements.into_iter().chain(elements).collect()
|
||||
}
|
||||
|
||||
fn render_old_tree(
|
||||
|
|
@ -5518,8 +5508,8 @@ where
|
|||
.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.output_enter(output, output_geo.as_logical());
|
||||
swap_elements.extend(
|
||||
|
|
@ -5534,7 +5524,6 @@ where
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((mode, resize)) = resize_indicator.as_mut() {
|
||||
let mut geo = geo;
|
||||
|
|
@ -5716,7 +5705,7 @@ where
|
|||
.into_iter()
|
||||
.flatten()
|
||||
.chain(swap_elements)
|
||||
.chain(indicators.into_iter().map(Into::into))
|
||||
.chain(indicators)
|
||||
.chain(window_elements)
|
||||
.chain(animating_window_elements)
|
||||
.chain(shadow_elements)
|
||||
|
|
@ -5858,11 +5847,11 @@ fn render_new_tree(
|
|||
(new_geo, percentage, false)
|
||||
};
|
||||
|
||||
if let Data::Mapped { mapped, .. } = data {
|
||||
if mapped.is_maximized(false) {
|
||||
if let Data::Mapped { mapped, .. } = data
|
||||
&& mapped.is_maximized(false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
processor(node_id, data, geo, original_geo, alpha, animating)
|
||||
});
|
||||
}
|
||||
|
|
|
|||
104
src/shell/mod.rs
104
src/shell/mod.rs
|
|
@ -479,7 +479,7 @@ impl WorkspaceSet {
|
|||
appearance: AppearanceConfig,
|
||||
) -> WorkspaceSet {
|
||||
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 {
|
||||
previously_active: None,
|
||||
|
|
@ -753,7 +753,7 @@ impl Workspaces {
|
|||
autotile: config.cosmic_conf.autotile,
|
||||
autotile_behavior: config.cosmic_conf.autotile_behavior,
|
||||
theme,
|
||||
appearance: config.cosmic_conf.appearance_settings.clone(),
|
||||
appearance: config.cosmic_conf.appearance_settings,
|
||||
persisted_workspaces: config.cosmic_conf.pinned_workspaces.clone(),
|
||||
}
|
||||
}
|
||||
|
|
@ -1462,7 +1462,7 @@ impl Common {
|
|||
let mut shell = self.shell.write();
|
||||
let shell_ref = &mut *shell;
|
||||
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() {
|
||||
zoom_state.increment = self.config.cosmic_conf.accessibility_zoom.increment;
|
||||
zoom_state.movement = self.config.cosmic_conf.accessibility_zoom.view_moves;
|
||||
|
|
@ -1519,14 +1519,14 @@ impl Common {
|
|||
let shell = self.shell.read();
|
||||
|
||||
for seat in shell.seats.iter() {
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||
&& 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) {
|
||||
mapped.on_commit(surface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data_device::on_commit(surface, seat);
|
||||
}
|
||||
|
|
@ -1595,7 +1595,7 @@ impl Shell {
|
|||
resize_mode: ResizeMode::None,
|
||||
resize_state: None,
|
||||
resize_indicator: None,
|
||||
appearance_conf: config.cosmic_conf.appearance_settings.clone(),
|
||||
appearance_conf: config.cosmic_conf.appearance_settings,
|
||||
zoom_state: None,
|
||||
tiling_exceptions,
|
||||
|
||||
|
|
@ -1972,14 +1972,15 @@ impl Shell {
|
|||
.filter(|seat| seat.active_output() == **o)
|
||||
.any(|seat| {
|
||||
let cursor_status = seat.cursor_image_status();
|
||||
if let CursorImageStatus::Surface(s) = cursor_status {
|
||||
if s == *surface {
|
||||
if let CursorImageStatus::Surface(s) = cursor_status
|
||||
&& s == *surface
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||
{
|
||||
for (window, _) in grab_state.element().windows() {
|
||||
let mut matches = false;
|
||||
window.0.with_surfaces(|s, _| {
|
||||
|
|
@ -1990,7 +1991,6 @@ impl Shell {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get_dnd_icon(seat).is_some_and(|icon| icon.surface == *surface)
|
||||
})
|
||||
|
|
@ -2216,19 +2216,19 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn overview_mode(&self) -> (OverviewMode, Option<SwapIndicator>) {
|
||||
if let OverviewMode::Started(trigger, timestamp) = &self.overview_mode {
|
||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||
if let OverviewMode::Started(trigger, timestamp) = &self.overview_mode
|
||||
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (
|
||||
OverviewMode::Active(trigger.clone()),
|
||||
self.swap_indicator.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
if let OverviewMode::Ended(_, timestamp) = &self.overview_mode {
|
||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||
if let OverviewMode::Ended(_, timestamp) = &self.overview_mode
|
||||
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (OverviewMode::None, None);
|
||||
}
|
||||
}
|
||||
|
||||
(self.overview_mode.clone(), self.swap_indicator.clone())
|
||||
}
|
||||
|
|
@ -2261,19 +2261,19 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn resize_mode(&self) -> (ResizeMode, Option<ResizeIndicator>) {
|
||||
if let ResizeMode::Started(binding, timestamp, direction) = &self.resize_mode {
|
||||
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||
if let ResizeMode::Started(binding, timestamp, direction) = &self.resize_mode
|
||||
&& Instant::now().duration_since(*timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (
|
||||
ResizeMode::Active(binding.clone(), *direction),
|
||||
self.resize_indicator.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
if let ResizeMode::Ended(timestamp, _) = self.resize_mode {
|
||||
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
||||
if let ResizeMode::Ended(timestamp, _) = self.resize_mode
|
||||
&& Instant::now().duration_since(timestamp) > ANIMATION_DURATION
|
||||
{
|
||||
return (ResizeMode::None, None);
|
||||
}
|
||||
}
|
||||
|
||||
(self.resize_mode.clone(), self.resize_indicator.clone())
|
||||
}
|
||||
|
|
@ -2299,7 +2299,7 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn appearance_config(&self) -> AppearanceConfig {
|
||||
self.appearance_conf.clone()
|
||||
self.appearance_conf
|
||||
}
|
||||
|
||||
pub fn trigger_zoom(
|
||||
|
|
@ -2333,11 +2333,11 @@ impl Shell {
|
|||
}
|
||||
|
||||
let mut toggled = self.zoom_state.is_none();
|
||||
if let Some(old_state) = self.zoom_state.as_ref() {
|
||||
if &old_state.seat != seat {
|
||||
if let Some(old_state) = self.zoom_state.as_ref()
|
||||
&& &old_state.seat != seat
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for output in &outputs {
|
||||
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
||||
|
|
@ -2766,19 +2766,17 @@ impl Shell {
|
|||
}
|
||||
|
||||
let maybe_focused = workspace.focus_stack.get(&seat).iter().next().cloned();
|
||||
if let Some(FocusTarget::Window(focused)) = maybe_focused {
|
||||
if (focused.is_stack() && !is_dialog && !should_be_maximized)
|
||||
if let Some(FocusTarget::Window(focused)) = maybe_focused
|
||||
&& (focused.is_stack() && !is_dialog && !should_be_maximized)
|
||||
&& !(workspace.is_tiled(&focused.active_window()) && floating_exception)
|
||||
{
|
||||
focused.stack_ref().unwrap().add_window(window, None, None);
|
||||
if was_activated {
|
||||
workspace_state.add_workspace_state(&workspace_handle, WState::Urgent);
|
||||
}
|
||||
return (workspace_output == seat.active_output()
|
||||
&& active_handle == workspace_handle)
|
||||
return (workspace_output == seat.active_output() && active_handle == workspace_handle)
|
||||
.then_some(KeyboardFocusTarget::Element(focused));
|
||||
}
|
||||
}
|
||||
|
||||
let mapped = CosmicMapped::from(CosmicWindow::new(
|
||||
window.clone(),
|
||||
|
|
@ -3026,8 +3024,9 @@ impl Shell {
|
|||
|
||||
let spaces = self.workspaces.spaces_mut();
|
||||
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(to_workspace) = other_w.iter_mut().find(|w| w.handle == to) {
|
||||
if let Some(from_workspace) = from_w.get_mut(0)
|
||||
&& 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| {
|
||||
|
|
@ -3082,7 +3081,6 @@ impl Shell {
|
|||
|
||||
return Ok(res.zip(new_pos));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
|
|
@ -3155,14 +3153,12 @@ impl Shell {
|
|||
was_maximized: previous.was_maximized(),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
if let FullscreenRestoreState::Tiling { workspace, .. }
|
||||
} else if let FullscreenRestoreState::Tiling { workspace, .. }
|
||||
| FullscreenRestoreState::Floating { workspace, .. } = previous
|
||||
{
|
||||
*workspace = *to;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if is_minimized {
|
||||
let to_workspace = self.workspaces.space_for_handle_mut(to).unwrap(); // checked above
|
||||
|
|
@ -3408,8 +3404,8 @@ impl Shell {
|
|||
}
|
||||
|
||||
pub fn update_reactive_popups(&self, mapped: &CosmicMapped) {
|
||||
if let Some(workspace) = self.space_for(mapped) {
|
||||
if let Some(element_loc) = workspace
|
||||
if let Some(workspace) = self.space_for(mapped)
|
||||
&& let Some(element_loc) = workspace
|
||||
.element_geometry(mapped)
|
||||
.map(|geo| geo.loc.to_global(&workspace.output))
|
||||
{
|
||||
|
|
@ -3425,7 +3421,6 @@ impl Shell {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn menu_request(
|
||||
&self,
|
||||
|
|
@ -3744,13 +3739,12 @@ impl Shell {
|
|||
None
|
||||
};
|
||||
|
||||
if mapped == old_mapped {
|
||||
if let Some(geo) = sticky_layer.unmap(&mapped, None) {
|
||||
if geo.size != elem_geo.size {
|
||||
if mapped == old_mapped
|
||||
&& let Some(geo) = sticky_layer.unmap(&mapped, None)
|
||||
&& geo.size != elem_geo.size
|
||||
{
|
||||
new_size = Some(geo.size.as_logical());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(new_size) = new_size {
|
||||
let ratio =
|
||||
|
|
@ -4404,18 +4398,19 @@ impl Shell {
|
|||
.resize(&focused, direction, edge, amount)
|
||||
{
|
||||
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
||||
} else if let Some(workspace) = self.workspaces.get_mut(idx, &output) {
|
||||
if workspace.resize(&focused, direction, edge, amount) {
|
||||
} else if let Some(workspace) = self.workspaces.get_mut(idx, &output)
|
||||
&& workspace.resize(&focused, direction, edge, amount)
|
||||
{
|
||||
self.resize_state = Some((focused, direction, edge, amount, idx, output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn finish_resize(&mut self, direction: ResizeDirection, edge: ResizeEdge) {
|
||||
if let Some((old_focused, old_direction, old_edge, _, idx, output)) =
|
||||
self.resize_state.take()
|
||||
&& old_direction == direction
|
||||
&& old_edge == edge
|
||||
{
|
||||
if old_direction == direction && old_edge == edge {
|
||||
let Some(toplevel) = old_focused.toplevel() else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -4447,7 +4442,6 @@ impl Shell {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn toggle_stacking(
|
||||
|
|
@ -4520,11 +4514,9 @@ impl Shell {
|
|||
None
|
||||
};
|
||||
|
||||
if was_maximized {
|
||||
if let Some(KeyboardFocusTarget::Element(mapped)) = res.as_ref() {
|
||||
if was_maximized && let Some(KeyboardFocusTarget::Element(mapped)) = res.as_ref() {
|
||||
self.maximize_request(mapped, seat, false, loop_handle);
|
||||
}
|
||||
}
|
||||
|
||||
res
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -112,13 +112,13 @@ impl Devices {
|
|||
.collect::<Vec<_>>();
|
||||
map.insert(id, caps);
|
||||
|
||||
if device.has_capability(DeviceCapability::Keyboard) {
|
||||
if let Some(device) = <dyn Any>::downcast_ref::<InputDevice>(device) {
|
||||
if device.has_capability(DeviceCapability::Keyboard)
|
||||
&& let Some(device) = <dyn Any>::downcast_ref::<InputDevice>(device)
|
||||
{
|
||||
let mut device = device.clone();
|
||||
device.led_update(led_state.into());
|
||||
self.keyboards.borrow_mut().push(device);
|
||||
}
|
||||
}
|
||||
|
||||
new_caps
|
||||
}
|
||||
|
|
@ -385,11 +385,11 @@ impl SeatExt for Seat<State> {
|
|||
let lock = self.user_data().get::<Mutex<CursorImageStatus>>().unwrap();
|
||||
// Reset the cursor if the surface is no longer alive
|
||||
let mut cursor_status = lock.lock().unwrap();
|
||||
if let CursorImageStatus::Surface(ref surface) = *cursor_status {
|
||||
if !surface.alive() {
|
||||
if let CursorImageStatus::Surface(ref surface) = *cursor_status
|
||||
&& !surface.alive()
|
||||
{
|
||||
*cursor_status = CursorImageStatus::default_named();
|
||||
}
|
||||
}
|
||||
cursor_status.clone()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -487,11 +487,9 @@ impl Workspace {
|
|||
.unwrap()
|
||||
.lock()
|
||||
.unwrap();
|
||||
let move_mapped = if let Some(move_grab_state) = &*move_grab_state {
|
||||
Some(move_grab_state.element())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let move_mapped = (*move_grab_state)
|
||||
.as_ref()
|
||||
.map(|move_grab_state| move_grab_state.element());
|
||||
|
||||
let mapped = || {
|
||||
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()`,
|
||||
// which may have already removed a non-alive surface.
|
||||
if let Some(floating_geometry) = self.floating_layer.unmap(mapped, None).or(was_maximized) {
|
||||
|
|
@ -695,8 +693,9 @@ impl Workspace {
|
|||
|
||||
let mapped = self.element_for_surface(surface)?;
|
||||
let maybe_stack = mapped.stack_ref().filter(|s| s.len() > 1);
|
||||
if let Some(stack) = maybe_stack {
|
||||
if stack.len() > 1 {
|
||||
if let Some(stack) = maybe_stack
|
||||
&& stack.len() > 1
|
||||
{
|
||||
let idx = stack.surfaces().position(|s| &s == surface);
|
||||
let layer = if self.is_tiled(surface) {
|
||||
ManagedLayer::Tiling
|
||||
|
|
@ -707,7 +706,6 @@ impl Workspace {
|
|||
.and_then(|idx| stack.remove_idx(idx))
|
||||
.map(|s| (s, layer.into()));
|
||||
}
|
||||
}
|
||||
|
||||
// we know mapped is no stack with more than one element now,
|
||||
// so we can treat mapped as containing only our surface.
|
||||
|
|
@ -774,26 +772,26 @@ impl Workspace {
|
|||
let stack = self.focus_stack.get(seat);
|
||||
let last_focused = stack.last();
|
||||
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
if last_focused.is_some_and(
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
&& last_focused.is_some_and(
|
||||
|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);
|
||||
}
|
||||
}
|
||||
|
||||
self.floating_layer
|
||||
.popup_element_under(location)
|
||||
.or_else(|| self.tiling_layer.popup_element_under(location))
|
||||
.or_else(|| {
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_))) {
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_)))
|
||||
&& let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
}
|
||||
None
|
||||
})
|
||||
}
|
||||
|
|
@ -824,26 +822,26 @@ impl Workspace {
|
|||
let stack = self.focus_stack.get(seat);
|
||||
let last_focused = stack.last();
|
||||
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
if last_focused.is_some_and(
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
&& last_focused.is_some_and(
|
||||
|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);
|
||||
}
|
||||
}
|
||||
|
||||
self.floating_layer
|
||||
.toplevel_element_under(location)
|
||||
.or_else(|| self.tiling_layer.toplevel_element_under(location))
|
||||
.or_else(|| {
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_))) {
|
||||
if let Some(fullscreen) = self.fullscreen.as_ref() {
|
||||
if last_focused.is_none_or(|t| !matches!(t, FocusTarget::Fullscreen(_)))
|
||||
&& let Some(fullscreen) = self.fullscreen.as_ref()
|
||||
{
|
||||
let geometry = self.fullscreen_geometry().unwrap();
|
||||
return fullscreen_element_under(fullscreen, geometry);
|
||||
}
|
||||
}
|
||||
None
|
||||
})
|
||||
}
|
||||
|
|
@ -1071,7 +1069,7 @@ impl Workspace {
|
|||
mapped.set_minimized(true);
|
||||
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)) {
|
||||
return Some(MinimizedWindow::Floating {
|
||||
window: mapped,
|
||||
|
|
|
|||
|
|
@ -232,24 +232,24 @@ impl ZoomState {
|
|||
let active_output = self.seat.active_output();
|
||||
let output = output.unwrap_or(&active_output);
|
||||
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
||||
let res = output_state
|
||||
|
||||
output_state
|
||||
.lock()
|
||||
.unwrap()
|
||||
.animating_focal_point()
|
||||
.to_global(output);
|
||||
res
|
||||
.to_global(output)
|
||||
}
|
||||
|
||||
pub fn current_focal_point(&self, output: Option<&Output>) -> Point<f64, Global> {
|
||||
let active_output = self.seat.active_output();
|
||||
let output = output.unwrap_or(&active_output);
|
||||
let output_state = output.user_data().get::<Mutex<OutputZoomState>>().unwrap();
|
||||
let res = output_state
|
||||
|
||||
output_state
|
||||
.lock()
|
||||
.unwrap()
|
||||
.current_focal_point()
|
||||
.to_global(output);
|
||||
res
|
||||
.to_global(output)
|
||||
}
|
||||
|
||||
pub fn update_focal_point(
|
||||
|
|
|
|||
79
src/state.rs
79
src/state.rs
|
|
@ -655,9 +655,9 @@ impl State {
|
|||
let cosmic_image_capture_source_state =
|
||||
CosmicImageCaptureSourceState::new::<Self, _>(dh, client_not_sandboxed);
|
||||
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 =
|
||||
ToplevelCaptureSourceState::new_with_filter::<State, _>(&dh, client_not_sandboxed);
|
||||
ToplevelCaptureSourceState::new_with_filter::<State, _>(dh, client_not_sandboxed);
|
||||
let image_copy_capture_state =
|
||||
ImageCopyCaptureState::new_with_filter::<Self, _>(dh, client_not_sandboxed);
|
||||
let shm_state =
|
||||
|
|
@ -681,7 +681,7 @@ impl State {
|
|||
VirtualKeyboardManagerState::new::<State, _>(dh, client_not_sandboxed);
|
||||
AlphaModifierState::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_inhibit_manager_state = IdleInhibitManagerState::new::<State>(dh);
|
||||
|
|
@ -954,11 +954,11 @@ impl Common {
|
|||
};
|
||||
|
||||
// lock surface
|
||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
||||
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
||||
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||
&& let Some(lock_surface) = session_lock.surfaces.get(output)
|
||||
{
|
||||
with_surfaces_surface_tree(lock_surface.wl_surface(), processor)
|
||||
}
|
||||
}
|
||||
|
||||
for seat in shell
|
||||
.seats
|
||||
|
|
@ -973,13 +973,13 @@ impl Common {
|
|||
}
|
||||
|
||||
// grabs
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||
{
|
||||
for (window, _) in grab_state.element().windows() {
|
||||
window.with_surfaces(processor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(icon) = get_dnd_icon(seat) {
|
||||
with_surfaces_surface_tree(&icon.surface, processor);
|
||||
|
|
@ -1037,9 +1037,9 @@ impl Common {
|
|||
) {
|
||||
let shell = self.shell.read();
|
||||
|
||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
||||
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
||||
if let Some(feedback) =
|
||||
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||
&& let Some(lock_surface) = session_lock.surfaces.get(output)
|
||||
&& let Some(feedback) =
|
||||
advertised_node_for_surface(lock_surface.wl_surface(), &self.display_handle)
|
||||
.and_then(&mut dmabuf_feedback)
|
||||
{
|
||||
|
|
@ -1060,8 +1060,6 @@ impl Common {
|
|||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for seat in shell
|
||||
.seats
|
||||
|
|
@ -1070,8 +1068,8 @@ impl Common {
|
|||
{
|
||||
let cursor_status = seat.cursor_image_status();
|
||||
|
||||
if let CursorImageStatus::Surface(wl_surface) = cursor_status {
|
||||
if let Some(feedback) =
|
||||
if let CursorImageStatus::Surface(wl_surface) = cursor_status
|
||||
&& let Some(feedback) =
|
||||
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
||||
.and_then(&mut dmabuf_feedback)
|
||||
{
|
||||
|
|
@ -1092,10 +1090,9 @@ impl Common {
|
|||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(icon) = get_dnd_icon(seat) {
|
||||
if let Some(feedback) =
|
||||
if let Some(icon) = get_dnd_icon(seat)
|
||||
&& let Some(feedback) =
|
||||
advertised_node_for_surface(&icon.surface, &self.display_handle)
|
||||
.and_then(&mut dmabuf_feedback)
|
||||
{
|
||||
|
|
@ -1116,10 +1113,10 @@ impl Common {
|
|||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||
&& let Some(grab_state) = move_grab.lock().unwrap().as_ref()
|
||||
{
|
||||
for (window, _) in grab_state.element().windows() {
|
||||
if let Some(feedback) = window
|
||||
.wl_surface()
|
||||
|
|
@ -1138,7 +1135,6 @@ impl Common {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shell
|
||||
.workspaces
|
||||
|
|
@ -1167,8 +1163,8 @@ impl Common {
|
|||
});
|
||||
|
||||
if let Some(active) = shell.active_space(output) {
|
||||
if let Some(window) = active.get_fullscreen() {
|
||||
if let Some(feedback) = window
|
||||
if let Some(window) = active.get_fullscreen()
|
||||
&& let Some(feedback) = window
|
||||
.wl_surface()
|
||||
.and_then(|wl_surface| {
|
||||
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
||||
|
|
@ -1182,7 +1178,6 @@ impl Common {
|
|||
surface_primary_scanout_output,
|
||||
);
|
||||
}
|
||||
}
|
||||
active.mapped().for_each(|mapped| {
|
||||
for (window, _) in mapped.windows() {
|
||||
if let Some(feedback) = window
|
||||
|
|
@ -1204,8 +1199,8 @@ impl Common {
|
|||
}
|
||||
|
||||
shell.override_redirect_windows.iter().for_each(|or| {
|
||||
if let Some(wl_surface) = or.wl_surface() {
|
||||
if let Some(feedback) =
|
||||
if let Some(wl_surface) = or.wl_surface()
|
||||
&& let Some(feedback) =
|
||||
advertised_node_for_surface(&wl_surface, &self.display_handle)
|
||||
.and_then(&mut dmabuf_feedback)
|
||||
{
|
||||
|
|
@ -1226,7 +1221,6 @@ impl Common {
|
|||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let map = smithay::desktop::layer_map_for_output(output);
|
||||
|
|
@ -1280,11 +1274,12 @@ impl Common {
|
|||
|
||||
// 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.
|
||||
if let Some((last_output, last_sequence)) = &*last_sent_at {
|
||||
if last_output == output && *last_sequence == sequence {
|
||||
if let Some((last_output, last_sequence)) = &*last_sent_at
|
||||
&& last_output == output
|
||||
&& *last_sequence == sequence
|
||||
{
|
||||
send = false;
|
||||
}
|
||||
}
|
||||
|
||||
if send {
|
||||
*last_sent_at = Some((output.downgrade(), sequence));
|
||||
|
|
@ -1306,16 +1301,10 @@ impl Common {
|
|||
|
||||
let shell = self.shell.read();
|
||||
|
||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
||||
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
||||
send_frames_surface_tree(
|
||||
lock_surface.wl_surface(),
|
||||
output,
|
||||
time,
|
||||
None,
|
||||
should_send,
|
||||
);
|
||||
}
|
||||
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||
&& let Some(lock_surface) = session_lock.surfaces.get(output)
|
||||
{
|
||||
send_frames_surface_tree(lock_surface.wl_surface(), output, time, None, should_send);
|
||||
}
|
||||
|
||||
for seat in shell
|
||||
|
|
@ -1335,13 +1324,13 @@ impl Common {
|
|||
)
|
||||
}
|
||||
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>()
|
||||
&& 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(icon) = get_dnd_icon(seat) {
|
||||
send_frames_surface_tree(
|
||||
|
|
|
|||
|
|
@ -449,8 +449,9 @@ impl<P: Program + Send + 'static> IcedElementInternal<P> {
|
|||
)
|
||||
.1;
|
||||
|
||||
if let Some(action) = actions {
|
||||
if let Some(t) = into_stream(action) {
|
||||
if let Some(action) = actions
|
||||
&& let Some(t) = into_stream(action)
|
||||
{
|
||||
let _ = self.scheduler.schedule(t.into_future().map(|f| match f.0 {
|
||||
Some(Action::Output(msg)) => Some(msg),
|
||||
_ => None,
|
||||
|
|
@ -458,7 +459,6 @@ impl<P: Program + Send + 'static> IcedElementInternal<P> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: Program + Send + 'static> PointerTarget<crate::state::State> for IcedElement<P> {
|
||||
fn enter(
|
||||
|
|
|
|||
|
|
@ -145,11 +145,11 @@ where
|
|||
// for now :^)
|
||||
let temp_cache = user_interface.into_cache();
|
||||
|
||||
let tasks = Task::batch(messages.into_iter().map(|message| {
|
||||
let task = self.program.update(message);
|
||||
|
||||
task
|
||||
}));
|
||||
let tasks = Task::batch(
|
||||
messages
|
||||
.into_iter()
|
||||
.map(|message| self.program.update(message)),
|
||||
);
|
||||
|
||||
let mut user_interface =
|
||||
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> {
|
||||
let view = program.view();
|
||||
|
||||
let user_interface = UserInterface::build(view, size, cache, renderer);
|
||||
|
||||
user_interface
|
||||
UserInterface::build(view, size, cache, renderer)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ fn xdg_popup_ensure_initial_configure(popup: &PopupKind) {
|
|||
|
||||
fn layer_surface_check_inital_configure(surface: &LayerSurface) -> bool {
|
||||
// send the initial configure if relevant
|
||||
let initial_configure_sent = with_states(surface.wl_surface(), |states| {
|
||||
with_states(surface.wl_surface(), |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<Mutex<LayerSurfaceAttributes>>()
|
||||
|
|
@ -81,9 +81,7 @@ fn layer_surface_check_inital_configure(surface: &LayerSurface) -> bool {
|
|||
.lock()
|
||||
.unwrap()
|
||||
.initial_configure_sent
|
||||
});
|
||||
|
||||
initial_configure_sent
|
||||
})
|
||||
}
|
||||
|
||||
pub fn client_compositor_state(client: &Client) -> &CompositorClientState {
|
||||
|
|
@ -195,25 +193,26 @@ impl CompositorHandler for State {
|
|||
})
|
||||
});
|
||||
if let Some(dmabuf) = maybe_dmabuf {
|
||||
if let Some(acquire_point) = acquire_point {
|
||||
if let Ok((blocker, source)) = acquire_point.generate_blocker() {
|
||||
if let Some(acquire_point) = acquire_point
|
||||
&& let Ok((blocker, source)) = acquire_point.generate_blocker()
|
||||
{
|
||||
let client = surface.client().unwrap();
|
||||
let res = state.common.event_loop_handle.insert_source(
|
||||
source,
|
||||
move |_, _, state| {
|
||||
let res =
|
||||
state
|
||||
.common
|
||||
.event_loop_handle
|
||||
.insert_source(source, move |_, _, state| {
|
||||
let dh = state.common.display_handle.clone();
|
||||
state
|
||||
.client_compositor_state(&client)
|
||||
.blocker_cleared(state, &dh);
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
});
|
||||
if res.is_ok() {
|
||||
add_blocker(surface, blocker);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Ok((blocker, source)) = dmabuf.generate_blocker(Interest::READ) {
|
||||
let client = surface.client().unwrap();
|
||||
let res =
|
||||
|
|
@ -379,8 +378,8 @@ impl State {
|
|||
.pending_windows
|
||||
.iter()
|
||||
.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() {
|
||||
Some(output.geometry().size.as_logical())
|
||||
} else if pending.maximized {
|
||||
|
|
@ -410,15 +409,14 @@ impl State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(layer_surface) = shell
|
||||
.pending_layers
|
||||
.iter()
|
||||
.find(|pending| pending.surface.wl_surface() == surface)
|
||||
.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
|
||||
if let Some(target) = shell.map_layer(&layer_surface) {
|
||||
let seat = shell.seats.last_active().clone();
|
||||
|
|
@ -427,7 +425,6 @@ impl State {
|
|||
}
|
||||
layer_surface.layer_surface().send_configure();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
false
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ impl XdgDecorationHandler for State {
|
|||
if let Some((window, _)) = mapped
|
||||
.windows()
|
||||
.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| {
|
||||
state.decoration_mode = Some(mode);
|
||||
});
|
||||
|
|
@ -83,7 +83,6 @@ impl XdgDecorationHandler for State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn request_mode(&mut self, toplevel: ToplevelSurface, mode: XdgMode) {
|
||||
let shell = self.common.shell.read();
|
||||
|
|
@ -91,15 +90,14 @@ impl XdgDecorationHandler for State {
|
|||
if let Some((window, _)) = mapped
|
||||
.windows()
|
||||
.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));
|
||||
toplevel.with_pending_state(|state| {
|
||||
state.decoration_mode = Some(mode);
|
||||
});
|
||||
toplevel.send_configure();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
toplevel.with_pending_state(|state| state.decoration_mode = Some(mode));
|
||||
}
|
||||
|
|
@ -107,12 +105,12 @@ impl XdgDecorationHandler for State {
|
|||
|
||||
fn unset_mode(&mut self, toplevel: ToplevelSurface) {
|
||||
let shell = self.common.shell.read();
|
||||
if let Some(mapped) = shell.element_for_surface(toplevel.wl_surface()) {
|
||||
if let Some((window, _)) = mapped
|
||||
if let Some(mapped) = shell.element_for_surface(toplevel.wl_surface())
|
||||
&& let Some((window, _)) = mapped
|
||||
.windows()
|
||||
.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);
|
||||
toplevel.with_pending_state(|state| {
|
||||
state.decoration_mode = None;
|
||||
|
|
@ -121,8 +119,6 @@ impl XdgDecorationHandler for State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl KdeDecorationHandler for State {
|
||||
fn kde_decoration_state(&self) -> &KdeDecorationState {
|
||||
|
|
|
|||
|
|
@ -79,15 +79,13 @@ impl DmabufHandler for State {
|
|||
feedback
|
||||
.primary_scanout_feedback
|
||||
.unwrap_or(feedback.render_feedback)
|
||||
} else {
|
||||
if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||
} else if frame_time_filter_fn(data) == Kind::ScanoutCandidate {
|
||||
feedback
|
||||
.overlay_scanout_feedback
|
||||
.unwrap_or(feedback.render_feedback)
|
||||
} else {
|
||||
feedback.render_feedback
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,24 +237,24 @@ impl ImageCopyCaptureHandler for State {
|
|||
}
|
||||
ImageCaptureSourceKind::Toplevel(mut toplevel) => {
|
||||
let shell = self.common.shell.read();
|
||||
if let Some(element) = shell.element_for_surface(&toplevel) {
|
||||
if element.has_active_window(&toplevel) {
|
||||
if let Some(workspace) = shell.space_for(element) {
|
||||
if let Some(geometry) = workspace.element_geometry(element) {
|
||||
if let Some(element) = shell.element_for_surface(&toplevel)
|
||||
&& element.has_active_window(&toplevel)
|
||||
&& let Some(workspace) = shell.space_for(element)
|
||||
&& let Some(geometry) = workspace.element_geometry(element)
|
||||
{
|
||||
let mut surface_geo = element.active_window_geometry().as_local();
|
||||
surface_geo.loc += geometry.loc;
|
||||
let global_geo = surface_geo.to_global(workspace.output());
|
||||
if global_geo.contains(pointer_loc) {
|
||||
let buffer_pos = (pointer_loc - global_geo.loc)
|
||||
.as_logical()
|
||||
.to_buffer(1, Transform::Normal, &toplevel.geometry().size);
|
||||
let buffer_pos = (pointer_loc - global_geo.loc).as_logical().to_buffer(
|
||||
1,
|
||||
Transform::Normal,
|
||||
&toplevel.geometry().size,
|
||||
);
|
||||
session.set_cursor_hotspot(hotspot);
|
||||
session.set_cursor_pos(Some(buffer_pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toplevel.add_cursor_session(session);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -577,19 +577,17 @@ pub fn render_window_to_buffer(
|
|||
let pointer = seat.get_pointer().unwrap();
|
||||
let pointer_loc = pointer.current_location().to_i32_round().as_global();
|
||||
let mut location = None;
|
||||
if let Some(element) = shell.element_for_surface(toplevel) {
|
||||
if element.has_active_window(toplevel) {
|
||||
if let Some(workspace) = shell.space_for(element) {
|
||||
if let Some(geometry) = workspace.element_geometry(element) {
|
||||
if let Some(element) = shell.element_for_surface(toplevel)
|
||||
&& element.has_active_window(toplevel)
|
||||
&& let Some(workspace) = shell.space_for(element)
|
||||
&& let Some(geometry) = workspace.element_geometry(element)
|
||||
{
|
||||
let mut surface_geo = element.active_window_geometry().as_local();
|
||||
surface_geo.loc += geometry.loc;
|
||||
let global_geo = surface_geo.to_global(workspace.output());
|
||||
if global_geo.contains(pointer_loc) {
|
||||
location = Some((pointer_loc - global_geo.loc).as_logical().to_f64());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
std::mem::drop(shell);
|
||||
|
||||
|
|
@ -620,8 +618,7 @@ pub fn render_window_to_buffer(
|
|||
|
||||
// TODO cosmic-workspaces wants to omit, but metadata cursor capture in portal should
|
||||
// still include dnd surface in window capture buffer?
|
||||
if draw_cursor {
|
||||
if let Some(dnd_icon) = get_dnd_icon(&seat) {
|
||||
if draw_cursor && let Some(dnd_icon) = get_dnd_icon(&seat) {
|
||||
elements.extend(
|
||||
cursor::draw_dnd_icon(
|
||||
renderer,
|
||||
|
|
@ -634,7 +631,6 @@ pub fn render_window_to_buffer(
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elements.extend(AsRenderElements::<R>::render_elements::<
|
||||
WindowCaptureElement<R>,
|
||||
|
|
|
|||
|
|
@ -174,8 +174,8 @@ impl State {
|
|||
*current_config = backup;
|
||||
}
|
||||
}
|
||||
if !test_only {
|
||||
if let Err(err) = backend.apply_config_for_outputs(
|
||||
if !test_only
|
||||
&& let Err(err) = backend.apply_config_for_outputs(
|
||||
false,
|
||||
&self.common.event_loop_handle,
|
||||
self.common.config.dynamic_conf.screen_filter(),
|
||||
|
|
@ -184,10 +184,10 @@ impl State {
|
|||
&self.common.xdg_activation_state,
|
||||
self.common.startup_done.clone(),
|
||||
&self.common.clock,
|
||||
) {
|
||||
)
|
||||
{
|
||||
error!("Failed to reset output config: {:?}", err);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
self.common.refresh();
|
||||
|
|
|
|||
|
|
@ -70,10 +70,9 @@ impl SelectionHandler for State {
|
|||
.xwayland_state
|
||||
.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).");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ impl SessionLockHandler for State {
|
|||
let mut shell = self.common.shell.write();
|
||||
|
||||
// Reject lock if sesion lock exists and is still valid
|
||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
||||
if self
|
||||
if let Some(session_lock) = shell.session_lock.as_ref()
|
||||
&& self
|
||||
.common
|
||||
.display_handle
|
||||
.get_client(session_lock.ext_session_lock.id())
|
||||
|
|
@ -30,7 +30,6 @@ impl SessionLockHandler for State {
|
|||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let ext_session_lock = locker.ext_session_lock().clone();
|
||||
locker.lock();
|
||||
|
|
@ -55,8 +54,9 @@ impl SessionLockHandler for State {
|
|||
|
||||
fn new_surface(&mut self, lock_surface: LockSurface, wl_output: WlOutput) {
|
||||
let mut shell = self.common.shell.write();
|
||||
if let Some(session_lock) = &mut shell.session_lock {
|
||||
if let Some(output) = Output::from_resource(&wl_output) {
|
||||
if let Some(session_lock) = &mut shell.session_lock
|
||||
&& let Some(output) = Output::from_resource(&wl_output)
|
||||
{
|
||||
lock_surface.with_pending_state(|states| {
|
||||
let size = output.geometry().size;
|
||||
states.size = Some(Size::from((size.w as u32, size.h as u32)));
|
||||
|
|
@ -68,6 +68,5 @@ impl SessionLockHandler for State {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate_session_lock!(State);
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ impl ToplevelManagementHandler for State {
|
|||
// move pointer to window if it’s on a different monitor/output
|
||||
if seat.active_output() != *output
|
||||
&& 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);
|
||||
if let Some(ptr) = seat.get_pointer() {
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
|
|
@ -130,7 +130,6 @@ impl ToplevelManagementHandler for State {
|
|||
ptr.frame(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Shell::set_focus(self, Some(&target), &seat, None, false);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ impl State {
|
|||
None,
|
||||
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();
|
||||
if workspace == current_workspace.handle {
|
||||
let Some(target) = shell
|
||||
|
|
|
|||
|
|
@ -45,12 +45,7 @@ impl XdgShellHandler for State {
|
|||
let mut shell = self.common.shell.write();
|
||||
let seat = shell.seats.last_active().clone();
|
||||
|
||||
if shell
|
||||
.pending_windows
|
||||
.iter()
|
||||
.find(|w| &w.surface == &surface)
|
||||
.is_none()
|
||||
{
|
||||
if !shell.pending_windows.iter().any(|w| w.surface == surface) {
|
||||
let surface = CosmicSurface::from(surface);
|
||||
shell.pending_windows.push(PendingWindow {
|
||||
surface,
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ pub fn update_reactive_popups<'a>(
|
|||
for (popup, _) in PopupManager::popups_for_surface(toplevel.wl_surface()) {
|
||||
match popup {
|
||||
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>();
|
||||
guard
|
||||
.current()
|
||||
|
|
|
|||
|
|
@ -204,12 +204,12 @@ where
|
|||
state.request_screen_invert(inverted);
|
||||
}
|
||||
|
||||
if let Ok(filter) = filter {
|
||||
if filter != state.a11y_state().screen_filter {
|
||||
if let Ok(filter) = filter
|
||||
&& filter != state.a11y_state().screen_filter
|
||||
{
|
||||
state.request_screen_filter(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -428,8 +428,7 @@ where
|
|||
}
|
||||
} else {
|
||||
None
|
||||
} {
|
||||
if inner.enabled
|
||||
} && inner.enabled
|
||||
&& output
|
||||
.current_mode()
|
||||
.map(|c| c == output_mode)
|
||||
|
|
@ -438,7 +437,6 @@ where
|
|||
instance.obj.current_mode(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
instance
|
||||
.obj
|
||||
|
|
@ -513,14 +511,13 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(extension_obj) = instance.extension_obj.as_ref() {
|
||||
if inner.enabled
|
||||
if let Some(extension_obj) = instance.extension_obj.as_ref()
|
||||
&& inner.enabled
|
||||
&& extension_obj.version() >= zcosmic_output_head_v1::EVT_XWAYLAND_PRIMARY_SINCE
|
||||
{
|
||||
extension_obj.xwayland_primary(output.config().xwayland_primary as u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_global_with_timer<D: 'static>(
|
||||
dh: &DisplayHandle,
|
||||
|
|
|
|||
|
|
@ -58,8 +58,9 @@ impl OutputPowerState {
|
|||
let mut output_powers = mem::take(&mut state.output_power_state().output_powers);
|
||||
for (output_power, old_mode) in output_powers.iter_mut() {
|
||||
let data = output_power.data::<OutputPowerData>().unwrap();
|
||||
if let Some(output) = data.output.upgrade() {
|
||||
if let Some(on) = state.get_dpms(&output) {
|
||||
if let Some(output) = data.output.upgrade()
|
||||
&& let Some(on) = state.get_dpms(&output)
|
||||
{
|
||||
let mode = output_power_mode(on);
|
||||
if mode != *old_mode {
|
||||
output_power.mode(mode);
|
||||
|
|
@ -67,7 +68,6 @@ impl OutputPowerState {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
state.output_power_state().output_powers = output_powers;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,8 +124,9 @@ impl OverlapNotifyState {
|
|||
})
|
||||
})
|
||||
{
|
||||
if let Some(window_geo) = window.global_geometry() {
|
||||
if let Some(intersection) = layer_geo.intersection(window_geo) {
|
||||
if let Some(window_geo) = window.global_geometry()
|
||||
&& let Some(intersection) = layer_geo.intersection(window_geo)
|
||||
{
|
||||
// relative to layer location
|
||||
let region = Rectangle::new(
|
||||
intersection.loc - layer_geo.loc,
|
||||
|
|
@ -135,7 +136,6 @@ impl OverlapNotifyState {
|
|||
new_snapshot.add_toplevel(window, region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for other_surface in map.layers().filter(|s| *s != layer_surface) {
|
||||
if other_surface.wl_surface().id() == layer_surface.wl_surface().id() {
|
||||
|
|
@ -238,9 +238,10 @@ impl LayerOverlapNotificationDataInternal {
|
|||
.collect::<Vec<_>>();
|
||||
|
||||
for toplevel in self.last_snapshot.toplevel_overlaps.keys() {
|
||||
if !new_snapshot.toplevel_overlaps.contains_key(toplevel) {
|
||||
if let Ok(toplevel) = toplevel.upgrade() {
|
||||
if let Some(client) = toplevel.client() {
|
||||
if !new_snapshot.toplevel_overlaps.contains_key(toplevel)
|
||||
&& let Ok(toplevel) = toplevel.upgrade()
|
||||
&& let Some(client) = toplevel.client()
|
||||
{
|
||||
for notification in notifications
|
||||
.iter()
|
||||
.filter(|n| n.client().is_some_and(|c| c == client))
|
||||
|
|
@ -249,17 +250,15 @@ impl LayerOverlapNotificationDataInternal {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (toplevel, overlap) in &new_snapshot.toplevel_overlaps {
|
||||
if !self
|
||||
.last_snapshot
|
||||
.toplevel_overlaps
|
||||
.get(toplevel)
|
||||
.is_some_and(|old_overlap| old_overlap == overlap)
|
||||
&& let Ok(toplevel) = toplevel.upgrade()
|
||||
&& let Some(client) = toplevel.client()
|
||||
{
|
||||
if let Ok(toplevel) = toplevel.upgrade() {
|
||||
if let Some(client) = toplevel.client() {
|
||||
for notification in notifications
|
||||
.iter()
|
||||
.filter(|n| n.client().is_some_and(|c| c == client))
|
||||
|
|
@ -274,8 +273,6 @@ impl LayerOverlapNotificationDataInternal {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (layer_surface, (identifier, ..)) in &self.last_snapshot.layer_overlaps {
|
||||
if !new_snapshot.layer_overlaps.contains_key(layer_surface) {
|
||||
|
|
|
|||
|
|
@ -574,13 +574,11 @@ where
|
|||
instance.geometry(&wl_output, geo.loc.x, geo.loc.y, geo.size.w, geo.size.h);
|
||||
}
|
||||
changed = true;
|
||||
} else if geometry_changed {
|
||||
if let Some(geo) = geometry {
|
||||
} else if geometry_changed && let Some(geo) = geometry {
|
||||
instance.geometry(&wl_output, geo.loc.x, geo.loc.y, geo.size.w, geo.size.h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
handle_state.wl_outputs.retain(|wl_output| {
|
||||
let retain = wl_output.is_alive()
|
||||
&& handle_state
|
||||
|
|
@ -635,10 +633,10 @@ pub fn window_from_handle<W: Window + 'static>(handle: ZcosmicToplevelHandleV1)
|
|||
.and_then(|state| state.lock().unwrap().window.clone())
|
||||
}
|
||||
|
||||
pub fn window_from_ext<'a, W: Window + 'static, D>(
|
||||
state: &'a D,
|
||||
pub fn window_from_ext<W: Window + 'static, D>(
|
||||
state: &D,
|
||||
handle: ForeignToplevelHandle,
|
||||
) -> Option<&'a W>
|
||||
) -> Option<&W>
|
||||
where
|
||||
D: ToplevelInfoHandler<Window = W>,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -258,12 +258,11 @@ where
|
|||
let window = window_from_handle(toplevel).unwrap();
|
||||
if let Some(workspace_handle) =
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,14 +94,13 @@ where
|
|||
.iter()
|
||||
.flat_map(|g| &g.workspaces)
|
||||
.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);
|
||||
ext_mngr.done();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_manager_v2::Request::Destroy => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
|
@ -128,8 +127,7 @@ where
|
|||
zcosmic_workspace_handle_v2::Request::Rename { name } => {
|
||||
if let Some(workspace_handle) =
|
||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||
{
|
||||
if let Ok(manager) =
|
||||
&& let Ok(manager) =
|
||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||
{
|
||||
let mut state = manager
|
||||
|
|
@ -143,14 +141,12 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v2::Request::SetTilingState {
|
||||
state: tiling_state,
|
||||
} => {
|
||||
if let Some(workspace_handle) =
|
||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||
{
|
||||
if let Ok(manager) =
|
||||
&& let Ok(manager) =
|
||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||
{
|
||||
let mut state = manager
|
||||
|
|
@ -164,12 +160,10 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v2::Request::Pin => {
|
||||
if let Some(workspace_handle) =
|
||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||
{
|
||||
if let Ok(manager) =
|
||||
&& let Ok(manager) =
|
||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||
{
|
||||
let mut state = manager
|
||||
|
|
@ -183,12 +177,10 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v2::Request::Unpin => {
|
||||
if let Some(workspace_handle) =
|
||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||
{
|
||||
if let Ok(manager) =
|
||||
&& let Ok(manager) =
|
||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||
{
|
||||
let mut state = manager
|
||||
|
|
@ -202,19 +194,16 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v2::Request::MoveBefore {
|
||||
other_workspace,
|
||||
axis,
|
||||
} => {
|
||||
if let Some(workspace_handle) =
|
||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||
{
|
||||
if let Some(other_workspace) = state
|
||||
&& let Some(other_workspace) = state
|
||||
.workspace_state()
|
||||
.get_ext_workspace_handle(&other_workspace)
|
||||
{
|
||||
if let Ok(manager) =
|
||||
&& let Ok(manager) =
|
||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||
{
|
||||
let mut state = manager
|
||||
|
|
@ -229,20 +218,16 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v2::Request::MoveAfter {
|
||||
other_workspace,
|
||||
axis,
|
||||
} => {
|
||||
if let Some(workspace_handle) =
|
||||
state.workspace_state().get_ext_workspace_handle(&workspace)
|
||||
{
|
||||
if let Some(other_workspace) = state
|
||||
&& let Some(other_workspace) = state
|
||||
.workspace_state()
|
||||
.get_ext_workspace_handle(&other_workspace)
|
||||
{
|
||||
if let Ok(manager) =
|
||||
&& let Ok(manager) =
|
||||
workspace.data::<WorkspaceData>().unwrap().manager.upgrade()
|
||||
{
|
||||
let mut state = manager
|
||||
|
|
@ -257,8 +242,6 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
zcosmic_workspace_handle_v2::Request::Destroy => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,8 +152,8 @@ where
|
|||
.iter()
|
||||
.find(|g| g.ext_instances.contains(obj))
|
||||
.map(|g| g.id)
|
||||
&& let Ok(manager) = data.manager.upgrade()
|
||||
{
|
||||
if let Ok(manager) = data.manager.upgrade() {
|
||||
let mut state = manager
|
||||
.data::<WorkspaceManagerData>()
|
||||
.unwrap()
|
||||
|
|
@ -165,7 +165,6 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
ext_workspace_group_handle_v1::Request::Destroy => {
|
||||
for group in &mut state.workspace_state_mut().groups {
|
||||
group.ext_instances.retain(|i| i != obj)
|
||||
|
|
@ -204,8 +203,8 @@ where
|
|||
ext_workspace_handle_v1::Request::Activate => {
|
||||
if let Some(workspace_handle) =
|
||||
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
|
||||
.data::<WorkspaceManagerData>()
|
||||
.unwrap()
|
||||
|
|
@ -214,12 +213,11 @@ where
|
|||
state.requests.push(Request::Activate(workspace_handle));
|
||||
}
|
||||
}
|
||||
}
|
||||
ext_workspace_handle_v1::Request::Deactivate => {
|
||||
if let Some(workspace_handle) =
|
||||
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
|
||||
.data::<WorkspaceManagerData>()
|
||||
.unwrap()
|
||||
|
|
@ -228,12 +226,11 @@ where
|
|||
state.requests.push(Request::Deactivate(workspace_handle));
|
||||
}
|
||||
}
|
||||
}
|
||||
ext_workspace_handle_v1::Request::Remove => {
|
||||
if let Some(workspace_handle) =
|
||||
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
|
||||
.data::<WorkspaceManagerData>()
|
||||
.unwrap()
|
||||
|
|
@ -242,19 +239,17 @@ where
|
|||
state.requests.push(Request::Remove(workspace_handle));
|
||||
}
|
||||
}
|
||||
}
|
||||
ext_workspace_handle_v1::Request::Assign { workspace_group } => {
|
||||
if let Some(workspace_handle) =
|
||||
state.workspace_state().get_ext_workspace_handle(obj)
|
||||
{
|
||||
if let Some(group_id) = state
|
||||
&& let Some(group_id) = state
|
||||
.workspace_state()
|
||||
.groups
|
||||
.iter()
|
||||
.find(|g| g.ext_instances.contains(&workspace_group))
|
||||
.map(|g| g.id)
|
||||
&& let Ok(manager) = data.manager.upgrade()
|
||||
{
|
||||
if let Ok(manager) = data.manager.upgrade() {
|
||||
let mut state = manager
|
||||
.data::<WorkspaceManagerData>()
|
||||
.unwrap()
|
||||
|
|
@ -266,8 +261,6 @@ where
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ext_workspace_handle_v1::Request::Destroy => {
|
||||
for group in &mut state.workspace_state_mut().groups {
|
||||
for workspace in &mut group.workspaces {
|
||||
|
|
@ -491,11 +484,11 @@ where
|
|||
changed = true;
|
||||
}
|
||||
|
||||
if handle_state.ext_id.is_none() {
|
||||
if let Some(id) = workspace.ext_id.clone() {
|
||||
if handle_state.ext_id.is_none()
|
||||
&& let Some(id) = workspace.ext_id.clone()
|
||||
{
|
||||
instance.id(id);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(cosmic_v2_handle) = handle_state
|
||||
.cosmic_v2_handle
|
||||
|
|
|
|||
|
|
@ -85,11 +85,11 @@ fn xrdb_thread(rx: Receiver<(String, u32)>, display: u32) {
|
|||
"Xcursor.theme: {}\nXcursor.size: {}\n",
|
||||
cursor_theme, cursor_size,
|
||||
);
|
||||
if let Some(mut stdin) = child.stdin.take() {
|
||||
if let Err(err) = stdin.write_all(resources.as_bytes()) {
|
||||
if let Some(mut stdin) = child.stdin.take()
|
||||
&& let Err(err) = stdin.write_all(resources.as_bytes())
|
||||
{
|
||||
warn!("Failed to update xresources: {}", err);
|
||||
}
|
||||
}
|
||||
match child.wait() {
|
||||
Ok(code) if code.success() => {}
|
||||
Ok(code) => {
|
||||
|
|
@ -346,8 +346,8 @@ impl Common {
|
|||
self.xwayland_reset_eavesdropping(serial);
|
||||
|
||||
let xstate = self.xwayland_state.as_mut().unwrap();
|
||||
if let Some(mime_types) = xstate.clipboard_selection_dirty.take() {
|
||||
if let Err(err) = xstate
|
||||
if let Some(mime_types) = xstate.clipboard_selection_dirty.take()
|
||||
&& let Err(err) = xstate
|
||||
.xwm
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
|
|
@ -355,9 +355,8 @@ impl Common {
|
|||
{
|
||||
warn!(?err, "Failed to set Xwayland clipboard selection.");
|
||||
}
|
||||
}
|
||||
if let Some(mime_types) = xstate.primary_selection_dirty.take() {
|
||||
if let Err(err) = xstate
|
||||
if let Some(mime_types) = xstate.primary_selection_dirty.take()
|
||||
&& let Err(err) = xstate
|
||||
.xwm
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
|
|
@ -368,7 +367,6 @@ impl Common {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn xwayland_reset_eavesdropping(&mut self, serial: Serial) {
|
||||
let seat = self.shell.read().seats.last_active().clone();
|
||||
|
|
@ -650,7 +648,7 @@ impl Common {
|
|||
}
|
||||
XwaylandDescaling::Fractional => {
|
||||
let shell = self.shell.read();
|
||||
let val =
|
||||
|
||||
if let Some(output) = shell.outputs().find(|o| o.config().xwayland_primary) {
|
||||
output.current_scale().fractional_scale().max(1f64)
|
||||
} else {
|
||||
|
|
@ -658,8 +656,7 @@ impl Common {
|
|||
.outputs()
|
||||
.map(|o| o.current_scale().fractional_scale())
|
||||
.fold(1f64, |acc, val| acc.max(val))
|
||||
};
|
||||
val
|
||||
}
|
||||
}
|
||||
};
|
||||
let (_, cursor_size) = load_cursor_env();
|
||||
|
|
@ -710,10 +707,14 @@ impl Common {
|
|||
None
|
||||
};
|
||||
|
||||
if let Err(_) = xwayland.xrdb_thread.send((
|
||||
if xwayland
|
||||
.xrdb_thread
|
||||
.send((
|
||||
cosmic::icon_theme::default(),
|
||||
(new_scale * cursor_size as f64).round() as u32,
|
||||
)) {
|
||||
))
|
||||
.is_err()
|
||||
{
|
||||
warn!("xrdb thread died");
|
||||
}
|
||||
|
||||
|
|
@ -756,14 +757,13 @@ impl Common {
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(xstate) = self.xwayland_state.as_mut() {
|
||||
if let Some(xwm) = xstate.xwm.as_mut() {
|
||||
if let Err(err) = xwm.set_randr_primary_output(xwayland_primary_output.as_ref()) {
|
||||
if let Some(xstate) = self.xwayland_state.as_mut()
|
||||
&& let Some(xwm) = xstate.xwm.as_mut()
|
||||
&& let Err(err) = xwm.set_randr_primary_output(xwayland_primary_output.as_ref())
|
||||
{
|
||||
warn!("Failed to set xwayland primary output: {}", err);
|
||||
return;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
self.output_configuration_state.update();
|
||||
}
|
||||
|
|
@ -808,12 +808,7 @@ impl XwmHandler for State {
|
|||
*context,
|
||||
);
|
||||
}
|
||||
if shell
|
||||
.pending_windows
|
||||
.iter()
|
||||
.find(|w| w.surface == window)
|
||||
.is_none()
|
||||
{
|
||||
if !shell.pending_windows.iter().any(|w| w.surface == window) {
|
||||
let surface = CosmicSurface::from(window);
|
||||
shell.pending_windows.push(PendingWindow {
|
||||
surface,
|
||||
|
|
@ -835,9 +830,8 @@ impl XwmHandler for State {
|
|||
if let std::collections::hash_map::Entry::Vacant(e) = shell
|
||||
.pending_activations
|
||||
.entry(crate::shell::ActivationKey::X11(surface.window_id()))
|
||||
{
|
||||
if let Some(startup_id) = window.x11_surface().and_then(|x| x.startup_id()) {
|
||||
if let Some(context) = self
|
||||
&& 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))
|
||||
|
|
@ -845,8 +839,6 @@ impl XwmHandler for State {
|
|||
{
|
||||
e.insert(*context);
|
||||
}
|
||||
}
|
||||
}
|
||||
let res = shell.map_window(
|
||||
&window,
|
||||
&mut self.common.toplevel_info_state,
|
||||
|
|
@ -881,11 +873,10 @@ impl XwmHandler for State {
|
|||
let seat = shell.seats.last_active().clone();
|
||||
if let Some(pending) =
|
||||
shell.unmap_surface(&window, &seat, &mut self.common.toplevel_info_state)
|
||||
&& shell
|
||||
&& !shell
|
||||
.pending_windows
|
||||
.iter()
|
||||
.find(|w| &w.surface == &pending.surface)
|
||||
.is_none()
|
||||
.any(|w| w.surface == pending.surface)
|
||||
{
|
||||
shell.pending_windows.push(pending);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue