#ifndef __LABWC_LOG_H
#define __LABWC_LOG_H
-/**
- * info - print info message
- */
-void info(const char *msg, ...);
-
/**
* warn - print warning
*/
void warn(const char *err, ...);
-/**
- * die - print fatal message and exit()
- */
-void die(const char *err, ...);
-
#endif /* __LABWC_LOG_H */
/* handle /etc/xdg... */
ctx->build_path_fn(ctx, NULL, d.path);
if (debug) {
- info("%s", ctx->buf);
+ fprintf(stderr, "%s\n", ctx->buf);
}
if (isdir(ctx->buf)) {
return ctx->buf;
for (gchar **p = prefixes; *p; p++) {
ctx->build_path_fn(ctx, *p, d.path);
if (debug) {
- info("%s", ctx->buf);
+ fprintf(stderr, "%s\n", ctx->buf);
}
if (isdir(ctx->buf)) {
g_strfreev(prefixes);
#include <stdlib.h>
#include <string.h>
-void
-info(const char *msg, ...)
-{
- va_list params;
- fprintf(stderr, "[labwc] info: ");
- va_start(params, msg);
- vfprintf(stderr, msg, params);
- va_end(params);
- fprintf(stderr, "\n");
-}
-
void
warn(const char *err, ...)
{
fprintf(stderr, "\n");
}
-void
-die(const char *err, ...)
-{
- va_list params;
- fprintf(stderr, "[labwc] fatal: ");
- va_start(params, err);
- vfprintf(stderr, err, params);
- va_end(params);
- fprintf(stderr, "\n");
- exit(EXIT_FAILURE);
-}
#include <strings.h>
#include <unistd.h>
#include <wayland-server-core.h>
-
+#include <wlr/util/log.h>
#include "common/dir.h"
#include "common/log.h"
#include "common/nodename.h"
post_processing(void)
{
if (!wl_list_length(&rc.keybinds)) {
- info("load default key bindings");
+ wlr_log(WLR_INFO, "load default key bindings");
bind("A-Escape", "Exit", NULL);
bind("A-Tab", "NextWindow", NULL);
bind("A-F3", "Execute", "bemenu-run");
find_config_file(rcxml, sizeof(rcxml), filename);
}
if (rcxml[0] == '\0') {
- info("cannot find rc.xml config file; using defaults");
+ wlr_log(WLR_INFO, "cannot find rc.xml config file");
goto no_config;
}
warn("cannot read (%s)", rcxml);
goto no_config;
}
- info("read config file (%s)", rcxml);
+ wlr_log(WLR_INFO, "read config file %s", rcxml);
buf_init(&b);
while (getline(&line, &len, stream) != -1) {
char *p = strrchr(line, '\n');
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <wlr/util/log.h>
#include "common/dir.h"
#include "common/log.h"
#include "common/spawn.h"
if (!stream) {
return;
}
- info("read environment file (%s)", filename);
+ wlr_log(WLR_INFO, "read environment file %s", filename);
while (getline(&line, &len, stream) != -1) {
char *p = strrchr(line, '\n');
if (p) {
warn("no autostart file");
goto out;
}
- info("run autostart file (%s)", autostart);
+ wlr_log(WLR_INFO, "run autostart file %s", autostart);
int len = strlen(autostart) + 4;
char *cmd = calloc(len, 1);
strcat(cmd, "sh ");
rcxml_read(config_file);
if (!getenv("XDG_RUNTIME_DIR")) {
- die("XDG_RUNTIME_DIR is unset");
+ wlr_log(WLR_ERROR, "XDG_RUNTIME_DIR is unset");
+ exit(EXIT_FAILURE);
}
struct server server = { 0 };
#include <stdlib.h>
#include <string.h>
#include <strings.h>
+#include <wlr/util/log.h>
#include "common/buf.h"
#include "common/dir.h"
#include "common/font.h"
warn("cannot read (%s)", menuxml);
return;
}
- info("read menu file (%s)", menuxml);
+ wlr_log(WLR_INFO, "read menu file %s", menuxml);
buf_init(&b);
while (getline(&line, &len, stream) != -1) {
char *p = strrchr(line, '\n');
*/
if (getenv("LABWC_ADAPTIVE_SYNC")) {
- info("Set %s adaptive sync to 'true'", wlr_output->name);
+ wlr_log(WLR_INFO, "enable adaptive sync on %s", wlr_output->name);
wlr_output_enable_adaptive_sync(wlr_output, true);
}
wlr_output_layout_add_auto(server->output_layout, wlr_output);
if (libinput_device_config_tap_get_finger_count(libinput_dev) <= 0) {
return;
}
- info("tap enabled for libinput device");
+ wlr_log(WLR_INFO, "tap enabled");
libinput_device_config_tap_set_enabled(libinput_dev,
LIBINPUT_CONFIG_TAP_ENABLED);
}
static void
reload_config_and_theme(void)
{
+ damage_all_outputs(g_server);
+
/* TODO: use rc.config_path */
rcxml_finish();
rcxml_read(NULL);
theme_finish(g_server->theme);
theme_init(g_server->theme, g_server->renderer, rc.theme_name);
menu_reconfigure(g_server, g_server->rootmenu);
- damage_all_outputs(g_server);
}
static int
{
if (getuid() != geteuid() || getgid() != getegid()) {
if (setgid(getgid())) {
- die("unable to drop root group");
+ wlr_log(WLR_ERROR, "unable to drop root group");
+ exit(EXIT_FAILURE);
}
if (setuid(getuid())) {
- die("unable to drop root user");
+ wlr_log(WLR_ERROR, "unable to drop root user");
+ exit(EXIT_FAILURE);
}
}
if (setgid(0) != -1 || setuid(0) != -1) {
- die("unable to drop root");
+ wlr_log(WLR_ERROR, "unable to drop root");
+ exit(EXIT_FAILURE);
}
}
#include <stdlib.h>
#include <string.h>
#include <wlr/util/box.h>
+#include <wlr/util/log.h>
#include "common/dir.h"
#include "common/font.h"
}
if (!stream) {
if (theme_name) {
- info("cannot find theme (%s), using built-in",
- theme_name);
+ wlr_log(WLR_INFO, "cannot find theme %s", theme_name);
}
return;
}
- info("read themerc (%s)", themerc);
+ wlr_log(WLR_INFO, "read theme %s", themerc);
while (getline(&line, &len, stream) != -1) {
char *p = strrchr(line, '\n');
if (p) {