Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Description: Corrected support for buttons backgrounds with transparency
- Added 'no background' if there is only one button and backgrounds no more
- overlap if transparency used.
- Corrected bug with left button clickable region when window is
- maximized
- Origin: Ubuntu
- Bug: https://bugzilla.gnome.org/show_bug.cgi?id=608511
- Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/metacity/+bug/535088
- Author: Nicolas Desfontaine <noop@free.fr>
- Index: metacity-2.28.1/src/ui/theme.c
- ===================================================================
- --- metacity-2.28.1/src/ui/theme.c (revision 1)
- +++ metacity-2.28.1/src/ui/theme.c (revision 53)
- @@ -702,29 +702,40 @@
- right_bg_rects[i] = NULL;
- }
- for (i = 0; i < n_left; i++)
- {
- - if (i == 0) /* prefer left background if only one button */
- - left_bg_rects[i] = &fgeom->left_left_background;
- + if (i == 0) /* For the first button (From left to right) */
- + {
- + if (n_left > 1) /* Set left_left_background
- + if we have more than one button */
- + left_bg_rects[i] = &fgeom->left_left_background;
- + else /* No background if we have only one single button */
- + left_bg_rects[i] = &fgeom->left_single_background;
- + }
- else if (i == (n_left - 1))
- left_bg_rects[i] = &fgeom->left_right_background;
- else
- left_bg_rects[i] = &fgeom->left_middle_backgrounds[i - 1];
- }
- for (i = 0; i < n_right; i++)
- {
- - /* prefer right background if only one button */
- - if (i == (n_right - 1))
- - right_bg_rects[i] = &fgeom->right_right_background;
- + if (i == (n_right - 1)) /* For the first button (From right to left) */
- + {
- + if (n_right > 1) /* Set right_right_background
- + if we have more than one button */
- + right_bg_rects[i] = &fgeom->right_right_background;
- + else /* No background if we have only one single button */
- + right_bg_rects[i] = &fgeom->right_single_background;
- + }
- else if (i == 0)
- right_bg_rects[i] = &fgeom->right_left_background;
- else
- right_bg_rects[i] = &fgeom->right_middle_backgrounds[i - 1];
- }
- -
- +
- /* Be sure buttons fit */
- while (n_left > 0 || n_right > 0)
- {
- int space_used_by_buttons;
- int space_available;
- @@ -836,13 +847,13 @@
- rect->visible.height = button_height;
- if (flags & META_FRAME_MAXIMIZED)
- {
- rect->clickable.x = rect->visible.x;
- - rect->clickable.y = 0;
- - rect->clickable.width = rect->visible.width;
- - rect->clickable.height = button_height + button_y;
- + rect->clickable.y = rect->visible.y;
- + rect->clickable.width = button_width;
- + rect->clickable.height = button_height;
- if (i == n_right - 1)
- rect->clickable.width += layout->right_titlebar_edge + layout->right_width + layout->button_border.right;
- }
- @@ -874,27 +885,17 @@
- rect->visible.width = button_width;
- rect->visible.height = button_height;
- if (flags & META_FRAME_MAXIMIZED)
- {
- - if (i==0)
- - {
- - rect->clickable.x = 0;
- - rect->clickable.width = button_width + x;
- - }
- - else
- - {
- - rect->clickable.x = rect->visible.x;
- - rect->clickable.width = button_width;
- - }
- -
- - rect->clickable.y = 0;
- - rect->clickable.height = button_height + button_y;
- - }
- - else
- - g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
- -
- + rect->clickable.x = rect->visible.x;
- + rect->clickable.y = rect->visible.y;
- + rect->clickable.width = button_width;
- + rect->clickable.height = button_height;
- + }
- + else
- + g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
- x = rect->visible.x + rect->visible.width + layout->button_border.right;
- if (left_buttons_has_spacer[i])
- x += (button_width * 0.75);
- @@ -4523,11 +4524,11 @@
- }
- /* MIDDLE_BACKGROUND type may get drawn more than once */
- if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND ||
- j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
- - middle_bg_offset < MAX_MIDDLE_BACKGROUNDS)
- + (middle_bg_offset < (MAX_MIDDLE_BACKGROUNDS - 1)))
- {
- ++middle_bg_offset;
- }
- else
- {
- Index: metacity-2.28.1/src/ui/theme.h
- ===================================================================
- --- metacity-2.28.1/src/ui/theme.h (revision 1)
- +++ metacity-2.28.1/src/ui/theme.h (revision 39)
- @@ -198,13 +198,15 @@
- MetaButtonSpace unshade_rect;
- MetaButtonSpace unabove_rect;
- MetaButtonSpace unstick_rect;
- #define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
- + GdkRectangle left_single_background;
- GdkRectangle left_left_background;
- GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
- GdkRectangle left_right_background;
- + GdkRectangle right_single_background;
- GdkRectangle right_left_background;
- GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
- GdkRectangle right_right_background;
- /* End of button rects (if changed adjust memset hack) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement