aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-06-24 20:19:36 (GMT)
committerfluxgen <fluxgen>2003-06-24 20:19:36 (GMT)
commit756dceab76cd4cf187fdf700539bc2995bc49fd3 (patch)
treee065ce56c936e344e20ce4df4d98a09eb579c0f4 /src/Slit.cc
parentc9c86f5b84f4ca444ec6a9cdb964ab1b457e97f7 (diff)
downloadfluxbox-756dceab76cd4cf187fdf700539bc2995bc49fd3.zip
fluxbox-756dceab76cd4cf187fdf700539bc2995bc49fd3.tar.bz2
fixed set alpha
Diffstat (limited to 'src/Slit.cc')
-rw-r--r--src/Slit.cc32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 5fdabdc..b135303 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Slit.cc,v 1.67 2003/06/24 16:29:14 fluxgen Exp $ 25// $Id: Slit.cc,v 1.68 2003/06/24 20:19:36 fluxgen Exp $
26 26
27#include "Slit.hh" 27#include "Slit.hh"
28 28
@@ -1088,6 +1088,9 @@ void Slit::exposeEvent(XExposeEvent &ev) {
1088 // just the are that gets exposed 1088 // just the are that gets exposed
1089 frame.window.clearArea(ev.x, ev.y, ev.width, ev.height); 1089 frame.window.clearArea(ev.x, ev.y, ev.width, ev.height);
1090 if (m_transp.get()) { 1090 if (m_transp.get()) {
1091 if ((int)m_transp->alpha() != *m_rc_alpha)
1092 m_transp->setAlpha(*m_rc_alpha);
1093
1091 if (screen().rootPixmap() != m_transp->source()) 1094 if (screen().rootPixmap() != m_transp->source())
1092 m_transp->setSource(screen().rootPixmap(), screen().screenNumber()); 1095 m_transp->setSource(screen().rootPixmap(), screen().screenNumber());
1093 1096
@@ -1101,6 +1104,9 @@ void Slit::exposeEvent(XExposeEvent &ev) {
1101void Slit::clearWindow() { 1104void Slit::clearWindow() {
1102 frame.window.clear(); 1105 frame.window.clear();
1103 if (m_transp.get()) { 1106 if (m_transp.get()) {
1107 if ((int)m_transp->alpha() != *m_rc_alpha)
1108 m_transp->setAlpha(*m_rc_alpha);
1109
1104 if (screen().rootPixmap() != m_transp->source()) 1110 if (screen().rootPixmap() != m_transp->source())
1105 m_transp->setSource(screen().rootPixmap(), screen().screenNumber()); 1111 m_transp->setSource(screen().rootPixmap(), screen().screenNumber());
1106 1112
@@ -1253,24 +1259,14 @@ void Slit::setupMenu() {
1253 FbTk::MenuItem *alpha_menuitem = new IntResMenuItem("Alpha", 1259 FbTk::MenuItem *alpha_menuitem = new IntResMenuItem("Alpha",
1254 m_rc_alpha, 1260 m_rc_alpha,
1255 0, 255); 1261 0, 255);
1256 // helper for setting new alpha value for slit 1262 // setup command for alpha value
1257 class SetAlpha:public FbCommands::SaveResources { 1263 MacroCommand *alpha_macrocmd = new MacroCommand();
1258 public: 1264 RefCount<Command> clear_cmd(new SimpleCommand<Slit>(*this, &Slit::clearWindow));
1259 SetAlpha(Slit &slit, int &alpha):m_slit(slit), m_alpha(alpha) { } 1265 alpha_macrocmd->add(saverc_cmd);
1260 void execute() { 1266 alpha_macrocmd->add(clear_cmd);
1261 FbCommands::SaveResources::execute(); 1267 RefCount<Command> set_alpha_cmd(alpha_macrocmd);
1262 if (m_slit.m_transp.get())
1263 m_slit.m_transp->setAlpha(m_alpha);
1264 else
1265 cerr<<"NO TRANSP!"<<endl;
1266 m_slit.clearWindow();
1267 }
1268 private:
1269 Slit &m_slit;
1270 int &m_alpha;
1271 };
1272 RefCount<Command> set_alpha_cmd(new SetAlpha(*this, *m_rc_alpha));
1273 alpha_menuitem->setCommand(set_alpha_cmd); 1268 alpha_menuitem->setCommand(set_alpha_cmd);
1269
1274 m_slitmenu.insert(alpha_menuitem); 1270 m_slitmenu.insert(alpha_menuitem);
1275 1271
1276 m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage(SlitSet, SlitSlitDirection, 1272 m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage(SlitSet, SlitSlitDirection,