]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src: put designated initializers in member order
authorJohn Lindgren <john@jlindgren.net>
Fri, 4 Jul 2025 04:40:15 +0000 (00:40 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 21 Jul 2025 14:51:10 +0000 (16:51 +0200)
Out-of-order named initializers are allowed in C (unlike in C++) but
are still surprising - I don't see a reason not to put them in order.

src/edges.c
src/input/ime.c
src/ssd/ssd.c
src/theme.c

index 6d64c5112c8feb9642e204af422245ccbf68d718..50b7e6155e1afcfe568f3f4b57866da9a7a4b1db 100644 (file)
@@ -283,8 +283,8 @@ subtract_view_from_space(struct view *view, pixman_region32_t *available)
        struct wlr_box view_size = ssd_max_extents(view);
        pixman_box32_t view_rect = {
                .x1 = view_size.x,
-               .x2 = view_size.x + view_size.width,
                .y1 = view_size.y,
+               .x2 = view_size.x + view_size.width,
                .y2 = view_size.y + view_size.height
        };
 
@@ -431,10 +431,10 @@ edges_find_neighbors(struct border *nearest_edges, struct view *view,
 
                struct border win_edges = {
                        .top = v->current.y - border.top,
-                       .left = v->current.x - border.left,
+                       .right = v->current.x + v->current.width + border.right,
                        .bottom = v->current.y + border.bottom
                                + view_effective_height(v, /* use_pending */ false),
-                       .right = v->current.x + v->current.width + border.right,
+                       .left = v->current.x - border.left,
                };
 
                validate_edges(nearest_edges, view_edges,
index ded28f5ce5064d29c7c5499e742583c4d371a4f0..e76b2f2c6c2f90edec4b79df5eb76672e9f15530 100644 (file)
@@ -224,13 +224,13 @@ update_popup_position(struct input_method_popup *popup)
                .anchor_rect = cursor_rect,
                .anchor = XDG_POSITIONER_ANCHOR_BOTTOM_LEFT,
                .gravity = XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT,
+               .constraint_adjustment =
+                       XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y
+                       | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X,
                .size = {
                        .width = popup->popup_surface->surface->current.width,
                        .height = popup->popup_surface->surface->current.height,
                },
-               .constraint_adjustment =
-                       XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y
-                       | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X,
        };
 
        struct wlr_box popup_box;
index 65416ca32d0b5a61714ec3bd248f83e9d16695f7..48d416b96300b9e25eecea6f2494b6a2c6264368 100644 (file)
@@ -46,9 +46,9 @@ ssd_thickness(struct view *view)
 
        struct border thickness = {
                .top = theme->titlebar_height + theme->border_width,
+               .right = theme->border_width,
                .bottom = theme->border_width,
                .left = theme->border_width,
-               .right = theme->border_width,
        };
 
        if (view->ssd_titlebar_hidden) {
index 5671c19544d94b2f817ec6146172ea4d47c1c92d..5fe9c1a2ee726140410ee2b2c7564dc8307cad46 100644 (file)
@@ -289,49 +289,49 @@ load_buttons(struct theme *theme)
 {
        struct button buttons[] = { {
                .name = "menu",
+               .fallback_button = (const char[]){ 0x00, 0x21, 0x33, 0x1E, 0x0C, 0x00 },
                .type = LAB_SSD_BUTTON_WINDOW_MENU,
                .state_set = 0,
-               .fallback_button = (const char[]){ 0x00, 0x21, 0x33, 0x1E, 0x0C, 0x00 },
        }, {
                .name = "iconify",
+               .fallback_button = (const char[]){ 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f },
                .type = LAB_SSD_BUTTON_ICONIFY,
                .state_set = 0,
-               .fallback_button = (const char[]){ 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f },
        }, {
                .name = "max",
+               .fallback_button = (const char[]){ 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f },
                .type = LAB_SSD_BUTTON_MAXIMIZE,
                .state_set = 0,
-               .fallback_button = (const char[]){ 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f },
        }, {
                .name = "max_toggled",
+               .fallback_button = (const char[]){ 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f },
                .type = LAB_SSD_BUTTON_MAXIMIZE,
                .state_set = LAB_BS_TOGGLED,
-               .fallback_button = (const char[]){ 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f },
        }, {
                .name = "shade",
+               .fallback_button = (const char[]){ 0x3f, 0x3f, 0x00, 0x0c, 0x1e, 0x3f },
                .type = LAB_SSD_BUTTON_SHADE,
                .state_set = 0,
-               .fallback_button = (const char[]){ 0x3f, 0x3f, 0x00, 0x0c, 0x1e, 0x3f },
        }, {
                .name = "shade_toggled",
+               .fallback_button = (const char[]){ 0x3f, 0x3f, 0x00, 0x3f, 0x1e, 0x0c },
                .type = LAB_SSD_BUTTON_SHADE,
                .state_set = LAB_BS_TOGGLED,
-               .fallback_button = (const char[]){ 0x3f, 0x3f, 0x00, 0x3f, 0x1e, 0x0c },
        }, {
                .name = "desk",
+               .fallback_button = (const char[]){ 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 },
                .type = LAB_SSD_BUTTON_OMNIPRESENT,
                .state_set = 0,
-               .fallback_button = (const char[]){ 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 },
        }, {
                .name = "desk_toggled",
+               .fallback_button = (const char[]){ 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 },
                .type = LAB_SSD_BUTTON_OMNIPRESENT,
                .state_set = LAB_BS_TOGGLED,
-               .fallback_button = (const char[]){ 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 },
        }, {
                .name = "close",
+               .fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
                .type = LAB_SSD_BUTTON_CLOSE,
                .state_set = 0,
-               .fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
        }, {
                .name = "menu_hover",
                .type = LAB_SSD_BUTTON_WINDOW_MENU,