[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Monitor objects per monitor-index



Aaand probably the last one for today :)

This patch adds monitor objects to be able to access them by their
index if they are unnamed.

-- 
() ascii ribbon campaign - stop html mail    www.asciiribbon.org
/\ www.the-compiler.org  | I love long mails http://email.is-not-s.ms/
Fashion is a form of ugliness so intolerable that we have to alter it every 
six months. -- Oscar Wilde 
From df9b7e87d45f47282f7150d3731e0190a3340fd0 Mon Sep 17 00:00:00 2001
From: Florian Bruhin <git _at_ the _minus_ compiler _dot_ org>
Date: Tue, 18 Jun 2013 17:51:31 +0200
Subject: [PATCH] Add objects monitors.* to access monitors per id

---
 src/monitor.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/monitor.c b/src/monitor.c
index 918c91e..59ef33c 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -416,6 +416,16 @@ HSMonitor* add_monitor(XRectangle rect, HSTag* tag, char* 
name) {
 
     stack_insert_slice(g_monitor_stack, m->slice);
     g_array_append_val(g_monitors, m);
+
+    GString* index_str = g_string_new("");
+    int index = monitor_index_of(m);
+
+    if (index >= 0) {
+        g_string_printf(index_str, "%d", monitor_index_of(m));
+        hsobject_link(g_monitor_object, &m->object, index_str->str);
+        g_string_free(index_str, true);
+    }
+
     return g_array_index(g_monitors, HSMonitor*, g_monitors->len-1);
 }
 
-- 
1.8.3.1

Attachment: pgpRHhYyqhRT1.pgp
Description: PGP signature


Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev