*/
struct border margin;
- /*
- * padding refers to the space between the extremities of the
- * wlr_surface and the parts of the surface that is considered the
- * window.
- * This is only used for xdg-shell views with CSD where the padding
- * area is typically invisible except for client-side drop-shawdows.
- */
- struct border padding;
-
struct view_pending_move_resize {
bool update_x, update_y;
double x, y;
void view_set_activated(struct view *view, bool activated);
void view_close(struct view *view);
-struct border view_border(struct view *view);
/**
* view_move_resize - resize and move view
struct wlr_box tgeom = {.x = *x, .y = *y, .width = view->w,
.height = view->h};
struct output *output;
- struct border border = view_border(view);
+ struct border border = view->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 */
.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_border(view);
+ struct border border = view->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 */
}
}
-struct border
-view_border(struct view *view)
-{
- struct border border = {
- .left = view->margin.left - view->padding.left,
- .top = view->margin.top - view->padding.top,
- .right = view->margin.right + view->padding.right,
- .bottom = view->margin.bottom + view->padding.bottom,
- };
- return border;
-}
-
static void
view_output_enter(struct view *view, struct wlr_output *wlr_output)
{
wlr_log(WLR_ERROR, "no output");
return;
}
- struct border border = view_border(view);
struct wlr_box usable = output_usable_area_in_layout_coords(output);
if (usable.height == output->wlr_output->height
&& output->wlr_output->scale != 1) {
int x = 0, y = 0;
if (!strcasecmp(direction, "left")) {
- x = usable.x + border.left + rc.gap;
+ x = usable.x + view->margin.left + rc.gap;
y = view->y;
} else if (!strcasecmp(direction, "up")) {
x = view->x;
- y = usable.y + border.top + rc.gap;
+ y = usable.y + view->margin.top + rc.gap;
} else if (!strcasecmp(direction, "right")) {
- x = usable.x + usable.width - view->w - border.right - rc.gap;
+ x = usable.x + usable.width - view->w - view->margin.right
+ - rc.gap;
y = view->y;
} else if (!strcasecmp(direction, "down")) {
x = view->x;
- y = usable.y + usable.height - view->h - border.bottom - rc.gap;
+ y = usable.y + usable.height - view->h - view->margin.bottom
+ - rc.gap;
}
view_move(view, x, y);
}
view_get_edge_snap_box(struct view *view, struct output *output,
enum view_edge edge)
{
- struct border border = view_border(view);
struct wlr_box usable = output_usable_area_in_layout_coords(output);
if (usable.height == output->wlr_output->height
&& output->wlr_output->scale != 1) {
break;
}
struct wlr_box dst = {
- .x = x_offset + usable.x + border.left,
- .y = y_offset + usable.y + border.top,
- .width = base_width - border.left - border.right,
- .height = base_height - border.top - border.bottom,
+ .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,
};
return dst;
view->w = size.width;
view->h = size.height;
- /* padding changes with maximize/unmaximize */
- view->padding.top = size.y;
- view->padding.bottom = size.y;
- view->padding.left = size.x;
- view->padding.right = size.x;
-
uint32_t serial = view->pending_move_resize.configure_serial;
if (serial > 0 && serial >= view->xdg_surface->current.configure_serial) {
if (view->pending_move_resize.update_x) {
wlr_xdg_toplevel_send_close(view->xdg_surface->toplevel);
}
-static void
-update_padding(struct view *view)
-{
- struct wlr_box padding;
- wlr_xdg_surface_get_geometry(view->xdg_surface, &padding);
- view->padding.top = padding.y;
- view->padding.bottom = padding.y;
- view->padding.left = padding.x;
- view->padding.right = padding.x;
-}
-
static void
xdg_toplevel_view_maximize(struct view *view, bool maximized)
{
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->padding.left;
- view->y += view->margin.top - view->padding.top;
+ view->x += view->margin.left;
+ view->y += view->margin.top;
}
static const char *
ssd_create(view);
}
- update_padding(view);
if (!view->fullscreen && requested->fullscreen) {
view_set_fullscreen(view, true,
requested->fullscreen_output);