]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Remove src/common/log.c
authorJohan Malm <jgm323@gmail.com>
Fri, 23 Jul 2021 20:15:55 +0000 (21:15 +0100)
committerJohan Malm <jgm323@gmail.com>
Fri, 23 Jul 2021 20:15:55 +0000 (21:15 +0100)
Use wlr_log() instead

20 files changed:
include/common/log.h [deleted file]
include/labwc.h
src/action.c
src/common/dir.c
src/common/log.c [deleted file]
src/common/meson.build
src/common/spawn.c
src/config/keybind.c
src/config/rcxml.c
src/config/session.c
src/cursor.c
src/keyboard.c
src/layers.c
src/main.c
src/menu/menu.c
src/osd.c
src/output.c
src/seat.c
src/server.c
src/theme.c

diff --git a/include/common/log.h b/include/common/log.h
deleted file mode 100644 (file)
index 81ece2a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __LABWC_LOG_H
-#define __LABWC_LOG_H
-
-/**
- * warn - print warning
- */
-void warn(const char *err, ...);
-
-#endif /* __LABWC_LOG_H */
index 8fc2b4f10cd3a1a82706fe6cc336207e4e837570..8956ad67217b8cbdace8c0be9cf3c453cd12750a 100644 (file)
@@ -33,8 +33,6 @@
 #include <wlr/xwayland.h>
 #endif
 #include <xkbcommon/xkbcommon.h>
-
-#include "common/log.h"
 #include "config/keybind.h"
 #include "config/rcxml.h"
 
index 75e7623f427a7516356e131053daf0ad73b090ef..914c557df6af127c966442d6037d0e060f524c1e 100644 (file)
@@ -1,5 +1,5 @@
 #include <strings.h>
-#include "common/log.h"
+#include <wlr/util/log.h>
 #include "common/spawn.h"
 #include "labwc.h"
 #include "menu/menu.h"
@@ -59,6 +59,6 @@ action(struct server *server, const char *action, const char *command)
                        view_maximize(view, true);
                }
        } else {
-               warn("action (%s) not supported", action);
+               wlr_log(WLR_ERROR, "action (%s) not supported", action);
        }
 }
index 82889af2d0dfd73d728488277d6c480807a3f203..150005181c4b43f86dfa6a35c5380bd17b927cba 100644 (file)
@@ -9,9 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
-
 #include "common/dir.h"
-#include "common/log.h"
 
 struct dir {
        const char *prefix;
diff --git a/src/common/log.c b/src/common/log.c
deleted file mode 100644 (file)
index 2049e0f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-void
-warn(const char *err, ...)
-{
-       va_list params;
-       fprintf(stderr, "[labwc] warn: ");
-       va_start(params, err);
-       vfprintf(stderr, err, params);
-       va_end(params);
-       fprintf(stderr, "\n");
-}
-
index 21044fdb2bb99dd0ee1bd7331749566cf9589292..02c763aaf4e249072e6d60628ead876a8fb1dafc 100644 (file)
@@ -3,7 +3,6 @@ labwc_sources += files(
   'dir.c',
   'font.c',
   'grab-file.c',
-  'log.c',
   'nodename.c',
   'spawn.c',
   'string-helpers.c',
index cfeb58ba808bafa1d74726fae0ed76bf85d71b34..f3ee2d796256ecb38c31ca817f21121542bc0dcd 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include "common/log.h"
+#include <wlr/util/log.h>
 #include "common/spawn.h"
 
 void
@@ -35,7 +35,7 @@ spawn_async_no_shell(char const *command)
        child = fork();
        switch (child) {
        case -1:
-               warn("unable to fork()");
+               wlr_log(WLR_ERROR, "unable to fork()");
                goto out;
        case 0:
                setsid();
@@ -47,7 +47,7 @@ spawn_async_no_shell(char const *command)
                        execvp(argv[0], argv);
                        _exit(0);
                } else if (grandchild < 0) {
-                       warn("unable to fork()");
+                       wlr_log(WLR_ERROR, "unable to fork()");
                }
                _exit(0);
        default:
index 75a1778142362998a08c7ae243464e551bc320f6..914909280c0ead31056b1189908c443c3bce97de 100644 (file)
@@ -3,8 +3,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#include "common/log.h"
+#include <wlr/util/log.h>
 #include "config/keybind.h"
 #include "config/rcxml.h"
 
@@ -39,7 +38,7 @@ keybind_create(const char *keybind)
                        xkb_keysym_t sym = xkb_keysym_from_name(
                                symname, XKB_KEYSYM_CASE_INSENSITIVE);
                        if (sym == XKB_KEY_NoSymbol) {
-                               warn("unknown keybind (%s)", symname);
+                               wlr_log(WLR_ERROR, "unknown keybind (%s)", symname);
                                free(k);
                                k = NULL;
                                break;
index 791785017afae409cc578935d36163c483667781..e76adea613bfd8a13b60090836c4dc4caeb12fd9 100644 (file)
@@ -12,7 +12,6 @@
 #include <wayland-server-core.h>
 #include <wlr/util/log.h>
 #include "common/dir.h"
-#include "common/log.h"
 #include "common/nodename.h"
 #include "common/string-helpers.h"
 #include "common/zfree.h"
@@ -227,7 +226,7 @@ rcxml_parse_xml(struct buf *b)
 {
        xmlDoc *d = xmlParseMemory(b->buf, b->len);
        if (!d) {
-               warn("xmlParseMemory()");
+               wlr_log(WLR_ERROR, "xmlParseMemory()");
                exit(EXIT_FAILURE);
        }
        xml_tree_walk(xmlDocGetRootElement(d));
@@ -330,7 +329,7 @@ rcxml_read(const char *filename)
        /* Reading file into buffer before parsing - better for unit tests */
        stream = fopen(rcxml, "r");
        if (!stream) {
-               warn("cannot read (%s)", rcxml);
+               wlr_log(WLR_ERROR, "cannot read (%s)", rcxml);
                goto no_config;
        }
        wlr_log(WLR_INFO, "read config file %s", rcxml);
index 695a79e10a888315d6e81a78dea3ac3278930515..fcf794f913fb6dd33a67835531a1f459a49c611f 100644 (file)
@@ -7,7 +7,6 @@
 #include <sys/stat.h>
 #include <wlr/util/log.h>
 #include "common/dir.h"
-#include "common/log.h"
 #include "common/spawn.h"
 #include "common/string-helpers.h"
 
@@ -99,7 +98,7 @@ session_autostart_init(void)
                return;
        }
        if (!isfile(autostart)) {
-               warn("no autostart file");
+               wlr_log(WLR_ERROR, "no autostart file");
                goto out;
        }
        wlr_log(WLR_INFO, "run autostart file %s", autostart);
index ec023aeb5a89026022e44d19e9473c58364bec3e..43a10dfbfa769587554708fa1a40e7dda947f0f6 100644 (file)
@@ -75,12 +75,11 @@ static void
 process_cursor_move(struct server *server, uint32_t time)
 {
        damage_all_outputs(server);
-       /* Move the grabbed view to the new position. */
        double dx = server->seat.cursor->x - server->grab_x;
        double dy = server->seat.cursor->y - server->grab_y;
-
        struct view *view = server->grabbed_view;
-       assert(view);
+
+       /* Move the grabbed view to the new position. */
        view->impl->move(view, server->grab_box.x + dx, server->grab_box.y + dy);
 }
 
index 747dd16b58db06d388565aab38f323ec8f30d41f..2250dc672e4a028e35169756410c0645d0b73394 100644 (file)
@@ -1,6 +1,5 @@
 #include <wlr/backend/multi.h>
 #include <wlr/backend/session.h>
-#include "common/log.h"
 #include "labwc.h"
 
 static void
index ed70685f330bcf819cab8ca70217f8fd969d8f46..0e52b3b6f356c9914428702279d53b78b6f4e5fd 100644 (file)
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <wayland-server.h>
 #include <wlr/types/wlr_layer_shell_v1.h>
+#include <wlr/util/log.h>
 #include "layers.h"
 #include "labwc.h"
 
@@ -149,7 +150,7 @@ arrange_layer(struct wlr_output *output, struct wl_list *list,
                        box.y -= state->margin.bottom;
                }
                if (box.width < 0 || box.height < 0) {
-                       warn("protocol error");
+                       wlr_log(WLR_ERROR, "protocol error");
                        wlr_layer_surface_v1_close(layer);
                        continue;
                }
index 6f8092ad3ff5562f5395c613a3c1bc0c208d0789..6b88464d7456cedbe779fa31187d8861236fdb73 100644 (file)
@@ -1,5 +1,4 @@
 #include "common/font.h"
-#include "common/log.h"
 #include "common/spawn.h"
 #include "config/session.h"
 #include "labwc.h"
index 81d4c76b7eed0a561c676baf08d5647c47699b4f..c2f02a3f82d7e2134c69874c57f88bd54077b7ba 100644 (file)
@@ -207,7 +207,7 @@ parse_xml(const char *filename, struct menu *menu)
 
        stream = fopen(menuxml, "r");
        if (!stream) {
-               warn("cannot read (%s)", menuxml);
+               wlr_log(WLR_ERROR, "cannot read %s", menuxml);
                return;
        }
        wlr_log(WLR_INFO, "read menu file %s", menuxml);
@@ -222,7 +222,7 @@ parse_xml(const char *filename, struct menu *menu)
        fclose(stream);
        xmlDoc *d = xmlParseMemory(b.buf, b.len);
        if (!d) {
-               warn("xmlParseMemory()");
+               wlr_log(WLR_ERROR, "xmlParseMemory()");
                exit(EXIT_FAILURE);
        }
        xml_tree_walk(xmlDocGetRootElement(d), menu);
index 705af2454a7d56859a1aa0d775ff80f1b8ffb21c..b03641af310e1f48d48f62728607da144105b710 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -1,5 +1,5 @@
 #include "config.h"
-#include "common/log.h"
+#include <wlr/util/log.h>
 #include "config/keybind.h"
 #include "config/rcxml.h"
 #include "labwc.h"
@@ -12,7 +12,7 @@ xwl_nr_parents(struct view *view)
        int i = 0;
 
        if (!s) {
-               warn("(%s) no xwayland surface\n", __func__);
+               wlr_log(WLR_ERROR, "no xwayland surface");
                return -1;
        }
        while (s->parent) {
index a3c1e9308ebbab5d6e37b31a702f1e7775019a90..d4bbcf7daf098fbfa67678060432de6284ff472f 100644 (file)
@@ -11,6 +11,7 @@
 #include <wlr/types/wlr_xdg_output_v1.h>
 #include <wlr/types/wlr_output_damage.h>
 #include <wlr/util/region.h>
+#include <wlr/util/log.h>
 #include "labwc.h"
 #include "layers.h"
 #include "menu/menu.h"
@@ -936,7 +937,7 @@ static struct wlr_output_configuration_v1 *create_output_config(struct server *s
 {
        struct wlr_output_configuration_v1 *config = wlr_output_configuration_v1_create();
        if(config == NULL) {
-               warn("wlr_output_configuration_v1_create() returned NULL");
+               wlr_log(WLR_ERROR, "wlr_output_configuration_v1_create()");
                return NULL;
        }
 
@@ -946,17 +947,17 @@ static struct wlr_output_configuration_v1 *create_output_config(struct server *s
                        wlr_output_configuration_head_v1_create(config,
                                output->wlr_output);
                if (head == NULL) {
-                       warn("wlr_output_configuration_head_v1_create() returned NULL");
+                       wlr_log(WLR_ERROR, "wlr_output_configuration_head_v1_create()");
                        wlr_output_configuration_v1_destroy(config);
                        return NULL;
                }
                struct wlr_box *box = wlr_output_layout_get_box(server->output_layout,
                                                                output->wlr_output);
-               if(box != NULL) {
+               if (box != NULL) {
                        head->state.x = box->x;
                        head->state.y = box->y;
                } else {
-                       warn("%s: failed to get box for output", __func__);
+                       wlr_log(WLR_ERROR, "failed to get output layout box");
                }
        }
 
@@ -972,7 +973,7 @@ static void handle_output_layout_change(struct wl_listener *listener, void *data
                if(config != NULL) {
                        wlr_output_manager_v1_set_configuration(server->output_manager, config);
                } else {
-                       warn("wlr_output_manager_v1_set_configuration returned NULL");
+                       wlr_log(WLR_ERROR, "wlr_output_manager_v1_set_configuration()");
                }
        }
 }
index e5a1dbec65abf304d7f0e59c402d7dadcefd0ba1..bcab494b41f580dd4aa495c8bd1c06fa1e23b773 100644 (file)
@@ -19,13 +19,13 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
         * for the time being, lets just enable tap.
         */
        if (!wlr_input_device) {
-               warn("%s:%d: no wlr_input_device", __FILE__, __LINE__);
+               wlr_log(WLR_ERROR, "no wlr_input_device");
                return;
        }
        struct libinput_device *libinput_dev =
                wlr_libinput_get_device_handle(wlr_input_device);
        if (!libinput_dev) {
-               warn("%s:%d: no libinput_dev", __FILE__, __LINE__);
+               wlr_log(WLR_ERROR, "no libinput_dev");
                return;
        }
        if (libinput_device_config_tap_get_finger_count(libinput_dev) <= 0) {
index a9d2392742092e3328db8b047807a56d887b2d17..8c13a3af9fc39867be64fcd2c79503f8a82c3c95 100644 (file)
@@ -7,7 +7,6 @@
 #include <wlr/types/wlr_gamma_control_v1.h>
 #include <wlr/types/wlr_primary_selection_v1.h>
 #include <wlr/types/wlr_screencopy_v1.h>
-#include "common/log.h"
 #include "config/rcxml.h"
 #include "labwc.h"
 #include "layers.h"
index ca760ed51ee20814ed07363e37eaa4d54fc60fe2..8d51c084fcc62b06c3b09d23c1e6a825fc8ad633 100644 (file)
 #include <string.h>
 #include <wlr/util/box.h>
 #include <wlr/util/log.h>
-
 #include "common/dir.h"
 #include "common/font.h"
-#include "common/log.h"
 #include "common/string-helpers.h"
 #include "common/zfree.h"
 #include "config/rcxml.h"
@@ -266,7 +264,7 @@ rounded_rect(struct wlr_renderer *renderer, struct rounded_corner_ctx *ctx)
                cairo_line_to(cairo, 0, 0);
                break;
        default:
-               warn("unknown corner type");
+               wlr_log(WLR_ERROR, "unknown corner type");
        }
        cairo_close_path(cairo);
        cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
@@ -293,7 +291,7 @@ rounded_rect(struct wlr_renderer *renderer, struct rounded_corner_ctx *ctx)
                cairo_line_to(cairo, w - half_line_width, h);
                break;
        default:
-               warn("unknown corner type");
+               wlr_log(WLR_ERROR, "unknown corner type");
        }
        cairo_stroke(cairo);