updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / metacity-better-button-layout / metacity-better-button-layout.patch
blob3fdc83f0c57ca4cf9d811c856e3defe07ea64152
1 --- metacity-2.28.1/src/ui/theme.c (revision 1)
2 +++ metacity-2.28.1/src/ui/theme.c (revision 53)
3 @@ -702,29 +702,40 @@
4 right_bg_rects[i] = NULL;
7 for (i = 0; i < n_left; i++)
9 - if (i == 0) /* prefer left background if only one button */
10 - left_bg_rects[i] = &fgeom->left_left_background;
11 + if (i == 0) /* For the first button (From left to right) */
12 + {
13 + if (n_left > 1) /* Set left_left_background
14 + if we have more than one button */
15 + left_bg_rects[i] = &fgeom->left_left_background;
16 + else /* No background if we have only one single button */
17 + left_bg_rects[i] = &fgeom->left_single_background;
18 + }
19 else if (i == (n_left - 1))
20 left_bg_rects[i] = &fgeom->left_right_background;
21 else
22 left_bg_rects[i] = &fgeom->left_middle_backgrounds[i - 1];
25 for (i = 0; i < n_right; i++)
27 - /* prefer right background if only one button */
28 - if (i == (n_right - 1))
29 - right_bg_rects[i] = &fgeom->right_right_background;
30 + if (i == (n_right - 1)) /* For the first button (From right to left) */
31 + {
32 + if (n_right > 1) /* Set right_right_background
33 + if we have more than one button */
34 + right_bg_rects[i] = &fgeom->right_right_background;
35 + else /* No background if we have only one single button */
36 + right_bg_rects[i] = &fgeom->right_single_background;
37 + }
38 else if (i == 0)
39 right_bg_rects[i] = &fgeom->right_left_background;
40 else
41 right_bg_rects[i] = &fgeom->right_middle_backgrounds[i - 1];
45 /* Be sure buttons fit */
46 while (n_left > 0 || n_right > 0)
48 int space_used_by_buttons;
49 int space_available;
50 @@ -836,13 +847,13 @@
51 rect->visible.height = button_height;
53 if (flags & META_FRAME_MAXIMIZED)
55 rect->clickable.x = rect->visible.x;
56 - rect->clickable.y = 0;
57 - rect->clickable.width = rect->visible.width;
58 - rect->clickable.height = button_height + button_y;
59 + rect->clickable.y = rect->visible.y;
60 + rect->clickable.width = button_width;
61 + rect->clickable.height = button_height;
63 if (i == n_right - 1)
64 rect->clickable.width += layout->right_titlebar_edge + layout->right_width + layout->button_border.right;
67 @@ -874,27 +885,17 @@
68 rect->visible.width = button_width;
69 rect->visible.height = button_height;
71 if (flags & META_FRAME_MAXIMIZED)
73 - if (i==0)
74 - {
75 - rect->clickable.x = 0;
76 - rect->clickable.width = button_width + x;
77 - }
78 - else
79 - {
80 - rect->clickable.x = rect->visible.x;
81 - rect->clickable.width = button_width;
82 - }
84 - rect->clickable.y = 0;
85 - rect->clickable.height = button_height + button_y;
86 - }
87 - else
88 - g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
90 + rect->clickable.x = rect->visible.x;
91 + rect->clickable.y = rect->visible.y;
92 + rect->clickable.width = button_width;
93 + rect->clickable.height = button_height;
94 + }
95 + else
96 + g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
98 x = rect->visible.x + rect->visible.width + layout->button_border.right;
99 if (left_buttons_has_spacer[i])
100 x += (button_width * 0.75);
102 @@ -4523,11 +4524,11 @@
105 /* MIDDLE_BACKGROUND type may get drawn more than once */
106 if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND ||
107 j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
108 - middle_bg_offset < MAX_MIDDLE_BACKGROUNDS)
109 + (middle_bg_offset < (MAX_MIDDLE_BACKGROUNDS - 1)))
111 ++middle_bg_offset;
113 else
116 Index: metacity-2.28.1/src/ui/theme.h
117 ===================================================================
118 --- metacity-2.28.1/src/ui/theme.h (revision 1)
119 +++ metacity-2.28.1/src/ui/theme.h (revision 39)
120 @@ -198,13 +198,15 @@
121 MetaButtonSpace unshade_rect;
122 MetaButtonSpace unabove_rect;
123 MetaButtonSpace unstick_rect;
125 #define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
126 + GdkRectangle left_single_background;
127 GdkRectangle left_left_background;
128 GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
129 GdkRectangle left_right_background;
130 + GdkRectangle right_single_background;
131 GdkRectangle right_left_background;
132 GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
133 GdkRectangle right_right_background;
134 /* End of button rects (if changed adjust memset hack) */