aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-04 01:03:41 (GMT)
committerrathnor <rathnor>2003-07-04 01:03:41 (GMT)
commit3144086eef171f6c402182f23bfc80a101e71fa2 (patch)
tree0df61dbcb4a7ce44fd90369b031e5a39037807c0
parent672ac023526d61af2e102a3a27b67eeedb2c4f10 (diff)
downloadfluxbox_pavel-3144086eef171f6c402182f23bfc80a101e71fa2.zip
fluxbox_pavel-3144086eef171f6c402182f23bfc80a101e71fa2.tar.bz2
support in remember for specifying groups.
Also split atomhandler::setupWindow
-rw-r--r--BUGS3
-rw-r--r--ChangeLog14
-rw-r--r--RoadMap2
-rw-r--r--src/AtomHandler.hh6
-rw-r--r--src/Ewmh.cc4
-rw-r--r--src/Ewmh.hh7
-rw-r--r--src/Gnome.cc6
-rw-r--r--src/Gnome.hh5
-rw-r--r--src/Remember.cc111
-rw-r--r--src/Remember.hh13
-rw-r--r--src/Screen.cc52
-rw-r--r--src/ToolbarHandler.cc4
-rw-r--r--src/ToolbarHandler.hh6
-rw-r--r--src/Window.cc55
-rw-r--r--src/fluxbox.cc13
-rw-r--r--src/fluxbox.hh4
16 files changed, 238 insertions, 67 deletions
diff --git a/BUGS b/BUGS
index 941572a..6307966 100644
--- a/BUGS
+++ b/BUGS
@@ -19,6 +19,9 @@ bugs:
19 large number of [remote] xload windows. 19 large number of [remote] xload windows.
20* Can lock up on workspace change - possibly related to above as it 20* Can lock up on workspace change - possibly related to above as it
21 works when there aren't too many xload windows started up yet. 21 works when there aren't too many xload windows started up yet.
22* Remember-patch grouping can change order on each restart. Need to turn
23 off remember functionality when restarting (only use it for first
24 instance).
22 25
23other todo: 26other todo:
24FAQ items for: 27FAQ items for:
diff --git a/ChangeLog b/ChangeLog
index fbc7de2..2779cc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.4: 2Changes for 0.9.4:
3*03/07/04:
4 * Add support in remember for grouping apps (Simon)
5 Achieved by using [group], e.g.
6 [group]
7 [app] (title=groupme)
8 [Deco] {NONE}
9 [end]
10 will group anything with the title "groupme" and will give that group
11 no decorations. You can have multiple [app] lines in a [group].
12 Recall that app lines can also use regular expressions.
13 - also includes split AtomHandler::setupWindow(fbw) into
14 setupFrame(fbw) and setupClient(winclient).
15 Remember.hh/cc Window.cc Screen.cc fluxbox.hh/cc
16 AtomHandler.hh Gnome.hh/cc Ewmh.hh/cc ToolbarHandler.hh/cc
3*03/07/03: 17*03/07/03:
4 * Added selected dot for style menu so one can see which style is selected (Henrik) 18 * Added selected dot for style menu so one can see which style is selected (Henrik)
5 Screen.cc 19 Screen.cc
diff --git a/RoadMap b/RoadMap
index 35bca21..d817512 100644
--- a/RoadMap
+++ b/RoadMap
@@ -133,7 +133,7 @@ Key Features:
133 * Regular expression support in remember 133 * Regular expression support in remember
134 on several attributes (Simon) 134 on several attributes (Simon)
135 * Save grouping so it persists over restart (Simon) 135 * Save grouping so it persists over restart (Simon)
136 - Autogrouping functionality into remember (Simon) 136 * Autogrouping functionality into remember (Simon)
137 (this will thus get regexp matching etc) 137 (this will thus get regexp matching etc)
138 + Shaped menu/slit/toolbar (Henrik) 138 + Shaped menu/slit/toolbar (Henrik)
139 * Improved screen object placement (Henrik) 139 * Improved screen object placement (Henrik)
diff --git a/src/AtomHandler.hh b/src/AtomHandler.hh
index 13183c9..4b47e15 100644
--- a/src/AtomHandler.hh
+++ b/src/AtomHandler.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: AtomHandler.hh,v 1.8 2003/06/18 13:32:19 fluxgen Exp $ 22// $Id: AtomHandler.hh,v 1.9 2003/07/04 01:03:40 rathnor Exp $
23 23
24#ifndef ATOMHANDLER_HH 24#ifndef ATOMHANDLER_HH
25#define ATOMHANDLER_HH 25#define ATOMHANDLER_HH
@@ -27,6 +27,7 @@
27#include <X11/Xlib.h> 27#include <X11/Xlib.h>
28 28
29class FluxboxWindow; 29class FluxboxWindow;
30class WinClient;
30class BScreen; 31class BScreen;
31 32
32class AtomHandler { 33class AtomHandler {
@@ -34,7 +35,8 @@ public:
34 virtual ~AtomHandler() { } 35 virtual ~AtomHandler() { }
35 36
36 virtual void initForScreen(BScreen &screen) = 0; 37 virtual void initForScreen(BScreen &screen) = 0;
37 virtual void setupWindow(FluxboxWindow &win) = 0; 38 virtual void setupFrame(FluxboxWindow &win) = 0;
39 virtual void setupClient(WinClient &winclient) = 0;
38 40
39 virtual void updateClientList(BScreen &screen) = 0; 41 virtual void updateClientList(BScreen &screen) = 0;
40 virtual void updateWorkspaceNames(BScreen &screen) = 0; 42 virtual void updateWorkspaceNames(BScreen &screen) = 0;
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 6b59a0c..10fa722 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Ewmh.cc,v 1.28 2003/07/02 14:31:43 fluxgen Exp $ 22// $Id: Ewmh.cc,v 1.29 2003/07/04 01:03:40 rathnor Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
@@ -95,7 +95,7 @@ void Ewmh::initForScreen(BScreen &screen) {
95 95
96} 96}
97 97
98void Ewmh::setupWindow(FluxboxWindow &win) { 98void Ewmh::setupFrame(FluxboxWindow &win) {
99 99
100 Atom ret_type; 100 Atom ret_type;
101 int fmt; 101 int fmt;
diff --git a/src/Ewmh.hh b/src/Ewmh.hh
index cf81209..ff508e5 100644
--- a/src/Ewmh.hh
+++ b/src/Ewmh.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Ewmh.hh,v 1.7 2003/06/18 13:33:15 fluxgen Exp $ 22// $Id: Ewmh.hh,v 1.8 2003/07/04 01:03:40 rathnor Exp $
23 23
24#include "AtomHandler.hh" 24#include "AtomHandler.hh"
25 25
@@ -32,8 +32,9 @@ public:
32 Ewmh(); 32 Ewmh();
33 ~Ewmh(); 33 ~Ewmh();
34 void initForScreen(BScreen &screen); 34 void initForScreen(BScreen &screen);
35 void setupWindow(FluxboxWindow &win); 35 void setupFrame(FluxboxWindow &win);
36 36 void setupClient(WinClient &winclient) {}
37
37 void updateClientList(BScreen &screen); 38 void updateClientList(BScreen &screen);
38 void updateWorkspaceNames(BScreen &screen); 39 void updateWorkspaceNames(BScreen &screen);
39 void updateCurrentWorkspace(BScreen &screen); 40 void updateCurrentWorkspace(BScreen &screen);
diff --git a/src/Gnome.cc b/src/Gnome.cc
index 240c691..10d1775 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Gnome.cc,v 1.28 2003/06/26 12:22:42 rathnor Exp $ 22// $Id: Gnome.cc,v 1.29 2003/07/04 01:03:40 rathnor Exp $
23 23
24#include "Gnome.hh" 24#include "Gnome.hh"
25 25
@@ -85,8 +85,8 @@ void Gnome::initForScreen(BScreen &screen) {
85 85
86} 86}
87 87
88void Gnome::setupWindow(FluxboxWindow &win) { 88void Gnome::setupFrame(FluxboxWindow &win) {
89 // load gnome state atom 89 // load gnome state (take queues from the main window of the frame)
90 Display *disp = FbTk::App::instance()->display(); 90 Display *disp = FbTk::App::instance()->display();
91 Atom ret_type; 91 Atom ret_type;
92 int fmt; 92 int fmt;
diff --git a/src/Gnome.hh b/src/Gnome.hh
index 6c78444..35e25c8 100644
--- a/src/Gnome.hh
+++ b/src/Gnome.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Gnome.hh,v 1.7 2003/06/18 13:32:43 fluxgen Exp $ 22// $Id: Gnome.hh,v 1.8 2003/07/04 01:03:40 rathnor Exp $
23 23
24#ifndef GNOME_HH 24#ifndef GNOME_HH
25#define GNOME_HH 25#define GNOME_HH
@@ -65,7 +65,8 @@ public:
65 Gnome(); 65 Gnome();
66 ~Gnome(); 66 ~Gnome();
67 void initForScreen(BScreen &screen); 67 void initForScreen(BScreen &screen);
68 void setupWindow(FluxboxWindow &win); 68 void setupFrame(FluxboxWindow &win);
69 void setupClient(WinClient &winclient) {}
69 70
70 void updateClientList(BScreen &screen); 71 void updateClientList(BScreen &screen);
71 void updateWorkspaceNames(BScreen &screen); 72 void updateWorkspaceNames(BScreen &screen);
diff --git a/src/Remember.cc b/src/Remember.cc
index a31843b..97d1e35 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -21,7 +21,7 @@
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id: Remember.cc,v 1.24 2003/06/12 15:12:19 rathnor Exp $ 24// $Id: Remember.cc,v 1.25 2003/07/04 01:03:40 rathnor Exp $
25 25
26#include "Remember.hh" 26#include "Remember.hh"
27#include "ClientPattern.hh" 27#include "ClientPattern.hh"
@@ -46,6 +46,7 @@
46#include <fstream> 46#include <fstream>
47#include <string> 47#include <string>
48#include <memory> 48#include <memory>
49#include <set>
49 50
50using namespace std; 51using namespace std;
51 52
@@ -128,7 +129,10 @@ FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win) {
128 129
129}; // end anonymous namespace 130}; // end anonymous namespace
130 131
131Application::Application() { 132Application::Application(bool grouped)
133 : is_grouped(grouped),
134 group(0)
135{
132 workspace_remember = 136 workspace_remember =
133 dimensions_remember = 137 dimensions_remember =
134 position_remember = 138 position_remember =
@@ -146,6 +150,7 @@ Application::Application() {
146 ************/ 150 ************/
147 151
148Remember::Remember() { 152Remember::Remember() {
153 enableUpdate();
149 load(); 154 load();
150} 155}
151 156
@@ -155,12 +160,19 @@ Remember::~Remember() {
155 // the patterns free the "Application"s 160 // the patterns free the "Application"s
156 // the client mapping shouldn't need cleaning 161 // the client mapping shouldn't need cleaning
157 Patterns::iterator it; 162 Patterns::iterator it;
163 std::set<Application *> all_apps; // no duplicates
158 while (!m_pats.empty()) { 164 while (!m_pats.empty()) {
159 it = m_pats.begin(); 165 it = m_pats.begin();
160 delete it->first; // ClientPattern 166 delete it->first; // ClientPattern
161 delete it->second; // Application 167 all_apps.insert(it->second); // Application, not necessarily unique
162 m_pats.erase(it); 168 m_pats.erase(it);
163 } 169 }
170
171 std::set<Application *>::iterator ait = all_apps.begin(); // no duplicates
172 while (ait != all_apps.end()) {
173 delete (*ait);
174 ++ait;
175 }
164} 176}
165 177
166Application* Remember::find(WinClient &winclient) { 178Application* Remember::find(WinClient &winclient) {
@@ -184,7 +196,7 @@ Application* Remember::find(WinClient &winclient) {
184 196
185Application * Remember::add(WinClient &winclient) { 197Application * Remember::add(WinClient &winclient) {
186 ClientPattern *p = new ClientPattern(); 198 ClientPattern *p = new ClientPattern();
187 Application *app = new Application(); 199 Application *app = new Application(false);
188 // by default, we match against the WMClass of a window. 200 // by default, we match against the WMClass of a window.
189 p->addTerm(p->getProperty(ClientPattern::NAME, winclient), ClientPattern::NAME); 201 p->addTerm(p->getProperty(ClientPattern::NAME, winclient), ClientPattern::NAME);
190 m_clients[&winclient] = app; 202 m_clients[&winclient] = app;
@@ -193,11 +205,16 @@ Application * Remember::add(WinClient &winclient) {
193 return app; 205 return app;
194} 206}
195 207
196int Remember::parseApp(ifstream &file, Application &app) { 208int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
197 string line; 209 string line;
198 int row = 0; 210 int row = 0;
199 while (! file.eof()) { 211 while (! file.eof()) {
200 if (getline(file, line)) { 212 if (first_line || getline(file, line)) {
213 if (first_line) {
214 line = *first_line;
215 first_line = 0;
216 }
217
201 row++; 218 row++;
202 if (line[0] != '#') { //the line is commented 219 if (line[0] != '#') { //the line is commented
203 int parse_pos = 0, err = 0; 220 int parse_pos = 0, err = 0;
@@ -307,6 +324,8 @@ void Remember::load() {
307 if (!apps_file.eof()) { 324 if (!apps_file.eof()) {
308 string line; 325 string line;
309 int row = 0; 326 int row = 0;
327 bool in_group = false;
328 std::list<ClientPattern *> grouped_pats;
310 while (getline(apps_file, line) && ! apps_file.eof()) { 329 while (getline(apps_file, line) && ! apps_file.eof()) {
311 row++; 330 row++;
312 if (line[0] == '#') 331 if (line[0] == '#')
@@ -319,14 +338,36 @@ void Remember::load() {
319 338
320 if (pos > 0 && key == "app") { 339 if (pos > 0 && key == "app") {
321 ClientPattern *pat = new ClientPattern(line.c_str() + pos); 340 ClientPattern *pat = new ClientPattern(line.c_str() + pos);
322 if ((err = pat->error()) == 0) { 341 if (!in_group) {
323 Application *app = new Application(); 342 if ((err = pat->error()) == 0) {
324 m_pats.push_back(make_pair(pat, app)); 343 Application *app = new Application(false);
325 row += parseApp(apps_file, *app); 344 m_pats.push_back(make_pair(pat, app));
345 row += parseApp(apps_file, *app);
346 } else {
347 cerr<<"Error reading apps file at line "<<row<<", column "<<(err+pos)<<"."<<endl;
348 delete pat; // since it didn't work
349 }
326 } else { 350 } else {
327 cerr<<"Error reading apps file at line "<<row<<", column "<<(err+pos)<<"."<<endl; 351 grouped_pats.push_back(pat);
328 delete pat; // since it didn't work 352 }
353 } else if (pos > 0 && key == "group") {
354 in_group = true;
355 } else if (in_group) {
356 // otherwise assume that it is the start of the attributes
357 Application *app = new Application(true);
358 while (!grouped_pats.empty()) {
359 // associate all the patterns with this app
360 m_pats.push_back(make_pair(grouped_pats.front(), app));
361 grouped_pats.pop_front();
362 }
363
364 // we hit end... probably don't have attribs for the group
365 // so finish it off with an empty application
366 // otherwise parse the app
367 if (!(pos>0 && key == "end")) {
368 row += parseApp(apps_file, *app, &line);
329 } 369 }
370 in_group = false;
330 } else 371 } else
331 cerr<<"Error in apps file on line "<<row<<"."<<endl; 372 cerr<<"Error in apps file on line "<<row<<"."<<endl;
332 373
@@ -350,9 +391,27 @@ void Remember::save() {
350 ofstream apps_file(apps_string.c_str()); 391 ofstream apps_file(apps_string.c_str());
351 Patterns::iterator it = m_pats.begin(); 392 Patterns::iterator it = m_pats.begin();
352 Patterns::iterator it_end = m_pats.end(); 393 Patterns::iterator it_end = m_pats.end();
394
395 std::set<Application *> grouped_apps; // no duplicates
396
353 for (; it != it_end; ++it) { 397 for (; it != it_end; ++it) {
354 apps_file << "[app]"<<it->first->toString()<<endl;
355 Application &a = *it->second; 398 Application &a = *it->second;
399 if (a.is_grouped) {
400 // if already processed
401 if (grouped_apps.find(&a) != grouped_apps.end())
402 continue;
403 // otherwise output this whole group
404 apps_file << "[group]" << endl;
405 Patterns::iterator git = m_pats.begin();
406 Patterns::iterator git_end = m_pats.end();
407 for (; git != git_end; git++) {
408 if (git->second->group == a.group) {
409 apps_file << " [app]"<<git->first->toString()<<endl;
410 }
411 }
412 } else {
413 apps_file << "[app]"<<it->first->toString()<<endl;
414 }
356 if (a.workspace_remember) { 415 if (a.workspace_remember) {
357 apps_file << " [Workspace]\t{" << a.workspace << "}" << endl; 416 apps_file << " [Workspace]\t{" << a.workspace << "}" << endl;
358 } 417 }
@@ -541,7 +600,7 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) {
541 } 600 }
542} 601}
543 602
544void Remember::setupWindow(FluxboxWindow &win) { 603void Remember::setupFrame(FluxboxWindow &win) {
545 WinClient &winclient = win.winClient(); 604 WinClient &winclient = win.winClient();
546 605
547 // we don't touch the window if it is a transient 606 // we don't touch the window if it is a transient
@@ -573,7 +632,10 @@ void Remember::setupWindow(FluxboxWindow &win) {
573 if (app == 0) 632 if (app == 0)
574 return; // nothing to do 633 return; // nothing to do
575 634
576 BScreen &screen = win.screen(); 635 if (app->is_grouped && app->group == 0)
636 app->group = &win;
637
638 BScreen &screen = winclient.screen();
577 639
578 if (app->workspace_remember) { 640 if (app->workspace_remember) {
579 // TODO: fix placement to initialise properly 641 // TODO: fix placement to initialise properly
@@ -611,10 +673,29 @@ void Remember::setupWindow(FluxboxWindow &win) {
611 673
612} 674}
613 675
676void Remember::setupClient(WinClient &winclient) {
677
678 Application *app = find(winclient);
679 if (app == 0)
680 return; // nothing to do
681
682 if (winclient.fbwindow() == 0 && app->is_grouped && app->group) {
683 app->group->attachClient(winclient);
684 }
685}
686
614void Remember::updateWindowClose(FluxboxWindow &win) { 687void Remember::updateWindowClose(FluxboxWindow &win) {
615 // This doesn't work at present since fluxbox.cc is missing the windowclose stuff. 688 // This doesn't work at present since fluxbox.cc is missing the windowclose stuff.
616 // I don't trust it (particularly winClient()) while this is the case 689 // I don't trust it (particularly winClient()) while this is the case
617 690
691 // scan all winclients and remove this fbw
692 Patterns::iterator it = m_pats.begin();
693 while (it != m_pats.end()) {
694 if (&win == it->second->group)
695 it->second->group = 0;
696 ++it;
697 }
698
618 return; 699 return;
619 700
620 WinClient &winclient = win.winClient(); 701 WinClient &winclient = win.winClient();
diff --git a/src/Remember.hh b/src/Remember.hh
index 0e8ffe7..756bc7f 100644
--- a/src/Remember.hh
+++ b/src/Remember.hh
@@ -21,7 +21,7 @@
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id: Remember.hh,v 1.8 2003/06/18 13:34:56 fluxgen Exp $ 24// $Id: Remember.hh,v 1.9 2003/07/04 01:03:40 rathnor Exp $
25 25
26/* Based on the original "Remember patch" by Xavier Brouckaert */ 26/* Based on the original "Remember patch" by Xavier Brouckaert */
27 27
@@ -43,7 +43,7 @@ class ClientPattern;
43 43
44class Application { 44class Application {
45public: 45public:
46 Application(); 46 Application(bool grouped);
47 inline void forgetWorkspace() { workspace_remember = false; } 47 inline void forgetWorkspace() { workspace_remember = false; }
48 inline void forgetDimensions() { dimensions_remember = false; } 48 inline void forgetDimensions() { dimensions_remember = false; }
49 inline void forgetPosition() { position_remember = false; } 49 inline void forgetPosition() { position_remember = false; }
@@ -107,6 +107,9 @@ public:
107 bool save_on_close_remember; 107 bool save_on_close_remember;
108 bool save_on_close; 108 bool save_on_close;
109 109
110 bool is_grouped;
111 FluxboxWindow *group;
112
110}; 113};
111 114
112/** 115/**
@@ -161,7 +164,8 @@ public:
161 // Functions relating to AtomHandler 164 // Functions relating to AtomHandler
162 165
163 // Functions we actually use 166 // Functions we actually use
164 void setupWindow(FluxboxWindow &win); 167 void setupFrame(FluxboxWindow &win);
168 void setupClient(WinClient &winclient);
165 void updateWindowClose(FluxboxWindow &win); 169 void updateWindowClose(FluxboxWindow &win);
166 170
167 // Functions we ignore (zero from AtomHandler) 171 // Functions we ignore (zero from AtomHandler)
@@ -186,7 +190,8 @@ public:
186private: 190private:
187 191
188 // returns number of lines read 192 // returns number of lines read
189 int parseApp(std::ifstream &file, Application &app); 193 // optionally can give a line to read before the first (lookahead line)
194 int parseApp(std::ifstream &file, Application &app, std::string *first_line = 0);
190 Patterns m_pats; 195 Patterns m_pats;
191 Clients m_clients; 196 Clients m_clients;
192 197
diff --git a/src/Screen.cc b/src/Screen.cc
index 54432b3..c33a5bb 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.200 2003/07/03 13:57:58 fluxgen Exp $ 25// $Id: Screen.cc,v 1.201 2003/07/04 01:03:40 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -1035,40 +1035,53 @@ FluxboxWindow *BScreen::createWindow(Window client) {
1035 return 0; 1035 return 0;
1036 } 1036 }
1037 1037
1038 bool new_win = false;
1039
1038 // check if it should be grouped with something else 1040 // check if it should be grouped with something else
1039 FluxboxWindow *win; 1041 FluxboxWindow *win;
1040 if ((win = findGroupLeft(*winclient)) != 0) { 1042 if ((win = findGroupLeft(*winclient)) != 0) {
1041 win->attachClient(*winclient); 1043 win->attachClient(*winclient);
1042 } else { 1044 Fluxbox::instance()->attachSignals(*winclient);
1043 win = new FluxboxWindow(*winclient, *this,
1044 winFrameTheme(), *menuTheme(),
1045 *layerManager().getLayer(Fluxbox::instance()->getNormalLayer()));
1046 }
1047
1048 if (!win->isManaged()) {
1049 delete win;
1050 return 0;
1051 } else { 1045 } else {
1052 1046
1053 // always put on end of focused list, if it gets focused it'll get pushed up 1047 Fluxbox::instance()->attachSignals(*winclient);
1054 // there is only the one win client at this stage 1048 if (winclient->fbwindow()) // may have been set in an atomhandler
1055 if (doFocusNew()) 1049 win = winclient->fbwindow();
1056 focused_list.push_front(&win->winClient()); 1050 else {
1057 else 1051 win = new FluxboxWindow(*winclient, *this,
1058 focused_list.push_back(&win->winClient()); 1052 winFrameTheme(), *menuTheme(),
1053 *layerManager().getLayer(Fluxbox::instance()->getNormalLayer()));
1054
1055 new_win = true;
1059 1056
1060 //TODO: is next line needed? 1057 if (!win->isManaged()) {
1061 Fluxbox::instance()->saveWindowSearch(client, win); 1058 delete win;
1059 return 0;
1060 }
1061 }
1062 }
1063
1064 // always put on end of focused list, if it gets focused it'll get pushed up
1065 // there is only the one win client at this stage
1066 if (doFocusNew())
1067 focused_list.push_front(&win->winClient());
1068 else
1069 focused_list.push_back(&win->winClient());
1070
1071 if (new_win) {
1062 setupWindowActions(*win); 1072 setupWindowActions(*win);
1063 Fluxbox::instance()->attachSignals(*win); 1073 Fluxbox::instance()->attachSignals(*win);
1064 } 1074 }
1065 1075
1076 Fluxbox::instance()->saveWindowSearch(client, win);
1077
1066 // we also need to check if another window expects this window to the left 1078 // we also need to check if another window expects this window to the left
1067 // and if so, then join it. 1079 // and if so, then join it.
1068 FluxboxWindow *otherwin = 0; 1080 FluxboxWindow *otherwin = 0;
1069 // TODO: does this do the right stuff focus-wise? 1081 // TODO: does this do the right stuff focus-wise?
1070 if ((otherwin = findGroupRight(*winclient)) && otherwin != win) 1082 if ((otherwin = findGroupRight(*winclient)) && otherwin != win) {
1071 win->attachClient(otherwin->winClient()); 1083 win->attachClient(otherwin->winClient());
1084 }
1072 1085
1073 if (!win->isIconic() && (win->workspaceNumber() == currentWorkspaceID() || win->isStuck())) { 1086 if (!win->isIconic() && (win->workspaceNumber() == currentWorkspaceID() || win->isStuck())) {
1074 win->show(); 1087 win->show();
@@ -1096,6 +1109,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
1096 Fluxbox::instance()->saveWindowSearch(client.window(), win); 1109 Fluxbox::instance()->saveWindowSearch(client.window(), win);
1097 setupWindowActions(*win); 1110 setupWindowActions(*win);
1098 Fluxbox::instance()->attachSignals(*win); 1111 Fluxbox::instance()->attachSignals(*win);
1112 // winclient actions should have been setup when the WinClient was created
1099 if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) { 1113 if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) {
1100 win->show(); 1114 win->show();
1101 } 1115 }
diff --git a/src/ToolbarHandler.cc b/src/ToolbarHandler.cc
index 81b8520..61949ce 100644
--- a/src/ToolbarHandler.cc
+++ b/src/ToolbarHandler.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: ToolbarHandler.cc,v 1.19 2003/07/01 12:40:56 fluxgen Exp $ 23// $Id: ToolbarHandler.cc,v 1.20 2003/07/04 01:03:40 rathnor Exp $
24 24
25/** 25/**
26 * The ToolbarHandler class acts as a rough interface to the toolbar. 26 * The ToolbarHandler class acts as a rough interface to the toolbar.
@@ -267,7 +267,7 @@ void ToolbarHandler::initForScreen(BScreen &screen) {
267 267
268} 268}
269 269
270void ToolbarHandler::setupWindow(FluxboxWindow &win) { 270void ToolbarHandler::setupFrame(FluxboxWindow &win) {
271 if (&win.screen() != &m_screen) 271 if (&win.screen() != &m_screen)
272 return; 272 return;
273 273
diff --git a/src/ToolbarHandler.hh b/src/ToolbarHandler.hh
index 3986cc0..f0c470d 100644
--- a/src/ToolbarHandler.hh
+++ b/src/ToolbarHandler.hh
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: ToolbarHandler.hh,v 1.4 2003/06/24 16:27:18 fluxgen Exp $ 23// $Id: ToolbarHandler.hh,v 1.5 2003/07/04 01:03:40 rathnor Exp $
24 24
25#ifndef TOOLBARHANDLER_HH 25#ifndef TOOLBARHANDLER_HH
26#define TOOLBARHANDLER_HH 26#define TOOLBARHANDLER_HH
@@ -56,7 +56,9 @@ public:
56 56
57 57
58 void initForScreen(BScreen &screen); 58 void initForScreen(BScreen &screen);
59 void setupWindow(FluxboxWindow &win); 59 void setupFrame(FluxboxWindow &win);
60 // TODO: add setupClient and configure option to show groups or indiv. clients
61 void setupClient(WinClient &winclient) {}
60 62
61 void updateState(FluxboxWindow &win); 63 void updateState(FluxboxWindow &win);
62 void updateWindowClose(FluxboxWindow &win); 64 void updateWindowClose(FluxboxWindow &win);
diff --git a/src/Window.cc b/src/Window.cc
index 7b14cb5..f5c4fb9 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.201 2003/07/02 05:27:40 fluxgen Exp $ 25// $Id: Window.cc,v 1.202 2003/07/04 01:03:40 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -557,11 +557,8 @@ void FluxboxWindow::attachClient(WinClient &client) {
557 557
558 // get the current window on the end of our client list 558 // get the current window on the end of our client list
559 Window leftwin = None; 559 Window leftwin = None;
560 ClientList::iterator client_it = clientList().end(); 560 if (!clientList().empty())
561 ClientList::iterator client_it_end = clientList().end(); 561 leftwin = clientList().back()->window();
562 --client_it;
563 if (client_it != client_it_end)
564 leftwin = (*client_it)->window();
565 562
566 client.setGroupLeftWindow(leftwin); 563 client.setGroupLeftWindow(leftwin);
567 564
@@ -570,8 +567,8 @@ void FluxboxWindow::attachClient(WinClient &client) {
570 567
571 Fluxbox *fb = Fluxbox::instance(); 568 Fluxbox *fb = Fluxbox::instance();
572 // make sure we set new window search for each client 569 // make sure we set new window search for each client
573 client_it = old_win->clientList().begin(); 570 ClientList::iterator client_it = old_win->clientList().begin();
574 client_it_end = old_win->clientList().end(); 571 ClientList::iterator client_it_end = old_win->clientList().end();
575 for (; client_it != client_it_end; ++client_it) { 572 for (; client_it != client_it_end; ++client_it) {
576 // setup eventhandlers for client 573 // setup eventhandlers for client
577 fb->saveWindowSearch((*client_it)->window(), this); 574 fb->saveWindowSearch((*client_it)->window(), this);
@@ -638,6 +635,7 @@ void FluxboxWindow::attachClient(WinClient &client) {
638 635
639 Fluxbox::instance()->saveWindowSearch(client.window(), this); 636 Fluxbox::instance()->saveWindowSearch(client.window(), this);
640 client.saveBlackboxAttribs(m_blackbox_attrib); 637 client.saveBlackboxAttribs(m_blackbox_attrib);
638 m_clientlist.push_back(&client);
641 } 639 }
642 640
643 // make sure that the state etc etc is updated for the new client 641 // make sure that the state etc etc is updated for the new client
@@ -659,6 +657,46 @@ bool FluxboxWindow::detachClient(WinClient &client) {
659 if (client.m_win != this || numClients() <= 1) 657 if (client.m_win != this || numClients() <= 1)
660 return false; 658 return false;
661 659
660 // I'm not sure how to do this bit better
661 // we need to find the window we've got, and update the
662 // window to its right to have a left window set to the
663 // window which is to the left of the current.
664 // Think in terms of:
665 // window1 <- my_window <- window2
666 // we need to take out my_window, so update window2 leftwin to be window1
667
668 Window leftwin = None;
669 ClientList::iterator client_it_end = clientList().end();
670 ClientList::iterator client_it = clientList().begin();
671 ClientList::iterator client_it_before = client_it_end;
672 ClientList::iterator client_it_after = clientList().begin();
673 if (!clientList().empty()) {
674 ++client_it_after;
675 if (clientList().front() == &client) {
676 leftwin = None;
677 } else {
678 ++client_it;
679 client_it_before = clientList().begin();
680 ++client_it_after;
681
682 while (client_it != client_it_end) {
683 if (*client_it == &client) {
684 break;
685 }
686 ++client_it_before;
687 ++client_it;
688 ++client_it_after;
689 }
690 }
691 }
692
693 // update the leftwin of the window to the right
694 if (client_it_before != client_it_end)
695 leftwin = (*client_it_before)->window();
696
697 if (client_it_after != client_it_end)
698 (*client_it_after)->setGroupLeftWindow(leftwin);
699
662 removeClient(client); 700 removeClient(client);
663 701
664 client.m_win = screen().createWindow(client); 702 client.m_win = screen().createWindow(client);
@@ -2998,6 +3036,7 @@ void FluxboxWindow::restore(bool remap) {
2998 3036
2999 while (!clientList().empty()) { 3037 while (!clientList().empty()) {
3000 restore(clientList().back(), remap); 3038 restore(clientList().back(), remap);
3039 // deleting winClient removes it from the clientList
3001 } 3040 }
3002} 3041}
3003 3042
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 7f76e46..cb5cb68 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.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: fluxbox.cc,v 1.167 2003/07/01 20:29:44 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.168 2003/07/04 01:03:41 rathnor Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -1326,10 +1326,17 @@ void Fluxbox::attachSignals(FluxboxWindow &win) {
1326 win.stateSig().attach(this); 1326 win.stateSig().attach(this);
1327 win.workspaceSig().attach(this); 1327 win.workspaceSig().attach(this);
1328 win.layerSig().attach(this); 1328 win.layerSig().attach(this);
1329 win.winClient().dieSig().attach(this);
1330 win.dieSig().attach(this); 1329 win.dieSig().attach(this);
1331 for (size_t i=0; i<m_atomhandler.size(); ++i) { 1330 for (size_t i=0; i<m_atomhandler.size(); ++i) {
1332 m_atomhandler[i]->setupWindow(win); 1331 m_atomhandler[i]->setupFrame(win);
1332 }
1333}
1334
1335void Fluxbox::attachSignals(WinClient &winclient) {
1336 winclient.dieSig().attach(this);
1337
1338 for (size_t i=0; i<m_atomhandler.size(); ++i) {
1339 m_atomhandler[i]->setupClient(winclient);
1333 } 1340 }
1334} 1341}
1335 1342
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index cf1e9a8..b819636 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.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: fluxbox.hh,v 1.63 2003/06/30 15:04:06 fluxgen Exp $ 25// $Id: fluxbox.hh,v 1.64 2003/07/04 01:03:41 rathnor Exp $
26 26
27#ifndef FLUXBOX_HH 27#ifndef FLUXBOX_HH
28#define FLUXBOX_HH 28#define FLUXBOX_HH
@@ -61,6 +61,7 @@
61 61
62class AtomHandler; 62class AtomHandler;
63class FluxboxWindow; 63class FluxboxWindow;
64class WinClient;
64class Keys; 65class Keys;
65class BScreen; 66class BScreen;
66class FbAtoms; 67class FbAtoms;
@@ -175,6 +176,7 @@ public:
175 void update(FbTk::Subject *changed); 176 void update(FbTk::Subject *changed);
176 177
177 void attachSignals(FluxboxWindow &win); 178 void attachSignals(FluxboxWindow &win);
179 void attachSignals(WinClient &winclient);
178 180
179 virtual void timeout(); 181 virtual void timeout();
180 182