#endif
};
-enum deco_part {
- LAB_DECO_NONE = 0,
- LAB_DECO_BUTTON_CLOSE,
- LAB_DECO_BUTTON_MAXIMIZE,
- LAB_DECO_BUTTON_ICONIFY,
- LAB_DECO_PART_TITLE,
- LAB_DECO_PART_TOP,
- LAB_DECO_PART_RIGHT,
- LAB_DECO_PART_BOTTOM,
- LAB_DECO_PART_LEFT,
- LAB_DECO_END_MARKER
+enum ssd_part {
+ LAB_SSD_NONE = 0,
+ LAB_SSD_BUTTON_CLOSE,
+ LAB_SSD_BUTTON_MAXIMIZE,
+ LAB_SSD_BUTTON_ICONIFY,
+ LAB_SSD_PART_TITLE,
+ LAB_SSD_PART_TOP,
+ LAB_SSD_PART_RIGHT,
+ LAB_SSD_PART_BOTTOM,
+ LAB_SSD_PART_LEFT,
+ LAB_SSD_END_MARKER
};
struct view_impl {
void server_start(struct server *server);
void server_finish(struct server *server);
-struct border deco_thickness(struct view *view);
-struct wlr_box deco_max_extents(struct view *view);
-struct wlr_box deco_box(struct view *view, enum deco_part deco_part);
-enum deco_part deco_at(struct view *view, double lx, double ly);
+struct border ssd_thickness(struct view *view);
+struct wlr_box ssd_max_extents(struct view *view);
+struct wlr_box ssd_box(struct view *view, enum ssd_part ssd_part);
+enum ssd_part ssd_at(struct view *view, double lx, double ly);
void action(struct server *server, const char *action, const char *command);
double sx, sy;
struct wlr_seat *wlr_seat = server->seat.seat;
struct wlr_surface *surface = NULL;
- int view_area = LAB_DECO_NONE;
+ int view_area = LAB_SSD_NONE;
char *cursor_name = NULL;
struct view *view =
desktop_view_at(server, server->seat.cursor->x, server->seat.cursor->y,
}
if (resize_edges) {
cursor_name_set_by_server = true;
- } else if (view_area != LAB_DECO_NONE) {
+ } else if (view_area != LAB_SSD_NONE) {
cursor_name = XCURSOR_DEFAULT;
cursor_name_set_by_server = true;
} else if (cursor_name_set_by_server) {
}
switch (view_area) {
- case LAB_DECO_BUTTON_CLOSE:
+ case LAB_SSD_BUTTON_CLOSE:
view->impl->close(view);
break;
- case LAB_DECO_BUTTON_ICONIFY:
+ case LAB_SSD_BUTTON_ICONIFY:
view_minimize(view);
break;
- case LAB_DECO_PART_TITLE:
+ case LAB_SSD_PART_TITLE:
interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
break;
- case LAB_DECO_BUTTON_MAXIMIZE:
+ case LAB_SSD_BUTTON_MAXIMIZE:
view_maximize(view, !view->maximized);
break;
}
if (!view->server_side_deco) {
continue;
}
- *view_area = deco_at(view, lx, ly);
- if (*view_area != LAB_DECO_NONE) {
+ *view_area = ssd_at(view, lx, ly);
+ if (*view_area != LAB_SSD_NONE) {
return view;
}
}
'action.c',
'cursor.c',
'damage.c',
- 'deco.c',
'desktop.c',
'interactive.c',
'keyboard.c',
'output.c',
'seat.c',
'server.c',
+ 'ssd.c',
'subsurface.c',
'theme.c',
'view.c',
}
static bool
-isbutton(enum deco_part deco_part)
+isbutton(enum ssd_part ssd_part)
{
- return deco_part == LAB_DECO_BUTTON_CLOSE ||
- deco_part == LAB_DECO_BUTTON_MAXIMIZE ||
- deco_part == LAB_DECO_BUTTON_ICONIFY;
+ return ssd_part == LAB_SSD_BUTTON_CLOSE ||
+ ssd_part == LAB_SSD_BUTTON_MAXIMIZE ||
+ ssd_part == LAB_SSD_BUTTON_ICONIFY;
}
static void
/* render border */
float *color = theme->window_active_handle_bg_color;
- enum deco_part border[4] = {
- LAB_DECO_PART_TOP,
- LAB_DECO_PART_RIGHT,
- LAB_DECO_PART_BOTTOM,
- LAB_DECO_PART_LEFT,
+ enum ssd_part border[4] = {
+ LAB_SSD_PART_TOP,
+ LAB_SSD_PART_RIGHT,
+ LAB_SSD_PART_BOTTOM,
+ LAB_SSD_PART_LEFT,
};
for (int i = 0; i < 4; i++) {
- struct wlr_box box = deco_box(view, border[i]);
+ struct wlr_box box = ssd_box(view, border[i]);
scale_box(&box, output->wlr_output->scale);
render_rect(output, output_damage, &box, color);
}
} else {
color = theme->window_inactive_title_bg_color;
}
- struct wlr_box box = deco_box(view, LAB_DECO_PART_TITLE);
+ struct wlr_box box = ssd_box(view, LAB_SSD_PART_TITLE);
scale_box(&box, output->wlr_output->scale);
render_rect(output, output_damage, &box, color);
/* button background */
struct wlr_cursor *cur = view->server->seat.cursor;
- enum deco_part deco_part = deco_at(view, cur->x, cur->y);
- box = deco_box(view, deco_part);
+ enum ssd_part ssd_part = ssd_at(view, cur->x, cur->y);
+ box = ssd_box(view, ssd_part);
scale_box(&box, output->wlr_output->scale);
- if (isbutton(deco_part) &&
+ if (isbutton(ssd_part) &&
wlr_box_contains_point(&box, cur->x, cur->y)) {
color = (float[4]){ 0.5, 0.5, 0.5, 0.5 };
render_rect(output, output_damage, &box, color);
/* buttons */
if (view->surface == seat->keyboard_state.focused_surface) {
- box = deco_box(view, LAB_DECO_BUTTON_CLOSE);
+ box = ssd_box(view, LAB_SSD_BUTTON_CLOSE);
scale_box(&box, output->wlr_output->scale);
render_icon(output, output_damage, &box,
theme->xbm_close_active_unpressed);
- box = deco_box(view, LAB_DECO_BUTTON_MAXIMIZE);
+ box = ssd_box(view, LAB_SSD_BUTTON_MAXIMIZE);
scale_box(&box, output->wlr_output->scale);
render_icon(output, output_damage, &box,
theme->xbm_maximize_active_unpressed);
- box = deco_box(view, LAB_DECO_BUTTON_ICONIFY);
+ box = ssd_box(view, LAB_SSD_BUTTON_ICONIFY);
scale_box(&box, output->wlr_output->scale);
render_icon(output, output_damage, &box,
theme->xbm_iconify_active_unpressed);
} else {
- box = deco_box(view, LAB_DECO_BUTTON_CLOSE);
+ box = ssd_box(view, LAB_SSD_BUTTON_CLOSE);
scale_box(&box, output->wlr_output->scale);
render_icon(output, output_damage, &box,
theme->xbm_close_inactive_unpressed);
- box = deco_box(view, LAB_DECO_BUTTON_MAXIMIZE);
+ box = ssd_box(view, LAB_SSD_BUTTON_MAXIMIZE);
scale_box(&box, output->wlr_output->scale);
render_icon(output, output_damage, &box,
theme->xbm_maximize_inactive_unpressed);
- box = deco_box(view, LAB_DECO_BUTTON_ICONIFY);
+ box = ssd_box(view, LAB_SSD_BUTTON_ICONIFY);
scale_box(&box, output->wlr_output->scale);
render_icon(output, output_damage, &box,
theme->xbm_iconify_inactive_unpressed);
#define BORDER_WIDTH (2)
struct border
-deco_thickness(struct view *view)
+ssd_thickness(struct view *view)
{
struct border border = {
.top = rc.title_height + BORDER_WIDTH,
}
struct wlr_box
-deco_max_extents(struct view *view)
+ssd_max_extents(struct view *view)
{
- struct border border = deco_thickness(view);
+ struct border border = ssd_thickness(view);
struct wlr_box box = {
.x = view->x - border.left,
.y = view->y - border.top,
}
struct wlr_box
-deco_box(struct view *view, enum deco_part deco_part)
+ssd_box(struct view *view, enum ssd_part ssd_part)
{
struct wlr_box box = { 0 };
assert(view);
- switch (deco_part) {
- case LAB_DECO_BUTTON_CLOSE:
+ switch (ssd_part) {
+ case LAB_SSD_BUTTON_CLOSE:
box.width = rc.title_height;
box.height = rc.title_height;
box.x = view->x + view->w - rc.title_height;
box.y = view->y - rc.title_height;
break;
- case LAB_DECO_BUTTON_MAXIMIZE:
+ case LAB_SSD_BUTTON_MAXIMIZE:
box.width = rc.title_height;
box.height = rc.title_height;
box.x = view->x + view->w - rc.title_height * 2;
box.y = view->y - rc.title_height;
break;
- case LAB_DECO_BUTTON_ICONIFY:
+ case LAB_SSD_BUTTON_ICONIFY:
box.width = rc.title_height;
box.height = rc.title_height;
box.x = view->x + view->w - rc.title_height * 3;
box.y = view->y - rc.title_height;
break;
- case LAB_DECO_PART_TITLE:
+ case LAB_SSD_PART_TITLE:
box.x = view->x;
box.y = view->y - rc.title_height;
box.width = view->w;
box.height = rc.title_height;
break;
- case LAB_DECO_PART_TOP:
+ case LAB_SSD_PART_TOP:
box.x = view->x - BORDER_WIDTH;
box.y = view->y - rc.title_height - BORDER_WIDTH;
box.width = view->w + 2 * BORDER_WIDTH;
box.height = BORDER_WIDTH;
break;
- case LAB_DECO_PART_RIGHT:
+ case LAB_SSD_PART_RIGHT:
box.x = view->x + view->w;
box.y = view->y - rc.title_height;
box.width = BORDER_WIDTH;
box.height = view->h + rc.title_height;
break;
- case LAB_DECO_PART_BOTTOM:
+ case LAB_SSD_PART_BOTTOM:
box.x = view->x - BORDER_WIDTH;
box.y = view->y + view->h;
box.width = view->w + 2 * BORDER_WIDTH;
box.height = +BORDER_WIDTH;
break;
- case LAB_DECO_PART_LEFT:
+ case LAB_SSD_PART_LEFT:
box.x = view->x - BORDER_WIDTH;
box.y = view->y - rc.title_height;
box.width = BORDER_WIDTH;
return box;
}
-enum deco_part
-deco_at(struct view *view, double lx, double ly)
+enum ssd_part
+ssd_at(struct view *view, double lx, double ly)
{
- enum deco_part deco_part;
- for (deco_part = 0; deco_part < LAB_DECO_END_MARKER; ++deco_part) {
- struct wlr_box box = deco_box(view, deco_part);
+ enum ssd_part ssd_part;
+ for (ssd_part = 0; ssd_part < LAB_SSD_END_MARKER; ++ssd_part) {
+ struct wlr_box box = ssd_box(view, ssd_part);
if (wlr_box_contains_point(&box, lx, ly)) {
- return deco_part;
+ return ssd_part;
}
}
- return LAB_DECO_NONE;
+ return LAB_SSD_NONE;
}
.height = output->height,
};
if (view->server_side_deco) {
- struct border border = deco_thickness(view);
+ struct border border = ssd_thickness(view);
box.x += border.left;
box.y += border.top;
box.width -= border.right + border.left;
view->server_side_deco = has_ssd(view);
if (view->server_side_deco) {
- view->margin = deco_thickness(view);
+ view->margin = ssd_thickness(view);
}
update_padding(view);
position_xdg_toplevel_view(view);
static void
top_left_edge_boundary_check(struct view *view)
{
- struct wlr_box deco = deco_max_extents(view);
+ struct wlr_box deco = ssd_max_extents(view);
if (deco.x < 0) {
view->x -= deco.x;
}
view->surface = view->xwayland_surface->surface;
view->server_side_deco = want_deco(view);
- view->margin = deco_thickness(view);
+ view->margin = ssd_thickness(view);
top_left_edge_boundary_check(view);