Merge lp:~mc-return/compiz/compiz.merge-fix1166195-fix1166196-fix116245-resizeinfo-fixes into lp:compiz/0.9.10

Proposed by MC Return
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3647
Merged at revision: 3651
Proposed branch: lp:~mc-return/compiz/compiz.merge-fix1166195-fix1166196-fix116245-resizeinfo-fixes
Merge into: lp:compiz/0.9.10
Diff against target: 384 lines (+90/-74)
3 files modified
plugins/resizeinfo/resizeinfo.xml.in (+19/-7)
plugins/resizeinfo/src/resizeinfo.cpp (+66/-62)
plugins/resizeinfo/src/resizeinfo.h (+5/-5)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-fix1166195-fix1166196-fix116245-resizeinfo-fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
Review via email: mp+157670@code.launchpad.net

Commit message

*Resizeinfo, xml changes:

Added option for bold/normal font, default is still bold.

Added option to change the font size (10-14), default is still 12
pixel.

Enhanced and corrected a few tooltips.

*Resizeinfo, code changes:

Choose between PANGO_WEIGHT_BOLD and PANGO_WEIGHT_NORMAL.

Use individual font size specified by the user in CCSM.

Fixed computation of wrong damageRegion, it was additionally adding
the window size, making it way too large.

Removed useless declaration of int width and height.

Declaration and assignment of local variables in one line, if possible.

Minor indentation fixes.

(LP: #1166195, LP: #1166196 and LP: #1166245)

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Hi,

Please see my previous comments on the usage of the boy-scout rule.

These were the only changes that were actually substantial:

77 -const unsigned short RESIZE_POPUP_WIDTH = 85;
78 -const unsigned short RESIZE_POPUP_HEIGHT = 50;
79 +const unsigned short RESIZE_POPUP_WIDTH = 100;
80 +const unsigned short RESIZE_POPUP_HEIGHT = 33;

149 pango_font_description_set_family (font,"Sans");
150 - pango_font_description_set_absolute_size (font, 12 * PANGO_SCALE);
151 + pango_font_description_set_absolute_size (font,
152 + is->optionGetResizeinfoFontSize () *
153 + PANGO_SCALE);
154 pango_font_description_set_style (font, PANGO_STYLE_NORMAL);
155 - pango_font_description_set_weight (font, PANGO_WEIGHT_BOLD);
156 -
157 +
158 + if (is->optionGetResizeinfoFontBold ())
159 + pango_font_description_set_weight (font, PANGO_WEIGHT_BOLD);
160 + else
161 + pango_font_description_set_weight (font, PANGO_WEIGHT_NORMAL);

As for those changes, they seem fine to me. I haven't got time to look at the formatting things just yet though.
162 +

Revision history for this message
MC Return (mc-return) wrote :

>
> These were the only changes that were actually substantial:
>
> 77 -const unsigned short RESIZE_POPUP_WIDTH = 85;
> 78 -const unsigned short RESIZE_POPUP_HEIGHT = 50;
> 79 +const unsigned short RESIZE_POPUP_WIDTH = 100;
> 80 +const unsigned short RESIZE_POPUP_HEIGHT = 33;
>
> 149 pango_font_description_set_family (font,"Sans");
> 150 - pango_font_description_set_absolute_size (font, 12 * PANGO_SCALE);
> 151 + pango_font_description_set_absolute_size (font,
> 152 + is->optionGetResizeinfoFontSize () *
> 153 + PANGO_SCALE);
> 154 pango_font_description_set_style (font, PANGO_STYLE_NORMAL);
> 155 - pango_font_description_set_weight (font, PANGO_WEIGHT_BOLD);
> 156 -
> 157 +
> 158 + if (is->optionGetResizeinfoFontBold ())
> 159 + pango_font_description_set_weight (font, PANGO_WEIGHT_BOLD);
> 160 + else
> 161 + pango_font_description_set_weight (font, PANGO_WEIGHT_NORMAL);
>
> As for those changes, they seem fine to me. I haven't got time to look at the
> formatting things just yet though.
> 162 +

TBH, the most substantial change in this MP was not listed by you ;)
It is this:

241 - (x + RESIZE_POPUP_WIDTH + 5),
242 - (y + RESIZE_POPUP_HEIGHT + 5));
243 + (RESIZE_POPUP_WIDTH + 5),
244 + (RESIZE_POPUP_HEIGHT + 5));

It reduces the damage rectangle's size by the window size...

Revision history for this message
MC Return (mc-return) wrote :

This does not mean anything for someone reading the tooltip:

<_long>Show resize info for all windows as opposed to just for windows with a resize increment of greater than 1.</_long>

so I changed it to:

<_long>Show resize info for all windows as opposed to just for text based windows like terminals.</_long>

The other changes in the tooltips are:
If the user adjusts the color, he can also adjust the opacity.

In the code I did some minor indentation fixes, I am sorry I can't let them untouched if I notice those...
Other than that and the things already mentioned by yourself, I just changed assignment and declaration of
local variables to be done in the same line, if possible...

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> This does not mean anything for someone reading the tooltip:
>
> <_long>Show resize info for all windows as opposed to just for windows with a
> resize increment of greater than 1.</_long>
>
> so I changed it to:
>
> <_long>Show resize info for all windows as opposed to just for text based
> windows like terminals.</_long>
>
> The other changes in the tooltips are:
> If the user adjusts the color, he can also adjust the opacity.
>
> In the code I did some minor indentation fixes, I am sorry I can't let them
> untouched if I notice those...
> Other than that and the things already mentioned by yourself, I just changed
> assignment and declaration of
> local variables to be done in the same line, if possible...

Indentation fixes and code cleanups are useful and appreciated. However, they tend to just confuse things when mixed them with substantive changes. Especially when the reviewer isn't immediately familiar with the section of code that's being edited.

I think this guideline should be followed when making such changes:
 1. If making a substantive change (eg, a change in behaviour, fixing the logic or a bug) keep the formatting, stylistic and other minor changes restricted to the code section in which the application logic is being changed. Do not change formatting, indentation, variable declarations or perform any other refactoring in unrelated code sections in the same, or other files.
 2. Merge proposals which change only indentation, formatting, variable declarations and perform other refactoring are 100% acceptable and encouraged (so long as they improve the quality of the code), however, they must be marked as separate so that reviewers know what to look out for.

Doing changes in this manner means that reviewers can get through both sets faster, because the type of cognitive load is different for each. In addition, it means that substantive changes aren't blocked on formatting changes which other reviewers might have suggestions on.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

>
> TBH, the most substantial change in this MP was not listed by you ;)
> It is this:
>
> 241 - (x + RESIZE_POPUP_WIDTH + 5),
> 242 - (y + RESIZE_POPUP_HEIGHT + 5));
> 243 + (RESIZE_POPUP_WIDTH + 5),
> 244 + (RESIZE_POPUP_HEIGHT + 5));
>
> It reduces the damage rectangle's size by the window size...

Right, this is exactly the problem I'm referring to. Mixing behavioural and formatting changes can cause important things like this to be missed.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

179 - int height = RESIZE_POPUP_HEIGHT;
180 - int width = RESIZE_POPUP_WIDTH;
181 float r, g, b, a;
182
183 INFO_SCREEN (screen);
184 @@ -197,7 +199,9 @@
185 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
186
187 /* Setup Gradient */
188 - pattern = cairo_pattern_create_linear (0, 0, width, height);
189 + pattern = cairo_pattern_create_linear (0, 0,
190 + RESIZE_POPUP_WIDTH,
191 + RESIZE_POPUP_HEIGHT);
192
193 r = is->optionGetGradient1Red () / (float)0xffff;
194 g = is->optionGetGradient1Green () / (float)0xffff;
195 @@ -220,10 +224,14 @@
196
197 /* Rounded Rectangle! */
198 cairo_arc (cr, border, border, border, PI, 1.5f * PI);
199 - cairo_arc (cr, border + width - 2 * border, border, border,
200 + cairo_arc (cr, border + RESIZE_POPUP_WIDTH - 2 * border,
201 + border, border,
202 1.5f * PI, 2.0 * PI);
203 - cairo_arc (cr, width - border, height - border, border, 0, PI / 2.0f);
204 - cairo_arc (cr, border, height - border, border, PI / 2.0f, PI);
205 + cairo_arc (cr, RESIZE_POPUP_WIDTH - border,
206 + RESIZE_POPUP_HEIGHT - border,
207 + border, 0, PI / 2.0f);
208 + cairo_arc (cr, border, RESIZE_POPUP_HEIGHT - border,
209 + border, PI / 2.0f, PI);

Instead of removing the declarations of width and height, it might be better to change their purpose. We seem to be doing a lot of this:

RESIZE_POPUP_WIDTH - border ... RESIZE_POPUP_HEIGHT - border etc

Why not change the declaration to

unsigned int widthWithoutBorder = RESIZE_POPUP_WIDTH - border;
unsigned int heightWithoutBorder = RESIZE_POPUP_HEIGHT - border;

Then you can just do:

cairo_arc (cr, widthWithoutBorder,
206 + heightWithoutBorder,
207 + border, 0, PI / 2.0f);

etc

Revision history for this message
MC Return (mc-return) wrote :

>
> Indentation fixes and code cleanups are useful and appreciated. However, they
> tend to just confuse things when mixed them with substantive changes.
> Especially when the reviewer isn't immediately familiar with the section of
> code that's being edited.
>
Yes, you are right - I apologize once again.

> I think this guideline should be followed when making such changes:
> 1. If making a substantive change (eg, a change in behaviour, fixing the
> logic or a bug) keep the formatting, stylistic and other minor changes
> restricted to the code section in which the application logic is being
> changed. Do not change formatting, indentation, variable declarations or
> perform any other refactoring in unrelated code sections in the same, or other
> files.
> 2. Merge proposals which change only indentation, formatting, variable
> declarations and perform other refactoring are 100% acceptable and encouraged
> (so long as they improve the quality of the code), however, they must be
> marked as separate so that reviewers know what to look out for.
>
Very good suggestion. I will do it that way from now on.

First I'll do a merge proposal with just substantial changes, then a follow-up
MP cleaning up that file's indentation and formatting problems only...

> Doing changes in this manner means that reviewers can get through both sets
> faster, because the type of cognitive load is different for each. In addition,
> it means that substantive changes aren't blocked on formatting changes which
> other reviewers might have suggestions on.

Agreed. I will try my best ;)

Revision history for this message
MC Return (mc-return) wrote :

> 179 - int height = RESIZE_POPUP_HEIGHT;
> 180 - int width = RESIZE_POPUP_WIDTH;
> 181 float r, g, b, a;
> 182
> 183 INFO_SCREEN (screen);
> 184 @@ -197,7 +199,9 @@
> 185 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
> 186
> 187 /* Setup Gradient */
> 188 - pattern = cairo_pattern_create_linear (0, 0, width, height);
> 189 + pattern = cairo_pattern_create_linear (0, 0,
> 190 + RESIZE_POPUP_WIDTH,
> 191 + RESIZE_POPUP_HEIGHT);
> 192
> 193 r = is->optionGetGradient1Red () / (float)0xffff;
> 194 g = is->optionGetGradient1Green () / (float)0xffff;
> 195 @@ -220,10 +224,14 @@
> 196
> 197 /* Rounded Rectangle! */
> 198 cairo_arc (cr, border, border, border, PI, 1.5f * PI);
> 199 - cairo_arc (cr, border + width - 2 * border, border, border,
> 200 + cairo_arc (cr, border + RESIZE_POPUP_WIDTH - 2 * border,
> 201 + border, border,
> 202 1.5f * PI, 2.0 * PI);
> 203 - cairo_arc (cr, width - border, height - border, border, 0, PI /
> 2.0f);
> 204 - cairo_arc (cr, border, height - border, border, PI / 2.0f, PI);
> 205 + cairo_arc (cr, RESIZE_POPUP_WIDTH - border,
> 206 + RESIZE_POPUP_HEIGHT - border,
> 207 + border, 0, PI / 2.0f);
> 208 + cairo_arc (cr, border, RESIZE_POPUP_HEIGHT - border,
> 209 + border, PI / 2.0f, PI);
>
> Instead of removing the declarations of width and height, it might be better
> to change their purpose. We seem to be doing a lot of this:
>
> RESIZE_POPUP_WIDTH - border ... RESIZE_POPUP_HEIGHT - border etc
>
> Why not change the declaration to
>
> unsigned int widthWithoutBorder = RESIZE_POPUP_WIDTH - border;
> unsigned int heightWithoutBorder = RESIZE_POPUP_HEIGHT - border;
>
> Then you can just do:
>
> cairo_arc (cr, widthWithoutBorder,
> 206 + heightWithoutBorder,
> 207 + border, 0, PI / 2.0f);
>
> etc

Yes, you are right. That would be a possibility.
But
"RESIZE_POPUP_WIDTH - border" is just used once and
"RESIZE_POPUP_HEIGHT - border" is just used twice in the code

So does this really justify creating 2 new variables ?
I do not think I agree here...

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Tue, Apr 9, 2013 at 5:24 PM, MC Return <email address hidden> wrote:
>>
>> Indentation fixes and code cleanups are useful and appreciated. However, they
>> tend to just confuse things when mixed them with substantive changes.
>> Especially when the reviewer isn't immediately familiar with the section of
>> code that's being edited.
>>
> Yes, you are right - I apologize once again.

No need to apologize, this was merely an observation.

>
>> I think this guideline should be followed when making such changes:
>> 1. If making a substantive change (eg, a change in behaviour, fixing the
>> logic or a bug) keep the formatting, stylistic and other minor changes
>> restricted to the code section in which the application logic is being
>> changed. Do not change formatting, indentation, variable declarations or
>> perform any other refactoring in unrelated code sections in the same, or other
>> files.
>> 2. Merge proposals which change only indentation, formatting, variable
>> declarations and perform other refactoring are 100% acceptable and encouraged
>> (so long as they improve the quality of the code), however, they must be
>> marked as separate so that reviewers know what to look out for.
>>
> Very good suggestion. I will do it that way from now on.
>
> First I'll do a merge proposal with just substantial changes, then a follow-up
> MP cleaning up that file's indentation and formatting problems only..

That makes sense, thanks :)
.
>
>> Doing changes in this manner means that reviewers can get through both sets
>> faster, because the type of cognitive load is different for each. In addition,
>> it means that substantive changes aren't blocked on formatting changes which
>> other reviewers might have suggestions on.
>
> Agreed. I will try my best ;)

> "RESIZE_POPUP_WIDTH - border" is just used once and
> "RESIZE_POPUP_HEIGHT - border" is just used twice in the code
> So does this really justify creating 2 new variables ?

My rule of thumb tends to be more extreme than the prevailing view,
which is that if you have some value that is being used as a value
passed to a function, then its a good idea to keep it in a constant if
the calculation is done more than once, as opposed to doing the
calculation multiple times as nested expressions within its
parameters. Its just a minor thing though, so its not something that
bothers me a whole lot.

> --
> https://code.launchpad.net/~mc-return/compiz/compiz.merge-fix1166195-fix1166196-fix116245-resizeinfo-fixes/+merge/157670
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~mc-return/compiz/compiz.merge-fix1166195-fix1166196-fix116245-resizeinfo-fixes into lp:compiz.

--
Sam Spilsbury

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/resizeinfo/resizeinfo.xml.in'
2--- plugins/resizeinfo/resizeinfo.xml.in 2012-11-06 10:20:30 +0000
3+++ plugins/resizeinfo/resizeinfo.xml.in 2013-04-08 15:17:24 +0000
4@@ -24,13 +24,25 @@
5 <max>5000</max>
6 </option>
7 <option name="always_show" type="bool">
8- <_short>Show resize info for all windows</_short>
9- <_long>Show resize info for all windows as opposed to just for windows with a resize increment of greater than 1.</_long>
10+ <_short>Show Resizeinfo For All Windows</_short>
11+ <_long>Show resize info for all windows as opposed to just for text based windows like terminals.</_long>
12 <default>false</default>
13 </option>
14+ <option name="resizeinfo_font_bold" type="bool">
15+ <_short>Bold Font</_short>
16+ <_long>Render the resize info's size display with a bold font.</_long>
17+ <default>true</default>
18+ </option>
19+ <option name="resizeinfo_font_size" type="int">
20+ <_short>Font Size</_short>
21+ <_long>Font size of the resize info's display.</_long>
22+ <default>12</default>
23+ <min>10</min>
24+ <max>14</max>
25+ </option>
26 <option name="text_color" type="color">
27 <_short>Text Color</_short>
28- <_long>Color of the resize popup's text.</_long>
29+ <_long>Color and opacity of the resize popup's text.</_long>
30 <default>
31 <red>0x0000</red>
32 <blue>0x0000</blue>
33@@ -40,7 +52,7 @@
34 </option>
35 <option name="gradient_1" type="color">
36 <_short>Gradient Color 1</_short>
37- <_long>Color on the left side of the gradient background.</_long>
38+ <_long>Color and opacity on the left side of the gradient background.</_long>
39 <default>
40 <red>0xcccc</red>
41 <green>0xcccc</green>
42@@ -50,7 +62,7 @@
43 </option>
44 <option name="gradient_2" type="color">
45 <_short>Gradient Color 2</_short>
46- <_long>Color in the center of the gradient background.</_long>
47+ <_long>Color and opacity in the center of the gradient background.</_long>
48 <default>
49 <red>0xf332</red>
50 <green>0xf332</green>
51@@ -60,7 +72,7 @@
52 </option>
53 <option name="gradient_3" type="color">
54 <_short>Gradient Color 3</_short>
55- <_long>Color on the right side of the gradient background.</_long>
56+ <_long>Color and opacity on the right side of the gradient background.</_long>
57 <default>
58 <red>0xd998</red>
59 <green>0xd998</green>
60@@ -70,7 +82,7 @@
61 </option>
62 <option name="outline_color" type="color">
63 <_short>Outline Color</_short>
64- <_long>Color of the background's outline.</_long>
65+ <_long>Color and opacity of the background's outline.</_long>
66 <default>
67 <red>0xe665</red>
68 <green>0xe665</green>
69
70=== modified file 'plugins/resizeinfo/src/resizeinfo.cpp'
71--- plugins/resizeinfo/src/resizeinfo.cpp 2013-02-27 11:33:10 +0000
72+++ plugins/resizeinfo/src/resizeinfo.cpp 2013-04-08 15:17:24 +0000
73@@ -25,8 +25,8 @@
74
75 COMPIZ_PLUGIN_20090315 (resizeinfo, InfoPluginVTable);
76
77-const unsigned short RESIZE_POPUP_WIDTH = 85;
78-const unsigned short RESIZE_POPUP_HEIGHT = 50;
79+const unsigned short RESIZE_POPUP_WIDTH = 100;
80+const unsigned short RESIZE_POPUP_HEIGHT = 33;
81
82 const double PI = 3.14159265359f;
83
84@@ -57,16 +57,17 @@
85 return;
86
87 pixmap = XCreatePixmap (screen->dpy (), screen->root (),
88- RESIZE_POPUP_WIDTH, RESIZE_POPUP_HEIGHT, 32);
89+ RESIZE_POPUP_WIDTH,
90+ RESIZE_POPUP_HEIGHT, 32);
91 if (!pixmap)
92 return;
93
94- surface =
95- cairo_xlib_surface_create_with_xrender_format (screen->dpy (),
96- pixmap, s,
97- format,
98- RESIZE_POPUP_WIDTH,
99- RESIZE_POPUP_HEIGHT);
100+ surface = cairo_xlib_surface_create_with_xrender_format (screen->dpy (),
101+ pixmap, s,
102+ format,
103+ RESIZE_POPUP_WIDTH,
104+ RESIZE_POPUP_HEIGHT);
105+
106 if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
107 {
108 compLogMessage ("resizeinfo", CompLogLevelWarn,
109@@ -102,9 +103,6 @@
110 void
111 InfoLayer::renderText ()
112 {
113- unsigned int baseWidth, baseHeight;
114- unsigned int widthInc, heightInc;
115- unsigned int width, height, xv, yv;
116 unsigned short *color;
117 char info[50];
118 PangoLayout *layout;
119@@ -116,17 +114,17 @@
120 if (!valid)
121 return;
122
123- baseWidth = is->pWindow->sizeHints ().base_width;
124- baseHeight = is->pWindow->sizeHints ().base_height;
125- widthInc = is->pWindow->sizeHints ().width_inc;
126- heightInc = is->pWindow->sizeHints ().height_inc;
127- width = is->resizeGeometry.width;
128- height = is->resizeGeometry.height;
129-
130+ unsigned int baseWidth = is->pWindow->sizeHints ().base_width;
131+ unsigned int baseHeight = is->pWindow->sizeHints ().base_height;
132+ unsigned int widthInc = is->pWindow->sizeHints ().width_inc;
133+ unsigned int heightInc = is->pWindow->sizeHints ().height_inc;
134+ unsigned int width = is->resizeGeometry.width;
135+ unsigned int height = is->resizeGeometry.height;
136+
137 color = is->optionGetTextColor ();
138
139- xv = (widthInc > 1) ? (width - baseWidth) / widthInc : width;
140- yv = (heightInc > 1) ? (height - baseHeight) / heightInc : height;
141+ unsigned int xv = (widthInc > 1) ? (width - baseWidth) / widthInc : width;
142+ unsigned int yv = (heightInc > 1) ? (height - baseHeight) / heightInc : height;
143
144 /* Clear the context. */
145 cairo_save (cr);
146@@ -141,10 +139,16 @@
147 layout = pango_cairo_create_layout (is->textLayer.cr);
148
149 pango_font_description_set_family (font,"Sans");
150- pango_font_description_set_absolute_size (font, 12 * PANGO_SCALE);
151+ pango_font_description_set_absolute_size (font,
152+ is->optionGetResizeinfoFontSize () *
153+ PANGO_SCALE);
154 pango_font_description_set_style (font, PANGO_STYLE_NORMAL);
155- pango_font_description_set_weight (font, PANGO_WEIGHT_BOLD);
156-
157+
158+ if (is->optionGetResizeinfoFontBold ())
159+ pango_font_description_set_weight (font, PANGO_WEIGHT_BOLD);
160+ else
161+ pango_font_description_set_weight (font, PANGO_WEIGHT_NORMAL);
162+
163 pango_layout_set_font_description (layout, font);
164 pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
165 pango_layout_set_text (layout, info, -1);
166@@ -152,7 +156,7 @@
167 pango_layout_get_pixel_size (layout, &w, &h);
168
169 cairo_move_to (cr,
170- RESIZE_POPUP_WIDTH / 2.0f - w / 2.0f,
171+ RESIZE_POPUP_WIDTH / 2.0f - w / 2.0f,
172 RESIZE_POPUP_HEIGHT / 2.0f - h / 2.0f);
173
174 pango_layout_set_width (layout, RESIZE_POPUP_WIDTH * PANGO_SCALE);
175@@ -178,8 +182,6 @@
176 {
177 cairo_pattern_t *pattern;
178 float border = 7.5;
179- int height = RESIZE_POPUP_HEIGHT;
180- int width = RESIZE_POPUP_WIDTH;
181 float r, g, b, a;
182
183 INFO_SCREEN (screen);
184@@ -197,7 +199,9 @@
185 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
186
187 /* Setup Gradient */
188- pattern = cairo_pattern_create_linear (0, 0, width, height);
189+ pattern = cairo_pattern_create_linear (0, 0,
190+ RESIZE_POPUP_WIDTH,
191+ RESIZE_POPUP_HEIGHT);
192
193 r = is->optionGetGradient1Red () / (float)0xffff;
194 g = is->optionGetGradient1Green () / (float)0xffff;
195@@ -220,10 +224,14 @@
196
197 /* Rounded Rectangle! */
198 cairo_arc (cr, border, border, border, PI, 1.5f * PI);
199- cairo_arc (cr, border + width - 2 * border, border, border,
200+ cairo_arc (cr, border + RESIZE_POPUP_WIDTH - 2 * border,
201+ border, border,
202 1.5f * PI, 2.0 * PI);
203- cairo_arc (cr, width - border, height - border, border, 0, PI / 2.0f);
204- cairo_arc (cr, border, height - border, border, PI / 2.0f, PI);
205+ cairo_arc (cr, RESIZE_POPUP_WIDTH - border,
206+ RESIZE_POPUP_HEIGHT - border,
207+ border, 0, PI / 2.0f);
208+ cairo_arc (cr, border, RESIZE_POPUP_HEIGHT - border,
209+ border, PI / 2.0f, PI);
210 cairo_close_path (cr);
211 cairo_fill_preserve (cr);
212
213@@ -240,7 +248,7 @@
214
215 static void
216 backgroundColorChanged (CompOption *o,
217- ResizeinfoOptions::Options num)
218+ ResizeinfoOptions::Options num)
219 {
220 INFO_SCREEN (screen);
221
222@@ -250,19 +258,17 @@
223 void
224 InfoScreen::damagePaintRegion ()
225 {
226- int x, y;
227-
228 if (!fadeTime && !drawing)
229 return;
230
231- x = resizeGeometry.x + resizeGeometry.width / 2.0f -
232- RESIZE_POPUP_WIDTH / 2.0f;
233- y = resizeGeometry.y + resizeGeometry.height / 2.0f -
234- RESIZE_POPUP_HEIGHT / 2.0f;
235+ int x = resizeGeometry.x + resizeGeometry.width / 2.0f -
236+ RESIZE_POPUP_WIDTH / 2.0f;
237+ int y = resizeGeometry.y + resizeGeometry.height / 2.0f -
238+ RESIZE_POPUP_HEIGHT / 2.0f;
239
240 CompRegion reg (x - 5, y - 5,
241- (x + RESIZE_POPUP_WIDTH + 5),
242- (y + RESIZE_POPUP_HEIGHT + 5));
243+ (RESIZE_POPUP_WIDTH + 5),
244+ (RESIZE_POPUP_HEIGHT + 5));
245
246 cScreen->damageRegion (reg);
247 }
248@@ -312,12 +318,11 @@
249 INFO_SCREEN (screen);
250
251 if ((!is->pWindow || !is->drawing) &&
252- ((window->state () & MAXIMIZE_STATE) != MAXIMIZE_STATE))
253+ ((window->state () & MAXIMIZE_STATE) != MAXIMIZE_STATE))
254 {
255- bool showInfo;
256- showInfo = (((window->sizeHints ().width_inc != 1) &&
257- (window->sizeHints ().height_inc != 1)) ||
258- is->optionGetAlwaysShow ());
259+ bool showInfo = (((window->sizeHints ().width_inc != 1) &&
260+ (window->sizeHints ().height_inc != 1)) ||
261+ is->optionGetAlwaysShow ());
262
263 if (showInfo && (mask & CompWindowGrabResizeMask))
264 {
265@@ -333,7 +338,7 @@
266 screen->handleEventSetEnabled (is, true);
267 }
268 }
269-
270+
271 window->grabNotify (x, y, state, mask);
272 }
273
274@@ -359,8 +364,8 @@
275 RESIZE_POPUP_HEIGHT with the opacity in InfoScreen. */
276 void
277 InfoLayer::draw (const GLMatrix &transform,
278- int x,
279- int y)
280+ int x,
281+ int y)
282 {
283 BOX box;
284 float opacity;
285@@ -375,9 +380,9 @@
286 GLushort colorData[4];
287 GLfloat textureData[8];
288 GLfloat vertexData[12];
289- GLTexture *tex = texture[i];
290- GLTexture::Matrix matrix = tex->matrix ();
291- GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
292+ GLTexture *tex = texture[i];
293+ GLTexture::Matrix matrix = tex->matrix ();
294+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
295
296 tex->enable (GLTexture::Good);
297
298@@ -440,19 +445,16 @@
299 CompOutput *output,
300 unsigned int mask)
301 {
302- bool status;
303-
304- status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
305+ bool status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
306
307 if ((drawing || fadeTime) && pWindow)
308 {
309 GLMatrix sTransform = transform;
310- int x, y;
311
312- x = resizeGeometry.x + resizeGeometry.width / 2.0f -
313- RESIZE_POPUP_WIDTH / 2.0f;
314- y = resizeGeometry.y + resizeGeometry.height / 2.0f -
315- RESIZE_POPUP_HEIGHT / 2.0f;
316+ int x = resizeGeometry.x + resizeGeometry.width / 2.0f -
317+ RESIZE_POPUP_WIDTH / 2.0f;
318+ int y = resizeGeometry.y + resizeGeometry.height / 2.0f -
319+ RESIZE_POPUP_HEIGHT / 2.0f;
320
321 sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
322
323@@ -465,7 +467,6 @@
324
325 gScreen->setTexEnvMode (GL_REPLACE);
326 glDisable (GL_BLEND);
327-
328 }
329
330 return status;
331@@ -474,13 +475,15 @@
332 void
333 InfoScreen::handleEvent (XEvent *event)
334 {
335- switch (event->type) {
336- case ClientMessage:
337+ switch (event->type)
338+ {
339+ case ClientMessage:
340 if (event->xclient.message_type == resizeInfoAtom)
341 {
342 CompWindow *w;
343
344 w = screen->findWindow (event->xclient.window);
345+
346 if (w && w == pWindow)
347 {
348 resizeGeometry.x = event->xclient.data.l[0];
349@@ -500,6 +503,7 @@
350 }
351 }
352 break;
353+
354 default:
355 break;
356 }
357
358=== modified file 'plugins/resizeinfo/src/resizeinfo.h'
359--- plugins/resizeinfo/src/resizeinfo.h 2012-09-07 23:29:42 +0000
360+++ plugins/resizeinfo/src/resizeinfo.h 2013-04-08 15:17:24 +0000
361@@ -58,8 +58,8 @@
362 cairo_t *cr;
363
364 void draw (const GLMatrix &transform,
365- int x,
366- int y);
367+ int x,
368+ int y);
369
370 void renderBackground ();
371 void renderText ();
372@@ -123,9 +123,9 @@
373
374 void
375 grabNotify (int,
376- int,
377- unsigned int,
378- unsigned int);
379+ int,
380+ unsigned int,
381+ unsigned int);
382
383 void
384 ungrabNotify ();

Subscribers

People subscribed via source and target branches

to all changes: