diff options
author | markt <markt> | 2007-10-23 17:34:30 (GMT) |
---|---|---|
committer | markt <markt> | 2007-10-23 17:34:30 (GMT) |
commit | 1c05af4329e62b8bfaf3c0f032c52ace4eaa5975 (patch) | |
tree | af37aee8b1e6cde31050cd627fcbd56c55f9dc21 /src/Remember.cc | |
parent | c849d3c7ffc518d85a365664530f1faa102cf83f (diff) | |
download | fluxbox-1c05af4329e62b8bfaf3c0f032c52ace4eaa5975.zip fluxbox-1c05af4329e62b8bfaf3c0f032c52ace4eaa5975.tar.bz2 |
allow remembering minimized, maximized, and fullscreen state
Diffstat (limited to 'src/Remember.cc')
-rw-r--r-- | src/Remember.cc | 99 |
1 files changed, 97 insertions, 2 deletions
diff --git a/src/Remember.cc b/src/Remember.cc index d8f1d83..41f91c4 100644 --- a/src/Remember.cc +++ b/src/Remember.cc | |||
@@ -173,6 +173,12 @@ FbTk::Menu *createRememberMenu(BScreen &screen) { | |||
173 | Remember::REM_DECOSTATE)); | 173 | Remember::REM_DECOSTATE)); |
174 | menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Shaded, "Shaded", "Remember shaded"), | 174 | menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Shaded, "Shaded", "Remember shaded"), |
175 | Remember::REM_SHADEDSTATE)); | 175 | Remember::REM_SHADEDSTATE)); |
176 | menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Minimized, "Minimized", "Remember minimized"), | ||
177 | Remember::REM_MINIMIZEDSTATE)); | ||
178 | menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Maximized, "Maximized", "Remember maximized"), | ||
179 | Remember::REM_MAXIMIZEDSTATE)); | ||
180 | menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Fullscreen, "Fullscreen", "Remember fullscreen"), | ||
181 | Remember::REM_FULLSCREENSTATE)); | ||
176 | if (FbTk::Transparent::haveComposite() | 182 | if (FbTk::Transparent::haveComposite() |
177 | || FbTk::Transparent::haveRender()) | 183 | || FbTk::Transparent::haveRender()) |
178 | menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Alpha, "Transparency", "Remember window tranparency settings"), | 184 | menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Alpha, "Transparency", "Remember window tranparency settings"), |
@@ -250,6 +256,10 @@ bool handleStartupItem(const string &line, int offset) { | |||
250 | Application::Application(bool grouped, ClientPattern *pat) | 256 | Application::Application(bool grouped, ClientPattern *pat) |
251 | : is_grouped(grouped), group_pattern(pat) | 257 | : is_grouped(grouped), group_pattern(pat) |
252 | { | 258 | { |
259 | reset(); | ||
260 | } | ||
261 | |||
262 | void Application::reset() { | ||
253 | decostate_remember = | 263 | decostate_remember = |
254 | dimensions_remember = | 264 | dimensions_remember = |
255 | focushiddenstate_remember = | 265 | focushiddenstate_remember = |
@@ -263,6 +273,9 @@ Application::Application(bool grouped, ClientPattern *pat) | |||
263 | workspace_remember = | 273 | workspace_remember = |
264 | head_remember = | 274 | head_remember = |
265 | alpha_remember = | 275 | alpha_remember = |
276 | minimizedstate_remember = | ||
277 | maximizedstate_remember = | ||
278 | fullscreenstate_remember = | ||
266 | save_on_close_remember = false; | 279 | save_on_close_remember = false; |
267 | } | 280 | } |
268 | 281 | ||
@@ -496,6 +509,19 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) { | |||
496 | had_error = 1; | 509 | had_error = 1; |
497 | } else if (strcasecmp(str_key.c_str(), "Sticky") == 0) { | 510 | } else if (strcasecmp(str_key.c_str(), "Sticky") == 0) { |
498 | app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0)); | 511 | app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0)); |
512 | } else if (strcasecmp(str_key.c_str(), "Minimized") == 0) { | ||
513 | app.rememberMinimizedstate((strcasecmp(str_label.c_str(), "yes") == 0)); | ||
514 | } else if (strcasecmp(str_key.c_str(), "Maximized") == 0) { | ||
515 | if (strcasecmp(str_label.c_str(), "yes") == 0) | ||
516 | app.rememberMaximizedstate(FluxboxWindow::MAX_FULL); | ||
517 | else if (strcasecmp(str_label.c_str(), "horz") == 0) | ||
518 | app.rememberMaximizedstate(FluxboxWindow::MAX_HORZ); | ||
519 | else if (strcasecmp(str_label.c_str(), "vert") == 0) | ||
520 | app.rememberMaximizedstate(FluxboxWindow::MAX_VERT); | ||
521 | else | ||
522 | app.rememberMaximizedstate(FluxboxWindow::MAX_NONE); | ||
523 | } else if (strcasecmp(str_key.c_str(), "Fullscreen") == 0) { | ||
524 | app.rememberFullscreenstate((strcasecmp(str_label.c_str(), "yes") == 0)); | ||
499 | } else if (strcasecmp(str_key.c_str(), "Jump") == 0) { | 525 | } else if (strcasecmp(str_key.c_str(), "Jump") == 0) { |
500 | app.rememberJumpworkspace((strcasecmp(str_label.c_str(), "yes") == 0)); | 526 | app.rememberJumpworkspace((strcasecmp(str_label.c_str(), "yes") == 0)); |
501 | } else if (strcasecmp(str_key.c_str(), "Close") == 0) { | 527 | } else if (strcasecmp(str_key.c_str(), "Close") == 0) { |
@@ -599,7 +625,9 @@ void Remember::reconfigure() { | |||
599 | if (!in_group) { | 625 | if (!in_group) { |
600 | if ((err = pat->error()) == 0) { | 626 | if ((err = pat->error()) == 0) { |
601 | Application *app = findMatchingPatterns(pat, old_pats, false); | 627 | Application *app = findMatchingPatterns(pat, old_pats, false); |
602 | if (!app) | 628 | if (app) |
629 | app->reset(); | ||
630 | else | ||
603 | app = new Application(false); | 631 | app = new Application(false); |
604 | 632 | ||
605 | m_pats->push_back(make_pair(pat, app)); | 633 | m_pats->push_back(make_pair(pat, app)); |
@@ -824,6 +852,30 @@ void Remember::save() { | |||
824 | if (a.stuckstate_remember) { | 852 | if (a.stuckstate_remember) { |
825 | apps_file << " [Sticky]\t{" << ((a.stuckstate)?"yes":"no") << "}" << endl; | 853 | apps_file << " [Sticky]\t{" << ((a.stuckstate)?"yes":"no") << "}" << endl; |
826 | } | 854 | } |
855 | if (a.minimizedstate_remember) { | ||
856 | apps_file << " [Minimized]\t{" << ((a.minimizedstate)?"yes":"no") << "}" << endl; | ||
857 | } | ||
858 | if (a.maximizedstate_remember) { | ||
859 | apps_file << " [Maximized]\t{"; | ||
860 | switch (a.maximizedstate) { | ||
861 | case FluxboxWindow::MAX_FULL: | ||
862 | apps_file << "yes" << "}" << endl; | ||
863 | break; | ||
864 | case FluxboxWindow::MAX_HORZ: | ||
865 | apps_file << "horz" << "}" << endl; | ||
866 | break; | ||
867 | case FluxboxWindow::MAX_VERT: | ||
868 | apps_file << "vert" << "}" << endl; | ||
869 | break; | ||
870 | case FluxboxWindow::MAX_NONE: | ||
871 | default: | ||
872 | apps_file << "no" << "}" << endl; | ||
873 | break; | ||
874 | } | ||
875 | } | ||
876 | if (a.fullscreenstate_remember) { | ||
877 | apps_file << " [Fullscreen]\t{" << ((a.fullscreenstate)?"yes":"no") << "}" << endl; | ||
878 | } | ||
827 | if (a.jumpworkspace_remember) { | 879 | if (a.jumpworkspace_remember) { |
828 | apps_file << " [Jump]\t{" << ((a.jumpworkspace)?"yes":"no") << "}" << endl; | 880 | apps_file << " [Jump]\t{" << ((a.jumpworkspace)?"yes":"no") << "}" << endl; |
829 | } | 881 | } |
@@ -874,6 +926,15 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) { | |||
874 | case REM_STUCKSTATE: | 926 | case REM_STUCKSTATE: |
875 | return app->stuckstate_remember; | 927 | return app->stuckstate_remember; |
876 | break; | 928 | break; |
929 | case REM_MINIMIZEDSTATE: | ||
930 | return app->minimizedstate_remember; | ||
931 | break; | ||
932 | case REM_MAXIMIZEDSTATE: | ||
933 | return app->maximizedstate_remember; | ||
934 | break; | ||
935 | case REM_FULLSCREENSTATE: | ||
936 | return app->fullscreenstate_remember; | ||
937 | break; | ||
877 | case REM_DECOSTATE: | 938 | case REM_DECOSTATE: |
878 | return app->decostate_remember; | 939 | return app->decostate_remember; |
879 | break; | 940 | break; |
@@ -941,6 +1002,15 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) { | |||
941 | case REM_STUCKSTATE: | 1002 | case REM_STUCKSTATE: |
942 | app->rememberStuckstate(win->isStuck()); | 1003 | app->rememberStuckstate(win->isStuck()); |
943 | break; | 1004 | break; |
1005 | case REM_MINIMIZEDSTATE: | ||
1006 | app->rememberMinimizedstate(win->isIconic()); | ||
1007 | break; | ||
1008 | case REM_MAXIMIZEDSTATE: | ||
1009 | app->rememberMaximizedstate(win->maximizedState()); | ||
1010 | break; | ||
1011 | case REM_FULLSCREENSTATE: | ||
1012 | app->rememberFullscreenstate(win->isFullscreen()); | ||
1013 | break; | ||
944 | case REM_ALPHA: | 1014 | case REM_ALPHA: |
945 | app->rememberAlpha(win->frame().getAlpha(true), win->frame().getAlpha(false)); | 1015 | app->rememberAlpha(win->frame().getAlpha(true), win->frame().getAlpha(false)); |
946 | break; | 1016 | break; |
@@ -992,6 +1062,15 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) { | |||
992 | case REM_STUCKSTATE: | 1062 | case REM_STUCKSTATE: |
993 | app->forgetStuckstate(); | 1063 | app->forgetStuckstate(); |
994 | break; | 1064 | break; |
1065 | case REM_MINIMIZEDSTATE: | ||
1066 | app->forgetMinimizedstate(); | ||
1067 | break; | ||
1068 | case REM_MAXIMIZEDSTATE: | ||
1069 | app->forgetMaximizedstate(); | ||
1070 | break; | ||
1071 | case REM_FULLSCREENSTATE: | ||
1072 | app->forgetFullscreenstate(); | ||
1073 | break; | ||
995 | case REM_DECOSTATE: | 1074 | case REM_DECOSTATE: |
996 | app->forgetDecostate(); | 1075 | app->forgetDecostate(); |
997 | break; | 1076 | break; |
@@ -1058,7 +1137,7 @@ void Remember::setupFrame(FluxboxWindow &win) { | |||
1058 | } | 1137 | } |
1059 | 1138 | ||
1060 | if (app->head_remember) { | 1139 | if (app->head_remember) { |
1061 | win.screen().setOnHead<FluxboxWindow>(win, app->head); | 1140 | win.setOnHead(app->head); |
1062 | } | 1141 | } |
1063 | 1142 | ||
1064 | if (app->dimensions_remember) | 1143 | if (app->dimensions_remember) |
@@ -1112,6 +1191,22 @@ void Remember::setupFrame(FluxboxWindow &win) { | |||
1112 | !win.isStuck() && app->stuckstate) | 1191 | !win.isStuck() && app->stuckstate) |
1113 | win.stick(); // toggles | 1192 | win.stick(); // toggles |
1114 | 1193 | ||
1194 | if (app->minimizedstate_remember) { | ||
1195 | // if inconsistent... | ||
1196 | // this one doesn't actually work, but I can't imagine needing it | ||
1197 | if (win.isIconic() && !app->minimizedstate) | ||
1198 | win.deiconify(); | ||
1199 | else if (!win.isIconic() && app->minimizedstate) | ||
1200 | win.iconify(); | ||
1201 | } | ||
1202 | |||
1203 | // I can't really test the "no" case of this | ||
1204 | if (app->maximizedstate_remember) | ||
1205 | win.setMaximizedState(app->maximizedstate); | ||
1206 | |||
1207 | // I can't really test the "no" case of this | ||
1208 | if (app->fullscreenstate_remember) | ||
1209 | win.setFullscreen(app->fullscreenstate); | ||
1115 | } | 1210 | } |
1116 | 1211 | ||
1117 | void Remember::setupClient(WinClient &winclient) { | 1212 | void Remember::setupClient(WinClient &winclient) { |