mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 13:51:19 +01:00
refactor(kde): order monitor.rs like the Windows monitor
Pure move, no behaviour change: struct Monitor first, then impl_ring_elements!, then MonitorInformation and its From impl, as in komorebi/src/monitor.rs. Field order and field sets are untouched (the derive order is the JSON order of the state, and Windows' extra fields name, device_id and workspace_names are content, not layout; see docs/dev/core-model.md). Verified: KDE cargo test -p komorebi --lib --tests (native): 633 passed, 0 failed. Not run: doc tests, VM suites.
This commit is contained in:
1 parent
ace81232a5
commit
3603926f0e
1 file changed
+23
-23
@@ -37,29 +37,6 @@ use serde::Serialize;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
/// A monitor's identity and bounds, as the daemon answers
|
||||
/// [`SocketMessage::MonitorInformation`](crate::core::SocketMessage::MonitorInformation) with them
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct MonitorInformation {
|
||||
pub id: u32,
|
||||
pub device: String,
|
||||
pub serial_number_id: String,
|
||||
pub size: Rect,
|
||||
}
|
||||
|
||||
impl From<&Monitor> for MonitorInformation {
|
||||
fn from(value: &Monitor) -> Self {
|
||||
Self {
|
||||
id: value.id,
|
||||
device: value.device.clone(),
|
||||
serial_number_id: value.serial_number_id.clone(),
|
||||
size: value.size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl_ring_elements!(Monitor, Workspace);
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
pub struct Monitor {
|
||||
@@ -85,6 +62,29 @@ pub struct Monitor {
|
||||
pub floating_layer_behaviour: Option<FloatingLayerBehaviour>,
|
||||
}
|
||||
|
||||
impl_ring_elements!(Monitor, Workspace);
|
||||
|
||||
/// A monitor's identity and bounds, as the daemon answers
|
||||
/// [`SocketMessage::MonitorInformation`](crate::core::SocketMessage::MonitorInformation) with them
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct MonitorInformation {
|
||||
pub id: u32,
|
||||
pub device: String,
|
||||
pub serial_number_id: String,
|
||||
pub size: Rect,
|
||||
}
|
||||
|
||||
impl From<&Monitor> for MonitorInformation {
|
||||
fn from(value: &Monitor) -> Self {
|
||||
Self {
|
||||
id: value.id,
|
||||
device: value.device.clone(),
|
||||
serial_number_id: value.serial_number_id.clone(),
|
||||
size: value.size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a monitor with one empty workspace, the way [`Monitor::new`] makes one, from owned
|
||||
/// names
|
||||
pub fn new(
|
||||
|
||||
Reference in new issue
Block a user