]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Rename deco.c ssd.c
authorJohan Malm <jgm323@gmail.com>
Sat, 20 Mar 2021 14:41:39 +0000 (14:41 +0000)
committerJohan Malm <jgm323@gmail.com>
Sat, 20 Mar 2021 14:41:39 +0000 (14:41 +0000)
include/labwc.h
src/cursor.c
src/desktop.c
src/meson.build
src/output.c
src/ssd.c [moved from src/deco.c with 74% similarity]
src/view.c
src/xdg.c
src/xwayland.c

index 6fb597db878da05f41f693a802d386390b42a35a..82106602e62227348ffe23546449142c15c8df51 100644 (file)
@@ -145,17 +145,17 @@ enum view_type {
 #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 {
@@ -345,10 +345,10 @@ void server_init(struct server *server);
 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);
 
index 1da84fd9216ff9fec33ef2ccefc98f364347ade1..217b5215c6d5345c25daa591bdce9f51cf741960 100644 (file)
@@ -140,7 +140,7 @@ process_cursor_motion(struct server *server, uint32_t time)
        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,
@@ -178,7 +178,7 @@ process_cursor_motion(struct server *server, uint32_t time)
                }
                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) {
@@ -319,16 +319,16 @@ cursor_button(struct wl_listener *listener, void *data)
        }
 
        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;
        }
index 6a7bf2bc3f998aabd21ce21cf749857c32dd9878..58a6254371f1e191b57d2667cac7926466a8ba71 100644 (file)
@@ -246,8 +246,8 @@ desktop_view_at(struct server *server, double lx, double ly,
                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;
                }
        }
index d5389dd6dab451627122d97298223e3cd42e2d7a..df65dcc878753ab36f63fee5797324bfe3218aa6 100644 (file)
@@ -2,7 +2,6 @@ labwc_sources = files(
   'action.c',
   'cursor.c',
   'damage.c',
-  'deco.c',
   'desktop.c',
   'interactive.c',
   'keyboard.c',
@@ -12,6 +11,7 @@ labwc_sources = files(
   'output.c',
   'seat.c',
   'server.c',
+  'ssd.c',
   'subsurface.c',
   'theme.c',
   'view.c',
index 4ba71f8ab06f07db21c99457743ba237521521b5..4fcd7d96d6de605c582b06be1273fda682904983 100644 (file)
@@ -432,11 +432,11 @@ render_icon(struct output *output, pixman_region32_t *output_damage,
 }
 
 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
@@ -451,14 +451,14 @@ render_deco(struct view *view, struct output *output,
 
        /* 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);
        }
@@ -470,16 +470,16 @@ render_deco(struct view *view, struct output *output,
        } 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);
@@ -487,28 +487,28 @@ render_deco(struct view *view, struct output *output,
 
        /* 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);
similarity index 74%
rename from src/deco.c
rename to src/ssd.c
index 49b87ef9bb1b83605e01be66e692b5fcbd783d4f..35bbfb058178da464b73c19354b46f988ae24755 100644 (file)
+++ b/src/ssd.c
@@ -11,7 +11,7 @@
 #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,
@@ -23,9 +23,9 @@ deco_thickness(struct view *view)
 }
 
 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,
@@ -36,54 +36,54 @@ deco_max_extents(struct view *view)
 }
 
 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;
@@ -95,15 +95,15 @@ deco_box(struct view *view, enum deco_part deco_part)
        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;
 }
index 2b43e177ba5d5a688fb55d17d0902ca0b1b0afa1..68946301af3cd0a7e17d461204ef42544fb2915b 100644 (file)
@@ -77,7 +77,7 @@ view_maximize(struct view *view, bool maximize)
                        .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;
index 377b926fcc80d4ce91db13cf3664c752fe46716d..d80c269d2e252618c6a8c626e8714cc551681211 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -254,7 +254,7 @@ xdg_toplevel_view_map(struct view *view)
 
                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);
index 2485361ee24df4d708f7a550c90bb9713f257aa8..c8187f5a0adcea13cd4ef3974beea576e7c5c8db 100644 (file)
@@ -124,7 +124,7 @@ want_deco(struct 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;
        }
@@ -148,7 +148,7 @@ map(struct view *view)
        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);