diff --git a/src/handler.c b/src/handler.c
index 86f8ef0..0ef9bc2 100644
--- a/src/handler.c
+++ b/src/handler.c
@@ -105,7 +105,7 @@ void wm_maprequest_handler(Wm *wm, XMapRequestEvent e)
wm_client_focus(wm, c);
if (wm->log_after_maprequest) {
- wm_log_state(wm, "after wm_kb_spawn", WM_LOGFILENAME);
+ wm_log_state(wm, "after wm_kb_spawn", wm->config.log_path);
wm->log_after_maprequest = false;
}
}
diff --git a/src/wm.c b/src/wm.c
index 8eeaf56..678ae70 100644
--- a/src/wm.c
+++ b/src/wm.c
@@ -17,21 +17,21 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#include "wm.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include
#include
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include "wm.h"
#include "config.h"
#include "handler.h"
#include "client.h"
@@ -410,10 +410,11 @@ void wm_mainloop(Wm *wm)
void wm_init(Wm *wm)
{
- XSetWindowAttributes xa;
- Display *d;
+ DEBUG_PRINT("wm_init\n");
+ DEBUG_PRINT("pid: %ld\n", getpid());
- signal(SIGINT, wm_sigint_handler);
+ XSetWindowAttributes xa;
+ // signal(SIGINT, wm_sigint_handler);
wm->config = (Config) {0};
wm_cfg_init_def(&wm->config);
@@ -426,12 +427,11 @@ void wm_init(Wm *wm)
ConfigFile configfile = {0};
wm_configfile_init(&configfile, path);
wm_configfile_read(&configfile, &wm->config);
+ wm_logfile_init(wm->config.log_path);
+ wm->log_entries = wm_read_log(wm->config.log_path);
- DEBUG_PRINT("wm_init\n")
- DEBUG_PRINT("pid: %ld\n", ((long)getpid()))
- d = wm_connect_display();
- wm->display = d;
- wm_monitors_open_all(wm, d);
+ wm->display = wm_connect_display();
+ wm_monitors_open_all(wm, wm->display);
char *display_string = DisplayString(wm->display);
setenv("DISPLAY", display_string, 1);
@@ -443,7 +443,7 @@ void wm_init(Wm *wm)
DEBUG_PRINT("root window: %ld\n", wm->root.window);
- XSync(d, false);
+ XSync(wm->display, false);
xa.event_mask = StructureNotifyMask | StructureNotifyMask |
SubstructureNotifyMask | SubstructureRedirectMask |
diff --git a/src/wm.h b/src/wm.h
index 740885b..dd50e09 100644
--- a/src/wm.h
+++ b/src/wm.h
@@ -67,16 +67,14 @@ if (c == NULL) \
#define WM_PREFIX_LEN 4096
-#define WM_LOGFILENAME "./log"
-
-#define WM_LOG_STATE_START(wm) do { \
- wm_log_state(wm, __func__, WM_LOGFILENAME); \
+#define WM_LOG_STATE_START(wm) do { \
+ wm_log_state(wm, __func__, (wm)->config.log_path); \
} while (0);
#define WM_LOG_STATE_END(wm) do { \
char __prefix[WM_PREFIX_LEN] = {0}; \
- snprintf(__prefix, WM_PREFIX_LEN, "after %s", __func__); \
- wm_log_state(wm, __prefix, WM_LOGFILENAME); \
+ snprintf(__prefix, WM_PREFIX_LEN, "%s:after", __func__); \
+ wm_log_state(wm, __prefix, (wm)->config.log_path); \
} while (0);
typedef struct Client Client;
@@ -140,6 +138,9 @@ struct Wm {
bool log_after_maprequest;
int socket_fd;
+
+ /* UIntArray */
+ UIntArray *log_entries;
};
Monitor wm_monitor_open(Display *d, XineramaScreenInfo info);