Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul of workspace code #194

Merged
merged 27 commits into from Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
42aaafe
utils: New geometry spaces local/global
Drakulix Oct 25, 2023
72df9d0
shell: One workspace per output
Drakulix Oct 25, 2023
6956342
shell: Rework maximize/fullscreen
Drakulix Oct 25, 2023
14ef57f
shell: Add update_config and fix workspace groups
Drakulix Oct 11, 2023
2e96236
kms: Handle subpixel layouts
Drakulix Oct 11, 2023
aec8263
move: Render translucent on non-active output
Drakulix Oct 11, 2023
64143e7
shell: Properly handle fullscreen outputs
Drakulix Oct 11, 2023
ab522dc
workspace: potential crash fix
Drakulix Oct 12, 2023
4199843
xdg-shell: Fix sub-popup positioning
Drakulix Oct 12, 2023
c16b86d
fix(shell): lagging tab animations
mmstick Oct 17, 2023
abbe94e
feat: theme integration
wash2 Oct 10, 2023
4e160dc
chore: cleanup libcosmic branch
wash2 Oct 17, 2023
d9e3d60
refactor: use a static color for CLEAR_COLOR
wash2 Oct 17, 2023
8561ab6
Update `smithay`
ids1024 Oct 19, 2023
ba44289
kms/deps: Fix nvidia 545 beta
Drakulix Oct 23, 2023
d6434d3
floating: Limit resizing to current output
Drakulix Oct 23, 2023
5b7efa3
floating: Restore size of moved maximized windows correctly
Drakulix Oct 23, 2023
b114865
Update `smithay`
ids1024 Oct 24, 2023
3901e63
floating: Don't render hint for maximized window
Drakulix Oct 24, 2023
724a417
shell: Fix moving fullscreen windows
Drakulix Oct 24, 2023
781427a
focus: Restore nested popup grabs
Drakulix Oct 24, 2023
ffb7bcf
shell: Don't crash when the last output is removed
Drakulix Oct 24, 2023
4f076f7
xwm: Fix stacking order
Drakulix Oct 25, 2023
33ee25c
shell: Don't be too pendantic about workspace groups
Drakulix Oct 25, 2023
1d799f4
shell: Fix dragging maximized windows on non-origin outputs
Drakulix Oct 25, 2023
33688e9
tiling: Fix rounding error causing overlap
Drakulix Oct 26, 2023
a957393
tiling/resize: Use old tree for correct ratios
Drakulix Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
560 changes: 309 additions & 251 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions Cargo.toml
Expand Up @@ -36,10 +36,10 @@ libsystemd = { version = "0.6", optional = true }
wayland-backend = "0.3.2"
wayland-scanner = "0.31.0"
cosmic-comp-config = { path = "cosmic-comp-config" }
cosmic-config = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", features = ["calloop"] }
cosmic-config = { git = "https://github.com/pop-os/libcosmic/", features = ["calloop", "macro"] }
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", branch = "main", default-features = false, features = ["server"] }
libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d" }
libcosmic = { git = "https://github.com/pop-os/libcosmic/", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/" }
tiny-skia = "0.10"
ordered-float = "4.0"
glow = "0.12.0"
Expand All @@ -53,6 +53,7 @@ once_cell = "1.18.0"
i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] }
i18n-embed-fl = "0.7"
rust-embed = "8.0"
libc = "0.2.149"

[dependencies.id_tree]
git = "https://github.com/Drakulix/id-tree.git"
Expand Down Expand Up @@ -87,7 +88,4 @@ debug = true
lto = "fat"

[patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/smithay//smithay", rev = "d60b1b83e" }

[patch.crates-io]
calloop = { git = "https://github.com/Smithay/calloop", rev = "71b6e633b1" }
smithay = { git = "https://github.com/pop-os/smithay", branch = "x11_fixes" }
63 changes: 37 additions & 26 deletions src/backend/kms/mod.rs
Expand Up @@ -16,6 +16,7 @@ use crate::{

use anyhow::{Context, Result};
use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_session_v1::FailureReason;
use libc::dev_t;
use smithay::{
backend::{
allocator::{
Expand All @@ -25,7 +26,7 @@ use smithay::{
Allocator, Format, Fourcc,
},
drm::{
compositor::{BlitFrameResultError, DrmCompositor, FrameError},
compositor::{BlitFrameResultError, DrmCompositor, FrameError, PrimaryPlaneElement},
DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime, DrmNode, NodeType,
},
egl::{EGLContext, EGLDevice, EGLDisplay},
Expand Down Expand Up @@ -58,7 +59,7 @@ use smithay::{
Device as _,
},
input::{self, Libinput},
nix::{fcntl::OFlag, sys::stat::dev_t},
rustix::fs::OFlags,
wayland_protocols::wp::{
linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1,
presentation_time::server::wp_presentation_feedback,
Expand All @@ -82,7 +83,6 @@ use std::{
collections::{HashMap, HashSet},
ffi::CStr,
fmt,
os::unix::io::FromRawFd,
path::PathBuf,
time::Duration,
};
Expand Down Expand Up @@ -418,23 +418,21 @@ impl State {
return Ok(());
}

let fd = DrmDeviceFd::new(unsafe {
DeviceFd::from_raw_fd(
self.backend
.kms()
.session
.open(
&path,
OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_NOCTTY | OFlag::O_NONBLOCK,
let fd = DrmDeviceFd::new(DeviceFd::from(
self.backend
.kms()
.session
.open(
&path,
OFlags::RDWR | OFlags::CLOEXEC | OFlags::NOCTTY | OFlags::NONBLOCK,
)
.with_context(|| {
format!(
"Failed to optain file descriptor for drm device: {}",
path.display()
)
.with_context(|| {
format!(
"Failed to optain file descriptor for drm device: {}",
path.display()
)
})?,
)
});
})?,
));
let (drm, notifier) = DrmDevice::new(fd.clone(), false)
.with_context(|| format!("Failed to initialize drm device for: {}", path.display()))?;
let drm_node = DrmNode::from_dev_id(dev)?;
Expand Down Expand Up @@ -1014,8 +1012,14 @@ impl Device {
interface,
PhysicalProperties {
size: (phys_w as i32, phys_h as i32).into(),
// TODO: We need to read that from the connector properties
subpixel: Subpixel::Unknown,
subpixel: match conn_info.subpixel() {
connector::SubPixel::HorizontalRgb => Subpixel::HorizontalRgb,
connector::SubPixel::HorizontalBgr => Subpixel::HorizontalBgr,
connector::SubPixel::VerticalRgb => Subpixel::VerticalRgb,
connector::SubPixel::VerticalBgr => Subpixel::VerticalBgr,
connector::SubPixel::None => Subpixel::None,
_ => Subpixel::Unknown,
},
make: edid_info
.as_ref()
.map(|info| info.manufacturer.clone())
Expand Down Expand Up @@ -1093,8 +1097,8 @@ fn render_node_for_output(
) -> DrmNode {
let workspace = shell.active_space(output);
let nodes = workspace
.get_fullscreen(output)
.map(|w| vec![w.surface()])
.get_fullscreen()
.map(|w| vec![w.clone()])
.unwrap_or_else(|| workspace.windows().collect::<Vec<_>>())
.into_iter()
.flat_map(|w| w.wl_surface().and_then(|s| source_node_for_surface(&s, dh)))
Expand Down Expand Up @@ -1235,8 +1239,11 @@ impl Surface {
})?;
self.fps.elements();

let res =
compositor.render_frame::<_, _, GlesTexture>(&mut renderer, &elements, CLEAR_COLOR);
let res = compositor.render_frame::<_, _, GlesTexture>(
&mut renderer,
&elements,
CLEAR_COLOR, // TODO use a theme neutral color
);
self.fps.render();

match res {
Expand All @@ -1247,6 +1254,11 @@ impl Surface {
None
};

if frame_result.needs_sync() {
if let PrimaryPlaneElement::Swapchain(elem) = &frame_result.primary_element {
elem.sync.wait();
}
}
match compositor.queue_frame(feedback) {
Ok(()) | Err(FrameError::EmptyFrame) => {}
Err(err) => {
Expand Down Expand Up @@ -1507,7 +1519,6 @@ impl KmsState {
false
};

shell.refresh_outputs();
if recreated {
let sessions = output.pending_buffers().collect::<Vec<_>>();
if let Err(err) = self.schedule_render(
Expand Down