2020-08-20 21:13:04 +01:00
|
|
|
#include "common/log.h"
|
2020-09-28 20:41:41 +01:00
|
|
|
#include "config/keybind.h"
|
|
|
|
|
#include "config/rcxml.h"
|
|
|
|
|
#include "labwc.h"
|
2020-08-20 21:13:04 +01:00
|
|
|
|
2020-09-28 20:41:41 +01:00
|
|
|
static int
|
|
|
|
|
xwl_nr_parents(struct view *view)
|
2020-08-20 21:13:04 +01:00
|
|
|
{
|
|
|
|
|
struct wlr_xwayland_surface *s = view->xwayland_surface;
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
if (!s) {
|
|
|
|
|
warn("(%s) no xwayland surface\n", __func__);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
while (s->parent) {
|
|
|
|
|
s = s->parent;
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
2019-12-27 21:45:00 +00:00
|
|
|
|
2020-09-28 20:41:41 +01:00
|
|
|
static void
|
|
|
|
|
show_one_xdg_view(struct view *view)
|
2019-12-27 21:45:00 +00:00
|
|
|
{
|
|
|
|
|
fprintf(stderr, "XDG ");
|
|
|
|
|
switch (view->xdg_surface->role) {
|
|
|
|
|
case WLR_XDG_SURFACE_ROLE_NONE:
|
|
|
|
|
fprintf(stderr, "- ");
|
|
|
|
|
break;
|
|
|
|
|
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
|
|
|
|
fprintf(stderr, "0 ");
|
|
|
|
|
break;
|
|
|
|
|
case WLR_XDG_SURFACE_ROLE_POPUP:
|
|
|
|
|
fprintf(stderr, "? ");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
fprintf(stderr, " %p %s", (void *)view,
|
|
|
|
|
view->xdg_surface->toplevel->app_id);
|
2020-09-08 20:18:12 +01:00
|
|
|
fprintf(stderr, " {%d, %d, %d, %d}\n", view->x, view->y, view->w,
|
|
|
|
|
view->h);
|
2019-12-27 21:45:00 +00:00
|
|
|
}
|
|
|
|
|
|
2020-09-28 20:41:41 +01:00
|
|
|
static void
|
|
|
|
|
show_one_xwl_view(struct view *view)
|
2019-12-27 21:45:00 +00:00
|
|
|
{
|
|
|
|
|
fprintf(stderr, "XWL ");
|
2020-08-31 08:33:23 +01:00
|
|
|
fprintf(stderr, "%d ", xwl_nr_parents(view));
|
2019-12-27 21:45:00 +00:00
|
|
|
fprintf(stderr, " %d ",
|
|
|
|
|
wl_list_length(&view->xwayland_surface->children));
|
|
|
|
|
if (view->mapped) {
|
|
|
|
|
fprintf(stderr, "Y");
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(stderr, "-");
|
|
|
|
|
}
|
2020-09-08 20:51:33 +01:00
|
|
|
fprintf(stderr, " %p %s {%d,%d,%d,%d}\n", (void *)view,
|
2019-12-27 21:45:00 +00:00
|
|
|
view->xwayland_surface->class, view->xwayland_surface->x,
|
|
|
|
|
view->xwayland_surface->y, view->xwayland_surface->width,
|
|
|
|
|
view->xwayland_surface->height);
|
|
|
|
|
/*
|
|
|
|
|
* Other variables to consider printing:
|
|
|
|
|
*
|
|
|
|
|
* view->mapped,
|
|
|
|
|
* view->xwayland_surface->override_redirect,
|
|
|
|
|
* wlr_xwayland_or_surface_wants_focus(view->xwayland_surface));
|
|
|
|
|
* view->xwayland_surface->saved_width,
|
|
|
|
|
* view->xwayland_surface->saved_height);
|
|
|
|
|
* view->xwayland_surface->surface->sx,
|
|
|
|
|
* view->xwayland_surface->surface->sy);
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-28 20:41:41 +01:00
|
|
|
void
|
|
|
|
|
dbg_show_one_view(struct view *view)
|
2019-12-27 21:45:00 +00:00
|
|
|
{
|
2020-09-28 20:41:41 +01:00
|
|
|
if (!view->surface) {
|
2020-09-07 19:47:11 +01:00
|
|
|
return;
|
2020-09-28 20:41:41 +01:00
|
|
|
}
|
|
|
|
|
if (!view->mapped && !view->minimized) {
|
2020-09-07 19:47:11 +01:00
|
|
|
return;
|
2020-09-28 20:41:41 +01:00
|
|
|
}
|
|
|
|
|
if (view->type == LAB_XDG_SHELL_VIEW) {
|
2019-12-27 21:45:00 +00:00
|
|
|
show_one_xdg_view(view);
|
2020-09-28 20:41:41 +01:00
|
|
|
} else if (view->type == LAB_XWAYLAND_VIEW) {
|
2019-12-27 21:45:00 +00:00
|
|
|
show_one_xwl_view(view);
|
2020-09-28 20:41:41 +01:00
|
|
|
}
|
2019-12-27 21:45:00 +00:00
|
|
|
}
|
|
|
|
|
|
2020-09-28 20:41:41 +01:00
|
|
|
void
|
|
|
|
|
dbg_show_views(struct server *server)
|
2019-12-27 21:45:00 +00:00
|
|
|
{
|
|
|
|
|
struct view *view;
|
|
|
|
|
|
|
|
|
|
fprintf(stderr, "---\n");
|
|
|
|
|
fprintf(stderr, "TYPE NR_PNT NR_CLD MAPPED VIEW-POINTER NAME\n");
|
2020-09-28 20:41:41 +01:00
|
|
|
wl_list_for_each_reverse (view, &server->views, link) {
|
2020-05-12 22:24:18 +01:00
|
|
|
dbg_show_one_view(view);
|
2020-09-28 20:41:41 +01:00
|
|
|
}
|
2019-12-27 21:45:00 +00:00
|
|
|
}
|
2020-06-18 20:39:55 +01:00
|
|
|
|
2020-09-28 20:41:41 +01:00
|
|
|
void
|
|
|
|
|
dbg_show_keybinds()
|
2020-06-18 20:39:55 +01:00
|
|
|
{
|
|
|
|
|
struct keybind *keybind;
|
|
|
|
|
wl_list_for_each_reverse (keybind, &rc.keybinds, link) {
|
|
|
|
|
printf("KEY=%s-", keybind->action);
|
2020-09-28 20:41:41 +01:00
|
|
|
for (size_t i = 0; i < keybind->keysyms_len; i++) {
|
2020-06-18 20:39:55 +01:00
|
|
|
printf(" %d\n", keybind->keysyms[i]);
|
2020-09-28 20:41:41 +01:00
|
|
|
}
|
2020-06-18 20:39:55 +01:00
|
|
|
}
|
|
|
|
|
}
|