diff options
author | fluxgen <fluxgen> | 2003-06-24 13:48:34 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-06-24 13:48:34 (GMT) |
commit | dc410934c600de57be609c374221ccb34406b975 (patch) | |
tree | 4323262a628f8f3babe42c3fefce879b3538dfd9 | |
parent | e913c6f086bb4afa05c972faeab3bb1277ede1ba (diff) | |
download | fluxbox-dc410934c600de57be609c374221ccb34406b975.zip fluxbox-dc410934c600de57be609c374221ccb34406b975.tar.bz2 |
fixed transparent stuff
-rw-r--r-- | src/Slit.cc | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/src/Slit.cc b/src/Slit.cc index c91a7b5..0ebe3d5 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.65 2003/06/23 13:32:30 fluxgen Exp $ | 25 | // $Id: Slit.cc,v 1.66 2003/06/24 13:48:34 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Slit.hh" | 27 | #include "Slit.hh" |
28 | 28 | ||
@@ -308,7 +308,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) | |||
308 | 308 | ||
309 | FbTk::EventManager::instance()->add(*this, frame.window); | 309 | FbTk::EventManager::instance()->add(*this, frame.window); |
310 | m_transp.reset(new FbTk::Transparent(screen().rootPixmap(), frame.window.drawable(), | 310 | m_transp.reset(new FbTk::Transparent(screen().rootPixmap(), frame.window.drawable(), |
311 | 255, | 311 | *m_rc_alpha, |
312 | screen().screenNumber())); | 312 | screen().screenNumber())); |
313 | 313 | ||
314 | m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); | 314 | m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); |
@@ -318,7 +318,6 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) | |||
318 | 318 | ||
319 | setupMenu(); | 319 | setupMenu(); |
320 | 320 | ||
321 | reconfigure(); | ||
322 | } | 321 | } |
323 | 322 | ||
324 | 323 | ||
@@ -626,8 +625,6 @@ void Slit::removeClient(Window w, bool remap) { | |||
626 | 625 | ||
627 | void Slit::reconfigure() { | 626 | void Slit::reconfigure() { |
628 | 627 | ||
629 | m_transp->setAlpha(*m_rc_alpha); | ||
630 | |||
631 | frame.width = 0; | 628 | frame.width = 0; |
632 | frame.height = 0; | 629 | frame.height = 0; |
633 | 630 | ||
@@ -707,6 +704,15 @@ void Slit::reconfigure() { | |||
707 | if (tmp) | 704 | if (tmp) |
708 | image_ctrl.removeImage(tmp); | 705 | image_ctrl.removeImage(tmp); |
709 | 706 | ||
707 | if (m_transp.get()) { | ||
708 | if (frame.pixmap == 0) | ||
709 | m_transp->setDest(frame.window.drawable(), frame.window.screenNumber()); | ||
710 | else | ||
711 | m_transp->setDest(frame.pixmap, frame.window.screenNumber()); | ||
712 | |||
713 | m_transp->setAlpha(*m_rc_alpha); | ||
714 | } | ||
715 | |||
710 | clearWindow(); | 716 | clearWindow(); |
711 | 717 | ||
712 | int x = 0, y = 0; | 718 | int x = 0, y = 0; |
@@ -1079,12 +1085,23 @@ void Slit::configureRequestEvent(XConfigureRequestEvent &event) { | |||
1079 | } | 1085 | } |
1080 | 1086 | ||
1081 | void Slit::exposeEvent(XExposeEvent &ev) { | 1087 | void Slit::exposeEvent(XExposeEvent &ev) { |
1082 | clearWindow(); | 1088 | // we don't need to clear the entire window |
1089 | // just the are that gets exposed | ||
1090 | frame.window.clearArea(ev.x, ev.y, ev.width, ev.height); | ||
1091 | if (m_transp.get()) { | ||
1092 | if (screen().rootPixmap() != m_transp->source()) | ||
1093 | m_transp->setSource(screen().rootPixmap(), screen().screenNumber()); | ||
1094 | |||
1095 | m_transp->render(frame.window.x() + ev.x, frame.window.y() + ev.y, | ||
1096 | ev.x, ev.y, | ||
1097 | ev.width, ev.height); | ||
1098 | |||
1099 | } | ||
1083 | } | 1100 | } |
1084 | 1101 | ||
1085 | void Slit::clearWindow() { | 1102 | void Slit::clearWindow() { |
1086 | frame.window.clear(); | 1103 | frame.window.clear(); |
1087 | if (frame.pixmap != 0) { | 1104 | if (m_transp.get()) { |
1088 | if (screen().rootPixmap() != m_transp->source()) | 1105 | if (screen().rootPixmap() != m_transp->source()) |
1089 | m_transp->setSource(screen().rootPixmap(), screen().screenNumber()); | 1106 | m_transp->setSource(screen().rootPixmap(), screen().screenNumber()); |
1090 | 1107 | ||
@@ -1233,10 +1250,28 @@ void Slit::setupMenu() { | |||
1233 | *m_rc_maximize_over, | 1250 | *m_rc_maximize_over, |
1234 | save_and_reconfigure_slit)); | 1251 | save_and_reconfigure_slit)); |
1235 | 1252 | ||
1253 | // this saves resources and clears the slit window to update alpha value | ||
1236 | FbTk::MenuItem *alpha_menuitem = new IntResMenuItem("Alpha", | 1254 | FbTk::MenuItem *alpha_menuitem = new IntResMenuItem("Alpha", |
1237 | m_rc_alpha, | 1255 | m_rc_alpha, |
1238 | 0, 255); | 1256 | 0, 255); |
1239 | alpha_menuitem->setCommand(save_and_reconfigure_slit); | 1257 | // helper for setting new alpha value for slit |
1258 | class SetAlpha:public FbCommands::SaveResources { | ||
1259 | public: | ||
1260 | SetAlpha(Slit &slit, int &alpha):m_slit(slit), m_alpha(alpha) { } | ||
1261 | void execute() { | ||
1262 | FbCommands::SaveResources::execute(); | ||
1263 | if (m_slit.m_transp.get()) | ||
1264 | m_slit.m_transp->setAlpha(m_alpha); | ||
1265 | else | ||
1266 | cerr<<"NO TRANSP!"<<endl; | ||
1267 | m_slit.clearWindow(); | ||
1268 | } | ||
1269 | private: | ||
1270 | Slit &m_slit; | ||
1271 | int &m_alpha; | ||
1272 | }; | ||
1273 | RefCount<Command> set_alpha_cmd(new SetAlpha(*this, *m_rc_alpha)); | ||
1274 | alpha_menuitem->setCommand(set_alpha_cmd); | ||
1240 | m_slitmenu.insert(alpha_menuitem); | 1275 | m_slitmenu.insert(alpha_menuitem); |
1241 | 1276 | ||
1242 | m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage(SlitSet, SlitSlitDirection, | 1277 | m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage(SlitSet, SlitSlitDirection, |
@@ -1280,8 +1315,8 @@ void Slit::setupMenu() { | |||
1280 | place_menu[i].base, | 1315 | place_menu[i].base, |
1281 | place_menu[i].default_str); | 1316 | place_menu[i].default_str); |
1282 | m_placement_menu.insert(new PlaceSlitMenuItem(i18n_str, *this, | 1317 | m_placement_menu.insert(new PlaceSlitMenuItem(i18n_str, *this, |
1283 | place_menu[i].slit_placement, | 1318 | place_menu[i].slit_placement, |
1284 | save_and_reconfigure)); | 1319 | save_and_reconfigure)); |
1285 | } | 1320 | } |
1286 | } | 1321 | } |
1287 | // finaly update sub menu | 1322 | // finaly update sub menu |