view/ssd: Move view->margin to view->ssd.margin

This commit is contained in:
John Lindgren 2022-11-21 15:13:43 -05:00 committed by Consolatis
parent e79c95489a
commit c536ee9d96
6 changed files with 26 additions and 26 deletions

View file

@ -41,7 +41,7 @@ resistance_move_apply(struct view *view, double *x, double *y)
struct wlr_box tgeom = {.x = *x, .y = *y, .width = view->w,
.height = view->h};
struct output *output;
struct border border = view->margin;
struct border border = view->ssd.margin;
struct edges view_edges; /* The edges of the current view */
struct edges target_edges; /* The desired edges */
struct edges other_edges; /* The edges of the monitor/other view */
@ -112,7 +112,7 @@ resistance_resize_apply(struct view *view, struct wlr_box *new_view_geo)
.height = view->h};
struct wlr_box tgeom = {.x = new_view_geo->x, .y = new_view_geo->y,
.width = new_view_geo->width, .height = new_view_geo->height};
struct border border = view->margin;
struct border border = view->ssd.margin;
struct edges view_edges; /* The edges of the current view */
struct edges target_edges; /* The desired edges */
struct edges other_edges; /* The edges of the monitor/other view */

View file

@ -161,7 +161,7 @@ ssd_create(struct view *view)
ssd_extents_create(view);
ssd_border_create(view);
ssd_titlebar_create(view);
view->margin = ssd_thickness(view);
view->ssd.margin = ssd_thickness(view);
ssd_set_active(view, is_active);
}
@ -175,14 +175,14 @@ ssd_update_geometry(struct view *view)
if (!view->ssd.enabled) {
if (view->ssd.tree && view->ssd.tree->node.enabled) {
wlr_scene_node_set_enabled(&view->ssd.tree->node, false);
view->margin = ssd_thickness(view);
view->ssd.margin = ssd_thickness(view);
}
return;
} else if (!view->ssd.tree) {
ssd_create(view);
} else if (!view->ssd.tree->node.enabled) {
wlr_scene_node_set_enabled(&view->ssd.tree->node, true);
view->margin = ssd_thickness(view);
view->ssd.margin = ssd_thickness(view);
}
int width = view->w;

View file

@ -88,10 +88,10 @@ view_get_edge_snap_box(struct view *view, struct output *output,
break;
}
struct wlr_box dst = {
.x = x_offset + usable.x + view->margin.left,
.y = y_offset + usable.y + view->margin.top,
.width = base_width - view->margin.left - view->margin.right,
.height = base_height - view->margin.top - view->margin.bottom,
.x = x_offset + usable.x + view->ssd.margin.left,
.y = y_offset + usable.y + view->ssd.margin.top,
.width = base_width - view->ssd.margin.left - view->ssd.margin.right,
.height = base_height - view->ssd.margin.top - view->ssd.margin.bottom,
};
return dst;
@ -276,8 +276,8 @@ view_compute_centered_position(struct view *view, int w, int h, int *x, int *y)
}
struct wlr_box usable = output_usable_area_in_layout_coords(output);
int width = w + view->margin.left + view->margin.right;
int height = h + view->margin.top + view->margin.bottom;
int width = w + view->ssd.margin.left + view->ssd.margin.right;
int height = h + view->ssd.margin.top + view->ssd.margin.bottom;
*x = usable.x + (usable.width - width) / 2;
*y = usable.y + (usable.height - height) / 2;
@ -292,8 +292,8 @@ view_compute_centered_position(struct view *view, int w, int h, int *x, int *y)
#if HAVE_XWAYLAND
/* TODO: refactor xwayland.c functions to get rid of this */
if (view->type == LAB_XWAYLAND_VIEW) {
*x += view->margin.left;
*y += view->margin.top;
*x += view->ssd.margin.left;
*y += view->ssd.margin.top;
}
#endif
@ -725,18 +725,18 @@ view_move_to_edge(struct view *view, const char *direction)
int x = 0, y = 0;
if (!strcasecmp(direction, "left")) {
x = usable.x + view->margin.left + rc.gap;
x = usable.x + view->ssd.margin.left + rc.gap;
y = view->y;
} else if (!strcasecmp(direction, "up")) {
x = view->x;
y = usable.y + view->margin.top + rc.gap;
y = usable.y + view->ssd.margin.top + rc.gap;
} else if (!strcasecmp(direction, "right")) {
x = usable.x + usable.width - view->w - view->margin.right
x = usable.x + usable.width - view->w - view->ssd.margin.right
- rc.gap;
y = view->y;
} else if (!strcasecmp(direction, "down")) {
x = view->x;
y = usable.y + usable.height - view->h - view->margin.bottom
y = usable.y + usable.height - view->h - view->ssd.margin.bottom
- rc.gap;
} else {
wlr_log(WLR_ERROR, "invalid edge");

View file

@ -276,8 +276,8 @@ position_xdg_toplevel_view(struct view *view)
view->x = center_x - view->xdg_surface->current.geometry.width / 2;
view->y = center_y - view->xdg_surface->current.geometry.height / 2;
}
view->x += view->margin.left;
view->y += view->margin.top;
view->x += view->ssd.margin.left;
view->y += view->ssd.margin.top;
}
static const char *