Replace fprintf() by weston_log()
This commit is contained in:
committed by
Kristian Høgsberg
parent
19e6f2693d
commit
6d11836721
+15
-15
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "xwayland.h"
|
||||
#include "xserver-server-protocol.h"
|
||||
#include "../log.h"
|
||||
|
||||
|
||||
static int
|
||||
@@ -44,7 +45,7 @@ weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
|
||||
int sv[2], client_fd;
|
||||
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
|
||||
fprintf(stderr, "socketpair failed\n");
|
||||
weston_log("socketpair failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -71,11 +72,11 @@ weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
|
||||
"-nolisten", "all",
|
||||
"-terminate",
|
||||
NULL) < 0)
|
||||
fprintf(stderr, "exec failed: %m\n");
|
||||
weston_log("exec failed: %m\n");
|
||||
exit(-1);
|
||||
|
||||
default:
|
||||
fprintf(stderr, "forked X server, pid %d\n", mxs->process.pid);
|
||||
weston_log("forked X server, pid %d\n", mxs->process.pid);
|
||||
|
||||
close(sv[1]);
|
||||
mxs->client = wl_client_create(mxs->wl_display, sv[0]);
|
||||
@@ -87,7 +88,7 @@ weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
|
||||
break;
|
||||
|
||||
case -1:
|
||||
fprintf(stderr, "failed to fork\n");
|
||||
weston_log( "failed to fork\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -135,14 +136,14 @@ weston_xserver_cleanup(struct weston_process *process, int status)
|
||||
weston_xserver_handle_event, mxs);
|
||||
|
||||
if (mxs->wm) {
|
||||
fprintf(stderr, "xserver exited, code %d\n", status);
|
||||
weston_log("xserver exited, code %d\n", status);
|
||||
weston_wm_destroy(mxs->wm);
|
||||
mxs->wm = NULL;
|
||||
} else {
|
||||
/* If the X server crashes before it binds to the
|
||||
* xserver interface, shut down and don't try
|
||||
* again. */
|
||||
fprintf(stderr, "xserver crashing too fast: %d\n", status);
|
||||
weston_log("xserver crashing too fast: %d\n", status);
|
||||
weston_xserver_shutdown(mxs);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +165,7 @@ bind_xserver(struct wl_client *client,
|
||||
|
||||
wxs->wm = weston_wm_create(wxs);
|
||||
if (wxs->wm == NULL) {
|
||||
fprintf(stderr, "failed to create wm\n");
|
||||
weston_log("failed to create wm\n");
|
||||
}
|
||||
|
||||
xserver_send_listen_socket(wxs->resource, wxs->abstract_fd);
|
||||
@@ -187,7 +188,7 @@ bind_to_abstract_socket(int display)
|
||||
"%c/tmp/.X11-unix/X%d", 0, display);
|
||||
size = offsetof(struct sockaddr_un, sun_path) + name_size;
|
||||
if (bind(fd, (struct sockaddr *) &addr, size) < 0) {
|
||||
fprintf(stderr, "failed to bind to @%s: %s\n",
|
||||
weston_log("failed to bind to @%s: %s\n",
|
||||
addr.sun_path + 1, strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
@@ -218,7 +219,7 @@ bind_to_unix_socket(int display)
|
||||
size = offsetof(struct sockaddr_un, sun_path) + name_size;
|
||||
unlink(addr.sun_path);
|
||||
if (bind(fd, (struct sockaddr *) &addr, size) < 0) {
|
||||
fprintf(stderr, "failed to bind to %s (%s)\n",
|
||||
weston_log("failed to bind to %s (%s)\n",
|
||||
addr.sun_path, strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
@@ -245,7 +246,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
|
||||
if (fd < 0 && errno == EEXIST) {
|
||||
fd = open(lockfile, O_CLOEXEC, O_RDONLY);
|
||||
if (fd < 0 || read(fd, pid, 11) != 11) {
|
||||
fprintf(stderr, "can't read lock file %s: %s\n",
|
||||
weston_log("can't read lock file %s: %s\n",
|
||||
lockfile, strerror(errno));
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
@@ -253,7 +254,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
|
||||
|
||||
other = strtol(pid, &end, 0);
|
||||
if (end != pid + 10) {
|
||||
fprintf(stderr, "can't parse lock file %s\n",
|
||||
weston_log("can't parse lock file %s\n",
|
||||
lockfile);
|
||||
close(fd);
|
||||
errno = EEXIST;
|
||||
@@ -262,8 +263,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
|
||||
|
||||
if (kill(other, 0) < 0 && errno == ESRCH) {
|
||||
/* stale lock file; unlink and try again */
|
||||
fprintf(stderr,
|
||||
"unlinking stale lock file %s\n", lockfile);
|
||||
weston_log("unlinking stale lock file %s\n", lockfile);
|
||||
close(fd);
|
||||
if (unlink(lockfile))
|
||||
/* If we fail to unlink, return EEXIST
|
||||
@@ -277,7 +277,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
} else if (fd < 0) {
|
||||
fprintf(stderr, "failed to create lock file %s: %s\n",
|
||||
weston_log("failed to create lock file %s: %s\n",
|
||||
lockfile, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ weston_xserver_init(struct weston_compositor *compositor)
|
||||
}
|
||||
|
||||
snprintf(display_name, sizeof display_name, ":%d", mxs->display);
|
||||
fprintf(stderr, "xserver listening on display %s\n", display_name);
|
||||
weston_log("xserver listening on display %s\n", display_name);
|
||||
setenv("DISPLAY", display_name, 1);
|
||||
|
||||
mxs->loop = wl_display_get_event_loop(display);
|
||||
|
||||
+25
-25
@@ -23,12 +23,12 @@
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "xwayland.h"
|
||||
#include "../log.h"
|
||||
|
||||
static int
|
||||
weston_wm_write_property(int fd, uint32_t mask, void *data)
|
||||
@@ -46,11 +46,11 @@ weston_wm_write_property(int fd, uint32_t mask, void *data)
|
||||
free(wm->property_reply);
|
||||
wl_event_source_remove(wm->property_source);
|
||||
close(fd);
|
||||
fprintf(stderr, "write error to target fd: %m\n");
|
||||
weston_log("write error to target fd: %m\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "wrote %d (chunk size %d) of %d bytes\n",
|
||||
weston_log("wrote %d (chunk size %d) of %d bytes\n",
|
||||
wm->property_start + len,
|
||||
len, xcb_get_property_value_length(wm->property_reply));
|
||||
|
||||
@@ -64,7 +64,7 @@ weston_wm_write_property(int fd, uint32_t mask, void *data)
|
||||
wm->selection_window,
|
||||
wm->atom.wl_selection);
|
||||
} else {
|
||||
fprintf(stderr, "transfer complete\n");
|
||||
weston_log("transfer complete\n");
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ weston_wm_get_incr_chunk(struct weston_wm *wm)
|
||||
wm);
|
||||
wm->property_reply = reply;
|
||||
} else {
|
||||
fprintf(stderr, "transfer complete\n");
|
||||
weston_log("transfer complete\n");
|
||||
close(wm->data_source_fd);
|
||||
free(reply);
|
||||
}
|
||||
@@ -345,20 +345,20 @@ weston_wm_read_data_source(int fd, uint32_t mask, void *data)
|
||||
|
||||
len = read(fd, p, available);
|
||||
if (len == -1) {
|
||||
fprintf(stderr, "read error from data source: %m\n");
|
||||
weston_log("read error from data source: %m\n");
|
||||
weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
|
||||
wl_event_source_remove(wm->property_source);
|
||||
close(fd);
|
||||
wl_array_release(&wm->source_data);
|
||||
}
|
||||
|
||||
fprintf(stderr, "read %d (available %d, mask 0x%x) bytes: \"%.*s\"\n",
|
||||
weston_log("read %d (available %d, mask 0x%x) bytes: \"%.*s\"\n",
|
||||
len, available, mask, len, (char *) p);
|
||||
|
||||
wm->source_data.size = current + len;
|
||||
if (wm->source_data.size >= incr_chunk_size) {
|
||||
if (!wm->incr) {
|
||||
fprintf(stderr, "got %zu bytes, starting incr\n",
|
||||
weston_log("got %zu bytes, starting incr\n",
|
||||
wm->source_data.size);
|
||||
wm->incr = 1;
|
||||
xcb_change_property(wm->conn,
|
||||
@@ -373,19 +373,19 @@ weston_wm_read_data_source(int fd, uint32_t mask, void *data)
|
||||
wl_event_source_remove(wm->property_source);
|
||||
weston_wm_send_selection_notify(wm, wm->selection_request.property);
|
||||
} else if (wm->selection_property_set) {
|
||||
fprintf(stderr, "got %zu bytes, waiting for "
|
||||
weston_log("got %zu bytes, waiting for "
|
||||
"property delete\n", wm->source_data.size);
|
||||
|
||||
wm->flush_property_on_delete = 1;
|
||||
wl_event_source_remove(wm->property_source);
|
||||
} else {
|
||||
fprintf(stderr, "got %zu bytes, "
|
||||
weston_log("got %zu bytes, "
|
||||
"property deleted, seting new property\n",
|
||||
wm->source_data.size);
|
||||
weston_wm_flush_source_data(wm);
|
||||
}
|
||||
} else if (len == 0 && !wm->incr) {
|
||||
fprintf(stderr, "non-incr transfer complete\n");
|
||||
weston_log("non-incr transfer complete\n");
|
||||
/* Non-incr transfer all done. */
|
||||
weston_wm_flush_source_data(wm);
|
||||
weston_wm_send_selection_notify(wm, wm->selection_request.property);
|
||||
@@ -395,14 +395,14 @@ weston_wm_read_data_source(int fd, uint32_t mask, void *data)
|
||||
wl_array_release(&wm->source_data);
|
||||
wm->selection_request.requestor = XCB_NONE;
|
||||
} else if (len == 0 && wm->incr) {
|
||||
fprintf(stderr, "incr transfer complete\n");
|
||||
weston_log("incr transfer complete\n");
|
||||
|
||||
wm->flush_property_on_delete = 1;
|
||||
if (wm->selection_property_set) {
|
||||
fprintf(stderr, "got %zu bytes, waiting for "
|
||||
weston_log("got %zu bytes, waiting for "
|
||||
"property delete\n", wm->source_data.size);
|
||||
} else {
|
||||
fprintf(stderr, "got %zu bytes, "
|
||||
weston_log("got %zu bytes, "
|
||||
"property deleted, seting new property\n",
|
||||
wm->source_data.size);
|
||||
weston_wm_flush_source_data(wm);
|
||||
@@ -413,7 +413,7 @@ weston_wm_read_data_source(int fd, uint32_t mask, void *data)
|
||||
wm->data_source_fd = -1;
|
||||
close(fd);
|
||||
} else {
|
||||
fprintf(stderr, "nothing happened, buffered the bytes\n");
|
||||
weston_log("nothing happened, buffered the bytes\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -427,7 +427,7 @@ weston_wm_send_data(struct weston_wm *wm, xcb_atom_t target, const char *mime_ty
|
||||
int p[2];
|
||||
|
||||
if (pipe2(p, O_CLOEXEC | O_NONBLOCK) == -1) {
|
||||
fprintf(stderr, "pipe2 failed: %m\n");
|
||||
weston_log("pipe2 failed: %m\n");
|
||||
weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
|
||||
return;
|
||||
}
|
||||
@@ -450,11 +450,11 @@ weston_wm_send_incr_chunk(struct weston_wm *wm)
|
||||
{
|
||||
int length;
|
||||
|
||||
fprintf(stderr, "property deleted\n");
|
||||
weston_log("property deleted\n");
|
||||
|
||||
wm->selection_property_set = 0;
|
||||
if (wm->flush_property_on_delete) {
|
||||
fprintf(stderr, "setting new property, %zu bytes\n",
|
||||
weston_log("setting new property, %zu bytes\n",
|
||||
wm->source_data.size);
|
||||
wm->flush_property_on_delete = 0;
|
||||
length = weston_wm_flush_source_data(wm);
|
||||
@@ -510,11 +510,11 @@ weston_wm_handle_selection_request(struct weston_wm *wm,
|
||||
xcb_selection_request_event_t *selection_request =
|
||||
(xcb_selection_request_event_t *) event;
|
||||
|
||||
fprintf(stderr, "selection request, %s, ",
|
||||
weston_log("selection request, %s, ",
|
||||
get_atom_name(wm->conn, selection_request->selection));
|
||||
fprintf(stderr, "target %s, ",
|
||||
weston_log_continue("target %s, ",
|
||||
get_atom_name(wm->conn, selection_request->target));
|
||||
fprintf(stderr, "property %s\n",
|
||||
weston_log_continue("property %s\n",
|
||||
get_atom_name(wm->conn, selection_request->property));
|
||||
|
||||
wm->selection_request = *selection_request;
|
||||
@@ -539,7 +539,7 @@ weston_wm_handle_selection_request(struct weston_wm *wm,
|
||||
weston_wm_send_data(wm, wm->atom.utf8_string,
|
||||
"text/plain;charset=utf-8");
|
||||
} else {
|
||||
fprintf(stderr, "can only handle UTF8_STRING targets...\n");
|
||||
weston_log("can only handle UTF8_STRING targets...\n");
|
||||
weston_wm_send_selection_notify(wm, XCB_ATOM_NONE);
|
||||
}
|
||||
}
|
||||
@@ -553,7 +553,7 @@ weston_wm_handle_xfixes_selection_notify(struct weston_wm *wm,
|
||||
struct weston_compositor *compositor;
|
||||
uint32_t serial;
|
||||
|
||||
printf("xfixes selection notify event: owner %d\n",
|
||||
weston_log("xfixes selection notify event: owner %d\n",
|
||||
xfixes_selection_notify->owner);
|
||||
|
||||
if (xfixes_selection_notify->owner == XCB_WINDOW_NONE) {
|
||||
@@ -577,7 +577,7 @@ weston_wm_handle_xfixes_selection_notify(struct weston_wm *wm,
|
||||
* answer TIMESTAMP conversion requests correctly. */
|
||||
if (xfixes_selection_notify->owner == wm->selection_window) {
|
||||
wm->selection_timestamp = xfixes_selection_notify->timestamp;
|
||||
fprintf(stderr, "our window, skipping\n");
|
||||
weston_log("our window, skipping\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ weston_wm_set_selection(struct wl_listener *listener, void *data)
|
||||
end = (const char **)
|
||||
((char *) source->mime_types.data + source->mime_types.size);
|
||||
while (p < end) {
|
||||
fprintf(stderr, " %s\n", *p);
|
||||
weston_log(" %s\n", *p);
|
||||
if (strcmp(*p, "text/plain") == 0 ||
|
||||
strcmp(*p, "text/plain;charset=utf-8") == 0)
|
||||
has_text_plain = 1;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "../../shared/cairo-util.h"
|
||||
#include "../compositor.h"
|
||||
#include "../log.h"
|
||||
#include "xserver-server-protocol.h"
|
||||
#include "hash.h"
|
||||
|
||||
@@ -149,13 +150,13 @@ dump_property(struct weston_wm *wm,
|
||||
int width, len;
|
||||
uint32_t i;
|
||||
|
||||
width = fprintf(stderr, "%s: ", get_atom_name(wm->conn, property));
|
||||
width = weston_log_continue("%s: ", get_atom_name(wm->conn, property));
|
||||
if (reply == NULL) {
|
||||
fprintf(stderr, "(no reply)\n");
|
||||
weston_log_continue("(no reply)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
width += fprintf(stderr,
|
||||
width += weston_log_continue(
|
||||
"%s/%d, length %d (value_len %d): ",
|
||||
get_atom_name(wm->conn, reply->type),
|
||||
reply->format,
|
||||
@@ -164,7 +165,7 @@ dump_property(struct weston_wm *wm,
|
||||
|
||||
if (reply->type == wm->atom.incr) {
|
||||
incr_value = xcb_get_property_value(reply);
|
||||
fprintf(stderr, "%d\n", *incr_value);
|
||||
weston_log_continue("%d\n", *incr_value);
|
||||
} else if (reply->type == wm->atom.utf8_string ||
|
||||
reply->type == wm->atom.string) {
|
||||
text_value = xcb_get_property_value(reply);
|
||||
@@ -172,23 +173,23 @@ dump_property(struct weston_wm *wm,
|
||||
len = 40;
|
||||
else
|
||||
len = reply->value_len;
|
||||
fprintf(stderr, "\"%.*s\"\n", len, text_value);
|
||||
weston_log_continue("\"%.*s\"\n", len, text_value);
|
||||
} else if (reply->type == XCB_ATOM_ATOM) {
|
||||
atom_value = xcb_get_property_value(reply);
|
||||
for (i = 0; i < reply->value_len; i++) {
|
||||
name = get_atom_name(wm->conn, atom_value[i]);
|
||||
if (width + strlen(name) + 2 > 78) {
|
||||
fprintf(stderr, "\n ");
|
||||
weston_log_continue("\n ");
|
||||
width = 4;
|
||||
} else if (i > 0) {
|
||||
width += fprintf(stderr, ", ");
|
||||
width += weston_log_continue(", ");
|
||||
}
|
||||
|
||||
width += fprintf(stderr, "%s", name);
|
||||
width += weston_log_continue("%s", name);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
weston_log_continue("\n");
|
||||
} else {
|
||||
fprintf(stderr, "huh?\n");
|
||||
weston_log_continue("huh?\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +341,7 @@ weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *ev
|
||||
uint32_t mask, values[16];
|
||||
int x, y, width, height, i = 0;
|
||||
|
||||
fprintf(stderr, "XCB_CONFIGURE_REQUEST (window %d) %d,%d @ %dx%d\n",
|
||||
weston_log("XCB_CONFIGURE_REQUEST (window %d) %d,%d @ %dx%d\n",
|
||||
configure_request->window,
|
||||
configure_request->x, configure_request->y,
|
||||
configure_request->width, configure_request->height);
|
||||
@@ -390,7 +391,7 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
|
||||
|
||||
window = hash_table_lookup(wm->window_hash, configure_notify->window);
|
||||
|
||||
fprintf(stderr, "XCB_CONFIGURE_NOTIFY (%s window %d) %d,%d @ %dx%d\n",
|
||||
weston_log("XCB_CONFIGURE_NOTIFY (%s window %d) %d,%d @ %dx%d\n",
|
||||
configure_notify->window == window->id ? "client" : "frame",
|
||||
configure_notify->window,
|
||||
configure_notify->x, configure_notify->y,
|
||||
@@ -476,7 +477,7 @@ weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
|
||||
int x, y, width, height;
|
||||
|
||||
if (our_resource(wm, map_request->window)) {
|
||||
fprintf(stderr, "XCB_MAP_REQUEST (window %d, ours)\n",
|
||||
weston_log("XCB_MAP_REQUEST (window %d, ours)\n",
|
||||
map_request->window);
|
||||
return;
|
||||
}
|
||||
@@ -516,7 +517,7 @@ weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
|
||||
xcb_configure_window(wm->conn, window->id,
|
||||
XCB_CONFIG_WINDOW_BORDER_WIDTH, values);
|
||||
|
||||
fprintf(stderr, "XCB_MAP_REQUEST (window %d, %p, frame %d)\n",
|
||||
weston_log("XCB_MAP_REQUEST (window %d, %p, frame %d)\n",
|
||||
window->id, window, window->frame_id);
|
||||
|
||||
xcb_map_window(wm->conn, map_request->window);
|
||||
@@ -539,12 +540,12 @@ weston_wm_handle_map_notify(struct weston_wm *wm, xcb_generic_event_t *event)
|
||||
xcb_map_notify_event_t *map_notify = (xcb_map_notify_event_t *) event;
|
||||
|
||||
if (our_resource(wm, map_notify->window)) {
|
||||
fprintf(stderr, "XCB_MAP_NOTIFY (window %d, ours)\n",
|
||||
weston_log("XCB_MAP_NOTIFY (window %d, ours)\n",
|
||||
map_notify->window);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "XCB_MAP_NOTIFY (window %d)\n", map_notify->window);
|
||||
weston_log("XCB_MAP_NOTIFY (window %d)\n", map_notify->window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -554,8 +555,7 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
|
||||
(xcb_unmap_notify_event_t *) event;
|
||||
struct weston_wm_window *window;
|
||||
|
||||
fprintf(stderr,
|
||||
"XCB_UNMAP_NOTIFY (window %d, event %d%s)\n",
|
||||
weston_log("XCB_UNMAP_NOTIFY (window %d, event %d%s)\n",
|
||||
unmap_notify->window,
|
||||
unmap_notify->event,
|
||||
our_resource(wm, unmap_notify->window) ? ", ours" : "");
|
||||
@@ -677,10 +677,10 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
|
||||
if (window)
|
||||
window->properties_dirty = 1;
|
||||
|
||||
fprintf(stderr, "XCB_PROPERTY_NOTIFY: window %d, ",
|
||||
weston_log("XCB_PROPERTY_NOTIFY: window %d, ",
|
||||
property_notify->window);
|
||||
if (property_notify->state == XCB_PROPERTY_DELETE)
|
||||
fprintf(stderr, "deleted\n");
|
||||
weston_log("deleted\n");
|
||||
else
|
||||
read_and_dump_property(wm, property_notify->window,
|
||||
property_notify->atom);
|
||||
@@ -699,7 +699,7 @@ weston_wm_window_create(struct weston_wm *wm,
|
||||
|
||||
window = malloc(sizeof *window);
|
||||
if (window == NULL) {
|
||||
fprintf(stderr, "failed to allocate window\n");
|
||||
weston_log("failed to allocate window\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -730,8 +730,7 @@ weston_wm_handle_create_notify(struct weston_wm *wm, xcb_generic_event_t *event)
|
||||
xcb_create_notify_event_t *create_notify =
|
||||
(xcb_create_notify_event_t *) event;
|
||||
|
||||
fprintf(stderr,
|
||||
"XCB_CREATE_NOTIFY (window %d, width %d, height %d%s%s)\n",
|
||||
weston_log("XCB_CREATE_NOTIFY (window %d, width %d, height %d%s%s)\n",
|
||||
create_notify->window,
|
||||
create_notify->width, create_notify->height,
|
||||
create_notify->override_redirect ? ", override" : "",
|
||||
@@ -752,7 +751,7 @@ weston_wm_handle_destroy_notify(struct weston_wm *wm, xcb_generic_event_t *event
|
||||
(xcb_destroy_notify_event_t *) event;
|
||||
struct weston_wm_window *window;
|
||||
|
||||
fprintf(stderr, "XCB_DESTROY_NOTIFY, win %d, event %d%s\n",
|
||||
weston_log("XCB_DESTROY_NOTIFY, win %d, event %d%s\n",
|
||||
destroy_notify->window,
|
||||
destroy_notify->event,
|
||||
our_resource(wm, destroy_notify->window) ? ", ours" : "");
|
||||
@@ -771,8 +770,7 @@ weston_wm_handle_reparent_notify(struct weston_wm *wm, xcb_generic_event_t *even
|
||||
(xcb_reparent_notify_event_t *) event;
|
||||
struct weston_wm_window *window;
|
||||
|
||||
fprintf(stderr,
|
||||
"XCB_REPARENT_NOTIFY (window %d, parent %d, event %d)\n",
|
||||
weston_log("XCB_REPARENT_NOTIFY (window %d, parent %d, event %d)\n",
|
||||
reparent_notify->window,
|
||||
reparent_notify->parent,
|
||||
reparent_notify->event);
|
||||
@@ -842,7 +840,7 @@ weston_wm_handle_client_message(struct weston_wm *wm,
|
||||
|
||||
window = hash_table_lookup(wm->window_hash, client_message->window);
|
||||
|
||||
fprintf(stderr, "XCB_CLIENT_MESSAGE (%s %d %d %d %d %d)\n",
|
||||
weston_log("XCB_CLIENT_MESSAGE (%s %d %d %d %d %d)\n",
|
||||
get_atom_name(wm->conn, client_message->type),
|
||||
client_message->data.data32[0],
|
||||
client_message->data.data32[1],
|
||||
@@ -865,7 +863,7 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
|
||||
struct theme *t = wm->theme;
|
||||
int width, height;
|
||||
|
||||
fprintf(stderr, "XCB_BUTTON_%s (detail %d)\n",
|
||||
weston_log("XCB_BUTTON_%s (detail %d)\n",
|
||||
button->response_type == XCB_BUTTON_PRESS ?
|
||||
"PRESS" : "RELEASE", button->detail);
|
||||
|
||||
@@ -946,7 +944,7 @@ weston_wm_handle_event(int fd, uint32_t mask, void *data)
|
||||
weston_wm_handle_destroy_notify(wm, event);
|
||||
break;
|
||||
case XCB_MAPPING_NOTIFY:
|
||||
fprintf(stderr, "XCB_MAPPING_NOTIFY\n");
|
||||
weston_log("XCB_MAPPING_NOTIFY\n");
|
||||
break;
|
||||
case XCB_PROPERTY_NOTIFY:
|
||||
weston_wm_handle_property_notify(wm, event);
|
||||
@@ -1048,7 +1046,7 @@ wxs_wm_get_resources(struct weston_wm *wm)
|
||||
|
||||
wm->xfixes = xcb_get_extension_data(wm->conn, &xcb_xfixes_id);
|
||||
if (!wm->xfixes || !wm->xfixes->present)
|
||||
fprintf(stderr, "xfixes not available\n");
|
||||
weston_log("xfixes not available\n");
|
||||
|
||||
xfixes_cookie = xcb_xfixes_query_version(wm->conn,
|
||||
XCB_XFIXES_MAJOR_VERSION,
|
||||
@@ -1056,7 +1054,7 @@ wxs_wm_get_resources(struct weston_wm *wm)
|
||||
xfixes_reply = xcb_xfixes_query_version_reply(wm->conn,
|
||||
xfixes_cookie, NULL);
|
||||
|
||||
printf("xfixes version: %d.%d\n",
|
||||
weston_log("xfixes version: %d.%d\n",
|
||||
xfixes_reply->major_version, xfixes_reply->minor_version);
|
||||
|
||||
free(xfixes_reply);
|
||||
@@ -1147,7 +1145,7 @@ weston_wm_create(struct weston_xserver *wxs)
|
||||
}
|
||||
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {
|
||||
fprintf(stderr, "socketpair failed\n");
|
||||
weston_log("socketpair failed\n");
|
||||
hash_table_destroy(wm->window_hash);
|
||||
free(wm);
|
||||
return NULL;
|
||||
@@ -1160,7 +1158,7 @@ weston_wm_create(struct weston_xserver *wxs)
|
||||
/* xcb_connect_to_fd takes ownership of the fd. */
|
||||
wm->conn = xcb_connect_to_fd(sv[0], NULL);
|
||||
if (xcb_connection_has_error(wm->conn)) {
|
||||
fprintf(stderr, "xcb_connect_to_fd failed\n");
|
||||
weston_log("xcb_connect_to_fd failed\n");
|
||||
close(sv[0]);
|
||||
hash_table_destroy(wm->window_hash);
|
||||
free(wm);
|
||||
@@ -1206,7 +1204,7 @@ weston_wm_create(struct weston_xserver *wxs)
|
||||
wl_signal_add(&wxs->compositor->activate_signal,
|
||||
&wm->activate_listener);
|
||||
|
||||
fprintf(stderr, "created wm\n");
|
||||
weston_log("created wm\n");
|
||||
|
||||
return wm;
|
||||
}
|
||||
@@ -1231,7 +1229,7 @@ surface_destroy(struct wl_listener *listener, void *data)
|
||||
container_of(listener,
|
||||
struct weston_wm_window, surface_destroy_listener);
|
||||
|
||||
fprintf(stderr, "surface for xid %d destroyed\n", window->id);
|
||||
weston_log("surface for xid %d destroyed\n", window->id);
|
||||
}
|
||||
|
||||
static struct weston_wm_window *
|
||||
@@ -1351,11 +1349,11 @@ xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
|
||||
|
||||
window = hash_table_lookup(wm->window_hash, id);
|
||||
if (window == NULL) {
|
||||
fprintf(stderr, "set_window_id for unknown window %d\n", id);
|
||||
weston_log("set_window_id for unknown window %d\n", id);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "set_window_id %d for surface %p\n", id, surface);
|
||||
weston_log("set_window_id %d for surface %p\n", id, surface);
|
||||
|
||||
weston_wm_window_read_properties(window);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user