use config field for log file name
This commit is contained in:
parent
fac46f74f6
commit
42779798fa
@ -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;
|
||||
}
|
||||
}
|
||||
|
38
src/wm.c
38
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "wm.h"
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/socket.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#include <asm-generic/errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#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 |
|
||||
|
11
src/wm.h
11
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); \
|
||||
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<LogEntry*> */
|
||||
UIntArray *log_entries;
|
||||
};
|
||||
|
||||
Monitor wm_monitor_open(Display *d, XineramaScreenInfo info);
|
||||
|
Loading…
x
Reference in New Issue
Block a user