add wlr-layer-shell bar support and fix popup-parent crash
--bar CMD launches an always-on-top layer-shell panel (e.g. waybar) in a dedicated launch slot. The bar's footprint reserves the usable area, shrinking and offsetting maximized tabs below it even when the client never sends an exclusive zone; the bar's scene tree is held above every window. Fix a use-after-free in xdg popup handling exposed by panel clients: resolve a popup's parent by address comparison against kick's live surfaces rather than dereferencing popup->parent (wlroots may hand a popup whose parent wl_surface was already freed outside the xdg teardown cascade). Popups whose parent is no longer live fall back to the active window's tree so they still get their initial configure instead of hanging the client. Bar child stdout/stderr is /dev/null'd unless KICK_LOG is at debug level, so waybar's chatter no longer pollutes kick's console (same convention as CLI clients).
This commit is contained in:
parent
fd7ed766ef
commit
fd8c41b71f
3 changed files with 840 additions and 26 deletions
443
kick.c
443
kick.c
|
|
@ -82,6 +82,7 @@
|
|||
#include <wlr/types/wlr_data_control_v1.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
|
@ -346,6 +347,25 @@ struct kick_server {
|
|||
window list. */
|
||||
struct wl_list tabs;
|
||||
|
||||
/* wlr-layer-shell (waybar / panels). Layer surfaces render into their
|
||||
own always-on-top scene tree (layer_tree) instead of being tabs, so a
|
||||
bar stays visible no matter which tab is focused. The bar's exclusive
|
||||
zone shrinks the usable area the maximized tabs are sized into. */
|
||||
struct wlr_layer_shell_v1 *layer_shell;
|
||||
struct wl_listener new_layer_surface;
|
||||
struct wlr_scene_tree *layer_tree;
|
||||
/* Layer surfaces, in reservation order (head = highest layer / lowest
|
||||
overlap priority); see kick_layer. */
|
||||
struct wl_list layer_surfaces;
|
||||
/* The command launched via --bar (a layer-shell panel such as waybar);
|
||||
NULL when no bar was requested. */
|
||||
char *bar_cmd;
|
||||
pid_t bar_pid;
|
||||
/* Origin of the usable area the maximized tabs are sized into: the top-left
|
||||
of the output shifted by any bar's reserved edge, so tabs start below a
|
||||
top bar instead of being covered by it. (0,0) with no bar reserved. */
|
||||
int layout_x, layout_y;
|
||||
|
||||
struct xkb_context *xkb_ctx;
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
|
|
@ -650,6 +670,8 @@ static bool tab_live(struct kick_tab *tab);
|
|||
static struct wlr_xdg_toplevel *active_toplevel(void);
|
||||
static void set_active_tab(struct kick_tab *tab);
|
||||
static void render_and_present(void);
|
||||
static void layer_apply_layout_box(const struct wlr_box *full);
|
||||
static void layer_raise_above_windows(void);
|
||||
|
||||
/* Request a redraw from a non-client source (kick's own UI: tab switches,
|
||||
reorder, resize, overlay, boot). Marks the frame dirty and wakes the
|
||||
|
|
@ -2192,20 +2214,14 @@ static void output_resize(int width, int height) {
|
|||
if (server.bg_rect)
|
||||
wlr_scene_rect_set_size(server.bg_rect, width, height);
|
||||
|
||||
/* Keep every mapped client at the current maximized size so switching
|
||||
tabs is instant and no tab is left small after a host resize. While
|
||||
fullscreen the fullscreen configure already sizes clients to the
|
||||
output, so skip the maximize request to avoid state churn. */
|
||||
struct kick_tab *tab;
|
||||
wl_list_for_each(tab, &server.tabs, link) {
|
||||
struct kick_window *w;
|
||||
wl_list_for_each(w, &tab->windows, link) {
|
||||
if (!window_live(w)) continue;
|
||||
if (!server.clients_fullscreen)
|
||||
window_set_maximized(w, true);
|
||||
window_set_size(w, width, height);
|
||||
}
|
||||
}
|
||||
/* Size every mapped client into the area left after any bar's exclusive
|
||||
zone (the layout pass applies the new full area before the output's
|
||||
geometry is committed here, so tabs and the panel both track the
|
||||
resize). While fullscreen the fullscreen configure already sizes
|
||||
clients to the output, so the maximize/size requests are skipped to
|
||||
avoid state churn (resize_tabs_to_usable honours clients_fullscreen). */
|
||||
struct wlr_box full = { 0, 0, width, height };
|
||||
layer_apply_layout_box(&full);
|
||||
|
||||
kick_request_redraw();
|
||||
}
|
||||
|
|
@ -2973,7 +2989,11 @@ static void position_tree(struct wlr_xdg_toplevel *toplevel,
|
|||
int y = -geom.y;
|
||||
if (geom.y < 0)
|
||||
y = 0;
|
||||
wlr_scene_node_set_position(&tree->node, -geom.x, y);
|
||||
/* Offset the tab content down (right) past any bar's reserved edge, so a
|
||||
top bar does not cover the window's titlebar area. With no bar the
|
||||
layout origin is (0,0) and the tab stays full-screen as before. */
|
||||
wlr_scene_node_set_position(&tree->node, -geom.x + server.layout_x,
|
||||
y + server.layout_y);
|
||||
}
|
||||
|
||||
static void position_window(struct kick_window *w) {
|
||||
|
|
@ -3334,6 +3354,7 @@ static void claim_xdg_window(struct kick_tab *tab, struct kick_window *w,
|
|||
w->client_pid = cpid;
|
||||
w->pgid = (pgid > 0 && pgid != getpgid(0)) ? pgid : -1;
|
||||
w->tree = wlr_scene_xdg_surface_create(&server.scene->tree, toplevel->base);
|
||||
layer_raise_above_windows();
|
||||
/* First commit keeps the window on the tab bar; the scene tree shows
|
||||
nothing until a map makes the tab (or its client) current. Without
|
||||
this the node starts enabled and a still-black pending window of the
|
||||
|
|
@ -3503,7 +3524,8 @@ static void x11_sync_position(struct kick_window *w) {
|
|||
if (!xs || !w->tree || !server.output) return;
|
||||
int nx = (xs->x > 0 && xs->x < server.output->width) ? -xs->x : 0;
|
||||
int ny = (xs->y > 0 && xs->y < server.output->height) ? -xs->y : 0;
|
||||
wlr_scene_node_set_position(&w->tree->node, nx, ny);
|
||||
wlr_scene_node_set_position(&w->tree->node, nx + server.layout_x,
|
||||
ny + server.layout_y);
|
||||
}
|
||||
|
||||
/* Maximize-and-size treatment shared by new X11 tabs (X11 has no
|
||||
|
|
@ -3554,6 +3576,7 @@ static void claim_x11_window(struct kick_tab *tab, struct kick_window *w,
|
|||
w->xsurface = NULL;
|
||||
return;
|
||||
}
|
||||
layer_raise_above_windows();
|
||||
/* hidden until it becomes the active tab */
|
||||
wlr_scene_node_set_enabled(&w->tree->node, false);
|
||||
|
||||
|
|
@ -3938,6 +3961,7 @@ static void or_window_create(struct wlr_xwayland_surface *xsurface) {
|
|||
free(orw);
|
||||
return;
|
||||
}
|
||||
layer_raise_above_windows();
|
||||
wlr_scene_node_set_enabled(&orw->tree->node, false);
|
||||
orw->associate.notify = or_handle_associate;
|
||||
wl_signal_add(&xsurface->events.associate, &orw->associate);
|
||||
|
|
@ -4163,11 +4187,30 @@ static struct kick_window *window_for_client(struct wl_client *client) {
|
|||
struct kick_popup {
|
||||
struct wlr_xdg_surface *xdg_surface;
|
||||
struct wlr_scene_tree *scene;
|
||||
/* Live-popup registry: every popup kick has created is on this list so
|
||||
that a later popup can find its parent popup's scene tree by *address
|
||||
comparison* alone (never dereferencing a possibly-freed pointer). */
|
||||
struct wl_list link;
|
||||
struct wl_listener commit;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener reposition;
|
||||
};
|
||||
|
||||
/* Live popups created by kick (see kick_popup.link). Keyed-by-address lookup
|
||||
only: resolve a popup's parent by comparing the parent wl_surface pointer
|
||||
against each entry's surface, which never dereferences a stale pointer. */
|
||||
static struct wl_list live_popups;
|
||||
|
||||
/* Lazily sealed (set to true once) right before the first popup is tracked. */
|
||||
static bool live_popups_ready;
|
||||
|
||||
static void live_popups_init(void) {
|
||||
if (!live_popups_ready) {
|
||||
wl_list_init(&live_popups);
|
||||
live_popups_ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enough of the host window for popups to be positioned within; open menus
|
||||
may exceed the toplevel but we keep them inside the visible area. */
|
||||
static void popup_usable_box(struct wlr_box *box) {
|
||||
|
|
@ -4218,6 +4261,12 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) {
|
|||
wl_list_remove(&tp->commit.link);
|
||||
wl_list_remove(&tp->destroy.link);
|
||||
wl_list_remove(&tp->reposition.link);
|
||||
wl_list_remove(&tp->link);
|
||||
/* The popup's xdg_surface outlives this kick_popup (it is freed later by
|
||||
wlroots' destroy_xdg_surface); clear the data pointer we stashed there
|
||||
so a later nest-under-this-surface popup never reads freed memory. */
|
||||
if (tp->xdg_surface)
|
||||
tp->xdg_surface->data = NULL;
|
||||
free(tp);
|
||||
}
|
||||
|
||||
|
|
@ -4240,6 +4289,8 @@ static void create_popup(struct wlr_xdg_popup *popup,
|
|||
wl_signal_add(&popup->events.reposition, &tp->reposition);
|
||||
/* remember the scene tree so a submenu popup can find its parent's tree */
|
||||
xdg_surface->data = tp;
|
||||
live_popups_init();
|
||||
wl_list_insert(live_popups.prev, &tp->link);
|
||||
}
|
||||
|
||||
/* The scene tree a window's popups must hang off: each window's popups ride
|
||||
|
|
@ -4254,23 +4305,318 @@ static void handle_new_popup(struct wl_listener *listener, void *data) {
|
|||
struct wlr_xdg_popup *popup = data;
|
||||
|
||||
/* Popups position themselves relative to their immediate parent surface,
|
||||
so place each popup under its parent's scene tree. */
|
||||
so place each popup under its parent's scene tree.
|
||||
|
||||
The parent is ONLY ever located by *address comparison* against kick's
|
||||
live surfaces -- never by dereferencing popup->parent. wlroots can
|
||||
hand us a popup whose parent wl_surface was already freed (outside the
|
||||
xdg teardown cascade), and wlr_xdg_surface_try_from_wlr_surface() then
|
||||
dereferences that freed pointer and crashes. Comparing the raw address
|
||||
against live surfaces is safe: a match means the parent is alive and we
|
||||
use its tree, no match means the parent is gone (or not kick-managed)
|
||||
and we skip the popup instead of faulting. */
|
||||
struct wlr_scene_tree *parent_tree = NULL;
|
||||
struct wlr_xdg_surface *parent =
|
||||
wlr_xdg_surface_try_from_wlr_surface(popup->parent);
|
||||
if (parent) {
|
||||
if (parent->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
|
||||
struct kick_window *w = window_for_toplevel(parent->toplevel);
|
||||
parent_tree = popup_tree_for_window(w);
|
||||
} else if (parent->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||
struct kick_popup *tp = parent->data;
|
||||
if (tp) parent_tree = tp->scene;
|
||||
struct wlr_surface *parent_ws = popup->parent;
|
||||
|
||||
live_popups_init();
|
||||
|
||||
struct kick_tab *tab;
|
||||
wl_list_for_each(tab, &server.tabs, link) {
|
||||
struct kick_window *w;
|
||||
wl_list_for_each(w, &tab->windows, link) {
|
||||
if (w->toplevel &&
|
||||
w->toplevel->base->surface == parent_ws) {
|
||||
parent_tree = popup_tree_for_window(w);
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct kick_popup *tp;
|
||||
wl_list_for_each(tp, &live_popups, link) {
|
||||
if (tp->xdg_surface->surface == parent_ws) {
|
||||
parent_tree = tp->scene;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
found:
|
||||
/* A popup's parent may be gone or not kick-managed (e.g. it belonged to
|
||||
a window that closed, or a non-tab surface such as a layer-shell bar).
|
||||
Rather than drop the popup -- which would leave the client waiting
|
||||
forever for its initial configure ("Timed out waiting for initial
|
||||
.configure") -- fall back to the currently-displayed window's tree so
|
||||
the popup still gets rendered and configured. */
|
||||
if (!parent_tree) {
|
||||
kick_log(KICK_LOG_DEBUG,
|
||||
"[popup] parent %p not live; hanging popup under active "
|
||||
"window tree\n",
|
||||
(void *)parent_ws);
|
||||
struct kick_window *cur = tab_current_window(server.active_tab);
|
||||
parent_tree = popup_tree_for_window(cur);
|
||||
}
|
||||
if (!parent_tree) return;
|
||||
create_popup(popup, parent_tree);
|
||||
}
|
||||
|
||||
/* ===================== wlr-layer-shell (waybar / panels) =================
|
||||
Layer-shell surfaces are never tabs: each renders into server.layer_tree, a
|
||||
dedicated child of server.scene->tree that sits above every window tree and
|
||||
is never toggled by show_window()/set_active_tab(), so a bar stays visible
|
||||
across all tabs. The bar's exclusive zone shrinks the usable area the
|
||||
maximized tabs are sized into, mirroring sway (tabs never overlap the bar).
|
||||
|
||||
wlroots' own scene helper (wlr_scene_layer_surface_v1_*) does the heavy
|
||||
lifting for us: it computes the surface's anchored/centered geometry from
|
||||
its pending state and, for mapped surfaces with a positive exclusive zone,
|
||||
shrinks a caller-supplied usable area for the next layer surface. We just
|
||||
drive that per-surface and then size every maximized tab to the residual
|
||||
usable box. */
|
||||
|
||||
struct kick_layer {
|
||||
struct wl_list link;
|
||||
struct wlr_layer_surface_v1 *surface;
|
||||
struct wlr_scene_layer_surface_v1 *scene;
|
||||
struct wl_listener commit;
|
||||
struct wl_listener destroy;
|
||||
bool mapped;
|
||||
/* Whether the surface's first commit (which sets wlroots' initialized
|
||||
flag) has been seen; guards the first configure. */
|
||||
bool seen_init;
|
||||
};
|
||||
|
||||
/* The full output box, used as the starting full_area for the layer layout
|
||||
pass and the "which area may tabs ever grow into" bounds. */
|
||||
static void layer_full_area(struct wlr_box *box) {
|
||||
box->x = 0;
|
||||
box->y = 0;
|
||||
if (server.output) {
|
||||
box->width = server.output->width;
|
||||
box->height = server.output->height;
|
||||
} else {
|
||||
box->width = host.width;
|
||||
box->height = host.height;
|
||||
}
|
||||
}
|
||||
|
||||
/* Abort any max/fullscreen state and re-size the maximized clients into the
|
||||
given usable box, mirroring output_resize's loop. Skipped when a client
|
||||
is fullscreen: the fullscreen configure already sizes it to the output and
|
||||
forcing a size here would fight it. */
|
||||
static void resize_tabs_to_usable(const struct wlr_box *usable) {
|
||||
struct kick_tab *tab;
|
||||
wl_list_for_each(tab, &server.tabs, link) {
|
||||
struct kick_window *w;
|
||||
wl_list_for_each(w, &tab->windows, link) {
|
||||
if (!window_live(w)) continue;
|
||||
if (!server.clients_fullscreen)
|
||||
window_set_maximized(w, true);
|
||||
window_set_size(w, usable->width, usable->height);
|
||||
/* Move the tab content down/right past a bar's reserved edge now,
|
||||
not only on the client's next commit. These are idempotent:
|
||||
position_window does nothing for X11 windows and
|
||||
x11_sync_position does nothing for XDG windows. */
|
||||
position_window(w);
|
||||
x11_sync_position(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the bar's scene tree above every window tree. layer_tree is created
|
||||
at scene setup before any windows attach (so they'd otherwise stack on top),
|
||||
and each new window subtree is appended above any siblings -- so after every
|
||||
window claim we re-raise the layer tree to stay on top. */
|
||||
static void layer_raise_above_windows(void) {
|
||||
if (server.layer_tree)
|
||||
wlr_scene_node_raise_to_top(&server.layer_tree->node);
|
||||
}
|
||||
|
||||
/* Run the layer layout pass: configure every layer surface against the given
|
||||
full area, letting each reservation shrink the shared usable box, then size
|
||||
all maximized tabs into the residual area. */
|
||||
/* Reserve the bar's own footprint along its anchored edge, independent of the
|
||||
client's exclusive_zone (which a panel like waybar may never send). The
|
||||
bar's rendered height is taken from its requested size, falling back to the
|
||||
mapped surface box. Only a mapped, positively-sized bar reserves space, so
|
||||
a still-starting client doesn't collapse the tabs. */
|
||||
static void layer_reserve_box(struct wlr_layer_surface_v1 *layer_surface,
|
||||
struct wlr_box *usable) {
|
||||
struct wlr_surface *s = layer_surface->surface;
|
||||
if (!s || !s->mapped) return;
|
||||
/* When the client already requests an exclusive zone, wlroots shrank
|
||||
usable by it during wlr_scene_layer_surface_v1_configure; reserving the
|
||||
footprint here too would double-shrink. Only self-reserve bars that do
|
||||
not ask for an exclusive zone (e.g. waybar defaulting to exclusive_zone
|
||||
0 while still occupying the edge). */
|
||||
if (layer_surface->current.exclusive_zone > 0) return;
|
||||
|
||||
uint32_t anchor = layer_surface->current.anchor;
|
||||
int h = (int)layer_surface->current.desired_height;
|
||||
int w = (int)layer_surface->current.desired_width;
|
||||
if (h == 0 && s->current.buffer_height > 0) {
|
||||
int scale = s->current.scale > 0 ? s->current.scale : 1;
|
||||
h = s->current.buffer_height / scale;
|
||||
}
|
||||
if (w == 0 && s->current.buffer_width > 0) {
|
||||
int scale = s->current.scale > 0 ? s->current.scale : 1;
|
||||
w = s->current.buffer_width / scale;
|
||||
}
|
||||
|
||||
if (anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP && h > 0) {
|
||||
usable->y += h;
|
||||
if (usable->height >= h)
|
||||
usable->height -= h;
|
||||
else
|
||||
usable->height = 0;
|
||||
} else if (anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM && h > 0) {
|
||||
if (usable->height >= h)
|
||||
usable->height -= h;
|
||||
else
|
||||
usable->height = 0;
|
||||
} else if (anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT && w > 0) {
|
||||
usable->x += w;
|
||||
if (usable->width >= w)
|
||||
usable->width -= w;
|
||||
else
|
||||
usable->width = 0;
|
||||
} else if (anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT && w > 0) {
|
||||
if (usable->width >= w)
|
||||
usable->width -= w;
|
||||
else
|
||||
usable->width = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void layer_apply_layout_box(const struct wlr_box *full) {
|
||||
struct wlr_box usable = *full;
|
||||
|
||||
struct kick_layer *sl;
|
||||
wl_list_for_each(sl, &server.layer_surfaces, link) {
|
||||
if (!sl->scene || !sl->seen_init) continue;
|
||||
wlr_scene_layer_surface_v1_configure(sl->scene, full, &usable);
|
||||
}
|
||||
/* Reserve the bars' footprint (see layer_reserve_box). This runs after
|
||||
wlroots has shrunk usable by any explicit exclusive_zone, but our own
|
||||
reservation is what actually guarantees tabs clear a bar that never
|
||||
requests an exclusive zone. */
|
||||
wl_list_for_each(sl, &server.layer_surfaces, link) {
|
||||
if (!sl->scene) continue;
|
||||
layer_reserve_box(sl->surface, &usable);
|
||||
}
|
||||
|
||||
server.layout_x = usable.x;
|
||||
server.layout_y = usable.y;
|
||||
resize_tabs_to_usable(&usable);
|
||||
kick_request_redraw();
|
||||
}
|
||||
|
||||
/* Layout pass for the current (already-applied) output size. */
|
||||
static void layer_apply_layout(void) {
|
||||
struct wlr_box full;
|
||||
layer_full_area(&full);
|
||||
layer_apply_layout_box(&full);
|
||||
}
|
||||
|
||||
static void layer_destroy(struct kick_layer *sl) {
|
||||
wl_list_remove(&sl->link);
|
||||
/* The surface's own destroy path (which raised this listener) is what
|
||||
frees the wlr_layer_surface_v1 and, via wlroots' scene helper, the
|
||||
scene node; here we only drop our bookkeeping. */
|
||||
free(sl);
|
||||
}
|
||||
|
||||
static void layer_handle_commit(struct wl_listener *listener, void *data) {
|
||||
(void)data;
|
||||
struct kick_layer *sl = wl_container_of(listener, sl, commit);
|
||||
bool mapped = sl->surface->surface->mapped;
|
||||
if (!sl->seen_init) {
|
||||
/* First commit. wlroots' layer_surface_role_commit runs first and
|
||||
sets surface->initialized, so this is the earliest point we may call
|
||||
wlr_layer_surface_v1_configure (which asserts initialized). Deliver
|
||||
the first geometry even though the surface isn't mapped yet. */
|
||||
sl->seen_init = true;
|
||||
sl->mapped = mapped;
|
||||
layer_apply_layout();
|
||||
} else if (mapped != sl->mapped) {
|
||||
sl->mapped = mapped;
|
||||
/* exclusive-zone reservation applies only once the surface is mapped
|
||||
(wlr_scene_layer_surface_v1_configure checks surface->mapped), so
|
||||
the bar's map is what actually shrinks the tabs. */
|
||||
layer_apply_layout();
|
||||
} else if (mapped) {
|
||||
/* Already mapped: the commit may have changed size/anchor/exclusive
|
||||
zone/desired size, so re-run layout to keep the bar and tabs in
|
||||
step. */
|
||||
layer_apply_layout();
|
||||
}
|
||||
}
|
||||
|
||||
static void layer_handle_destroy(struct wl_listener *listener, void *data) {
|
||||
(void)data;
|
||||
struct kick_layer *sl = wl_container_of(listener, sl, destroy);
|
||||
layer_destroy(sl);
|
||||
layer_apply_layout();
|
||||
}
|
||||
|
||||
static void handle_new_layer_surface(struct wl_listener *listener, void *data) {
|
||||
(void)listener;
|
||||
struct wlr_layer_surface_v1 *layer_surface = data;
|
||||
|
||||
/* The protocol lets the client bind a layer surface without naming an
|
||||
output; kick has exactly one output, so always anchor to it. */
|
||||
if (layer_surface->output == NULL && server.output)
|
||||
layer_surface->output = server.output;
|
||||
|
||||
struct kick_layer *sl = calloc(1, sizeof(*sl));
|
||||
if (!sl) {
|
||||
wlr_layer_surface_v1_destroy(layer_surface);
|
||||
return;
|
||||
}
|
||||
sl->surface = layer_surface;
|
||||
sl->scene = wlr_scene_layer_surface_v1_create(server.layer_tree,
|
||||
layer_surface);
|
||||
layer_raise_above_windows();
|
||||
wl_list_insert(server.layer_surfaces.prev, &sl->link);
|
||||
|
||||
sl->commit.notify = layer_handle_commit;
|
||||
wl_signal_add(&layer_surface->surface->events.commit, &sl->commit);
|
||||
sl->destroy.notify = layer_handle_destroy;
|
||||
wl_signal_add(&layer_surface->events.destroy, &sl->destroy);
|
||||
}
|
||||
|
||||
/* Fork the --bar panel command (only ever one, hence no slot bookkeeping like
|
||||
tabs need). Runs in its own process group but is never claimed by
|
||||
handle_new_toplevel: a layer-shell client never creates a toplevel. */
|
||||
static void launch_bar(void) {
|
||||
if (!server.bar_cmd) return;
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
setpgid(0, 0);
|
||||
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
|
||||
if (!xdg_runtime) xdg_runtime = "/tmp";
|
||||
setenv("WAYLAND_DISPLAY", kick_socket, 1);
|
||||
setenv("XDG_RUNTIME_DIR", xdg_runtime, 1);
|
||||
unsetenv("DISPLAY");
|
||||
/* A panel is a background process; its [info]/[warning] chatter must
|
||||
not spill onto the launching terminal. As with CLI clients, only
|
||||
debug logging keeps the bar's own output visible. */
|
||||
if (kick_log_level() < KICK_LOG_DEBUG) {
|
||||
int nullfd = open("/dev/null", O_WRONLY);
|
||||
if (nullfd >= 0) {
|
||||
dup2(nullfd, STDOUT_FILENO);
|
||||
dup2(nullfd, STDERR_FILENO);
|
||||
if (nullfd > STDERR_FILENO) close(nullfd);
|
||||
}
|
||||
}
|
||||
execlp("/bin/sh", "sh", "-c", server.bar_cmd, NULL);
|
||||
_exit(127);
|
||||
}
|
||||
if (pid > 0) {
|
||||
server.bar_pid = pid;
|
||||
kick_log(KICK_LOG_INFO, "[bar] pid=%d cmd=%s\n", pid, server.bar_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/* Apply a cursor-shape-v1 shape value end to end: in standalone mode set the
|
||||
composited cursor image from the theme; in nested mode forward the shape to
|
||||
the host pointer so the host draws the right cursor over our window. */
|
||||
|
|
@ -8452,6 +8798,10 @@ int main(int argc, char *argv[]) {
|
|||
" tab group); 'off' gives each "
|
||||
"related window its own\n"
|
||||
" tab right of the parent.\n"
|
||||
" --bar CMD Launch a wlr-layer-shell "
|
||||
"panel (e.g. waybar) as an\n"
|
||||
" always-on-top bar that "
|
||||
"sizes the tabs underneath it.\n"
|
||||
" -h, --help Show the full help.\n"
|
||||
"\n"
|
||||
"Keys (hold the modifier):\n"
|
||||
|
|
@ -8549,6 +8899,28 @@ int main(int argc, char *argv[]) {
|
|||
return 2;
|
||||
}
|
||||
continue;
|
||||
} else if (strcmp(argv[i], "--bar") == 0) {
|
||||
if (i + 1 >= argc) {
|
||||
fprintf(stderr, "kick: --bar needs a value, "
|
||||
"e.g. --bar waybar\n");
|
||||
free(appv);
|
||||
return 2;
|
||||
}
|
||||
if (server.bar_cmd) {
|
||||
fprintf(stderr, "kick: only one --bar is allowed\n");
|
||||
free(appv);
|
||||
return 2;
|
||||
}
|
||||
server.bar_cmd = strdup(argv[++i]);
|
||||
continue;
|
||||
} else if (strncmp(argv[i], "--bar=", 6) == 0) {
|
||||
if (server.bar_cmd) {
|
||||
fprintf(stderr, "kick: only one --bar is allowed\n");
|
||||
free(appv);
|
||||
return 2;
|
||||
}
|
||||
server.bar_cmd = strdup(argv[i] + 6);
|
||||
continue;
|
||||
} else if (strcmp(argv[i], "--start-cmd-index") == 0) {
|
||||
if (i + 1 >= argc) {
|
||||
fprintf(stderr, "kick: --start-cmd-index needs a "
|
||||
|
|
@ -8618,6 +8990,12 @@ int main(int argc, char *argv[]) {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
if (server.bar_cmd && !cmd_in_path(server.bar_cmd)) {
|
||||
fprintf(stderr, "kick: --bar '%s' not found in PATH\n",
|
||||
server.bar_cmd);
|
||||
free(appv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct sigaction crash_sa = {
|
||||
.sa_sigaction = crash_handler,
|
||||
|
|
@ -8792,6 +9170,16 @@ int main(int argc, char *argv[]) {
|
|||
server.scene = wlr_scene_create();
|
||||
server.xdg_shell = wlr_xdg_shell_create(server.wl_display, 6);
|
||||
|
||||
/* Layer-shell (waybar/panels): the surfaces live in an always-on-top
|
||||
scene tree, kept a sibling of the tab window trees so tabs and the bar
|
||||
never interfere. */
|
||||
wl_list_init(&server.layer_surfaces);
|
||||
server.layer_tree = wlr_scene_tree_create(&server.scene->tree);
|
||||
server.layer_shell = wlr_layer_shell_v1_create(server.wl_display, 3);
|
||||
server.new_layer_surface.notify = handle_new_layer_surface;
|
||||
wl_signal_add(&server.layer_shell->events.new_surface,
|
||||
&server.new_layer_surface);
|
||||
|
||||
/* Passive protocol globals that cost one global each and let clients run
|
||||
at their best: presentation-time for frame pacing, xdg-output for
|
||||
logical output geometry, viewporter for viewport-scaled buffers (e.g.
|
||||
|
|
@ -9075,6 +9463,9 @@ int main(int argc, char *argv[]) {
|
|||
/* Fork every command-line command at once; the process-group match in
|
||||
handle_new_toplevel gives each its own slot on arrival. */
|
||||
launch_all_cli();
|
||||
/* The --bar panel, if any: a layer-shell client, forked separately since
|
||||
it never claims a tab. */
|
||||
launch_bar();
|
||||
|
||||
const char *prefix = tab_prefix == PREFIX_SUPER ? "Super" : "Alt";
|
||||
kick_log(KICK_LOG_INFO, "kick: running. "
|
||||
|
|
|
|||
16
meson.build
16
meson.build
|
|
@ -100,6 +100,14 @@ protocols = {
|
|||
'wlr-protocols/wlr-data-control-unstable-v1.xml',
|
||||
'wlr-data-control',
|
||||
],
|
||||
# wlr-layer-shell is what waybar and other panels use to make an
|
||||
# always-visible bar. Bundled locally (like wlr-data-control) rather than
|
||||
# referenced from the wlroots tree, so it works with either a system
|
||||
# wlroots or the pinned subproject.
|
||||
'wlr-layer-shell-unstable-v1': [
|
||||
'wlr-protocols/wlr-layer-shell-unstable-v1.xml',
|
||||
'wlr-layer-shell-unstable-v1',
|
||||
],
|
||||
'cursor-shape': [
|
||||
wl_protocols_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
|
||||
'cursor-shape-v1',
|
||||
|
|
@ -166,6 +174,14 @@ foreach protocol, p : protocols
|
|||
output: base + '-protocol.h',
|
||||
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'])
|
||||
endif
|
||||
if protocol == 'wlr-layer-shell-unstable-v1'
|
||||
# Serves wlr_layer_shell_v1.h's quoted
|
||||
# #include "wlr-layer-shell-unstable-v1-protocol.h".
|
||||
protocol_headers += custom_target(protocol + ' server header',
|
||||
input: xml,
|
||||
output: base + '-protocol.h',
|
||||
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'])
|
||||
endif
|
||||
endforeach
|
||||
|
||||
executable('kick',
|
||||
|
|
|
|||
407
wlr-protocols/wlr-layer-shell-unstable-v1.xml
Normal file
407
wlr-protocols/wlr-layer-shell-unstable-v1.xml
Normal file
|
|
@ -0,0 +1,407 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_layer_shell_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2017 Drew DeVault
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="5">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
rendered with a defined z-depth respective to each other. They may also be
|
||||
anchored to the edges and corners of a screen and specify input handling
|
||||
semantics. This interface should be suitable for the implementation of
|
||||
many desktop shell components, and a broad number of other applications
|
||||
that interact with the desktop.
|
||||
</description>
|
||||
|
||||
<request name="get_layer_surface">
|
||||
<description summary="create a layer_surface from a surface">
|
||||
Create a layer surface for an existing surface. This assigns the role of
|
||||
layer_surface, or raises a protocol error if another role is already
|
||||
assigned.
|
||||
|
||||
Creating a layer surface from a wl_surface which has a buffer attached
|
||||
or committed is a client error, and any attempts by a client to attach
|
||||
or manipulate a buffer prior to the first layer_surface.configure call
|
||||
must also be treated as errors.
|
||||
|
||||
After creating a layer_surface object and setting it up, the client
|
||||
must perform an initial commit without any buffer attached.
|
||||
The compositor will reply with a layer_surface.configure event.
|
||||
The client must acknowledge it and is then allowed to attach a buffer
|
||||
to map the surface.
|
||||
|
||||
You may pass NULL for output to allow the compositor to decide which
|
||||
output to use. Generally this will be the one that the user most
|
||||
recently interacted with.
|
||||
|
||||
Clients can specify a namespace that defines the purpose of the layer
|
||||
surface.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
|
||||
<arg name="namespace" type="string" summary="namespace for the layer surface"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="role" value="0" summary="wl_surface has another role"/>
|
||||
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
|
||||
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
|
||||
</enum>
|
||||
|
||||
<enum name="layer">
|
||||
<description summary="available layers for surfaces">
|
||||
These values indicate which layers a surface can be rendered in. They
|
||||
are ordered by z depth, bottom-most first. Traditional shell surfaces
|
||||
will typically be rendered between the bottom and top layers.
|
||||
Fullscreen shell surfaces are typically rendered at the top layer.
|
||||
Multiple surfaces can share a single layer, and ordering within a
|
||||
single layer is undefined.
|
||||
</description>
|
||||
|
||||
<entry name="background" value="0"/>
|
||||
<entry name="bottom" value="1"/>
|
||||
<entry name="top" value="2"/>
|
||||
<entry name="overlay" value="3"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
|
||||
<request name="destroy" type="destructor" since="3">
|
||||
<description summary="destroy the layer_shell object">
|
||||
This request indicates that the client will not use the layer_shell
|
||||
object any more. Objects that have been created through this instance
|
||||
are not affected.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="5">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
environment.
|
||||
|
||||
Layer surface state (layer, size, anchor, exclusive zone,
|
||||
margin, interactivity) is double-buffered, and will be applied at the
|
||||
time wl_surface.commit of the corresponding wl_surface is called.
|
||||
|
||||
Attaching a null buffer to a layer surface unmaps it.
|
||||
|
||||
Unmapping a layer_surface means that the surface cannot be shown by the
|
||||
compositor until it is explicitly mapped again. The layer_surface
|
||||
returns to the state it had right after layer_shell.get_layer_surface.
|
||||
The client can re-map the surface by performing a commit without any
|
||||
buffer attached, waiting for a configure event and handling it as usual.
|
||||
</description>
|
||||
|
||||
<request name="set_size">
|
||||
<description summary="sets the size of the surface">
|
||||
Sets the size of the surface in surface-local coordinates. The
|
||||
compositor will display the surface centered with respect to its
|
||||
anchors.
|
||||
|
||||
If you pass 0 for either value, the compositor will assign it and
|
||||
inform you of the assignment in the configure event. You must set your
|
||||
anchor to opposite edges in the dimensions you omit; not doing so is a
|
||||
protocol error. Both values are 0 by default.
|
||||
|
||||
Size is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="set_anchor">
|
||||
<description summary="configures the anchor point of the surface">
|
||||
Requests that the compositor anchor the surface to the specified edges
|
||||
and corners. If two orthogonal edges are specified (e.g. 'top' and
|
||||
'left'), then the anchor point will be the intersection of the edges
|
||||
(e.g. the top left corner of the output); otherwise the anchor point
|
||||
will be centered on that edge, or in the center if none is specified.
|
||||
|
||||
Anchor is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="anchor" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
|
||||
<request name="set_exclusive_zone">
|
||||
<description summary="configures the exclusive geometry of this surface">
|
||||
Requests that the compositor avoids occluding an area with other
|
||||
surfaces. The compositor's use of this information is
|
||||
implementation-dependent - do not assume that this region will not
|
||||
actually be occluded.
|
||||
|
||||
A positive value is only meaningful if the surface is anchored to one
|
||||
edge or an edge and both perpendicular edges. If the surface is not
|
||||
anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||
to only two parallel edges or anchored to all edges, a positive value
|
||||
will be treated the same as zero.
|
||||
|
||||
A positive zone is the distance from the edge in surface-local
|
||||
coordinates to consider exclusive.
|
||||
|
||||
Surfaces that do not wish to have an exclusive zone may instead specify
|
||||
how they should interact with surfaces that do. If set to zero, the
|
||||
surface indicates that it would like to be moved to avoid occluding
|
||||
surfaces with a positive exclusive zone. If set to -1, the surface
|
||||
indicates that it would not like to be moved to accommodate for other
|
||||
surfaces, and the compositor should extend it all the way to the edges
|
||||
it is anchored to.
|
||||
|
||||
For example, a panel might set its exclusive zone to 10, so that
|
||||
maximized shell surfaces are not shown on top of it. A notification
|
||||
might set its exclusive zone to 0, so that it is moved to avoid
|
||||
occluding the panel, but shell surfaces are shown underneath it. A
|
||||
wallpaper or lock screen might set their exclusive zone to -1, so that
|
||||
they stretch below or over the panel.
|
||||
|
||||
The default value is 0.
|
||||
|
||||
Exclusive zone is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="zone" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_margin">
|
||||
<description summary="sets a margin from the anchor point">
|
||||
Requests that the surface be placed some distance away from the anchor
|
||||
point on the output, in surface-local coordinates. Setting this value
|
||||
for edges you are not anchored to has no effect.
|
||||
|
||||
The exclusive zone includes the margin.
|
||||
|
||||
Margin is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="top" type="int"/>
|
||||
<arg name="right" type="int"/>
|
||||
<arg name="bottom" type="int"/>
|
||||
<arg name="left" type="int"/>
|
||||
</request>
|
||||
|
||||
<enum name="keyboard_interactivity">
|
||||
<description summary="types of keyboard interaction possible for a layer shell surface">
|
||||
Types of keyboard interaction possible for layer shell surfaces. The
|
||||
rationale for this is twofold: (1) some applications are not interested
|
||||
in keyboard events and not allowing them to be focused can improve the
|
||||
desktop experience; (2) some applications will want to take exclusive
|
||||
keyboard focus.
|
||||
</description>
|
||||
|
||||
<entry name="none" value="0">
|
||||
<description summary="no keyboard focus is possible">
|
||||
This value indicates that this surface is not interested in keyboard
|
||||
events and the compositor should never assign it the keyboard focus.
|
||||
|
||||
This is the default value, set for newly created layer shell surfaces.
|
||||
|
||||
This is useful for e.g. desktop widgets that display information or
|
||||
only have interaction with non-keyboard input devices.
|
||||
</description>
|
||||
</entry>
|
||||
<entry name="exclusive" value="1">
|
||||
<description summary="request exclusive keyboard focus">
|
||||
Request exclusive keyboard focus if this surface is above the shell surface layer.
|
||||
|
||||
For the top and overlay layers, the seat will always give
|
||||
exclusive keyboard focus to the top-most layer which has keyboard
|
||||
interactivity set to exclusive. If this layer contains multiple
|
||||
surfaces with keyboard interactivity set to exclusive, the compositor
|
||||
determines the one receiving keyboard events in an implementation-
|
||||
defined manner. In this case, no guarantee is made when this surface
|
||||
will receive keyboard focus (if ever).
|
||||
|
||||
For the bottom and background layers, the compositor is allowed to use
|
||||
normal focus semantics.
|
||||
|
||||
This setting is mainly intended for applications that need to ensure
|
||||
they receive all keyboard events, such as a lock screen or a password
|
||||
prompt.
|
||||
</description>
|
||||
</entry>
|
||||
<entry name="on_demand" value="2" since="4">
|
||||
<description summary="request regular keyboard focus semantics">
|
||||
This requests the compositor to allow this surface to be focused and
|
||||
unfocused by the user in an implementation-defined manner. The user
|
||||
should be able to unfocus this surface even regardless of the layer
|
||||
it is on.
|
||||
|
||||
Typically, the compositor will want to use its normal mechanism to
|
||||
manage keyboard focus between layer shell surfaces with this setting
|
||||
and regular toplevels on the desktop layer (e.g. click to focus).
|
||||
Nevertheless, it is possible for a compositor to require a special
|
||||
interaction to focus or unfocus layer shell surfaces (e.g. requiring
|
||||
a click even if focus follows the mouse normally, or providing a
|
||||
keybinding to switch focus between layers).
|
||||
|
||||
This setting is mainly intended for desktop shell components (e.g.
|
||||
panels) that allow keyboard interaction. Using this option can allow
|
||||
implementing a desktop shell that can be fully usable without the
|
||||
mouse.
|
||||
</description>
|
||||
</entry>
|
||||
</enum>
|
||||
|
||||
<request name="set_keyboard_interactivity">
|
||||
<description summary="requests keyboard events">
|
||||
Set how keyboard events are delivered to this surface. By default,
|
||||
layer shell surfaces do not receive keyboard events; this request can
|
||||
be used to change this.
|
||||
|
||||
This setting is inherited by child surfaces set by the get_popup
|
||||
request.
|
||||
|
||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||
you do not want to receive them, set the input region on your surface
|
||||
to an empty region.
|
||||
|
||||
Keyboard interactivity is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/>
|
||||
</request>
|
||||
|
||||
<request name="get_popup">
|
||||
<description summary="assign this layer_surface as an xdg_popup parent">
|
||||
This assigns an xdg_popup's parent to this layer_surface. This popup
|
||||
should have been created via xdg_surface::get_popup with the parent set
|
||||
to NULL, and this request must be invoked before committing the popup's
|
||||
initial state.
|
||||
|
||||
See the documentation of xdg_popup for more details about what an
|
||||
xdg_popup is and how it is used.
|
||||
</description>
|
||||
<arg name="popup" type="object" interface="xdg_popup"/>
|
||||
</request>
|
||||
|
||||
<request name="ack_configure">
|
||||
<description summary="ack a configure event">
|
||||
When a configure event is received, if a client commits the
|
||||
surface in response to the configure event, then the client
|
||||
must make an ack_configure request sometime before the commit
|
||||
request, passing along the serial of the configure event.
|
||||
|
||||
If the client receives multiple configure events before it
|
||||
can respond to one, it only has to ack the last configure event.
|
||||
|
||||
A client is not required to commit immediately after sending
|
||||
an ack_configure request - it may even ack_configure several times
|
||||
before its next surface commit.
|
||||
|
||||
A client may send multiple ack_configure requests before committing, but
|
||||
only the last request sent before a commit indicates which configure
|
||||
event the client really is responding to.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="the serial from the configure event"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the layer_surface">
|
||||
This request destroys the layer surface.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="configure">
|
||||
<description summary="suggest a surface change">
|
||||
The configure event asks the client to resize its surface.
|
||||
|
||||
Clients should arrange their surface for the new states, and then send
|
||||
an ack_configure request with the serial sent in this configure event at
|
||||
some point before committing the new surface.
|
||||
|
||||
The client is free to dismiss all but the last configure event it
|
||||
received.
|
||||
|
||||
The width and height arguments specify the size of the window in
|
||||
surface-local coordinates.
|
||||
|
||||
The size is a hint, in the sense that the client is free to ignore it if
|
||||
it doesn't resize, pick a smaller size (to satisfy aspect ratio or
|
||||
resize in steps of NxM pixels). If the client picks a smaller size and
|
||||
is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
|
||||
surface will be centered on this axis.
|
||||
|
||||
If the width or height arguments are zero, it means the client should
|
||||
decide its own window dimension.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</event>
|
||||
|
||||
<event name="closed">
|
||||
<description summary="surface should be closed">
|
||||
The closed event is sent by the compositor when the surface will no
|
||||
longer be shown. The output may have been destroyed or the user may
|
||||
have asked for it to be removed. Further changes to the surface will be
|
||||
ignored. The client should destroy the resource after receiving this
|
||||
event, and create a new surface if they so choose.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||
</enum>
|
||||
|
||||
<enum name="anchor" bitfield="true">
|
||||
<entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
|
||||
<entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
|
||||
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
||||
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<request name="set_layer" since="2">
|
||||
<description summary="change the layer of the surface">
|
||||
Change the layer that the surface is rendered on.
|
||||
|
||||
Layer is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||
</request>
|
||||
|
||||
<!-- Version 5 additions -->
|
||||
|
||||
<request name="set_exclusive_edge" since="5">
|
||||
<description summary="set the edge the exclusive zone will be applied to">
|
||||
Requests an edge for the exclusive zone to apply. The exclusive
|
||||
edge will be automatically deduced from anchor points when possible,
|
||||
but when the surface is anchored to a corner, it will be necessary
|
||||
to set it explicitly to disambiguate, as it is not possible to deduce
|
||||
which one of the two corner edges should be used.
|
||||
|
||||
The edge must be one the surface is anchored to, otherwise the
|
||||
invalid_exclusive_edge protocol error will be raised.
|
||||
</description>
|
||||
<arg name="edge" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
Loading…
Add table
Add a link
Reference in a new issue