Skip to content

Commit

Permalink
WIP image-capture-source / image-copy-capture
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Dec 26, 2024
1 parent ca6a36e commit a5b95be
Show file tree
Hide file tree
Showing 5 changed files with 506 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ thiserror = "1.0.30"
wayland-backend = "0.3.0"
wayland-client = "0.31.1"
wayland-cursor = "0.31.0"
wayland-protocols = { version = "0.32.1", features = ["client", "staging", "unstable"] }
wayland-protocols = { version = "0.32.4", features = ["client", "staging", "unstable"] }
wayland-protocols-wlr = { version = "0.3.1", features = ["client"] }
wayland-scanner = "0.31.0"
wayland-csd-frame = "0.3.0"
Expand Down
83 changes: 83 additions & 0 deletions examples/image_copy_capture.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
use smithay_client_toolkit::{
delegate_image_copy_capture,
image_copy_capture::{
BufferConstraints, Frame, ImageCopyCaptureHandler, ImageCopyCaptureState,
ImageCopyFrameData, ImageCopyFrameDataExt, ImageCopySessionData, ImageCopySessionDataExt,
},
};
use wayland_client::{Connection, QueueHandle, WEnum};
use wayland_protocols::ext::image_copy_capture::v1::client::{
ext_image_copy_capture_cursor_session_v1, ext_image_copy_capture_frame_v1,

Check warning on line 10 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused imports: `ext_image_copy_capture_cursor_session_v1` and `ext_image_copy_capture_manager_v1`

Check warning on line 10 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused imports: `ext_image_copy_capture_cursor_session_v1` and `ext_image_copy_capture_manager_v1`
ext_image_copy_capture_manager_v1, ext_image_copy_capture_session_v1,
};

struct State {
image_copy_capture_state: ImageCopyCaptureState,
}

struct SessionData {
session_data: ImageCopySessionData,
}

impl ImageCopySessionDataExt for SessionData {
fn image_copy_session_data(&self) -> &ImageCopySessionData {
&self.session_data
}
}

struct FrameData {
frame_data: ImageCopyFrameData,
}

impl ImageCopyFrameDataExt for FrameData {
fn image_copy_frame_data(&self) -> &ImageCopyFrameData {
&self.frame_data
}
}

struct CursorSessionData {}

fn main() {}

impl ImageCopyCaptureHandler for State {
fn image_copy_capture_state(&mut self) -> &mut ImageCopyCaptureState {
&mut self.image_copy_capture_state
}

fn buffer_constraints(
&mut self,
conn: &Connection,

Check warning on line 49 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused variable: `conn`

Check warning on line 49 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused variable: `conn`
qh: &QueueHandle<Self>,

Check warning on line 50 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused variable: `qh`

Check warning on line 50 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused variable: `qh`
session: &ext_image_copy_capture_session_v1::ExtImageCopyCaptureSessionV1,

Check warning on line 51 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused variable: `session`

Check warning on line 51 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused variable: `session`
constraints: BufferConstraints,

Check warning on line 52 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused variable: `constraints`

Check warning on line 52 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused variable: `constraints`
) {
}

fn stopped(
&mut self,
conn: &Connection,

Check warning on line 58 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused variable: `conn`

Check warning on line 58 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused variable: `conn`
qh: &QueueHandle<Self>,

Check warning on line 59 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused variable: `qh`

Check warning on line 59 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused variable: `qh`
session: &ext_image_copy_capture_session_v1::ExtImageCopyCaptureSessionV1,

Check warning on line 60 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (stable)

unused variable: `session`

Check warning on line 60 in examples/image_copy_capture.rs

View workflow job for this annotation

GitHub Actions / test (beta)

unused variable: `session`
) {
}

fn ready(
&mut self,
conn: &Connection,
qh: &QueueHandle<Self>,
image_copy_frame: &ext_image_copy_capture_frame_v1::ExtImageCopyCaptureFrameV1,
frame: Frame,
) {
}

fn failed(
&mut self,
conn: &Connection,
qh: &QueueHandle<Self>,
image_copy_frame: &ext_image_copy_capture_frame_v1::ExtImageCopyCaptureFrameV1,
reason: WEnum<ext_image_copy_capture_frame_v1::FailureReason>,
) {
}
}

delegate_image_copy_capture!(State, session: [SessionData], frame: [FrameData], cursor_session: [CursorSessionData]);
4 changes: 2 additions & 2 deletions src/dmabuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use wayland_protocols::wp::linux_dmabuf::zv1::client::{

// Workaround until `libc` updates to FreeBSD 12 ABI
#[cfg(target_os = "freebsd")]
type dev_t = u64;
pub(crate) type dev_t = u64;
#[cfg(not(target_os = "freebsd"))]
use libc::dev_t;
pub(crate) use libc::dev_t;

/// A preference tranche of dmabuf formats
#[derive(Clone, Debug)]
Expand Down
Loading

0 comments on commit a5b95be

Please sign in to comment.