Merge lp:~nwkj86/compiz/add-background-conf-to-switcher into lp:compiz/0.9.12

Proposed by Artur
Status: Superseded
Proposed branch: lp:~nwkj86/compiz/add-background-conf-to-switcher
Merge into: lp:compiz/0.9.12
Diff against target: 110 lines (+56/-4)
3 files modified
plugins/switcher/src/switcher.cpp (+33/-3)
plugins/switcher/src/switcher.h (+5/-1)
plugins/switcher/switcher.xml.in (+18/-0)
To merge this branch: bzr merge lp:~nwkj86/compiz/add-background-conf-to-switcher
Reviewer Review Type Date Requested Status
Stephen M. Webb Needs Fixing
Review via email: mp+268393@code.launchpad.net

Description of the change

Add additional section in switcher configuration that allows you to set background color (without alpha so far).

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote :

The indentation is wrong in this patch. Compiz indents C and C++ code 4 spaces, tab at 8 spaces. The XML also looks inconsistent within the same file.

review: Needs Fixing
3972. By Artur

Fix indentation

3973. By Artur

Allow to set background in staticswitcher & switcher

3974. By Artur

Post review changes.

* change setBackground to updateBackground and move it to base class
* fix typo

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/switcher/src/switcher.cpp'
2--- plugins/switcher/src/switcher.cpp 2015-07-25 20:01:51 +0000
3+++ plugins/switcher/src/switcher.cpp 2015-08-18 23:05:27 +0000
4@@ -217,8 +217,35 @@
5 BaseSwitchScreen::handleEvent (event);
6 }
7
8-void
9-SwitchScreen::initiate (SwitchWindowSelection selection,
10+void SwitchScreen::setBackground()
11+{
12+ SWITCH_SCREEN(screen);
13+ if(!ss->popupWindow)
14+ return;
15+
16+ Display *dpy = screen->dpy();
17+
18+ unsigned long background_pixel = 0ul;
19+ if (optionGetUseBackgroundColor())
20+ {
21+ Visual *visual = findArgbVisual(dpy, screen->screenNum());
22+ Colormap colormap = XCreateColormap(dpy, screen->root(), visual, AllocNone);
23+
24+ XColor col;
25+ col.red = optionGetBackgroundColorRed();
26+ col.green = optionGetBackgroundColorGreen();
27+ col.blue = optionGetBackgroundColorBlue();
28+ XAllocColor(dpy, colormap, &col);
29+
30+ background_pixel = col.pixel;
31+
32+ unsigned short alpha = optionGetBackgroundColorAlpha();
33+ }
34+
35+ XSetWindowBackground(dpy, ss->popupWindow, background_pixel);
36+}
37+
38+void SwitchScreen::initiate(SwitchWindowSelection selection,
39 bool showPopup)
40 {
41 int count;
42@@ -299,7 +326,8 @@
43 XA_ATOM, 32, PropModeReplace,
44 (unsigned char *) &Atoms::winTypeUtil, 1);
45
46- screen->setWindowProp (popupWindow, Atoms::winDesktop, 0xffffffff);
47+ screen->setWindowProp(popupWindow, Atoms::winDesktop, 0xffffffff);
48+ setBackground();
49
50 setSelectedWindowHint (false);
51 }
52@@ -1122,6 +1150,8 @@
53 zooming = (optionGetZoom () > 0.05f);
54
55 optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));
56+ optionSetUseBackgroundColorNotify(boost::bind(&SwitchScreen::setBackground, this));
57+ optionSetBackgroundColorNotify(boost::bind(&SwitchScreen::setBackground, this));
58
59 #define SWITCHBIND(a,b,c) boost::bind (switchInitiateCommon, _1, _2, _3, a, b, c)
60
61
62=== modified file 'plugins/switcher/src/switcher.h'
63--- plugins/switcher/src/switcher.h 2012-12-10 03:28:47 +0000
64+++ plugins/switcher/src/switcher.h 2015-08-18 23:05:27 +0000
65@@ -71,6 +71,11 @@
66 void handleSelectionChange (bool toNext, int nextIdx);
67 int countWindows ();
68 void handleEvent (XEvent *event);
69+
70+ private:
71+ void setBackground ();
72+
73+ public:
74 void initiate (SwitchWindowSelection selection,
75 bool showPopup);
76 void windowRemove (CompWindow *w);
77@@ -177,4 +182,3 @@
78 bool init ();
79 };
80
81-
82
83=== modified file 'plugins/switcher/switcher.xml.in'
84--- plugins/switcher/switcher.xml.in 2012-10-15 10:31:51 +0000
85+++ plugins/switcher/switcher.xml.in 2015-08-18 23:05:27 +0000
86@@ -166,6 +166,24 @@
87 <_long>Rotate to the selected window while switching</_long>
88 <default>false</default>
89 </option>
90+ <subgroup>
91+ <_short>Background</_short>
92+ <option name="use_background_color" type="bool">
93+ <_short>Set background color</_short>
94+ <_long>Set background color</_long>
95+ <default>false</default>
96+ </option>
97+ <option name="background_color" type="color">
98+ <_short>Bacground Color</_short>
99+ <_long>Background color of the switcher window.</_long>
100+ <default>
101+ <red>0x3333</red>
102+ <green>0x3333</green>
103+ <blue>0x3333</blue>
104+ <alpha>0xd998</alpha>
105+ </default>
106+ </option>
107+ </subgroup>
108 </options>
109 </plugin>
110 </compiz>

Subscribers

People subscribed via source and target branches