aboutsummaryrefslogtreecommitdiff
path: root/src
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
parentd050c6d0a6a103d743bd5c6b75eb6f0a92a204cb (diff)
downloadfluxbox_pavel-3ac43716b79cd6ee207aee4c0444678f2ac6298b.zip
fluxbox_pavel-3ac43716b79cd6ee207aee4c0444678f2ac6298b.tar.bz2
transparent slit
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc5
-rw-r--r--src/Screen.hh6
-rw-r--r--src/Slit.cc44
-rw-r--r--src/Slit.hh4
4 files changed, 49 insertions, 10 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index a81e60b..a399258 100644
--- a/src/Screen.cc
+++ b/src/Screen.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: Screen.cc,v 1.163 2003/05/13 14:03:27 fluxgen Exp $ 25// $Id: Screen.cc,v 1.164 2003/05/13 21:12:18 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -485,7 +485,8 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
485 slit_auto_hide(rm, false, scrname+".slit.autoHide", altscrname+".Slit.AutoHide"), 485 slit_auto_hide(rm, false, scrname+".slit.autoHide", altscrname+".Slit.AutoHide"),
486 slit_placement(rm, Slit::BOTTOMRIGHT, 486 slit_placement(rm, Slit::BOTTOMRIGHT,
487 scrname+".slit.placement", altscrname+".Slit.Placement"), 487 scrname+".slit.placement", altscrname+".Slit.Placement"),
488 slit_direction(rm, Slit::VERTICAL, scrname+".slit.direction", altscrname+".Slit.Direction") 488 slit_direction(rm, Slit::VERTICAL, scrname+".slit.direction", altscrname+".Slit.Direction"),
489 slit_alpha(rm, 255, scrname+".slit.alpha", altscrname+".Slit.Alpha")
489 490
490{ 491{
491 492
diff --git a/src/Screen.hh b/src/Screen.hh
index 85d3ff7..72647a6 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -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: Screen.hh,v 1.95 2003/05/13 14:02:48 fluxgen Exp $ 25// $Id: Screen.hh,v 1.96 2003/05/13 21:12:17 fluxgen Exp $
26 26
27#ifndef SCREEN_HH 27#ifndef SCREEN_HH
28#define SCREEN_HH 28#define SCREEN_HH
@@ -111,10 +111,11 @@ public:
111 111
112 inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; } 112 inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; }
113 inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; } 113 inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; }
114 inline Resource<int> &slitAlphaResource() { return resource.slit_alpha; }
114 inline void saveSlitPlacement(Slit::Placement p) { resource.slit_placement = p; } 115 inline void saveSlitPlacement(Slit::Placement p) { resource.slit_placement = p; }
115 inline void saveSlitDirection(Slit::Direction d) { resource.slit_direction = d; } 116 inline void saveSlitDirection(Slit::Direction d) { resource.slit_direction = d; }
116 inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; } 117 inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; }
117 118
118 inline unsigned int getSlitOnHead() const { return resource.slit_on_head; } 119 inline unsigned int getSlitOnHead() const { return resource.slit_on_head; }
119 inline void saveSlitOnHead(unsigned int h) { resource.slit_on_head = h; } 120 inline void saveSlitOnHead(unsigned int h) { resource.slit_on_head = h; }
120 121
@@ -411,6 +412,7 @@ private:
411 Resource<bool> slit_auto_hide; 412 Resource<bool> slit_auto_hide;
412 Resource<Slit::Placement> slit_placement; 413 Resource<Slit::Placement> slit_placement;
413 Resource<Slit::Direction> slit_direction; 414 Resource<Slit::Direction> slit_direction;
415 Resource<int> slit_alpha;
414 416
415 unsigned int slit_on_head; 417 unsigned int slit_on_head;
416 418
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,
diff --git a/src/Slit.hh b/src/Slit.hh
index f2e74bb..4eeed28 100644
--- a/src/Slit.hh
+++ b/src/Slit.hh
@@ -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.hh,v 1.27 2003/05/11 17:42:51 fluxgen Exp $ 25/// $Id: Slit.hh,v 1.28 2003/05/13 21:09:43 fluxgen Exp $
26 26
27#ifndef SLIT_HH 27#ifndef SLIT_HH
28#define SLIT_HH 28#define SLIT_HH
@@ -111,6 +111,7 @@ public:
111 111
112 112
113private: 113private:
114 void clearWindow();
114 void setupMenu(); 115 void setupMenu();
115 116
116 void removeClient(SlitClient *client, bool remap, bool destroy); 117 void removeClient(SlitClient *client, bool remap, bool destroy);
@@ -144,6 +145,7 @@ private:
144 145
145 std::auto_ptr<FbTk::XLayerItem> m_layeritem; 146 std::auto_ptr<FbTk::XLayerItem> m_layeritem;
146 std::auto_ptr<SlitTheme> m_slit_theme; 147 std::auto_ptr<SlitTheme> m_slit_theme;
148 std::auto_ptr<FbTk::Transparent> m_transp;
147}; 149};
148 150
149 151