mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
Remove src/common/log.c
Use wlr_log() instead
This commit is contained in:
parent
20fd8f59a7
commit
82e47ac1f5
20 changed files with 28 additions and 65 deletions
|
|
@ -1,9 +0,0 @@
|
||||||
#ifndef __LABWC_LOG_H
|
|
||||||
#define __LABWC_LOG_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* warn - print warning
|
|
||||||
*/
|
|
||||||
void warn(const char *err, ...);
|
|
||||||
|
|
||||||
#endif /* __LABWC_LOG_H */
|
|
||||||
|
|
@ -33,8 +33,6 @@
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
#endif
|
#endif
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
#include "common/log.h"
|
|
||||||
#include "config/keybind.h"
|
#include "config/keybind.h"
|
||||||
#include "config/rcxml.h"
|
#include "config/rcxml.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "common/log.h"
|
#include <wlr/util/log.h>
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
|
|
@ -59,6 +59,6 @@ action(struct server *server, const char *action, const char *command)
|
||||||
view_maximize(view, true);
|
view_maximize(view, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn("action (%s) not supported", action);
|
wlr_log(WLR_ERROR, "action (%s) not supported", action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "common/dir.h"
|
#include "common/dir.h"
|
||||||
#include "common/log.h"
|
|
||||||
|
|
||||||
struct dir {
|
struct dir {
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
|
|
|
||||||
|
|
@ -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");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -3,7 +3,6 @@ labwc_sources += files(
|
||||||
'dir.c',
|
'dir.c',
|
||||||
'font.c',
|
'font.c',
|
||||||
'grab-file.c',
|
'grab-file.c',
|
||||||
'log.c',
|
|
||||||
'nodename.c',
|
'nodename.c',
|
||||||
'spawn.c',
|
'spawn.c',
|
||||||
'string-helpers.c',
|
'string-helpers.c',
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "common/log.h"
|
#include <wlr/util/log.h>
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -35,7 +35,7 @@ spawn_async_no_shell(char const *command)
|
||||||
child = fork();
|
child = fork();
|
||||||
switch (child) {
|
switch (child) {
|
||||||
case -1:
|
case -1:
|
||||||
warn("unable to fork()");
|
wlr_log(WLR_ERROR, "unable to fork()");
|
||||||
goto out;
|
goto out;
|
||||||
case 0:
|
case 0:
|
||||||
setsid();
|
setsid();
|
||||||
|
|
@ -47,7 +47,7 @@ spawn_async_no_shell(char const *command)
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
} else if (grandchild < 0) {
|
} else if (grandchild < 0) {
|
||||||
warn("unable to fork()");
|
wlr_log(WLR_ERROR, "unable to fork()");
|
||||||
}
|
}
|
||||||
_exit(0);
|
_exit(0);
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wlr/util/log.h>
|
||||||
#include "common/log.h"
|
|
||||||
#include "config/keybind.h"
|
#include "config/keybind.h"
|
||||||
#include "config/rcxml.h"
|
#include "config/rcxml.h"
|
||||||
|
|
||||||
|
|
@ -39,7 +38,7 @@ keybind_create(const char *keybind)
|
||||||
xkb_keysym_t sym = xkb_keysym_from_name(
|
xkb_keysym_t sym = xkb_keysym_from_name(
|
||||||
symname, XKB_KEYSYM_CASE_INSENSITIVE);
|
symname, XKB_KEYSYM_CASE_INSENSITIVE);
|
||||||
if (sym == XKB_KEY_NoSymbol) {
|
if (sym == XKB_KEY_NoSymbol) {
|
||||||
warn("unknown keybind (%s)", symname);
|
wlr_log(WLR_ERROR, "unknown keybind (%s)", symname);
|
||||||
free(k);
|
free(k);
|
||||||
k = NULL;
|
k = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "common/dir.h"
|
#include "common/dir.h"
|
||||||
#include "common/log.h"
|
|
||||||
#include "common/nodename.h"
|
#include "common/nodename.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
#include "common/zfree.h"
|
#include "common/zfree.h"
|
||||||
|
|
@ -227,7 +226,7 @@ rcxml_parse_xml(struct buf *b)
|
||||||
{
|
{
|
||||||
xmlDoc *d = xmlParseMemory(b->buf, b->len);
|
xmlDoc *d = xmlParseMemory(b->buf, b->len);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
warn("xmlParseMemory()");
|
wlr_log(WLR_ERROR, "xmlParseMemory()");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
xml_tree_walk(xmlDocGetRootElement(d));
|
xml_tree_walk(xmlDocGetRootElement(d));
|
||||||
|
|
@ -330,7 +329,7 @@ rcxml_read(const char *filename)
|
||||||
/* Reading file into buffer before parsing - better for unit tests */
|
/* Reading file into buffer before parsing - better for unit tests */
|
||||||
stream = fopen(rcxml, "r");
|
stream = fopen(rcxml, "r");
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
warn("cannot read (%s)", rcxml);
|
wlr_log(WLR_ERROR, "cannot read (%s)", rcxml);
|
||||||
goto no_config;
|
goto no_config;
|
||||||
}
|
}
|
||||||
wlr_log(WLR_INFO, "read config file %s", rcxml);
|
wlr_log(WLR_INFO, "read config file %s", rcxml);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "common/dir.h"
|
#include "common/dir.h"
|
||||||
#include "common/log.h"
|
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
|
|
||||||
|
|
@ -99,7 +98,7 @@ session_autostart_init(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isfile(autostart)) {
|
if (!isfile(autostart)) {
|
||||||
warn("no autostart file");
|
wlr_log(WLR_ERROR, "no autostart file");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
wlr_log(WLR_INFO, "run autostart file %s", autostart);
|
wlr_log(WLR_INFO, "run autostart file %s", autostart);
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,11 @@ static void
|
||||||
process_cursor_move(struct server *server, uint32_t time)
|
process_cursor_move(struct server *server, uint32_t time)
|
||||||
{
|
{
|
||||||
damage_all_outputs(server);
|
damage_all_outputs(server);
|
||||||
/* Move the grabbed view to the new position. */
|
|
||||||
double dx = server->seat.cursor->x - server->grab_x;
|
double dx = server->seat.cursor->x - server->grab_x;
|
||||||
double dy = server->seat.cursor->y - server->grab_y;
|
double dy = server->seat.cursor->y - server->grab_y;
|
||||||
|
|
||||||
struct view *view = server->grabbed_view;
|
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);
|
view->impl->move(view, server->grab_box.x + dx, server->grab_box.y + dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include <wlr/backend/multi.h>
|
#include <wlr/backend/multi.h>
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
#include "common/log.h"
|
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
|
#include <wlr/util/log.h>
|
||||||
#include "layers.h"
|
#include "layers.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
||||||
|
|
@ -149,7 +150,7 @@ arrange_layer(struct wlr_output *output, struct wl_list *list,
|
||||||
box.y -= state->margin.bottom;
|
box.y -= state->margin.bottom;
|
||||||
}
|
}
|
||||||
if (box.width < 0 || box.height < 0) {
|
if (box.width < 0 || box.height < 0) {
|
||||||
warn("protocol error");
|
wlr_log(WLR_ERROR, "protocol error");
|
||||||
wlr_layer_surface_v1_close(layer);
|
wlr_layer_surface_v1_close(layer);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include "common/font.h"
|
#include "common/font.h"
|
||||||
#include "common/log.h"
|
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
#include "config/session.h"
|
#include "config/session.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ parse_xml(const char *filename, struct menu *menu)
|
||||||
|
|
||||||
stream = fopen(menuxml, "r");
|
stream = fopen(menuxml, "r");
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
warn("cannot read (%s)", menuxml);
|
wlr_log(WLR_ERROR, "cannot read %s", menuxml);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_log(WLR_INFO, "read menu file %s", menuxml);
|
wlr_log(WLR_INFO, "read menu file %s", menuxml);
|
||||||
|
|
@ -222,7 +222,7 @@ parse_xml(const char *filename, struct menu *menu)
|
||||||
fclose(stream);
|
fclose(stream);
|
||||||
xmlDoc *d = xmlParseMemory(b.buf, b.len);
|
xmlDoc *d = xmlParseMemory(b.buf, b.len);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
warn("xmlParseMemory()");
|
wlr_log(WLR_ERROR, "xmlParseMemory()");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
xml_tree_walk(xmlDocGetRootElement(d), menu);
|
xml_tree_walk(xmlDocGetRootElement(d), menu);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common/log.h"
|
#include <wlr/util/log.h>
|
||||||
#include "config/keybind.h"
|
#include "config/keybind.h"
|
||||||
#include "config/rcxml.h"
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
@ -12,7 +12,7 @@ xwl_nr_parents(struct view *view)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
warn("(%s) no xwayland surface\n", __func__);
|
wlr_log(WLR_ERROR, "no xwayland surface");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
while (s->parent) {
|
while (s->parent) {
|
||||||
|
|
|
||||||
11
src/output.c
11
src/output.c
|
|
@ -11,6 +11,7 @@
|
||||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||||
#include <wlr/types/wlr_output_damage.h>
|
#include <wlr/types/wlr_output_damage.h>
|
||||||
#include <wlr/util/region.h>
|
#include <wlr/util/region.h>
|
||||||
|
#include <wlr/util/log.h>
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "layers.h"
|
#include "layers.h"
|
||||||
#include "menu/menu.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();
|
struct wlr_output_configuration_v1 *config = wlr_output_configuration_v1_create();
|
||||||
if(config == NULL) {
|
if(config == NULL) {
|
||||||
warn("wlr_output_configuration_v1_create() returned NULL");
|
wlr_log(WLR_ERROR, "wlr_output_configuration_v1_create()");
|
||||||
return NULL;
|
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,
|
wlr_output_configuration_head_v1_create(config,
|
||||||
output->wlr_output);
|
output->wlr_output);
|
||||||
if (head == NULL) {
|
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);
|
wlr_output_configuration_v1_destroy(config);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct wlr_box *box = wlr_output_layout_get_box(server->output_layout,
|
struct wlr_box *box = wlr_output_layout_get_box(server->output_layout,
|
||||||
output->wlr_output);
|
output->wlr_output);
|
||||||
if(box != NULL) {
|
if (box != NULL) {
|
||||||
head->state.x = box->x;
|
head->state.x = box->x;
|
||||||
head->state.y = box->y;
|
head->state.y = box->y;
|
||||||
} else {
|
} 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) {
|
if(config != NULL) {
|
||||||
wlr_output_manager_v1_set_configuration(server->output_manager, config);
|
wlr_output_manager_v1_set_configuration(server->output_manager, config);
|
||||||
} else {
|
} else {
|
||||||
warn("wlr_output_manager_v1_set_configuration returned NULL");
|
wlr_log(WLR_ERROR, "wlr_output_manager_v1_set_configuration()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
|
||||||
* for the time being, lets just enable tap.
|
* for the time being, lets just enable tap.
|
||||||
*/
|
*/
|
||||||
if (!wlr_input_device) {
|
if (!wlr_input_device) {
|
||||||
warn("%s:%d: no wlr_input_device", __FILE__, __LINE__);
|
wlr_log(WLR_ERROR, "no wlr_input_device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct libinput_device *libinput_dev =
|
struct libinput_device *libinput_dev =
|
||||||
wlr_libinput_get_device_handle(wlr_input_device);
|
wlr_libinput_get_device_handle(wlr_input_device);
|
||||||
if (!libinput_dev) {
|
if (!libinput_dev) {
|
||||||
warn("%s:%d: no libinput_dev", __FILE__, __LINE__);
|
wlr_log(WLR_ERROR, "no libinput_dev");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (libinput_device_config_tap_get_finger_count(libinput_dev) <= 0) {
|
if (libinput_device_config_tap_get_finger_count(libinput_dev) <= 0) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||||
#include <wlr/types/wlr_screencopy_v1.h>
|
#include <wlr/types/wlr_screencopy_v1.h>
|
||||||
#include "common/log.h"
|
|
||||||
#include "config/rcxml.h"
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "layers.h"
|
#include "layers.h"
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
#include "common/dir.h"
|
#include "common/dir.h"
|
||||||
#include "common/font.h"
|
#include "common/font.h"
|
||||||
#include "common/log.h"
|
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
#include "common/zfree.h"
|
#include "common/zfree.h"
|
||||||
#include "config/rcxml.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);
|
cairo_line_to(cairo, 0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
warn("unknown corner type");
|
wlr_log(WLR_ERROR, "unknown corner type");
|
||||||
}
|
}
|
||||||
cairo_close_path(cairo);
|
cairo_close_path(cairo);
|
||||||
cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
|
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);
|
cairo_line_to(cairo, w - half_line_width, h);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
warn("unknown corner type");
|
wlr_log(WLR_ERROR, "unknown corner type");
|
||||||
}
|
}
|
||||||
cairo_stroke(cairo);
|
cairo_stroke(cairo);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue