summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoname <[email protected]>2025-03-07 18:10:37 +1100
committernoname <[email protected]>2025-03-07 18:10:37 +1100
commit4b7e91493c900028dc6120d55005f51d5242be02 (patch)
tree9ef25a85758c2d54b85709d94641c1f04dc4148d
parent7bec8a8f9bd8b0e0fa9a9997b48463765dc79a47 (diff)
make setter of properties private
-rw-r--r--lib/sway/container.vala12
-rw-r--r--lib/sway/ipc.vala3
-rw-r--r--lib/sway/node.vala4
-rw-r--r--lib/sway/output.vala20
-rw-r--r--lib/sway/window.vala10
-rw-r--r--lib/sway/workspace.vala8
6 files changed, 27 insertions, 30 deletions
diff --git a/lib/sway/container.vala b/lib/sway/container.vala
index 414c902..fc11b76 100644
--- a/lib/sway/container.vala
+++ b/lib/sway/container.vala
@@ -1,11 +1,11 @@
namespace AstalSway {
public class Container : Node {
- public bool sticky;
- public bool floating;
- public bool focused;
- public string border;
- public int border_width;
- public int fullscreen_mode;
+ public bool sticky { get; private set; }
+ public bool floating { get; private set; }
+ public bool focused { get; private set; }
+ public string border { get; private set; }
+ public int border_width { get; private set; }
+ public int fullscreen_mode { get; private set; }
public float percent { get; private set; }
public Container() {
diff --git a/lib/sway/ipc.vala b/lib/sway/ipc.vala
index cbd9a5f..b4ee15d 100644
--- a/lib/sway/ipc.vala
+++ b/lib/sway/ipc.vala
@@ -43,9 +43,6 @@ private class Ipc : Object {
try {
var header = stream.read_bytes(14);
uint8 data[14] = header.get_data();
- if (data == null) {
- return null;
- }
uint32 pl_length = *(uint32 *)&data[IPC_MAGIC.length];
PayloadType pl_type = *(uint32 *)&data[IPC_MAGIC.length+4];
diff --git a/lib/sway/node.vala b/lib/sway/node.vala
index 13fbcd1..9a0332c 100644
--- a/lib/sway/node.vala
+++ b/lib/sway/node.vala
@@ -1,6 +1,6 @@
namespace AstalSway {
public class Node : Object {
- public int id {get; private set; }
+ public int id { get; private set; }
public bool urgent { get; private set; }
public string name { get; private set; }
public string layout { get; private set; }
@@ -8,7 +8,7 @@ public class Node : Object {
public Rectangle rect { get; private set; }
public Rectangle window_rect { get; private set; }
public Rectangle deco_rect { get; private set; }
- public NodeType node_type {get; protected set;}
+ public NodeType node_type { get; protected set;}
public weak Node parent;
diff --git a/lib/sway/output.vala b/lib/sway/output.vala
index cd0c7db..c3bbac1 100644
--- a/lib/sway/output.vala
+++ b/lib/sway/output.vala
@@ -1,15 +1,15 @@
namespace AstalSway {
public class Output : Node {
- public string make;
- public string model;
- public string serial;
- public bool active;
- public bool power;
- public bool focused;
- public float scale;
- public string subpixel_hinting;
- public string transform;
- public Workspace current_workspace;
+ public string make { get; private set; }
+ public string model { get; private set; }
+ public string serial { get; private set; }
+ public bool active { get; private set; }
+ public bool power { get; private set; }
+ public bool focused { get; private set; }
+ public float scale { get; private set; }
+ public string subpixel_hinting { get; private set; }
+ public string transform { get; private set; }
+ public Workspace current_workspace { get; private set; }
public List<weak Workspace> workspaces { owned get {
var arr = new List<weak Workspace> ();
foreach (var node in nodes) {
diff --git a/lib/sway/window.vala b/lib/sway/window.vala
index 012e76e..651e593 100644
--- a/lib/sway/window.vala
+++ b/lib/sway/window.vala
@@ -1,10 +1,10 @@
namespace AstalSway {
public class Window : Container {
- public string app_id;
- public string shell;
- public int pid;
- public bool visible;
- public bool inhibit_idle;
+ public string app_id { get; private set; }
+ public string shell { get; private set; }
+ public int pid { get; private set; }
+ public bool visible { get; private set; }
+ public bool inhibit_idle { get; private set; }
public Window() {
node_type = NodeType.WINDOW;
diff --git a/lib/sway/workspace.vala b/lib/sway/workspace.vala
index c8f584c..bf0491d 100644
--- a/lib/sway/workspace.vala
+++ b/lib/sway/workspace.vala
@@ -1,9 +1,9 @@
namespace AstalSway {
public class Workspace : Node {
- public string representation;
- public bool focused;
- public bool visible;
- public int num;
+ public string representation { get; private set; }
+ public bool focused { get; private set; }
+ public bool visible { get; private set; }
+ public int num { get; private set; }
public Workspace() {
node_type = NodeType.WORKSPACE;