aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-13 21:12:18 (GMT)
committerfluxgen <fluxgen>2003-05-13 21:12:18 (GMT)
commit3ac43716b79cd6ee207aee4c0444678f2ac6298b (patch)
tree9e7e67c3efaca2911f515df56293959bdebc1d87 /src/Slit.cc
parentd050c6d0a6a103d743bd5c6b75eb6f0a92a204cb (diff)
downloadfluxbox-3ac43716b79cd6ee207aee4c0444678f2ac6298b.zip
fluxbox-3ac43716b79cd6ee207aee4c0444678f2ac6298b.tar.bz2
transparent slit
Diffstat (limited to 'src/Slit.cc')
-rw-r--r--src/Slit.cc44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index d61b411..936815d 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.51 2003/05/13 13:28:28 fluxgen Exp $ 25// $Id: Slit.cc,v 1.52 2003/05/13 21:09:43 fluxgen Exp $
26 26
27#include "Slit.hh" 27#include "Slit.hh"
28 28
@@ -49,6 +49,8 @@
49#include "RootTheme.hh" 49#include "RootTheme.hh"
50#include "FbTk/Theme.hh" 50#include "FbTk/Theme.hh"
51#include "FbMenu.hh" 51#include "FbMenu.hh"
52#include "Transparent.hh"
53#include "IntResMenuItem.hh"
52 54
53#include <algorithm> 55#include <algorithm>
54#include <iostream> 56#include <iostream>
@@ -318,6 +320,9 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
318 create_mask, &attrib); 320 create_mask, &attrib);
319 321
320 FbTk::EventManager::instance()->add(*this, frame.window); 322 FbTk::EventManager::instance()->add(*this, frame.window);
323 m_transp.reset(new FbTk::Transparent(screen().rootPixmap(), frame.window.drawable(),
324 *screen().slitAlphaResource(),
325 screen().getScreenNumber()));
321 326
322 m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); 327 m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer));
323 328
@@ -470,7 +475,7 @@ void Slit::addClient(Window w) {
470 FbTk::EventManager::instance()->add(*this, client->icon_window); 475 FbTk::EventManager::instance()->add(*this, client->icon_window);
471 476
472 frame.window.show(); 477 frame.window.show();
473 frame.window.clear(); 478 clearWindow();
474 reconfigure(); 479 reconfigure();
475 480
476 updateClientmenu(); 481 updateClientmenu();
@@ -557,6 +562,8 @@ void Slit::removeClient(Window w, bool remap) {
557 562
558 563
559void Slit::reconfigure() { 564void Slit::reconfigure() {
565 m_transp->setAlpha(*screen().slitAlphaResource());
566
560 frame.width = 0; 567 frame.width = 0;
561 frame.height = 0; 568 frame.height = 0;
562 569
@@ -654,8 +661,7 @@ void Slit::reconfigure() {
654 if (tmp) 661 if (tmp)
655 image_ctrl->removeImage(tmp); 662 image_ctrl->removeImage(tmp);
656 663
657 frame.window.clear(); 664 clearWindow();
658
659 int x, y; 665 int x, y;
660 666
661 switch (direction()) { 667 switch (direction()) {
@@ -1064,7 +1070,21 @@ void Slit::configureRequestEvent(XConfigureRequestEvent &event) {
1064} 1070}
1065 1071
1066void Slit::exposeEvent(XExposeEvent &ev) { 1072void Slit::exposeEvent(XExposeEvent &ev) {
1073 clearWindow();
1074}
1075
1076void Slit::clearWindow() {
1067 frame.window.clear(); 1077 frame.window.clear();
1078 if (frame.pixmap != 0) {
1079 if (screen().rootPixmap() != m_transp->source())
1080 m_transp->setSource(screen().rootPixmap(), screen().getScreenNumber());
1081
1082 m_transp->render(frame.window.x(), frame.window.y(),
1083 0, 0,
1084 frame.window.width(), frame.window.height());
1085
1086 }
1087
1068} 1088}
1069 1089
1070void Slit::timeout() { 1090void Slit::timeout() {
@@ -1162,12 +1182,20 @@ void Slit::setupMenu() {
1162 using namespace FbTk; 1182 using namespace FbTk;
1163 1183
1164 FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand(); 1184 FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand();
1185 FbTk::MacroCommand *s_a_reconf_slit_macro = new FbTk::MacroCommand();
1165 FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), 1186 FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(),
1166 &Fluxbox::save_rc)); 1187 &Fluxbox::save_rc));
1167 FbTk::RefCount<FbTk::Command> reconf_cmd(new FbCommands::ReconfigureFluxboxCmd()); 1188 FbTk::RefCount<FbTk::Command> reconf_cmd(new FbCommands::ReconfigureFluxboxCmd());
1189 FbTk::RefCount<FbTk::Command> reconf_slit_cmd(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure));
1190
1168 s_a_reconf_macro->add(saverc_cmd); 1191 s_a_reconf_macro->add(saverc_cmd);
1169 s_a_reconf_macro->add(reconf_cmd); 1192 s_a_reconf_macro->add(reconf_cmd);
1193
1194 s_a_reconf_slit_macro->add(saverc_cmd);
1195 s_a_reconf_slit_macro->add(reconf_slit_cmd);
1196
1170 FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro); 1197 FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro);
1198 FbTk::RefCount<FbTk::Command> save_and_reconfigure_slit(s_a_reconf_slit_macro);
1171 1199
1172 // setup base menu 1200 // setup base menu
1173 m_slitmenu.setLabel("Slit"); 1201 m_slitmenu.setLabel("Slit");
@@ -1182,7 +1210,13 @@ void Slit::setupMenu() {
1182 CommonSet, CommonAutoHide, 1210 CommonSet, CommonAutoHide,
1183 "Auto hide"), 1211 "Auto hide"),
1184 screen().doSlitAutoHide(), 1212 screen().doSlitAutoHide(),
1185 save_and_reconfigure)); 1213 save_and_reconfigure_slit));
1214
1215 FbTk::MenuItem *alpha_menuitem = new IntResMenuItem("Alpha",
1216 screen().slitAlphaResource(),
1217 0, 255);
1218 alpha_menuitem->setCommand(save_and_reconfigure_slit);
1219 m_slitmenu.insert(alpha_menuitem);
1186 1220
1187 m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage( 1221 m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage(
1188 SlitSet, SlitSlitDirection, 1222 SlitSet, SlitSlitDirection,