aboutsummaryrefslogtreecommitdiff
path: root/example/shared.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-06-21 14:15:06 -0400
committerDrew DeVault <sir@cmpwn.com>2017-06-21 14:15:06 -0400
commitb93f00b92f20dcdc5360605649a142551bd837a9 (patch)
tree29c730fd1c1779ec1f97a3e0fd4bab7f23fa8e7c /example/shared.c
parent3d71969b2a66a029df88e0c6bbcb8d388d57a13c (diff)
Utilize wlr_log in example logging
Diffstat (limited to 'example/shared.c')
-rw-r--r--example/shared.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/example/shared.c b/example/shared.c
index 8e7259d8..d9a6c1fd 100644
--- a/example/shared.c
+++ b/example/shared.c
@@ -11,6 +11,7 @@
#include <wlr/session.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_input_device.h>
+#include <wlr/util/log.h>
#include "shared.h"
static void keyboard_led_update(struct keyboard_state *kbstate) {
@@ -35,7 +36,7 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
char name[64];
int l = xkb_keysym_get_name(sym, name, sizeof(name));
if (l != -1 && l != sizeof(name)) {
- fprintf(stderr, "Key event: %s %s\n", name,
+ wlr_log(L_DEBUG, "Key event: %s %s", name,
key_state == WLR_KEY_PRESSED ? "pressed" : "released");
}
if (kbstate->compositor->keyboard_key_cb) {
@@ -65,19 +66,19 @@ static void keyboard_add(struct wlr_input_device *device, struct compositor_stat
rules.options = getenv("XKB_DEFAULT_OPTIONS");
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (!context) {
- fprintf(stderr, "Failed to create XKB context\n");
+ wlr_log(L_ERROR, "Failed to create XKB context");
exit(1);
}
kbstate->keymap = xkb_map_new_from_names(
context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
if (!kbstate->keymap) {
- fprintf(stderr, "Failed to create XKB keymap\n");
+ wlr_log(L_ERROR, "Failed to create XKB keymap");
exit(1);
}
xkb_context_unref(context);
kbstate->xkb_state = xkb_state_new(kbstate->keymap);
if (!kbstate->xkb_state) {
- fprintf(stderr, "Failed to create XKB state\n");
+ wlr_log(L_ERROR, "Failed to create XKB state");
exit(1);
}
const char *led_names[3] = {
@@ -381,8 +382,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
static void output_add_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct compositor_state *state = wl_container_of(listener, state, output_add);
- fprintf(stderr, "Output '%s' added\n", output->name);
- fprintf(stderr, "%s %s %"PRId32"mm x %"PRId32"mm\n", output->make, output->model,
+ wlr_log(L_DEBUG, "Output '%s' added", output->name);
+ wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", output->make, output->model,
output->phys_width, output->phys_height);
if (output->modes->length > 0) {
wlr_output_set_mode(output, output->modes->items[0]);
@@ -460,7 +461,7 @@ void compositor_init(struct compositor_state *state) {
clock_gettime(CLOCK_MONOTONIC, &state->last_frame);
if (!wlr_backend_init(state->backend)) {
- fprintf(stderr, "Failed to initialize backend\n");
+ wlr_log(L_ERROR, "Failed to initialize backend");
exit(1);
}
}