aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2005-05-03 09:28:05 (GMT)
committerfluxgen <fluxgen>2005-05-03 09:28:05 (GMT)
commit1bf17f9c322c1aed9f9f4e317ec52459d73b9636 (patch)
tree68f86eb4f478fef7f87bb68e0ade6d8f22fed53f /src
parentbc3b377efb10dc4a3a084189657017fd0c9f23b6 (diff)
downloadfluxbox_paul-1bf17f9c322c1aed9f9f4e317ec52459d73b9636.zip
fluxbox_paul-1bf17f9c322c1aed9f9f4e317ec52459d73b9636.tar.bz2
using associateClient to create new tab and map it to labelbuttons
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc70
-rw-r--r--src/Window.hh2
2 files changed, 27 insertions, 45 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 7ea594a..65e1436 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -422,20 +422,11 @@ void FluxboxWindow::init() {
422 frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor()); 422 frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor());
423 frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor()); 423 frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor());
424 424
425 associateClient(*m_client);
425 426
426 FbWinFrame::ButtonId btn = frame().createTab(m_client->title(), 427 frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
427 new SetClientCmd(*m_client));
428
429 m_labelbuttons[m_client] = btn;
430 frame().setLabelButtonFocus(*btn);
431
432 FbTk::EventManager &evm = *FbTk::EventManager::instance();
433
434 evm.add(*this, btn->window()); // we take care of button events for this
435 evm.add(*this, m_client->window());
436 428
437 // redirect events from frame to us 429 // redirect events from frame to us
438
439 frame().setEventHandler(*this); 430 frame().setEventHandler(*this);
440 431
441 frame().resize(m_client->width(), m_client->height()); 432 frame().resize(m_client->width(), m_client->height());
@@ -473,10 +464,10 @@ void FluxboxWindow::init() {
473 // fetch client size and placement 464 // fetch client size and placement
474 XWindowAttributes wattrib; 465 XWindowAttributes wattrib;
475 if (! m_client->getAttrib(wattrib) || 466 if (! m_client->getAttrib(wattrib) ||
476 !wattrib.screen // no screen? ?? 467 !wattrib.screen || // no screen? ??
477 || wattrib.override_redirect) { // override redirect 468 wattrib.override_redirect || // override redirect
469 m_client->initial_state == WithdrawnState) // Slit client
478 return; 470 return;
479 }
480 471
481 // save old border width so we can restore it later 472 // save old border width so we can restore it later
482 m_client->old_bw = wattrib.border_width; 473 m_client->old_bw = wattrib.border_width;
@@ -488,13 +479,6 @@ void FluxboxWindow::init() {
488 m_timer.setCommand(raise_cmd); 479 m_timer.setCommand(raise_cmd);
489 m_timer.fireOnce(true); 480 m_timer.fireOnce(true);
490 481
491 // Slit client?
492 if (m_client->initial_state == WithdrawnState) {
493 return;
494 }
495
496
497
498 Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this); 482 Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this);
499 483
500 /**************************************************/ 484 /**************************************************/
@@ -666,16 +650,13 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
666 650
667 ClientList::iterator client_insert_pos = getClientInsertPosition(x, y); 651 ClientList::iterator client_insert_pos = getClientInsertPosition(x, y);
668 FbTk::TextButton *button_insert_pos = NULL; 652 FbTk::TextButton *button_insert_pos = NULL;
669 if(client_insert_pos != m_clientlist.end()) 653 if (client_insert_pos != m_clientlist.end())
670 button_insert_pos = m_labelbuttons[*client_insert_pos]; 654 button_insert_pos = m_labelbuttons[*client_insert_pos];
671 655
672 // make sure we set new window search for each client 656 // make sure we set new window search for each client
673 ClientList::iterator client_it = old_win->clientList().begin(); 657 ClientList::iterator client_it = old_win->clientList().begin();
674 ClientList::iterator client_it_end = old_win->clientList().end(); 658 ClientList::iterator client_it_end = old_win->clientList().end();
675 for (; client_it != client_it_end; ++client_it) { 659 for (; client_it != client_it_end; ++client_it) {
676 // setup eventhandlers for client
677 evm.add(*this, (*client_it)->window());
678
679 // reparent window to this 660 // reparent window to this
680 frame().setClientWindow(**client_it); 661 frame().setClientWindow(**client_it);
681 if ((*client_it) == focused_win) 662 if ((*client_it) == focused_win)
@@ -687,20 +668,13 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
687 frame().clientArea().width(), 668 frame().clientArea().width(),
688 frame().clientArea().height()); 669 frame().clientArea().height());
689 670
690 (*client_it)->setFluxboxWindow(this);
691
692 // create a labelbutton for this client and 671 // create a labelbutton for this client and
693 // associate it with the pointer 672 // associate it with the pointer
694 FbWinFrame::ButtonId btn = frame().createTab((*client_it)->title(), 673 associateClient(*(*client_it));
695 new SetClientCmd(*(*client_it)));
696 m_labelbuttons[(*client_it)] = btn;
697 674
698 //null if we want the new button at the end of the list 675 //null if we want the new button at the end of the list
699 if(x >= 0 && button_insert_pos) 676 if (x >= 0 && button_insert_pos)
700 frame().moveLabelButtonLeftOf(*btn, *button_insert_pos); 677 frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos);
701
702
703 evm.add(*this, btn->window()); // we take care of button events for this
704 678
705 (*client_it)->saveBlackboxAttribs(m_blackbox_attrib); 679 (*client_it)->saveBlackboxAttribs(m_blackbox_attrib);
706 } 680 }
@@ -714,20 +688,11 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
714 delete old_win; 688 delete old_win;
715 689
716 } else { // client.fbwindow() == 0 690 } else { // client.fbwindow() == 0
717 // create a labelbutton for this client and associate it with the pointer 691 associateClient(client);
718 FbWinFrame::ButtonId btn = frame().createTab(client.title(),
719 new SetClientCmd(client));
720 m_labelbuttons[&client] = btn;
721
722 FbTk::EventManager &evm = *FbTk::EventManager::instance();
723
724 evm.add(*this, btn->window()); // we take care of button events for this
725 692
726 if (&client == focused_win) 693 if (&client == focused_win)
727 was_focused = focused_win; 694 was_focused = focused_win;
728 695
729 client.setFluxboxWindow(this);
730
731 client.saveBlackboxAttribs(m_blackbox_attrib); 696 client.saveBlackboxAttribs(m_blackbox_attrib);
732 m_clientlist.push_back(&client); 697 m_clientlist.push_back(&client);
733 } 698 }
@@ -3986,3 +3951,18 @@ void FluxboxWindow::ungrabPointer(Time time) {
3986 if (s_num_grabs < 0) 3951 if (s_num_grabs < 0)
3987 s_num_grabs = 0; 3952 s_num_grabs = 0;
3988} 3953}
3954
3955void FluxboxWindow::associateClient(WinClient &client) {
3956
3957 FbWinFrame::ButtonId btn = frame().createTab(client.title(),
3958 new SetClientCmd(client));
3959
3960 m_labelbuttons[&client] = btn;
3961
3962
3963 FbTk::EventManager &evm = *FbTk::EventManager::instance();
3964
3965 evm.add(*this, btn->window()); // we take care of button events for this
3966 evm.add(*this, client.window());
3967 client.setFluxboxWindow(this);
3968}
diff --git a/src/Window.hh b/src/Window.hh
index 53b6041..ee53036 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -445,6 +445,8 @@ private:
445 Time time); 445 Time time);
446 static void ungrabPointer(Time time); 446 static void ungrabPointer(Time time);
447 447
448 void associateClient(WinClient &client);
449
448 // state and hint signals 450 // state and hint signals
449 WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig, m_focussig, m_titlesig; 451 WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig, m_focussig, m_titlesig;
450 452