More debugging messages

This commit is contained in:
Keith Bowes 2020-03-10 15:56:48 -04:00
parent d19918e482
commit 73460ae133
4 changed files with 14 additions and 7 deletions

View file

@ -20,6 +20,7 @@ static void render_surface(struct wlr_surface *surface, int sx, int sy, void *da
* means. You don't have to worry about this, wlroots takes care of it. */
struct wlr_texture *texture = wlr_surface_get_texture(surface);
if (texture == NULL) {
wlr_log(WLR_ERROR, "%s: %s", _("Couldn't get a surface texture"));
return;
}
@ -75,6 +76,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
clock_gettime(CLOCK_MONOTONIC, &now);
if (!wlr_output_attach_render(output->wlr_output, NULL)) {
wlr_log_errno(WLR_ERROR, "%s", _("Couldn't attach renderer to output"));
return;
}
int width, height;
@ -119,6 +121,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
listener, server, new_output
);
struct wlr_output *wlr_output = data;
wlr_log(WLR_INFO, "%s: %s", _("New output device detected"), wlr_output->name);
if (!wl_list_empty(&wlr_output->modes)) {
struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
@ -126,6 +129,7 @@ void new_output_notify(struct wl_listener *listener, void *data) {
wlr_output_enable(wlr_output, true);
if (!wlr_output_commit(wlr_output)) {
wlr_log_errno(WLR_ERROR, "%s", _("Couldn't commit pending frame to output"));
return;
}
}

View file

@ -128,12 +128,15 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
struct wb_server *server = wl_container_of(listener, server, new_input);
switch (device->type) {
case WLR_INPUT_DEVICE_KEYBOARD:
wlr_log(WLR_INFO, "%s: %s", _("New keyboard detected"), device->name);
handle_new_keyboard(server, device);
break;
case WLR_INPUT_DEVICE_POINTER:
wlr_log(WLR_INFO, "%s: %s", _("New pointer detected"), device->name);
wlr_cursor_attach_input_device(server->cursor->cursor, device);
break;
default:
wlr_log(WLR_INFO, "%s: %s", _("Unsupported input device detected"), device->name);
break;
}

View file

@ -46,13 +46,7 @@ bool wb_start_server(struct wb_server* server) {
return false;
}
const char*const tmp = _("Running Wayland compositor on Wayland display '%s'");
char *sockmsg = calloc(sizeof(char), strlen(tmp) + strlen(socket) - 2);
if (sockmsg) {
sprintf(sockmsg, tmp, socket);
wlr_log(WLR_INFO, "%s", sockmsg);
}
free(sockmsg);
wlr_log(WLR_INFO, "%s: WAYLAND_DISPLAY=%s", _("Running Wayland compositor on Wayland display"), socket);
setenv("WAYLAND_DISPLAY", socket, true);
wlr_gamma_control_manager_v1_create(server->wl_display);

View file

@ -1,6 +1,8 @@
#include "waybox/xdg_shell.h"
void focus_view(struct wb_view *view, struct wlr_surface *surface) {
wlr_log(WLR_INFO, "%s: %s", _("Keyboard focus is now on surface"),
wlr_xdg_surface_from_wlr_surface(surface)->toplevel->app_id);
/* Note: this function only deals with keyboard focus. */
if (view == NULL) {
return;
@ -54,11 +56,15 @@ static void xdg_surface_unmap(struct wl_listener *listener, void *data) {
/* If the current view is mapped, focus it. */
if (current_view->mapped) {
wlr_log(WLR_INFO, "%s: %s", _("Focusing current view"),
current_view->xdg_surface->toplevel->app_id);
focus_view(current_view, current_view->xdg_surface->surface);
}
/* Otherwise, focus the next view, if any. */
else if (next_view->xdg_surface->surface &&
wlr_surface_is_xdg_surface(next_view->xdg_surface->surface)) {
wlr_log(WLR_INFO, "%s: %s", _("Focusing next view"),
next_view->xdg_surface->toplevel->app_id);
focus_view(next_view, next_view->xdg_surface->surface);
}
}