aboutsummaryrefslogtreecommitdiff
path: root/src/CurrentWindowCmd.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r--src/CurrentWindowCmd.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index a975bdd..fcc141b 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -173,3 +173,33 @@ FullscreenCmd::FullscreenCmd() { }
173void FullscreenCmd::real_execute() { 173void FullscreenCmd::real_execute() {
174 fbwindow().setFullscreen(!fbwindow().isFullscreen()); 174 fbwindow().setFullscreen(!fbwindow().isFullscreen());
175} 175}
176
177SetAlphaCmd::SetAlphaCmd(int focused, bool relative,
178 int unfocused, bool un_relative) :
179 m_focus(focused), m_unfocus(unfocused),
180 m_relative(relative), m_un_relative(un_relative) { }
181
182void SetAlphaCmd::real_execute() {
183 if (m_focus == 256 && m_unfocus == 256) {
184 // made up signal to return to default
185 fbwindow().setUseDefaultAlpha(true);
186 return;
187 }
188
189 int new_alpha;
190 if (m_relative) {
191 new_alpha = fbwindow().getFocusedAlpha() + m_focus;
192 if (new_alpha < 0) new_alpha = 0;
193 if (new_alpha > 255) new_alpha = 255;
194 fbwindow().setFocusedAlpha(new_alpha);
195 } else
196 fbwindow().setFocusedAlpha(m_focus);
197
198 if (m_un_relative) {
199 new_alpha = fbwindow().getUnfocusedAlpha() + m_unfocus;
200 if (new_alpha < 0) new_alpha = 0;
201 if (new_alpha > 255) new_alpha = 255;
202 fbwindow().setUnfocusedAlpha(new_alpha);
203 } else
204 fbwindow().setUnfocusedAlpha(m_unfocus);
205}