summarylogtreecommitdiffstats
path: root/switcher-background.patch
blob: 5ed29bd85f353f57daffc164d14bed7616f871d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
=== modified file 'plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h'
--- a/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h	2013-10-31 15:59:14 +0000
+++ b/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h	2015-08-22 21:46:01 +0000
@@ -63,7 +63,7 @@
     AllViewports,
     Panels,
     Group
-} SwitchWindowSelection;	    
+} SwitchWindowSelection;
 
 class BaseSwitchScreen
 {
@@ -75,6 +75,7 @@
 	void setSelectedWindowHint (bool focus);
 	void activateEvent (bool activating);
 	void updateForegroundColor ();
+	void updateBackground (bool useBackgroundColor, unsigned short backgroundColor[]);
 
 	CompWindow *switchToWindow (bool toNext, bool autoChangeVPOption, bool focus);
 	static bool compareWindows (CompWindow *w1, CompWindow *w2);

=== modified file 'plugins/compiztoolbox/src/compiztoolbox.cpp'
--- a/plugins/compiztoolbox/src/compiztoolbox.cpp	2013-05-12 08:13:05 +0000
+++ b/plugins/compiztoolbox/src/compiztoolbox.cpp	2015-08-22 21:46:01 +0000
@@ -124,6 +124,24 @@
     return "";
 }
 
+void
+BaseSwitchScreen::updateBackground(bool           useBackgroundColor,
+				   unsigned short backgroundColor[])
+{
+    if (!popupWindow)
+	return;
+
+    unsigned long  background_pixel = 0ul;
+    if (useBackgroundColor)
+    {
+	background_pixel = ((((static_cast<unsigned long>(backgroundColor [3]) * backgroundColor [2]) >> 24) & 0x0000ff) |
+	(((backgroundColor [3] * backgroundColor [1]) >> 16) & 0x00ff00) |
+	(((backgroundColor [3] * backgroundColor [0]) >> 8) & 0xff0000) |
+	(((backgroundColor [3] & 0xff00) << 16)));
+    }
+
+    XSetWindowBackground (screen->dpy(), popupWindow, background_pixel);
+}
 
 void
 BaseSwitchScreen::setSelectedWindowHint (bool focus)

=== modified file 'plugins/staticswitcher/src/staticswitcher.cpp'
--- a/plugins/staticswitcher/src/staticswitcher.cpp	2013-06-11 04:45:57 +0000
+++ b/plugins/staticswitcher/src/staticswitcher.cpp	2015-08-22 21:46:01 +0000
@@ -286,6 +286,7 @@
 			 (unsigned char *) &Atoms::winTypeUtil, 1);
 
 	::screen->setWindowProp (popupWindow, Atoms::winDesktop, 0xffffffff);
+	updateBackground(optionGetUseBackgroundColor(), optionGetBackgroundColor());
 
 	setSelectedWindowHint (false);
 
@@ -1357,6 +1358,10 @@
     move (0),
     mouseSelect (false)
 {
+    auto bgUpdater = [=] (...){ this->updateBackground (this->optionGetUseBackgroundColor (), this->optionGetBackgroundColor ());};
+    optionSetUseBackgroundColorNotify (bgUpdater);
+    optionSetBackgroundColorNotify (bgUpdater);
+
 #define SWITCHBIND(a,b,c) boost::bind (switchInitiateCommon, _1, _2, _3, a, b, c)
 
     optionSetNextButtonInitiate (SWITCHBIND (CurrentViewport, true, true));

=== modified file 'plugins/staticswitcher/staticswitcher.xml.in'
--- a/plugins/staticswitcher/staticswitcher.xml.in	2012-10-15 10:31:51 +0000
+++ b/plugins/staticswitcher/staticswitcher.xml.in	2015-08-22 21:46:01 +0000
@@ -293,6 +293,24 @@
 			</default>
 		    </option>
 		</subgroup>
+		<subgroup>
+		    <_short>Background</_short>
+		    <option name="use_background_color" type="bool">
+			<_short>Set background color</_short>
+			<_long>Set background color</_long>
+			<default>false</default>
+		    </option>
+		    <option name="background_color" type="color">
+			<_short>Background Color</_short>
+			<_long>Background color of the switcher window.</_long>
+			<default>
+			    <red>0x3333</red>
+			    <green>0x3333</green>
+			    <blue>0x3333</blue>
+			    <alpha>0xd998</alpha>
+			</default>
+		    </option>
+		</subgroup>
 	    </group>
 	</options>
     </plugin>

=== modified file 'plugins/switcher/src/switcher.cpp'
--- a/plugins/switcher/src/switcher.cpp	2015-07-25 20:01:51 +0000
+++ b/plugins/switcher/src/switcher.cpp	2015-08-22 21:46:01 +0000
@@ -66,7 +66,6 @@
      (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
 };
 
-
 void
 SwitchScreen::updateWindowList (int count)
 {
@@ -300,6 +299,7 @@
 			 (unsigned char *) &Atoms::winTypeUtil, 1);
 
 	screen->setWindowProp (popupWindow, Atoms::winDesktop, 0xffffffff);
+        updateBackground (optionGetUseBackgroundColor (), optionGetBackgroundColor ());
 
 	setSelectedWindowHint (false);
     }
@@ -1123,6 +1123,10 @@
 
     optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));
 
+    auto bgUpdater = [=] (...){ this->updateBackground (this->optionGetUseBackgroundColor (), this->optionGetBackgroundColor ());};
+    optionSetUseBackgroundColorNotify (bgUpdater);
+    optionSetBackgroundColorNotify (bgUpdater);
+
 #define SWITCHBIND(a,b,c) boost::bind (switchInitiateCommon, _1, _2, _3, a, b, c)
 
     optionSetNextButtonInitiate (SWITCHBIND (CurrentViewport, true, true));

=== modified file 'plugins/switcher/switcher.xml.in'
--- a/plugins/switcher/switcher.xml.in	2012-10-15 10:31:51 +0000
+++ b/plugins/switcher/switcher.xml.in	2015-08-22 21:46:01 +0000
@@ -166,6 +166,24 @@
 		<_long>Rotate to the selected window while switching</_long>
 		<default>false</default>
 	    </option>
+	    <subgroup>
+		<_short>Background</_short>
+		<option name="use_background_color" type="bool">
+		    <_short>Set background color</_short>
+		    <_long>Set background color</_long>
+		    <default>false</default>
+		</option>
+		<option name="background_color" type="color">
+		    <_short>Background Color</_short>
+		    <_long>Background color of the switcher window.</_long>
+		    <default>
+			<red>0x3333</red>
+			<green>0x3333</green>
+			<blue>0x3333</blue>
+			<alpha>0xd998</alpha>
+		    </default>
+		</option>
+	    </subgroup>
 	</options>
     </plugin>
 </compiz>