mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
view, xdg: notify clients when tiling windows
This commit is contained in:
parent
ab1b0478a5
commit
c1a2dd3e27
3 changed files with 51 additions and 0 deletions
|
|
@ -94,6 +94,7 @@ struct view_impl {
|
|||
void (*map)(struct view *view);
|
||||
void (*set_activated)(struct view *view, bool activated);
|
||||
void (*set_fullscreen)(struct view *view, bool fullscreen);
|
||||
void (*set_tiled)(struct view *view);
|
||||
/*
|
||||
* client_request is true if the client unmapped its own
|
||||
* surface; false if we are just minimizing the view. The two
|
||||
|
|
|
|||
14
src/view.c
14
src/view.c
|
|
@ -1051,6 +1051,10 @@ view_set_untiled(struct view *view)
|
|||
view->tiled = VIEW_EDGE_INVALID;
|
||||
view->tiled_region = NULL;
|
||||
zfree(view->tiled_region_evacuate);
|
||||
|
||||
if (view->impl->set_tiled) {
|
||||
view->impl->set_tiled(view);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1771,6 +1775,11 @@ view_snap_to_edge(struct view *view, enum view_edge edge,
|
|||
view_set_untiled(view);
|
||||
view_set_output(view, output);
|
||||
view->tiled = edge;
|
||||
|
||||
if (view->impl->set_tiled) {
|
||||
view->impl->set_tiled(view);
|
||||
}
|
||||
|
||||
view_apply_tiled_geometry(view);
|
||||
}
|
||||
|
||||
|
|
@ -1804,6 +1813,11 @@ view_snap_to_region(struct view *view, struct region *region,
|
|||
}
|
||||
view_set_untiled(view);
|
||||
view->tiled_region = region;
|
||||
|
||||
if (view->impl->set_tiled) {
|
||||
view->impl->set_tiled(view);
|
||||
}
|
||||
|
||||
view_apply_region_geometry(view);
|
||||
}
|
||||
|
||||
|
|
|
|||
36
src/xdg.c
36
src/xdg.c
|
|
@ -423,6 +423,41 @@ xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
|
|||
fullscreen);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_view_set_tiled(struct view *view)
|
||||
{
|
||||
enum wlr_edges edge;
|
||||
|
||||
/*
|
||||
* Edge-snapped view are considered tiled on the snapped edge and those
|
||||
* perpendicular to it.
|
||||
*/
|
||||
switch (view->tiled) {
|
||||
case VIEW_EDGE_LEFT:
|
||||
edge = WLR_EDGE_LEFT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM;
|
||||
break;
|
||||
case VIEW_EDGE_RIGHT:
|
||||
edge = WLR_EDGE_RIGHT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM;
|
||||
break;
|
||||
case VIEW_EDGE_UP:
|
||||
edge = WLR_EDGE_TOP | WLR_EDGE_LEFT | WLR_EDGE_RIGHT;
|
||||
break;
|
||||
case VIEW_EDGE_DOWN:
|
||||
edge = WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT;
|
||||
break;
|
||||
default:
|
||||
edge = WLR_EDGE_NONE;
|
||||
}
|
||||
|
||||
if (view->tiled_region) {
|
||||
/* Region-snapped views are considered tiled on all edges */
|
||||
edge = WLR_EDGE_LEFT | WLR_EDGE_RIGHT |
|
||||
WLR_EDGE_TOP | WLR_EDGE_BOTTOM;
|
||||
}
|
||||
|
||||
wlr_xdg_toplevel_set_tiled(xdg_toplevel_from_view(view), edge);
|
||||
}
|
||||
|
||||
static struct view *
|
||||
lookup_view_by_xdg_toplevel(struct server *server,
|
||||
struct wlr_xdg_toplevel *xdg_toplevel)
|
||||
|
|
@ -594,6 +629,7 @@ static const struct view_impl xdg_toplevel_view_impl = {
|
|||
.map = xdg_toplevel_view_map,
|
||||
.set_activated = xdg_toplevel_view_set_activated,
|
||||
.set_fullscreen = xdg_toplevel_view_set_fullscreen,
|
||||
.set_tiled = xdg_toplevel_view_set_tiled,
|
||||
.unmap = xdg_toplevel_view_unmap,
|
||||
.maximize = xdg_toplevel_view_maximize,
|
||||
.minimize = xdg_toplevel_view_minimize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue