spkp

Stacking wayland compositor
git clone git://git.z3bra.org/spkp.git
Log | Files | Refs

commit 225253e393ebc7586d665967d1e09e84b91ec524
parent 525ea7dcb1b101b54fef91fd6084734aa79e6046
Author: Willy Goiffon <dev@z3bra.org>
Date:   Mon, 16 Nov 2020 14:15:49 +0100

Rename "toplevel" window attribute to "xdg"

Diffstat:
Msp:kp.c | 26+++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/sp:kp.c b/sp:kp.c @@ -104,7 +104,7 @@ struct output { struct window { struct state *server; struct wlr_surface *surface; - struct wlr_xdg_surface *toplevel; + struct wlr_xdg_surface *xdg; struct wlr_xdg_toplevel_decoration_v1 decoration; double x, y; @@ -361,7 +361,7 @@ cb_frame_output(struct wl_listener *listener, void *data) rdata.window = window; clock_gettime(CLOCK_MONOTONIC, &rdata.when); - wlr_xdg_surface_for_each_surface(window->toplevel, render, &rdata); + wlr_xdg_surface_for_each_surface(window->xdg, render, &rdata); } struct state *server = output->server; @@ -399,7 +399,7 @@ cb_new_window(struct wl_listener *listener, void *data) window = calloc(1, sizeof(*window)); window->server = server; - window->toplevel = surface; + window->xdg = surface; window->x = -1; window->y = -1; @@ -410,7 +410,7 @@ cb_new_window(struct wl_listener *listener, void *data) window->destroy.notify = cb_destroy_window; /* have the client consider itself "tiled", to constrain it */ - wlr_xdg_toplevel_set_tiled(window->toplevel, + wlr_xdg_toplevel_set_tiled(window->xdg, WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM); @@ -491,12 +491,12 @@ cb_map_window(struct wl_listener *listener, void *data) layer = wlr_output_layout_get(server->layout, output); wlr_output_effective_resolution(output, &ow, &oh); - wlr_xdg_surface_get_geometry(w->toplevel, &geom); + wlr_xdg_surface_get_geometry(w->xdg, &geom); if (geom.width > ow || geom.height > oh) { geom.width = MIN(ow - 2 * bordersize, geom.width); geom.height = MIN(oh - 2 * bordersize, geom.height); - wlr_xdg_toplevel_set_size(w->toplevel, geom.width, geom.height); + wlr_xdg_toplevel_set_size(w->xdg, geom.width, geom.height); } w->x = layer->x + ow/2 - geom.width/2; @@ -769,7 +769,7 @@ cb_click_release(struct state *server, struct wlr_event_pointer_button *ev) case RESIZE: geom.width = server->grabbox.width; geom.height = server->grabbox.height; - wlr_xdg_toplevel_set_size(server->grabbed->toplevel, geom.width, geom.height); + wlr_xdg_toplevel_set_size(server->grabbed->xdg, geom.width, geom.height); /* FALLTHROUGH */ case MOVE: server->grabbed->x = server->grabbox.x; @@ -841,7 +841,7 @@ cb_click_press(struct state *server, struct wlr_event_pointer_button *ev) server->grabbox.height = 1; break; case BTN_LEFT: - wlr_xdg_surface_get_geometry(w->toplevel, &geom); + wlr_xdg_surface_get_geometry(w->xdg, &geom); server->grabmode = MOVE; server->grabbox.width = geom.width; server->grabbox.height = geom.height; @@ -966,7 +966,7 @@ render(struct wlr_surface *surface, int x, int y, void *data) box.height = surface->current.height; focus = window->server->seat->keyboard_state.focused_surface; - if (surface == window->toplevel->surface) + if (surface == window->xdg->surface) render_border(&box, rdata, (surface == focus) ? activecolor : bordercolor); wlr_matrix_project_box(matrix, &box, transform, 0, output->transform_matrix); @@ -1038,7 +1038,7 @@ focus(struct window *window) server->grabbed = window; /* give keyboard focus to the toplevel window */ - wlr_seat_keyboard_notify_enter(seat, window->toplevel->surface, + wlr_seat_keyboard_notify_enter(seat, window->xdg->surface, kb->keycodes, kb->num_keycodes, &kb->modifiers); } @@ -1103,7 +1103,7 @@ underneath(struct state *server, double x, double y) * sx, sy will be updated with the pointer coordinates * within the subsurface (always positive). */ - w->surface = wlr_xdg_surface_surface_at(w->toplevel, + w->surface = wlr_xdg_surface_surface_at(w->xdg, x - w->x, y - w->y, &w->sx, &w->sy); if (w->surface) { @@ -1113,8 +1113,8 @@ underneath(struct state *server, double x, double y) if (server->cursor->x > w->x - bordersize && server->cursor->y > w->y - bordersize - && server->cursor->x < w->x + w->toplevel->surface->current.width + bordersize - && server->cursor->y < w->y + w->toplevel->surface->current.height + bordersize) { + && server->cursor->x < w->x + w->xdg->surface->current.width + bordersize + && server->cursor->y < w->y + w->xdg->surface->current.height + bordersize) { w->area = BORDER; return w; }