]> git.mdlowis.com Git - proto/labwc.git/commitdiff
ssd: also add spacing between innermost button and title
authorJohn Lindgren <john@jlindgren.net>
Mon, 30 Sep 2024 16:27:19 +0000 (12:27 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 30 Sep 2024 17:28:55 +0000 (18:28 +0100)
Currently, left-aligned title text gets pushed right up to the window
icon with no spacing at all, which looks bad IMO.

src/ssd/ssd-titlebar.c

index caa0a7595010399026b69c98b423a52fbb970403..b3a72b35d157097ffd30af4168d6467eaaa2c7c4 100644 (file)
@@ -272,11 +272,12 @@ update_visible_buttons(struct ssd *ssd)
        /*
         * The corner-left button is lastly removed as it's usually a window
         * menu button (or an app icon button in the future).
+        *
+        * There is spacing to the inside of each button, including between the
+        * innermost buttons and the window title. See also get_title_offsets().
         */
-       while (width <
-               ((button_width * (button_count_left + button_count_right)) +
-                       (MAX((button_count_right - 1), 0) * button_spacing) +
-                       (MAX((button_count_left - 1), 0) * button_spacing))) {
+       while (width < ((button_width + button_spacing)
+                       * (button_count_left + button_count_right))) {
                if (button_count_left > button_count_right) {
                        button_count_left--;
                } else {
@@ -486,15 +487,13 @@ get_title_offsets(struct ssd *ssd, int *offset_left, int *offset_right)
        wl_list_for_each(b, &rc.title_buttons_left, link) {
                struct ssd_part *part = ssd_get_part(&subtree->parts, b->type);
                if (part->node->enabled) {
-                       *offset_left += *offset_left > padding_width ? button_spacing : 0;
-                       *offset_left += button_width;
+                       *offset_left += button_width + button_spacing;
                }
        }
        wl_list_for_each_reverse(b, &rc.title_buttons_right, link) {
                struct ssd_part *part = ssd_get_part(&subtree->parts, b->type);
                if (part->node->enabled) {
-                       *offset_right += *offset_right > padding_width ? button_spacing : 0;
-                       *offset_right += button_width;
+                       *offset_right += button_width + button_spacing;
                }
        }
 }