Fix building mock backend
This commit is contained in:
parent
3dc82789f5
commit
207e7b2ff3
2 changed files with 17 additions and 11 deletions
|
|
@ -25,7 +25,7 @@ use std::{
|
||||||
fs,
|
fs,
|
||||||
io::{self, Write},
|
io::{self, Write},
|
||||||
sync::{
|
sync::{
|
||||||
atomic::{AtomicUsize, Ordering},
|
atomic::{AtomicU32, Ordering},
|
||||||
Arc,
|
Arc,
|
||||||
},
|
},
|
||||||
thread,
|
thread,
|
||||||
|
|
@ -35,7 +35,13 @@ use super::{CaptureImage, Cmd, Event};
|
||||||
use crate::utils;
|
use crate::utils;
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
||||||
struct MockObjectId(usize);
|
pub struct MockObjectId(u32);
|
||||||
|
|
||||||
|
impl MockObjectId {
|
||||||
|
pub fn protocol_id(&self) -> u32 {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn create_solid_capture_image(r: u8, g: u8, b: u8) -> CaptureImage {
|
fn create_solid_capture_image(r: u8, g: u8, b: u8) -> CaptureImage {
|
||||||
let file = fs::File::from(utils::create_memfile().unwrap());
|
let file = fs::File::from(utils::create_memfile().unwrap());
|
||||||
|
|
@ -68,7 +74,7 @@ fn create_solid_capture_image(r: u8, g: u8, b: u8) -> CaptureImage {
|
||||||
|
|
||||||
impl MockObjectId {
|
impl MockObjectId {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
static NEXT_MOCK_ID: AtomicUsize = AtomicUsize::new(0);
|
static NEXT_MOCK_ID: AtomicU32 = AtomicU32::new(0);
|
||||||
Self(NEXT_MOCK_ID.fetch_add(1, Ordering::SeqCst))
|
Self(NEXT_MOCK_ID.fetch_add(1, Ordering::SeqCst))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -76,6 +82,12 @@ impl MockObjectId {
|
||||||
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
||||||
pub struct ZcosmicWorkspaceHandleV1(MockObjectId);
|
pub struct ZcosmicWorkspaceHandleV1(MockObjectId);
|
||||||
|
|
||||||
|
impl ZcosmicWorkspaceHandleV1 {
|
||||||
|
pub fn id(&self) -> MockObjectId {
|
||||||
|
self.0.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
||||||
pub struct ZcosmicToplevelHandleV1(MockObjectId);
|
pub struct ZcosmicToplevelHandleV1(MockObjectId);
|
||||||
|
|
||||||
|
|
|
||||||
10
src/dnd.rs
10
src/dnd.rs
|
|
@ -1,10 +1,7 @@
|
||||||
//! Types related to drag-and-drop
|
//! Types related to drag-and-drop
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
cctk::{
|
cctk::wayland_client::{protocol::wl_output, Proxy},
|
||||||
cosmic_protocols::workspace::v1::client::zcosmic_workspace_handle_v1,
|
|
||||||
wayland_client::{protocol::wl_output, Proxy},
|
|
||||||
},
|
|
||||||
iced::clipboard::mime::AsMimeTypes,
|
iced::clipboard::mime::AsMimeTypes,
|
||||||
};
|
};
|
||||||
use std::{borrow::Cow, sync::LazyLock};
|
use std::{borrow::Cow, sync::LazyLock};
|
||||||
|
|
@ -71,10 +68,7 @@ impl TryFrom<(Vec<u8>, std::string::String)> for DragToplevel {
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum DropTarget {
|
pub enum DropTarget {
|
||||||
WorkspaceSidebarEntry(
|
WorkspaceSidebarEntry(ZcosmicWorkspaceHandleV1, wl_output::WlOutput),
|
||||||
zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1,
|
|
||||||
wl_output::WlOutput,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DropTarget {
|
impl DropTarget {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue