Merge lp:~mc-return/compiz/compiz.merge-fix1070297-no-possibility-to-change-background-outline-color into lp:compiz/0.9.9

Proposed by MC Return on 2012-11-01
Status: Merged
Approved by: Martin Mrazik on 2012-11-06
Approved revision: 3453
Merged at revision: 3452
Proposed branch: lp:~mc-return/compiz/compiz.merge-fix1070297-no-possibility-to-change-background-outline-color
Merge into: lp:compiz/0.9.9
Diff against target: 59 lines (+20/-5)
2 files modified
plugins/resizeinfo/resizeinfo.xml.in (+10/-0)
plugins/resizeinfo/src/resizeinfo.cpp (+10/-5)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-fix1070297-no-possibility-to-change-background-outline-color
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2012-11-06
Daniel van Vugt Approve on 2012-11-06
MC Return Resubmit on 2012-11-06
Sam Spilsbury 2012-11-01 Approve on 2012-11-02
Review via email: mp+132500@code.launchpad.net

Commit Message

Resizeinfo Plug-In:
Added option to change the color of the background's outline.
(LP: #1070297)

Also renamed 'gradientChanged' to 'backgroundColorChanged'.

Description of the Change

As requested by Daniel, I am separating the fixes for the resizeinfo problems.
This branch just adds the option to change resizeinfo plug-in's background outline color via CCSM as well, so all the colors can be adjusted.

To post a comment you must log in.
Sam Spilsbury (smspillaz) wrote :

33 + a = is->optionGetGradient4Alpha () / (float)0xffff;

Instead of using 0xffff here it might be better to use std::numeric_limits and static_cast

eg

a = is->optionGetGradient4Alpha () / static_cast <float> (std::numeric_limits <int>::max ())

Also I think an option name like gradient_4 sounds a bit weird especially as there's no correlation between "Outline Color" in the settings manager and Gradient4 in the code. Just use outline_color.

MC Return (mc-return) wrote :

> 33 + a = is->optionGetGradient4Alpha () / (float)0xffff;
>
> Instead of using 0xffff here it might be better to use std::numeric_limits and
> static_cast
>
> eg
>
> a = is->optionGetGradient4Alpha () / static_cast <float> (std::numeric_limits
> <int>::max ())

Done in r3449.

> Also I think an option name like gradient_4 sounds a bit weird especially as
> there's no correlation between "Outline Color" in the settings manager and
> Gradient4 in the code. Just use outline_color.

Done in r3448. Also renamed 'static void gradientChanged' to 'static void backgroundColorChanged' in this commit.

Sam Spilsbury (smspillaz) wrote :

Cool, looking good.

One more thing I realized was that you can probably have a constant for the int maximum as a float to avoid the compound statement (I forget about this all the time, so)

const float intMaxAsFloat = std::numeric_limits <int>::max ();

Feel free to do that. Its not important. I'll leave this approved till Daniel looks at it.

review: Approve
MC Return (mc-return) wrote :

> Cool, looking good.
>
> One more thing I realized was that you can probably have a constant for the
> int maximum as a float to avoid the compound statement (I forget about this
> all the time, so)
>
> const float intMaxAsFloat = std::numeric_limits <int>::max ();
>
> Feel free to do that. Its not important. I'll leave this approved till Daniel
> looks at it.

Thanks a lot for the review and your approval :).
I would like to do this change also, but would prefer to do it once the resize info branches are merged, because the same change would need to be done to the other branch as well.
But it is noted and I will do it in a separate branch together with the gradient_1-3 name changes.

Daniel van Vugt (vanvugt) wrote :

Again, this is mathematically incorrect:
    static_cast <float> (std::numeric_limits <int>::max ())
so I'm not sure how/if it's working for you.

It should be 65535.0f instead. Or even (float)COLOR or (float)OPAQUE [from composite.h]

review: Needs Fixing
MC Return (mc-return) wrote :

> Again, this is mathematically incorrect:
> static_cast <float> (std::numeric_limits <int>::max ())
> so I'm not sure how/if it's working for you.
>

It was working, when I tested it...

> It should be 65535.0f instead. Or even (float)COLOR or (float)OPAQUE [from
> composite.h]

Going back to (float)0xffff as it is done almost everywhere in lp:compiz.
If we want a change here, we probably could and should do it in a special commit and throughout the whole lp:compiz codebase.

review: Resubmit
Daniel van Vugt (vanvugt) wrote :

Please change the default outline colour in the XML back to the old default. Should be something like:
   0xe665 0xe665 0xe665 0xffff

There shouldn't be any visual changes to default colours.

review: Needs Fixing
MC Return (mc-return) wrote :

> Please change the default outline colour in the XML back to the old default.
> Should be something like:
> 0xe665 0xe665 0xe665 0xffff
>

Done in r 3452. :)

review: Resubmit
Daniel van Vugt (vanvugt) :
review: Approve
Martin Mrazik (mrazik) wrote :

Same jenkins issue as in the previous job. Should be fixed now.

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-10-15 10:31:51 +0000
3+++ plugins/resizeinfo/resizeinfo.xml.in 2012-11-06 08:27:25 +0000
4@@ -68,6 +68,16 @@
5 <alpha>0xcccc</alpha>
6 </default>
7 </option>
8+ <option name="outline_color" type="color">
9+ <_short>Outline Color</_short>
10+ <_long>Color of the background's outline.</_long>
11+ <default>
12+ <red>0xe665</red>
13+ <green>0xe665</green>
14+ <blue>0xe665</blue>
15+ <alpha>0xffff</alpha>
16+ </default>
17+ </option>
18 </options>
19 </plugin>
20 </compiz>
21
22=== modified file 'plugins/resizeinfo/src/resizeinfo.cpp'
23--- plugins/resizeinfo/src/resizeinfo.cpp 2012-09-07 23:29:42 +0000
24+++ plugins/resizeinfo/src/resizeinfo.cpp 2012-11-06 08:27:25 +0000
25@@ -228,14 +228,18 @@
26 cairo_fill_preserve (cr);
27
28 /* Outline */
29- cairo_set_source_rgba (cr, 0.9f, 0.9f, 0.9f, 1.0f);
30+ r = is->optionGetOutlineColorRed () / (float)0xffff;
31+ g = is->optionGetOutlineColorGreen () / (float)0xffff;
32+ b = is->optionGetOutlineColorBlue () / (float)0xffff;
33+ a = is->optionGetOutlineColorAlpha () / (float)0xffff;
34+ cairo_set_source_rgba (cr, r, g, b, a);
35 cairo_stroke (cr);
36
37 cairo_pattern_destroy (pattern);
38 }
39
40 static void
41-gradientChanged (CompOption *o,
42+backgroundColorChanged (CompOption *o,
43 ResizeinfoOptions::Options num)
44 {
45 INFO_SCREEN (screen);
46@@ -527,9 +531,10 @@
47
48 backgroundLayer.renderBackground ();
49
50- optionSetGradient1Notify (gradientChanged);
51- optionSetGradient2Notify (gradientChanged);
52- optionSetGradient3Notify (gradientChanged);
53+ optionSetGradient1Notify (backgroundColorChanged);
54+ optionSetGradient2Notify (backgroundColorChanged);
55+ optionSetGradient3Notify (backgroundColorChanged);
56+ optionSetOutlineColorNotify (backgroundColorChanged);
57 }
58
59 InfoWindow::InfoWindow (CompWindow *window) :

Subscribers

People subscribed via source and target branches