diff options
author | markt <markt> | 2007-02-02 19:04:57 (GMT) |
---|---|---|
committer | markt <markt> | 2007-02-02 19:04:57 (GMT) |
commit | 2b25b05b27a0d4735ace950d667510bb4cf309b7 (patch) | |
tree | 7e426a707fb2195e4e357e06a58a51062a8dcdf7 /src/CurrentWindowCmd.cc | |
parent | de9ac128956c08aef22e68306c4f3fdcfde0221d (diff) | |
download | fluxbox_pavel-2b25b05b27a0d4735ace950d667510bb4cf309b7.zip fluxbox_pavel-2b25b05b27a0d4735ace950d667510bb4cf309b7.tar.bz2 |
added SetAlpha key command
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r-- | src/CurrentWindowCmd.cc | 30 |
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() { } | |||
173 | void FullscreenCmd::real_execute() { | 173 | void FullscreenCmd::real_execute() { |
174 | fbwindow().setFullscreen(!fbwindow().isFullscreen()); | 174 | fbwindow().setFullscreen(!fbwindow().isFullscreen()); |
175 | } | 175 | } |
176 | |||
177 | SetAlphaCmd::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 | |||
182 | void 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 | } | ||