diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 79 |
1 files changed, 25 insertions, 54 deletions
diff --git a/src/Window.cc b/src/Window.cc index e899300..50b6f53 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -338,10 +338,9 @@ FluxboxWindow::~FluxboxWindow() { | |||
338 | 338 | ||
339 | Client2ButtonMap::iterator it = m_labelbuttons.begin(); | 339 | Client2ButtonMap::iterator it = m_labelbuttons.begin(); |
340 | Client2ButtonMap::iterator it_end = m_labelbuttons.end(); | 340 | Client2ButtonMap::iterator it_end = m_labelbuttons.end(); |
341 | for (; it != it_end; ++it) { | 341 | for (; it != it_end; ++it) |
342 | frame().removeLabelButton(*(*it).second); | 342 | frame().removeTab((*it).second); |
343 | delete (*it).second; | 343 | |
344 | } | ||
345 | m_labelbuttons.clear(); | 344 | m_labelbuttons.clear(); |
346 | 345 | ||
347 | m_timer.stop(); | 346 | m_timer.stop(); |
@@ -420,21 +419,14 @@ void FluxboxWindow::init() { | |||
420 | frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor()); | 419 | frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor()); |
421 | 420 | ||
422 | 421 | ||
423 | FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), | 422 | FbWinFrame::ButtonId btn = frame().createTab(m_client->title(), |
424 | frame().theme().font(), | 423 | new SetClientCmd(*m_client)); |
425 | m_client->title()); | 424 | |
426 | btn->setJustify(frame().theme().justify()); | ||
427 | m_labelbuttons[m_client] = btn; | 425 | m_labelbuttons[m_client] = btn; |
428 | frame().addLabelButton(*btn); | ||
429 | frame().setLabelButtonFocus(*btn); | 426 | frame().setLabelButtonFocus(*btn); |
430 | btn->show(); | 427 | |
431 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); | 428 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); |
432 | // we need motion notify so we mask it | ||
433 | btn->setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | | ||
434 | ButtonMotionMask | EnterWindowMask); | ||
435 | 429 | ||
436 | FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(*m_client)); | ||
437 | btn->setOnClick(set_client_cmd); | ||
438 | evm.add(*this, btn->window()); // we take care of button events for this | 430 | evm.add(*this, btn->window()); // we take care of button events for this |
439 | evm.add(*this, m_client->window()); | 431 | evm.add(*this, m_client->window()); |
440 | 432 | ||
@@ -668,11 +660,10 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { | |||
668 | if (client.fbwindow() != 0) { | 660 | if (client.fbwindow() != 0) { |
669 | FluxboxWindow *old_win = client.fbwindow(); // store old window | 661 | FluxboxWindow *old_win = client.fbwindow(); // store old window |
670 | 662 | ||
671 | ClientList::iterator client_insert_pos=getClientInsertPosition(x,y); | 663 | ClientList::iterator client_insert_pos = getClientInsertPosition(x, y); |
672 | FbTk::TextButton *button_insert_pos=NULL; | 664 | FbTk::TextButton *button_insert_pos = NULL; |
673 | if(client_insert_pos!=m_clientlist.end()) | 665 | if(client_insert_pos != m_clientlist.end()) |
674 | button_insert_pos=m_labelbuttons[*client_insert_pos]; | 666 | button_insert_pos = m_labelbuttons[*client_insert_pos]; |
675 | |||
676 | 667 | ||
677 | // make sure we set new window search for each client | 668 | // make sure we set new window search for each client |
678 | ClientList::iterator client_it = old_win->clientList().begin(); | 669 | ClientList::iterator client_it = old_win->clientList().begin(); |
@@ -693,29 +684,18 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { | |||
693 | frame().clientArea().height()); | 684 | frame().clientArea().height()); |
694 | 685 | ||
695 | (*client_it)->setFluxboxWindow(this); | 686 | (*client_it)->setFluxboxWindow(this); |
687 | |||
696 | // create a labelbutton for this client and | 688 | // create a labelbutton for this client and |
697 | // associate it with the pointer | 689 | // associate it with the pointer |
698 | FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), | 690 | FbWinFrame::ButtonId btn = frame().createTab((*client_it)->title(), |
699 | frame().theme().font(), | 691 | new SetClientCmd(*(*client_it))); |
700 | (*client_it)->title()); | ||
701 | btn->setJustify(frame().theme().justify()); | ||
702 | m_labelbuttons[(*client_it)] = btn; | 692 | m_labelbuttons[(*client_it)] = btn; |
703 | frame().addLabelButton(*btn); | 693 | |
704 | if(x >= 0) { | 694 | //null if we want the new button at the end of the list |
705 | if(button_insert_pos){ //null if we want the new button at the end of the list | 695 | if(x >= 0 && button_insert_pos) |
706 | frame().moveLabelButtonLeftOf(*btn, *button_insert_pos); | 696 | frame().moveLabelButtonLeftOf(*btn, *button_insert_pos); |
707 | } | 697 | |
708 | } | 698 | |
709 | btn->show(); | ||
710 | // we need motion notify so we mask it | ||
711 | btn->setEventMask(ExposureMask | ButtonPressMask | | ||
712 | ButtonReleaseMask | ButtonMotionMask | | ||
713 | EnterWindowMask); | ||
714 | |||
715 | |||
716 | FbTk::RefCount<FbTk::Command> | ||
717 | set_client_cmd(new SetClientCmd(*(*client_it))); | ||
718 | btn->setOnClick(set_client_cmd); | ||
719 | evm.add(*this, btn->window()); // we take care of button events for this | 699 | evm.add(*this, btn->window()); // we take care of button events for this |
720 | 700 | ||
721 | (*client_it)->saveBlackboxAttribs(m_blackbox_attrib); | 701 | (*client_it)->saveBlackboxAttribs(m_blackbox_attrib); |
@@ -731,25 +711,17 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { | |||
731 | 711 | ||
732 | } else { // client.fbwindow() == 0 | 712 | } else { // client.fbwindow() == 0 |
733 | // create a labelbutton for this client and associate it with the pointer | 713 | // create a labelbutton for this client and associate it with the pointer |
734 | FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), | 714 | FbWinFrame::ButtonId btn = frame().createTab(client.title(), |
735 | frame().theme().font(), | 715 | new SetClientCmd(client)); |
736 | client.title()); | ||
737 | m_labelbuttons[&client] = btn; | 716 | m_labelbuttons[&client] = btn; |
738 | frame().addLabelButton(*btn); | ||
739 | btn->show(); | ||
740 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); | ||
741 | // we need motion notify so we mask it | ||
742 | btn->setEventMask(ExposureMask | ButtonPressMask | | ||
743 | ButtonReleaseMask | ButtonMotionMask | | ||
744 | EnterWindowMask); | ||
745 | 717 | ||
718 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); | ||
746 | 719 | ||
747 | FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(client)); | ||
748 | btn->setOnClick(set_client_cmd); | ||
749 | evm.add(*this, btn->window()); // we take care of button events for this | 720 | evm.add(*this, btn->window()); // we take care of button events for this |
750 | 721 | ||
751 | if (&client == focused_win) | 722 | if (&client == focused_win) |
752 | was_focused = focused_win; | 723 | was_focused = focused_win; |
724 | |||
753 | client.setFluxboxWindow(this); | 725 | client.setFluxboxWindow(this); |
754 | 726 | ||
755 | client.saveBlackboxAttribs(m_blackbox_attrib); | 727 | client.saveBlackboxAttribs(m_blackbox_attrib); |
@@ -871,9 +843,8 @@ bool FluxboxWindow::removeClient(WinClient &client) { | |||
871 | 843 | ||
872 | FbTk::TextButton *label_btn = m_labelbuttons[&client]; | 844 | FbTk::TextButton *label_btn = m_labelbuttons[&client]; |
873 | if (label_btn != 0) { | 845 | if (label_btn != 0) { |
874 | frame().removeLabelButton(*label_btn); | 846 | frame().removeTab(label_btn); |
875 | evm.remove(label_btn->window()); | 847 | evm.remove(label_btn->window()); |
876 | delete label_btn; | ||
877 | label_btn = 0; | 848 | label_btn = 0; |
878 | } | 849 | } |
879 | 850 | ||