Commit 2a02a3e8f9efa610951a020ab6344c29553f7e86

Authored by Colomban Wendling
1 parent 66e02c49

Add patch to fix buttons background when some buttons are hidden

debian/changelog
  1 +metacity (1:3.14.3-1+hypra1) UNRELEASED; urgency=medium
  2 +
  3 + * Add patch to fix buttons background when some buttons are hidden.
  4 +
  5 + -- Colomban Wendling <cwendling@hypra.fr> Wed, 14 Nov 2018 16:58:45 +0100
  6 +
1 7 metacity (1:3.14.3-1) unstable; urgency=medium
2 8  
3 9 * New upstream bugfix release.
... ...
debian/patches/0001-Fix-buttons-background-when-some-buttons-are-hidden.patch 0 → 100644
... ... @@ -0,0 +1,111 @@
  1 +From 966e091376e2cade8bd0c494577589a7be2bb4a9 Mon Sep 17 00:00:00 2001
  2 +From: Colomban Wendling <cwendling@hypra.fr>
  3 +Date: Wed, 14 Nov 2018 18:57:47 +0100
  4 +Subject: [PATCH] Fix buttons background when some buttons are hidden
  5 +
  6 +Properly save the actual button layout in the frame geometry instead of
  7 +the actual number of buttons but the configured layout, which might
  8 +include hidden buttons.
  9 +This fixes later lookup in the frame geometry so it uses the actually
  10 +displayed buttons.
  11 +---
  12 + src/ui/theme.c | 29 ++++++++++++++++++-----------
  13 + 1 file changed, 18 insertions(+), 11 deletions(-)
  14 +
  15 +diff --git a/src/ui/theme.c b/src/ui/theme.c
  16 +index 5763851..aa58579 100644
  17 +--- a/src/ui/theme.c
  18 ++++ b/src/ui/theme.c
  19 +@@ -618,9 +618,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  20 + MetaButtonSpace *left_func_rects[MAX_BUTTONS_PER_CORNER];
  21 + MetaButtonSpace *right_func_rects[MAX_BUTTONS_PER_CORNER];
  22 + GdkRectangle *left_bg_rects[MAX_BUTTONS_PER_CORNER];
  23 +- gboolean left_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
  24 + GdkRectangle *right_bg_rects[MAX_BUTTONS_PER_CORNER];
  25 +- gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
  26 +
  27 + MetaFrameBorders borders;
  28 +
  29 +@@ -680,6 +678,14 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  30 + n_left_spacers = 0;
  31 + n_right_spacers = 0;
  32 +
  33 ++ for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
  34 ++ {
  35 ++ fgeom->button_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
  36 ++ fgeom->button_layout.left_buttons_has_spacer[i] = FALSE;
  37 ++ fgeom->button_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
  38 ++ fgeom->button_layout.right_buttons_has_spacer[i] = FALSE;
  39 ++ }
  40 ++
  41 + if (!layout->hide_buttons)
  42 + {
  43 + /* Try to fill in rects */
  44 +@@ -690,8 +696,9 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  45 + theme);
  46 + if (left_func_rects[n_left] != NULL)
  47 + {
  48 +- left_buttons_has_spacer[n_left] = button_layout->left_buttons_has_spacer[i];
  49 +- if (button_layout->left_buttons_has_spacer[i])
  50 ++ fgeom->button_layout.left_buttons[n_left] = button_layout->left_buttons[i];
  51 ++ fgeom->button_layout.left_buttons_has_spacer[n_left] = button_layout->left_buttons_has_spacer[i];
  52 ++ if (fgeom->button_layout.left_buttons_has_spacer[n_left])
  53 + ++n_left_spacers;
  54 +
  55 + ++n_left;
  56 +@@ -705,8 +712,9 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  57 + theme);
  58 + if (right_func_rects[n_right] != NULL)
  59 + {
  60 +- right_buttons_has_spacer[n_right] = button_layout->right_buttons_has_spacer[i];
  61 +- if (button_layout->right_buttons_has_spacer[i])
  62 ++ fgeom->button_layout.right_buttons[n_right] = button_layout->right_buttons[i];
  63 ++ fgeom->button_layout.right_buttons_has_spacer[n_right] = button_layout->right_buttons_has_spacer[i];
  64 ++ if (fgeom->button_layout.right_buttons_has_spacer[n_right])
  65 + ++n_right_spacers;
  66 +
  67 + ++n_right;
  68 +@@ -770,12 +778,12 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  69 + /* First try to remove separators */
  70 + if (n_left_spacers > 0)
  71 + {
  72 +- left_buttons_has_spacer[--n_left_spacers] = FALSE;
  73 ++ fgeom->button_layout.left_buttons_has_spacer[--n_left_spacers] = FALSE;
  74 + continue;
  75 + }
  76 + else if (n_right_spacers > 0)
  77 + {
  78 +- right_buttons_has_spacer[--n_right_spacers] = FALSE;
  79 ++ fgeom->button_layout.right_buttons_has_spacer[--n_right_spacers] = FALSE;
  80 + continue;
  81 + }
  82 +
  83 +@@ -839,7 +847,6 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  84 + }
  85 +
  86 + /* Save the button layout */
  87 +- fgeom->button_layout = *button_layout;
  88 + fgeom->n_left_buttons = n_left;
  89 + fgeom->n_right_buttons = n_right;
  90 +
  91 +@@ -860,7 +867,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  92 +
  93 + rect = right_func_rects[i];
  94 + rect->visible.x = x - layout->button_border.right - button_width;
  95 +- if (right_buttons_has_spacer[i])
  96 ++ if (fgeom->button_layout.right_buttons_has_spacer[i])
  97 + rect->visible.x -= (button_width * 0.75);
  98 +
  99 + rect->visible.y = button_y;
  100 +@@ -919,7 +926,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
  101 + g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
  102 +
  103 + x = rect->visible.x + rect->visible.width + layout->button_border.right;
  104 +- if (left_buttons_has_spacer[i])
  105 ++ if (fgeom->button_layout.left_buttons_has_spacer[i])
  106 + x += (button_width * 0.75);
  107 +
  108 + *(left_bg_rects[i]) = rect->visible;
  109 +--
  110 +2.1.4
  111 +
... ...
debian/patches/series 0 → 100644
... ... @@ -0,0 +1 @@
  1 +0001-Fix-buttons-background-when-some-buttons-are-hidden.patch
... ...