aboutsummaryrefslogtreecommitdiff
path: root/src/Remember.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2007-01-07 11:55:14 (GMT)
committersimonb <simonb>2007-01-07 11:55:14 (GMT)
commit1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de (patch)
tree1de2b149b23e589a36c81bd2aa51092db7b6e190 /src/Remember.cc
parentcfd33dd7a8f392253d8af9f418d86dc3083fc27d (diff)
downloadfluxbox_pavel-1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de.zip
fluxbox_pavel-1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de.tar.bz2
per-window transparency, including apps and menu support, plus some
infrastructure and related changes. Thanks for original patch from Julien Trolet, dmxen at sourceforge dot net
Diffstat (limited to 'src/Remember.cc')
-rw-r--r--src/Remember.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Remember.cc b/src/Remember.cc
index f084677..6db1f9c 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -40,6 +40,7 @@
40#include "FbTk/MenuItem.hh" 40#include "FbTk/MenuItem.hh"
41#include "FbTk/App.hh" 41#include "FbTk/App.hh"
42#include "FbTk/stringstream.hh" 42#include "FbTk/stringstream.hh"
43#include "FbTk/Transparent.hh"
43 44
44 45
45#include <X11/Xlib.h> 46#include <X11/Xlib.h>
@@ -155,6 +156,10 @@ FbTk::Menu *createRememberMenu(BScreen &screen) {
155 Remember::REM_DECOSTATE)); 156 Remember::REM_DECOSTATE));
156 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Shaded, "Shaded", "Remember shaded"), 157 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Shaded, "Shaded", "Remember shaded"),
157 Remember::REM_SHADEDSTATE)); 158 Remember::REM_SHADEDSTATE));
159 if (FbTk::Transparent::haveComposite()
160 || FbTk::Transparent::haveRender())
161 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Alpha, "Transparency", "Remember window tranparency settings"),
162 Remember::REM_ALPHA));
158 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Layer, "Layer", "Remember Layer"), 163 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Layer, "Layer", "Remember Layer"),
159 Remember::REM_LAYER)); 164 Remember::REM_LAYER));
160 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, SaveOnClose, "Save on close", "Save remembered attributes on close"), 165 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, SaveOnClose, "Save on close", "Save remembered attributes on close"),
@@ -241,6 +246,7 @@ Application::Application(bool grouped)
241 tabstate_remember = 246 tabstate_remember =
242 workspace_remember = 247 workspace_remember =
243 head_remember = 248 head_remember =
249 alpha_remember =
244 save_on_close_remember = false; 250 save_on_close_remember = false;
245} 251}
246 252
@@ -477,6 +483,30 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
477 else 483 else
478 had_error = 1; 484 had_error = 1;
479 } 485 }
486 } else if (strcasecmp(str_key.c_str(), "Alpha") == 0) {
487 int focused_a, unfocused_a;
488 if (sscanf(str_label.c_str(), "%i %i", &focused_a, &unfocused_a) == 2)
489 {
490 // clamp;
491 if (focused_a > 255)
492 focused_a = 255;
493 if (unfocused_a > 255)
494 unfocused_a = 255;
495 if (focused_a <= 0)
496 focused_a = 0;
497 if (unfocused_a <= 0)
498 unfocused_a = 0;
499
500 app.rememberAlpha(focused_a, unfocused_a);
501 } else if (sscanf(str_label.c_str(), "%i", &focused_a) == 1) {
502 if (focused_a > 255)
503 focused_a = 255;
504 if (focused_a <= 0)
505 focused_a = 0;
506 app.rememberAlpha(focused_a, focused_a);
507 }
508 else
509 had_error = 1;
480 } else if (strcasecmp(str_key.c_str(), "Sticky") == 0) { 510 } else if (strcasecmp(str_key.c_str(), "Sticky") == 0) {
481 app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0)); 511 app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0));
482 } else if (strcasecmp(str_key.c_str(), "Jump") == 0) { 512 } else if (strcasecmp(str_key.c_str(), "Jump") == 0) {
@@ -807,6 +837,12 @@ void Remember::save() {
807 if (a.save_on_close_remember) { 837 if (a.save_on_close_remember) {
808 apps_file << " [Close]\t{" << ((a.save_on_close)?"yes":"no") << "}" << endl; 838 apps_file << " [Close]\t{" << ((a.save_on_close)?"yes":"no") << "}" << endl;
809 } 839 }
840 if (a.alpha_remember) {
841 if (a.focused_alpha == a.unfocused_alpha)
842 apps_file << " [Alpha]\t{" << a.focused_alpha << "}" << endl;
843 else
844 apps_file << " [Alpha]\t{" << a.focused_alpha << " " << a.unfocused_alpha << "}" << endl;
845 }
810 apps_file << "[end]" << endl; 846 apps_file << "[end]" << endl;
811 } 847 }
812 apps_file.close(); 848 apps_file.close();
@@ -860,6 +896,8 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
860 case REM_SAVEONCLOSE: 896 case REM_SAVEONCLOSE:
861 return app->save_on_close_remember; 897 return app->save_on_close_remember;
862 break; 898 break;
899 case REM_ALPHA:
900 return app->alpha_remember;
863 case REM_LASTATTRIB: 901 case REM_LASTATTRIB:
864 default: 902 default:
865 return false; // should never get here 903 return false; // should never get here
@@ -903,6 +941,9 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) {
903 case REM_STUCKSTATE: 941 case REM_STUCKSTATE:
904 app->rememberStuckstate(win->isStuck()); 942 app->rememberStuckstate(win->isStuck());
905 break; 943 break;
944 case REM_ALPHA:
945 app->rememberAlpha(win->frame().getAlpha(true), win->frame().getAlpha(false));
946 break;
906 // case REM_TABSTATE: 947 // case REM_TABSTATE:
907 // break; 948 // break;
908 case REM_JUMPWORKSPACE: 949 case REM_JUMPWORKSPACE:
@@ -957,6 +998,9 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) {
957 case REM_SHADEDSTATE: 998 case REM_SHADEDSTATE:
958 app->forgetShadedstate(); 999 app->forgetShadedstate();
959 break; 1000 break;
1001 case REM_ALPHA:
1002 app->forgetAlpha();
1003 break;
960// case REM_TABSTATE: 1004// case REM_TABSTATE:
961// break; 1005// break;
962 case REM_JUMPWORKSPACE: 1006 case REM_JUMPWORKSPACE:
@@ -1004,6 +1048,12 @@ void Remember::setupFrame(FluxboxWindow &win) {
1004 if (app->decostate_remember) 1048 if (app->decostate_remember)
1005 win.setDecorationMask(app->decostate); 1049 win.setDecorationMask(app->decostate);
1006 1050
1051 if (app->alpha_remember) {
1052 win.frame().setUseDefaultAlpha(false);
1053 win.frame().setAlpha(true,app->focused_alpha);
1054 win.frame().setAlpha(false,app->unfocused_alpha);
1055 }
1056
1007 BScreen &screen = winclient.screen(); 1057 BScreen &screen = winclient.screen();
1008 1058
1009 // now check if fluxbox is restarting 1059 // now check if fluxbox is restarting