mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-02-20 01:40:56 -05:00
view: reorder functions
It had gotten a bit messy. Now functions are grouped together (i.e., getters, queries, etc).
This commit is contained in:
parent
64b971a665
commit
7175100d0d
4 changed files with 95 additions and 95 deletions
62
xdg_shell.c
62
xdg_shell.c
|
|
@ -30,6 +30,37 @@ get_title(struct cg_view *view)
|
|||
return xdg_shell_view->xdg_surface->toplevel->title;
|
||||
}
|
||||
|
||||
static void
|
||||
get_geometry(struct cg_view *view, int *width_out, int *height_out)
|
||||
{
|
||||
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
|
||||
struct wlr_box geom;
|
||||
|
||||
wlr_xdg_surface_get_geometry(xdg_shell_view->xdg_surface, &geom);
|
||||
*width_out = geom.width;
|
||||
*height_out = geom.height;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_primary(struct cg_view *view)
|
||||
{
|
||||
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
|
||||
struct wlr_xdg_surface *parent = xdg_shell_view->xdg_surface->toplevel->parent;
|
||||
/* FIXME: role is 0? */
|
||||
return parent == NULL; /*&& role == WLR_XDG_SURFACE_ROLE_TOPLEVEL */
|
||||
}
|
||||
|
||||
static bool
|
||||
is_parent(struct cg_view *parent, struct cg_view *child)
|
||||
{
|
||||
if (child->type != CAGE_XDG_SHELL_VIEW) {
|
||||
return false;
|
||||
}
|
||||
struct cg_xdg_shell_view *_parent = xdg_shell_view_from_view(parent);
|
||||
struct cg_xdg_shell_view *_child = xdg_shell_view_from_view(child);
|
||||
return _child->xdg_surface->toplevel->parent == _parent->xdg_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
activate(struct cg_view *view, bool activate)
|
||||
{
|
||||
|
|
@ -52,17 +83,6 @@ destroy(struct cg_view *view)
|
|||
free(xdg_shell_view);
|
||||
}
|
||||
|
||||
static void
|
||||
get_geometry(struct cg_view *view, int *width_out, int *height_out)
|
||||
{
|
||||
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
|
||||
struct wlr_box geom;
|
||||
|
||||
wlr_xdg_surface_get_geometry(xdg_shell_view->xdg_surface, &geom);
|
||||
*width_out = geom.width;
|
||||
*height_out = geom.height;
|
||||
}
|
||||
|
||||
static void
|
||||
for_each_surface(struct cg_view *view, wlr_surface_iterator_func_t iterator, void *data)
|
||||
{
|
||||
|
|
@ -77,26 +97,6 @@ wlr_surface_at(struct cg_view *view, double sx, double sy, double *sub_x, double
|
|||
return wlr_xdg_surface_surface_at(xdg_shell_view->xdg_surface, sx, sy, sub_x, sub_y);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_primary(struct cg_view *view)
|
||||
{
|
||||
struct cg_xdg_shell_view *xdg_shell_view = xdg_shell_view_from_view(view);
|
||||
struct wlr_xdg_surface *parent = xdg_shell_view->xdg_surface->toplevel->parent;
|
||||
/* FIXME: role is 0? */
|
||||
return parent == NULL; /*&& role == WLR_XDG_SURFACE_ROLE_TOPLEVEL */
|
||||
}
|
||||
|
||||
static bool
|
||||
is_parent(struct cg_view *parent, struct cg_view *child)
|
||||
{
|
||||
if (child->type != CAGE_XDG_SHELL_VIEW) {
|
||||
return false;
|
||||
}
|
||||
struct cg_xdg_shell_view *_parent = xdg_shell_view_from_view(parent);
|
||||
struct cg_xdg_shell_view *_child = xdg_shell_view_from_view(child);
|
||||
return _child->xdg_surface->toplevel->parent == _parent->xdg_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_xdg_shell_surface_unmap(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue