aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hercek <hercek@users.sourceforge.net>2011-02-03 17:50:17 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-02-03 17:51:10 (GMT)
commitfc192b1161bf9d1ca0ca9a35397c99ee1a41c7f3 (patch)
tree636d2fa490cba115ba35e9e0c5f710eb63ce535d
parent5f6694ca14d599bee6c56700d88ca86ff1126de9 (diff)
downloadfluxbox_paul-fc192b1161bf9d1ca0ca9a35397c99ee1a41c7f3.zip
fluxbox_paul-fc192b1161bf9d1ca0ca9a35397c99ee1a41c7f3.tar.bz2
allow to override 'FocusNewWindow' via .fluxbox/apps
-rw-r--r--doc/asciidoc/fluxbox-apps.txt4
-rw-r--r--src/Remember.cc24
-rw-r--r--src/Remember.hh1
-rw-r--r--src/Window.hh1
4 files changed, 30 insertions, 0 deletions
diff --git a/doc/asciidoc/fluxbox-apps.txt b/doc/asciidoc/fluxbox-apps.txt
index c278962..cf27987 100644
--- a/doc/asciidoc/fluxbox-apps.txt
+++ b/doc/asciidoc/fluxbox-apps.txt
@@ -156,6 +156,10 @@ enabled, Focus Enabled.
156*[Tab]* {'bool'}:: 156*[Tab]* {'bool'}::
157 Whether the window has tabs enabled. 157 Whether the window has tabs enabled.
158 158
159*[FocusNewWindow]* {'bool'}::
160 If enabled, a new window will grab X focus as soon as it is opened.
161 If disabled, a new window will not grab X focus as soon as it is opened.
162
159*[FocusHidden]* {'bool'}:: 163*[FocusHidden]* {'bool'}::
160 If enabled, the window will not appear in 'NextWindow'/'PrevWindow' lists. 164 If enabled, the window will not appear in 'NextWindow'/'PrevWindow' lists.
161 165
diff --git a/src/Remember.cc b/src/Remember.cc
index b94b2e6..a9be4bc 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -86,6 +86,7 @@ public:
86 void forgetFocusHiddenstate() { focushiddenstate_remember= false; } 86 void forgetFocusHiddenstate() { focushiddenstate_remember= false; }
87 void forgetIconHiddenstate() { iconhiddenstate_remember= false; } 87 void forgetIconHiddenstate() { iconhiddenstate_remember= false; }
88 void forgetStuckstate() { stuckstate_remember = false; } 88 void forgetStuckstate() { stuckstate_remember = false; }
89 void forgetFocusNewWindow() { focusnewwindow_remember = false; }
89 void forgetJumpworkspace() { jumpworkspace_remember = false; } 90 void forgetJumpworkspace() { jumpworkspace_remember = false; }
90 void forgetLayer() { layer_remember = false; } 91 void forgetLayer() { layer_remember = false; }
91 void forgetSaveOnClose() { save_on_close_remember = false; } 92 void forgetSaveOnClose() { save_on_close_remember = false; }
@@ -115,6 +116,8 @@ public:
115 { decostate = state; decostate_remember = true; } 116 { decostate = state; decostate_remember = true; }
116 void rememberStuckstate(bool state) 117 void rememberStuckstate(bool state)
117 { stuckstate = state; stuckstate_remember = true; } 118 { stuckstate = state; stuckstate_remember = true; }
119 void rememberFocusNewWindow(bool state)
120 { focusnewwindow = state; focusnewwindow_remember = true; }
118 void rememberJumpworkspace(bool state) 121 void rememberJumpworkspace(bool state)
119 { jumpworkspace = state; jumpworkspace_remember = true; } 122 { jumpworkspace = state; jumpworkspace_remember = true; }
120 void rememberLayer(int layernum) 123 void rememberLayer(int layernum)
@@ -159,6 +162,9 @@ public:
159 bool stuckstate_remember; 162 bool stuckstate_remember;
160 bool stuckstate; 163 bool stuckstate;
161 164
165 bool focusnewwindow_remember;
166 bool focusnewwindow;
167
162 bool focushiddenstate_remember; 168 bool focushiddenstate_remember;
163 bool focushiddenstate; 169 bool focushiddenstate;
164 170
@@ -209,6 +215,7 @@ void Application::reset() {
209 position_remember = 215 position_remember =
210 shadedstate_remember = 216 shadedstate_remember =
211 stuckstate_remember = 217 stuckstate_remember =
218 focusnewwindow_remember =
212 tabstate_remember = 219 tabstate_remember =
213 workspace_remember = 220 workspace_remember =
214 head_remember = 221 head_remember =
@@ -527,6 +534,8 @@ int parseApp(ifstream &file, Application &app, string *first_line = 0) {
527 } 534 }
528 } else if (str_key == "sticky") { 535 } else if (str_key == "sticky") {
529 app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0)); 536 app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0));
537 } else if (str_key == "focusnewwindow") {
538 app.rememberFocusNewWindow((strcasecmp(str_label.c_str(), "yes") == 0));
530 } else if (str_key == "minimized") { 539 } else if (str_key == "minimized") {
531 app.rememberMinimizedstate((strcasecmp(str_label.c_str(), "yes") == 0)); 540 app.rememberMinimizedstate((strcasecmp(str_label.c_str(), "yes") == 0));
532 } else if (str_key == "maximized") { 541 } else if (str_key == "maximized") {
@@ -981,6 +990,9 @@ void Remember::save() {
981 if (a.stuckstate_remember) { 990 if (a.stuckstate_remember) {
982 apps_file << " [Sticky]\t{" << ((a.stuckstate)?"yes":"no") << "}" << endl; 991 apps_file << " [Sticky]\t{" << ((a.stuckstate)?"yes":"no") << "}" << endl;
983 } 992 }
993 if (a.focusnewwindow_remember) {
994 apps_file << " [FocusNewWindow]\t{" << ((a.focusnewwindow)?"yes":"no") << "}" << endl;
995 }
984 if (a.minimizedstate_remember) { 996 if (a.minimizedstate_remember) {
985 apps_file << " [Minimized]\t{" << ((a.minimizedstate)?"yes":"no") << "}" << endl; 997 apps_file << " [Minimized]\t{" << ((a.minimizedstate)?"yes":"no") << "}" << endl;
986 } 998 }
@@ -1052,6 +1064,9 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
1052 case REM_STUCKSTATE: 1064 case REM_STUCKSTATE:
1053 return app->stuckstate_remember; 1065 return app->stuckstate_remember;
1054 break; 1066 break;
1067 case REM_FOCUSNEWWINDOW:
1068 return app->focusnewwindow_remember;
1069 break;
1055 case REM_MINIMIZEDSTATE: 1070 case REM_MINIMIZEDSTATE:
1056 return app->minimizedstate_remember; 1071 return app->minimizedstate_remember;
1057 break; 1072 break;
@@ -1129,6 +1144,9 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) {
1129 case REM_STUCKSTATE: 1144 case REM_STUCKSTATE:
1130 app->rememberStuckstate(win->isStuck()); 1145 app->rememberStuckstate(win->isStuck());
1131 break; 1146 break;
1147 case REM_FOCUSNEWWINDOW:
1148 app->rememberFocusNewWindow(win->isFocusNew());
1149 break;
1132 case REM_MINIMIZEDSTATE: 1150 case REM_MINIMIZEDSTATE:
1133 app->rememberMinimizedstate(win->isIconic()); 1151 app->rememberMinimizedstate(win->isIconic());
1134 break; 1152 break;
@@ -1189,6 +1207,9 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) {
1189 case REM_STUCKSTATE: 1207 case REM_STUCKSTATE:
1190 app->forgetStuckstate(); 1208 app->forgetStuckstate();
1191 break; 1209 break;
1210 case REM_FOCUSNEWWINDOW:
1211 app->forgetFocusNewWindow();
1212 break;
1192 case REM_MINIMIZEDSTATE: 1213 case REM_MINIMIZEDSTATE:
1193 app->forgetMinimizedstate(); 1214 app->forgetMinimizedstate();
1194 break; 1215 break;
@@ -1291,6 +1312,9 @@ void Remember::setupFrame(FluxboxWindow &win) {
1291 (!win.isStuck() && app->stuckstate)) 1312 (!win.isStuck() && app->stuckstate))
1292 win.stick(); // toggles 1313 win.stick(); // toggles
1293 1314
1315 if (app->focusnewwindow_remember)
1316 win.setFocusNew(app->focusnewwindow);
1317
1294 if (app->minimizedstate_remember) { 1318 if (app->minimizedstate_remember) {
1295 // if inconsistent... 1319 // if inconsistent...
1296 // this one doesn't actually work, but I can't imagine needing it 1320 // this one doesn't actually work, but I can't imagine needing it
diff --git a/src/Remember.hh b/src/Remember.hh
index 0adbfa9..a1abf5a 100644
--- a/src/Remember.hh
+++ b/src/Remember.hh
@@ -73,6 +73,7 @@ public:
73 REM_MINIMIZEDSTATE, 73 REM_MINIMIZEDSTATE,
74 REM_MAXIMIZEDSTATE, 74 REM_MAXIMIZEDSTATE,
75 REM_FULLSCREENSTATE, 75 REM_FULLSCREENSTATE,
76 REM_FOCUSNEWWINDOW,
76 REM_LASTATTRIB // not actually used 77 REM_LASTATTRIB // not actually used
77 }; 78 };
78 79
diff --git a/src/Window.hh b/src/Window.hh
index 7f8133e..8ce9563 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -387,6 +387,7 @@ public:
387 bool isClosable() const { return functions.close; } 387 bool isClosable() const { return functions.close; }
388 bool isMoveable() const { return functions.move; } 388 bool isMoveable() const { return functions.move; }
389 bool isStuck() const { return m_state.stuck; } 389 bool isStuck() const { return m_state.stuck; }
390 bool isFocusNew() const { return m_focus_new; }
390 bool hasTitlebar() const { return decorations.titlebar; } 391 bool hasTitlebar() const { return decorations.titlebar; }
391 bool isMoving() const { return moving; } 392 bool isMoving() const { return moving; }
392 bool isResizing() const { return resizing; } 393 bool isResizing() const { return resizing; }