aboutsummaryrefslogtreecommitdiff
path: root/src/layout/monitor.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-10-10 09:24:20 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-10-10 09:24:20 +0300
commitab7d81aae00e88395f85b629489512b4a7bac064 (patch)
tree239f976094a3454022754e218fb71c6fceee8431 /src/layout/monitor.rs
parente24723125f5ef91983735043fba893a940469686 (diff)
downloadniri-ab7d81aae00e88395f85b629489512b4a7bac064.tar.gz
niri-ab7d81aae00e88395f85b629489512b4a7bac064.tar.bz2
niri-ab7d81aae00e88395f85b629489512b4a7bac064.zip
layout: Reduce field visibility
The outside code isn't supposed to mess with the fields.
Diffstat (limited to 'src/layout/monitor.rs')
-rw-r--r--src/layout/monitor.rs22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs
index 2bd84665..a4960012 100644
--- a/src/layout/monitor.rs
+++ b/src/layout/monitor.rs
@@ -33,19 +33,19 @@ const WORKSPACE_GESTURE_RUBBER_BAND: RubberBand = RubberBand {
#[derive(Debug)]
pub struct Monitor<W: LayoutElement> {
/// Output for this monitor.
- pub output: Output,
+ pub(super) output: Output,
/// Cached name of the output.
output_name: String,
// Must always contain at least one.
- pub workspaces: Vec<Workspace<W>>,
+ pub(super) workspaces: Vec<Workspace<W>>,
/// Index of the currently active workspace.
- pub active_workspace_idx: usize,
+ pub(super) active_workspace_idx: usize,
/// ID of the previously active workspace.
- pub previous_workspace_id: Option<WorkspaceId>,
+ pub(super) previous_workspace_id: Option<WorkspaceId>,
/// In-progress switch between workspaces.
- pub workspace_switch: Option<WorkspaceSwitch>,
+ pub(super) workspace_switch: Option<WorkspaceSwitch>,
/// Configurable properties of the layout.
- pub options: Rc<Options>,
+ pub(super) options: Rc<Options>,
}
#[derive(Debug)]
@@ -59,7 +59,7 @@ pub struct WorkspaceSwitchGesture {
/// Index of the workspace where the gesture was started.
center_idx: usize,
/// Current, fractional workspace index.
- pub current_idx: f64,
+ pub(super) current_idx: f64,
tracker: SwipeTracker,
/// Whether the gesture is controlled by the touchpad.
is_touchpad: bool,
@@ -105,10 +105,18 @@ impl<W: LayoutElement> Monitor<W> {
}
}
+ pub fn output(&self) -> &Output {
+ &self.output
+ }
+
pub fn output_name(&self) -> &String {
&self.output_name
}
+ pub fn active_workspace_idx(&self) -> usize {
+ self.active_workspace_idx
+ }
+
pub fn active_workspace_ref(&self) -> &Workspace<W> {
&self.workspaces[self.active_workspace_idx]
}