xwm: Reduce window property debug output
We just print properties when they change now instead of dumping all properties whenever we re-read them. Also, make the property output a little more concise.
This commit is contained in:
@@ -139,8 +139,8 @@ get_atom_name(xcb_connection_t *c, xcb_atom_t atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_property(struct weston_wm *wm, xcb_atom_t property,
|
dump_property(struct weston_wm *wm,
|
||||||
xcb_get_property_reply_t *reply)
|
xcb_atom_t property, xcb_get_property_reply_t *reply)
|
||||||
{
|
{
|
||||||
int32_t *incr_value;
|
int32_t *incr_value;
|
||||||
const char *text_value, *name;
|
const char *text_value, *name;
|
||||||
@@ -148,14 +148,14 @@ dump_property(struct weston_wm *wm, xcb_atom_t property,
|
|||||||
int width, len;
|
int width, len;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
width = fprintf(stderr, " %s: ", get_atom_name(wm->conn, property));
|
width = fprintf(stderr, "%s: ", get_atom_name(wm->conn, property));
|
||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
fprintf(stderr, "(no reply)\n");
|
fprintf(stderr, "(no reply)\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
width += fprintf(stderr,
|
width += fprintf(stderr,
|
||||||
"type %s, format %d, length %d (value_len %d): ",
|
"%s/%d, length %d (value_len %d): ",
|
||||||
get_atom_name(wm->conn, reply->type),
|
get_atom_name(wm->conn, reply->type),
|
||||||
reply->format,
|
reply->format,
|
||||||
xcb_get_property_value_length(reply),
|
xcb_get_property_value_length(reply),
|
||||||
@@ -191,42 +191,20 @@ dump_property(struct weston_wm *wm, xcb_atom_t property,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
dump_window_properties(struct weston_wm *wm, xcb_window_t window)
|
read_and_dump_property(struct weston_wm *wm,
|
||||||
|
xcb_window_t window, xcb_atom_t property)
|
||||||
{
|
{
|
||||||
xcb_list_properties_cookie_t list_cookie;
|
xcb_get_property_reply_t *reply;
|
||||||
xcb_list_properties_reply_t *list_reply;
|
xcb_get_property_cookie_t cookie;
|
||||||
xcb_get_property_cookie_t property_cookie;
|
|
||||||
xcb_get_property_reply_t *property_reply;
|
|
||||||
xcb_atom_t *atoms;
|
|
||||||
int i, length;
|
|
||||||
|
|
||||||
list_cookie = xcb_list_properties(wm->conn, window);
|
cookie = xcb_get_property(wm->conn, 0, window,
|
||||||
list_reply = xcb_list_properties_reply(wm->conn, list_cookie, NULL);
|
property, XCB_ATOM_ANY, 0, 2048);
|
||||||
if (!list_reply)
|
reply = xcb_get_property_reply(wm->conn, cookie, NULL);
|
||||||
/* Bad window, typically */
|
|
||||||
return;
|
|
||||||
|
|
||||||
length = xcb_list_properties_atoms_length(list_reply);
|
dump_property(wm, property, reply);
|
||||||
atoms = xcb_list_properties_atoms(list_reply);
|
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
free(reply);
|
||||||
property_cookie =
|
|
||||||
xcb_get_property(wm->conn,
|
|
||||||
0, /* delete */
|
|
||||||
window,
|
|
||||||
atoms[i],
|
|
||||||
XCB_ATOM_ANY,
|
|
||||||
0, 2048);
|
|
||||||
|
|
||||||
property_reply = xcb_get_property_reply(wm->conn,
|
|
||||||
property_cookie, NULL);
|
|
||||||
dump_property(wm, atoms[i], property_reply);
|
|
||||||
|
|
||||||
free(property_reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(list_reply);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We reuse some predefined, but otherwise useles atoms */
|
/* We reuse some predefined, but otherwise useles atoms */
|
||||||
@@ -266,8 +244,6 @@ weston_wm_window_read_properties(struct weston_wm_window *window)
|
|||||||
return;
|
return;
|
||||||
window->properties_dirty = 0;
|
window->properties_dirty = 0;
|
||||||
|
|
||||||
dump_window_properties(wm, window->id);
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(props); i++)
|
for (i = 0; i < ARRAY_LENGTH(props); i++)
|
||||||
cookie[i] = xcb_get_property(wm->conn,
|
cookie[i] = xcb_get_property(wm->conn,
|
||||||
0, /* delete */
|
0, /* delete */
|
||||||
@@ -648,29 +624,14 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
|
|||||||
if (window)
|
if (window)
|
||||||
window->properties_dirty = 1;
|
window->properties_dirty = 1;
|
||||||
|
|
||||||
if (property_notify->atom == XCB_ATOM_WM_CLASS) {
|
fprintf(stderr, "XCB_PROPERTY_NOTIFY: window %d, ",
|
||||||
fprintf(stderr, "wm_class changed\n");
|
property_notify->window);
|
||||||
} else if (property_notify->atom == XCB_ATOM_WM_TRANSIENT_FOR) {
|
read_and_dump_property(wm, property_notify->window,
|
||||||
fprintf(stderr, "wm_transient_for changed\n");
|
property_notify->atom);
|
||||||
} else if (property_notify->atom == wm->atom.wm_protocols) {
|
|
||||||
fprintf(stderr, "wm_protocols changed\n");
|
if (property_notify->atom == wm->atom.net_wm_name ||
|
||||||
} else if (property_notify->atom == wm->atom.net_wm_name) {
|
property_notify->atom == XCB_ATOM_WM_NAME)
|
||||||
fprintf(stderr, "_net_wm_name changed\n");
|
|
||||||
weston_wm_window_schedule_repaint(window);
|
weston_wm_window_schedule_repaint(window);
|
||||||
} else if (property_notify->atom == wm->atom.net_wm_user_time) {
|
|
||||||
fprintf(stderr, "_net_wm_user_time changed\n");
|
|
||||||
} else if (property_notify->atom == wm->atom.net_wm_icon_name) {
|
|
||||||
fprintf(stderr, "_net_wm_icon_name changed\n");
|
|
||||||
} else if (property_notify->atom == XCB_ATOM_WM_NAME) {
|
|
||||||
fprintf(stderr, "wm_name changed\n");
|
|
||||||
weston_wm_window_schedule_repaint(window);
|
|
||||||
} else if (property_notify->atom == XCB_ATOM_WM_ICON_NAME) {
|
|
||||||
fprintf(stderr, "wm_icon_name changed\n");
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "XCB_PROPERTY_NOTIFY: "
|
|
||||||
"unhandled property change: %s\n",
|
|
||||||
get_atom_name(wm->conn, property_notify->atom));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -122,6 +122,9 @@ struct weston_wm {
|
|||||||
void
|
void
|
||||||
dump_property(struct weston_wm *wm, xcb_atom_t property,
|
dump_property(struct weston_wm *wm, xcb_atom_t property,
|
||||||
xcb_get_property_reply_t *reply);
|
xcb_get_property_reply_t *reply);
|
||||||
|
void
|
||||||
|
read_and_dump_property(struct weston_wm *wm,
|
||||||
|
xcb_window_t window, xcb_atom_t property);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
get_atom_name(xcb_connection_t *c, xcb_atom_t atom);
|
get_atom_name(xcb_connection_t *c, xcb_atom_t atom);
|
||||||
|
|||||||
Reference in New Issue
Block a user