aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Window.cc57
1 files changed, 34 insertions, 23 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 61bf3ee..85cadef 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.190 2003/06/12 14:35:36 fluxgen Exp $ 25// $Id: Window.cc,v 1.191 2003/06/13 20:49:05 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -292,6 +292,9 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
292FluxboxWindow::~FluxboxWindow() { 292FluxboxWindow::~FluxboxWindow() {
293#ifdef DEBUG 293#ifdef DEBUG
294 cerr<<__FILE__<<"("<<__LINE__<<"): starting ~FluxboxWindow("<<this<<")"<<endl; 294 cerr<<__FILE__<<"("<<__LINE__<<"): starting ~FluxboxWindow("<<this<<")"<<endl;
295 cerr<<__FILE__<<"("<<__LINE__<<"): num clients = "<<numClients()<<endl;
296 cerr<<__FILE__<<"("<<__LINE__<<"): curr client = "<<m_client<<endl;
297 cerr<<__FILE__<<"("<<__LINE__<<"): m_labelbuttons.size = "<<m_labelbuttons.size()<<endl;
295#endif // DEBUG 298#endif // DEBUG
296 if (moving || resizing || m_attaching_tab) { 299 if (moving || resizing || m_attaching_tab) {
297 screen().hideGeometry(); 300 screen().hideGeometry();
@@ -589,9 +592,10 @@ void FluxboxWindow::attachClient(WinClient &client) {
589 ClientList::iterator client_it = old_win->clientList().begin(); 592 ClientList::iterator client_it = old_win->clientList().begin();
590 ClientList::iterator client_it_end = old_win->clientList().end(); 593 ClientList::iterator client_it_end = old_win->clientList().end();
591 for (; client_it != client_it_end; ++client_it) { 594 for (; client_it != client_it_end; ++client_it) {
595 // setup eventhandlers for client
592 fb->saveWindowSearch((*client_it)->window(), this); 596 fb->saveWindowSearch((*client_it)->window(), this);
593 evm.add(*this, (*client_it)->window()); 597 evm.add(*this, (*client_it)->window());
594 598
595 // reparent window to this 599 // reparent window to this
596 frame().setClientWindow(**client_it); 600 frame().setClientWindow(**client_it);
597 resizeClient(**client_it, 601 resizeClient(**client_it,
@@ -624,8 +628,8 @@ void FluxboxWindow::attachClient(WinClient &client) {
624 // add client and move over all attached clients 628 // add client and move over all attached clients
625 // from the old window to this list 629 // from the old window to this list
626 m_clientlist.splice(m_clientlist.end(), old_win->m_clientlist); 630 m_clientlist.splice(m_clientlist.end(), old_win->m_clientlist);
627
628 old_win->m_client = 0; 631 old_win->m_client = 0;
632
629 delete old_win; 633 delete old_win;
630 634
631 } else { // client.fbwindow() == 0 635 } else { // client.fbwindow() == 0
@@ -656,9 +660,6 @@ void FluxboxWindow::attachClient(WinClient &client) {
656 660
657 // keep the current window on top 661 // keep the current window on top
658 m_client->raise(); 662 m_client->raise();
659
660
661
662} 663}
663 664
664 665
@@ -1275,6 +1276,9 @@ void FluxboxWindow::iconify() {
1275} 1276}
1276 1277
1277void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { 1278void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
1279 if (numClients() == 0)
1280 return;
1281
1278 if (oplock) return; 1282 if (oplock) return;
1279 oplock = true; 1283 oplock = true;
1280 1284
@@ -1693,10 +1697,14 @@ void FluxboxWindow::saveBlackboxHints() {
1693 Sets state on each client in our list 1697 Sets state on each client in our list
1694 */ 1698 */
1695void FluxboxWindow::setState(unsigned long new_state) { 1699void FluxboxWindow::setState(unsigned long new_state) {
1700 if (numClients() == 0)
1701 return;
1702
1696 m_current_state = new_state; 1703 m_current_state = new_state;
1697 unsigned long state[2]; 1704 unsigned long state[2];
1698 state[0] = (unsigned long) m_current_state; 1705 state[0] = (unsigned long) m_current_state;
1699 state[1] = (unsigned long) None; 1706 state[1] = (unsigned long) None;
1707
1700 for_each(m_clientlist.begin(), m_clientlist.end(), 1708 for_each(m_clientlist.begin(), m_clientlist.end(),
1701 FbTk::ChangeProperty(display, FbAtoms::instance()->getWMStateAtom(), 1709 FbTk::ChangeProperty(display, FbAtoms::instance()->getWMStateAtom(),
1702 PropModeReplace, 1710 PropModeReplace,
@@ -2015,11 +2023,12 @@ void FluxboxWindow::handleEvent(XEvent &event) {
2015} 2023}
2016 2024
2017void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) { 2025void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
2026
2018 // we're only conserned about client window event 2027 // we're only conserned about client window event
2019 WinClient *client = findClient(re.window); 2028 WinClient *client = findClient(re.window);
2020 if (client == 0) { 2029 if (client == 0) {
2021#ifdef DEBUG 2030#ifdef DEBUG
2022 cerr<<"mapRequestEvent: Can't find client!"<<endl; 2031 cerr<<__FILE__<<"("<<__FUNCTION__<<"): Can't find client!"<<endl;
2023#endif // DEBUG 2032#endif // DEBUG
2024 return; 2033 return;
2025 } 2034 }
@@ -2045,12 +2054,13 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
2045 withdraw(); 2054 withdraw();
2046 break; 2055 break;
2047 2056
2048 case NormalState: 2057 case NormalState: {
2058 // if the window was destroyed while autogrouping
2059 bool destroyed = false;
2060
2049 // check WM_CLASS only when we changed state to NormalState from 2061 // check WM_CLASS only when we changed state to NormalState from
2050 // WithdrawnState (ICCC 4.1.2.5) 2062 // WithdrawnState (ICCC 4.1.2.5)
2051
2052 XClassHint ch; 2063 XClassHint ch;
2053
2054 if (XGetClassHint(display, client->window(), &ch) == 0) { 2064 if (XGetClassHint(display, client->window(), &ch) == 0) {
2055 cerr<<"Failed to read class hint!"<<endl; 2065 cerr<<"Failed to read class hint!"<<endl;
2056 } else { 2066 } else {
@@ -2066,19 +2076,20 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
2066 } else 2076 } else
2067 m_class_name = ""; 2077 m_class_name = "";
2068 2078
2069 /* 2079
2070 Workspace *wsp = screen().getWorkspace(m_workspace_number); 2080 Workspace *wsp = screen().getWorkspace(m_workspace_number);
2071 // we must be resizable AND maximizable to be autogrouped 2081 // we must be resizable AND maximizable to be autogrouped
2072 //!! TODO: there should be an isGroupable() function 2082 //!! TODO: there should be an isGroupable() function
2073 if (wsp != 0 && isResizable() && isMaximizable()) { 2083 if (wsp != 0 && isResizable() && isMaximizable()) {
2074 wsp->checkGrouping(*this); 2084 destroyed = wsp->checkGrouping(*this);
2075 } 2085 }
2076 */ 2086
2077 } 2087 }
2078 2088 // if we wasn't grouped with another window we deiconify ourself
2079 deiconify(false); 2089 if (!destroyed)
2090 deiconify(false);
2080 2091
2081 break; 2092 } break;
2082 case InactiveState: 2093 case InactiveState:
2083 case ZoomState: 2094 case ZoomState:
2084 default: 2095 default: