summaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 93ba77e..5a882b3 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.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: Workspace.cc,v 1.61 2003/05/11 13:36:12 fluxgen Exp $ 25// $Id: Workspace.cc,v 1.62 2003/05/11 15:35:03 fluxgen Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -113,7 +113,7 @@ private:
113Workspace::GroupList Workspace::m_groups; 113Workspace::GroupList Workspace::m_groups;
114 114
115Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int i): 115Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int i):
116 screen(scrn), 116 m_screen(scrn),
117 lastfocus(0), 117 lastfocus(0),
118 m_clientmenu(*scrn.menuTheme(), scrn.getScreenNumber(), *scrn.getImageControl()), 118 m_clientmenu(*scrn.menuTheme(), scrn.getScreenNumber(), *scrn.getImageControl()),
119 m_layermanager(layermanager), 119 m_layermanager(layermanager),
@@ -122,7 +122,7 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int
122 cascade_x(32), cascade_y(32) { 122 cascade_x(32), cascade_y(32) {
123 123
124 m_clientmenu.setInternalMenu(); 124 m_clientmenu.setInternalMenu();
125 setName(screen.getNameOfWorkspace(m_id)); 125 setName(screen().getNameOfWorkspace(m_id));
126 126
127} 127}
128 128
@@ -200,7 +200,7 @@ int Workspace::addWindow(FluxboxWindow &w, bool place) {
200 FluxboxWindow::ClientList::iterator client_it_end = 200 FluxboxWindow::ClientList::iterator client_it_end =
201 w.clientList().end(); 201 w.clientList().end();
202 for (; client_it != client_it_end; ++client_it) 202 for (; client_it != client_it_end; ++client_it)
203 screen.updateNetizenWindowAdd((*client_it)->window(), m_id); 203 screen().updateNetizenWindowAdd((*client_it)->window(), m_id);
204 } 204 }
205 205
206 return w.getWindowNumber(); 206 return w.getWindowNumber();
@@ -217,8 +217,8 @@ int Workspace::removeWindow(FluxboxWindow *w) {
217 } 217 }
218 218
219 if (w->isFocused()) { 219 if (w->isFocused()) {
220 if (screen.isSloppyFocus()) { 220 if (screen().isSloppyFocus()) {
221 Fluxbox::instance()->revertFocus(&screen); 221 Fluxbox::instance()->revertFocus(screen());
222 } else { 222 } else {
223 // go up the transient tree looking for a focusable window 223 // go up the transient tree looking for a focusable window
224 WinClient *client = 0; 224 WinClient *client = 0;
@@ -234,7 +234,7 @@ int Workspace::removeWindow(FluxboxWindow *w) {
234 } 234 }
235 } 235 }
236 if (client == 0) // we were unsuccessful 236 if (client == 0) // we were unsuccessful
237 Fluxbox::instance()->revertFocus(&screen); 237 Fluxbox::instance()->revertFocus(screen());
238 } 238 }
239 } 239 }
240 240
@@ -255,7 +255,7 @@ int Workspace::removeWindow(FluxboxWindow *w) {
255 FluxboxWindow::ClientList::iterator client_it_end = 255 FluxboxWindow::ClientList::iterator client_it_end =
256 w->clientList().end(); 256 w->clientList().end();
257 for (; client_it != client_it_end; ++client_it) 257 for (; client_it != client_it_end; ++client_it)
258 screen.updateNetizenWindowDel((*client_it)->window()); 258 screen().updateNetizenWindowDel((*client_it)->window());
259 } 259 }
260 260
261 return m_windowlist.size(); 261 return m_windowlist.size();
@@ -415,7 +415,7 @@ void Workspace::update() {
415 415
416 416
417bool Workspace::isCurrent() const{ 417bool Workspace::isCurrent() const{
418 return (m_id == screen.getCurrentWorkspaceID()); 418 return (m_id == screen().getCurrentWorkspaceID());
419} 419}
420 420
421 421
@@ -424,7 +424,7 @@ bool Workspace::isLastWindow(FluxboxWindow *w) const{
424} 424}
425 425
426void Workspace::setCurrent() { 426void Workspace::setCurrent() {
427 screen.changeWorkspaceID(m_id); 427 screen().changeWorkspaceID(m_id);
428} 428}
429 429
430 430
@@ -441,7 +441,7 @@ void Workspace::setName(const std::string &name) {
441 m_name = tname; 441 m_name = tname;
442 } 442 }
443 443
444 screen.updateWorkspaceNamesAtom(); 444 screen().updateWorkspaceNamesAtom();
445 445
446 m_clientmenu.setLabel(m_name.c_str()); 446 m_clientmenu.setLabel(m_name.c_str());
447 m_clientmenu.update(); 447 m_clientmenu.update();
@@ -454,7 +454,7 @@ void Workspace::setName(const std::string &name) {
454*/ 454*/
455void Workspace::shutdown() { 455void Workspace::shutdown() {
456#ifdef DEBUG 456#ifdef DEBUG
457 cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<<screen.getScreenNumber()<<", ws "<< 457 cerr<<__FILE__<<"("<<__FUNCTION__<<"): scr "<<screen().getScreenNumber()<<", ws "<<
458 m_id<<", windowlist:"<<endl; 458 m_id<<", windowlist:"<<endl;
459 copy(m_windowlist.begin(), m_windowlist.end(), 459 copy(m_windowlist.begin(), m_windowlist.end(),
460 ostream_iterator<FluxboxWindow *>(cerr, " \n")); 460 ostream_iterator<FluxboxWindow *>(cerr, " \n"));
@@ -494,9 +494,9 @@ void Workspace::placeWindow(FluxboxWindow &win) {
494 494
495 int place_x = 0, place_y = 0, change_x = 1, change_y = 1; 495 int place_x = 0, place_y = 0, change_x = 1, change_y = 1;
496 496
497 if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP) 497 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
498 change_y = -1; 498 change_y = -1;
499 if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) 499 if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT)
500 change_x = -1; 500 change_x = -1;
501 501
502 int win_w = win.width() + win.getFbWindow().borderWidth()*2, 502 int win_w = win.width() + win.getFbWindow().borderWidth()*2,
@@ -505,7 +505,7 @@ void Workspace::placeWindow(FluxboxWindow &win) {
505 505
506 int test_x, test_y, curr_x, curr_y, curr_w, curr_h; 506 int test_x, test_y, curr_x, curr_y, curr_w, curr_h;
507 507
508 switch (screen.getPlacementPolicy()) { 508 switch (screen().getPlacementPolicy()) {
509 case BScreen::UNDERMOUSEPLACEMENT: { 509 case BScreen::UNDERMOUSEPLACEMENT: {
510 int root_x, root_y, min_y, min_x, max_y, max_x, ignore_i; 510 int root_x, root_y, min_y, min_x, max_y, max_x, ignore_i;
511 511
@@ -514,17 +514,17 @@ void Workspace::placeWindow(FluxboxWindow &win) {
514 Window ignore_w; 514 Window ignore_w;
515 515
516 XQueryPointer(FbTk::App::instance()->display(), 516 XQueryPointer(FbTk::App::instance()->display(),
517 screen.rootWindow().window(), &ignore_w, 517 screen().rootWindow().window(), &ignore_w,
518 &ignore_w, &root_x, &root_y, 518 &ignore_w, &root_x, &root_y,
519 &ignore_i, &ignore_i, &ignore_ui); 519 &ignore_i, &ignore_i, &ignore_ui);
520 520
521 test_x = root_x - (win_w / 2); 521 test_x = root_x - (win_w / 2);
522 test_y = root_y - (win_h / 2); 522 test_y = root_y - (win_h / 2);
523 523
524 min_x = (int) screen.getMaxLeft(); 524 min_x = (int) screen().getMaxLeft();
525 min_y = (int) screen.getMaxTop(); 525 min_y = (int) screen().getMaxTop();
526 max_x = (int) screen.getMaxRight() - win_w; 526 max_x = (int) screen().getMaxRight() - win_w;
527 max_y = (int) screen.getMaxBottom() - win_h; 527 max_y = (int) screen().getMaxBottom() - win_h;
528 528
529 // keep the window inside the screen 529 // keep the window inside the screen
530 530
@@ -552,22 +552,22 @@ void Workspace::placeWindow(FluxboxWindow &win) {
552 552
553 test_y = 0; 553 test_y = 0;
554 554
555 if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP) 555 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
556 test_y = screen.getHeight() - win_h - test_y; 556 test_y = screen().getHeight() - win_h - test_y;
557 557
558 558
559 while (((screen.getColPlacementDirection() == BScreen::BOTTOMTOP) ? 559 while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ?
560 test_y > 0 : test_y + win_h < (signed) screen.getHeight()) && 560 test_y > 0 : test_y + win_h < (signed) screen().getHeight()) &&
561 ! placed) { 561 ! placed) {
562 562
563 test_x = 0; 563 test_x = 0;
564 564
565 if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) 565 if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT)
566 test_x = screen.getWidth() - win_w - test_x; 566 test_x = screen().getWidth() - win_w - test_x;
567 567
568 568
569 while (((screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) ? 569 while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
570 test_x > 0 : test_x + win_w < (signed) screen.getWidth()) && ! placed) { 570 test_x > 0 : test_x + win_w < (signed) screen().getWidth()) && ! placed) {
571 571
572 placed = true; 572 placed = true;
573 573
@@ -611,21 +611,21 @@ void Workspace::placeWindow(FluxboxWindow &win) {
611 case BScreen::COLSMARTPLACEMENT: { 611 case BScreen::COLSMARTPLACEMENT: {
612 test_x = 0; 612 test_x = 0;
613 613
614 if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) 614 if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT)
615 615
616 test_x = screen.getWidth() - win_w - test_x; 616 test_x = screen().getWidth() - win_w - test_x;
617 617
618 618
619 while (((screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) ? 619 while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
620 test_x > 0 : test_x + win_w < (signed) screen.getWidth()) && 620 test_x > 0 : test_x + win_w < (signed) screen().getWidth()) &&
621 !placed) { 621 !placed) {
622 622
623 test_y = 0; 623 test_y = 0;
624 if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP) 624 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
625 test_y = screen.getHeight() - win_h - test_y; 625 test_y = screen().getHeight() - win_h - test_y;
626 626
627 while (((screen.getColPlacementDirection() == BScreen::BOTTOMTOP) ? 627 while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ?
628 test_y > 0 : test_y + win_h < (signed) screen.getHeight()) && 628 test_y > 0 : test_y + win_h < (signed) screen().getHeight()) &&
629 !placed) { 629 !placed) {
630 placed = True; 630 placed = True;
631 631
@@ -670,8 +670,8 @@ void Workspace::placeWindow(FluxboxWindow &win) {
670 // cascade placement or smart placement failed 670 // cascade placement or smart placement failed
671 if (! placed) { 671 if (! placed) {
672 672
673 if (((unsigned) cascade_x > (screen.getWidth() / 2)) || 673 if (((unsigned) cascade_x > (screen().getWidth() / 2)) ||
674 ((unsigned) cascade_y > (screen.getHeight() / 2))) 674 ((unsigned) cascade_y > (screen().getHeight() / 2)))
675 cascade_x = cascade_y = 32; 675 cascade_x = cascade_y = 32;
676 676
677 place_x = cascade_x; 677 place_x = cascade_x;
@@ -681,10 +681,10 @@ void Workspace::placeWindow(FluxboxWindow &win) {
681 cascade_y += win.getTitleHeight(); 681 cascade_y += win.getTitleHeight();
682 } 682 }
683 683
684 if (place_x + win_w > (signed) screen.getWidth()) 684 if (place_x + win_w > (signed) screen().getWidth())
685 place_x = (((signed) screen.getWidth()) - win_w) / 2; 685 place_x = (((signed) screen().getWidth()) - win_w) / 2;
686 if (place_y + win_h > (signed) screen.getHeight()) 686 if (place_y + win_h > (signed) screen().getHeight())
687 place_y = (((signed) screen.getHeight()) - win_h) / 2; 687 place_y = (((signed) screen().getHeight()) - win_h) / 2;
688 688
689 689
690 win.moveResize(place_x, place_y, win.width(), win.height()); 690 win.moveResize(place_x, place_y, win.width(), win.height());