aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AttentionNoticeHandler.cc4
-rw-r--r--src/FocusableList.cc5
-rw-r--r--src/WinButton.cc6
-rw-r--r--src/WinButton.hh3
-rw-r--r--src/Window.cc40
-rw-r--r--src/Window.hh6
-rw-r--r--src/fluxbox.cc49
-rw-r--r--src/fluxbox.hh2
8 files changed, 56 insertions, 59 deletions
diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc
index 9052319..7edd8e2 100644
--- a/src/AttentionNoticeHandler.cc
+++ b/src/AttentionNoticeHandler.cc
@@ -93,7 +93,7 @@ void AttentionNoticeHandler::addAttention(Focusable &client) {
93 93
94 // update _NET_WM_STATE atom 94 // update _NET_WM_STATE atom
95 if (client.fbwindow()) 95 if (client.fbwindow())
96 client.fbwindow()->stateSig().notify(); 96 client.fbwindow()->stateSig().emit(*client.fbwindow());
97} 97}
98 98
99void AttentionNoticeHandler::windowFocusChanged(Focusable& win) { 99void AttentionNoticeHandler::windowFocusChanged(Focusable& win) {
@@ -113,7 +113,7 @@ void AttentionNoticeHandler::updateWindow(Focusable& win, bool died) {
113 // update _NET_WM_STATE atom if the window is not dead 113 // update _NET_WM_STATE atom if the window is not dead
114 FluxboxWindow *fbwin = win.fbwindow(); 114 FluxboxWindow *fbwin = win.fbwindow();
115 if (fbwin && ! died) 115 if (fbwin && ! died)
116 fbwin->stateSig().notify(); 116 fbwin->stateSig().emit(*fbwin);
117 117
118} 118}
119 119
diff --git a/src/FocusableList.cc b/src/FocusableList.cc
index ca73a22..0368442 100644
--- a/src/FocusableList.cc
+++ b/src/FocusableList.cc
@@ -271,12 +271,14 @@ void FocusableList::attachSignals(Focusable &win) {
271 tracker->join(fbwin->workspaceSig(), 271 tracker->join(fbwin->workspaceSig(),
272 MemFun(*this, &FocusableList::windowUpdated) 272 MemFun(*this, &FocusableList::windowUpdated)
273 ); 273 );
274 tracker->join(fbwin->stateSig(),
275 MemFun(*this, &FocusableList::windowUpdated)
276 );
274 } 277 }
275 } 278 }
276 279
277 if (!fbwin) 280 if (!fbwin)
278 return; 281 return;
279 fbwin->stateSig().attach(this);
280 fbwin->layerSig().attach(this); 282 fbwin->layerSig().attach(this);
281 // TODO: can't watch (head=...) yet 283 // TODO: can't watch (head=...) yet
282 } 284 }
@@ -289,7 +291,6 @@ void FocusableList::detachSignals(Focusable &win) {
289 FluxboxWindow *fbwin = win.fbwindow(); 291 FluxboxWindow *fbwin = win.fbwindow();
290 if (!fbwin) 292 if (!fbwin)
291 return; 293 return;
292 fbwin->stateSig().detach(this);
293 fbwin->layerSig().detach(this); 294 fbwin->layerSig().detach(this);
294 // TODO: can't watch (head=...) yet 295 // TODO: can't watch (head=...) yet
295 } 296 }
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 22fe29c..703820d 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -48,7 +48,7 @@ WinButton::WinButton(FluxboxWindow &listen_to,
48 join(theme.reconfigSig(), FbTk::MemFun(*this, &WinButton::updateAll)); 48 join(theme.reconfigSig(), FbTk::MemFun(*this, &WinButton::updateAll));
49 49
50 if (buttontype == MENUICON) 50 if (buttontype == MENUICON)
51 update(0); 51 updateAll();
52} 52}
53 53
54void WinButton::exposeEvent(XExposeEvent &event) { 54void WinButton::exposeEvent(XExposeEvent &event) {
@@ -316,7 +316,3 @@ void WinButton::updateAll() {
316 316
317 clear(); 317 clear();
318} 318}
319
320void WinButton::update(FbTk::Subject *subj) {
321 updateAll();
322}
diff --git a/src/WinButton.hh b/src/WinButton.hh
index a116a15..35befa8 100644
--- a/src/WinButton.hh
+++ b/src/WinButton.hh
@@ -36,7 +36,7 @@ template <class T> class ThemeProxy;
36} 36}
37 37
38/// draws and handles basic window button graphic 38/// draws and handles basic window button graphic
39class WinButton:public FbTk::Button, public FbTk::Observer, public FbTk::SignalTracker { 39class WinButton:public FbTk::Button, public FbTk::SignalTracker {
40public: 40public:
41 /// draw type for the button 41 /// draw type for the button
42 enum Type {MAXIMIZE, MINIMIZE, SHADE, STICK, CLOSE, MENUICON}; 42 enum Type {MAXIMIZE, MINIMIZE, SHADE, STICK, CLOSE, MENUICON};
@@ -57,7 +57,6 @@ public:
57 Pixmap getPressedPixmap() const; 57 Pixmap getPressedPixmap() const;
58 /// override for redrawing 58 /// override for redrawing
59 void clear(); 59 void clear();
60 void update(FbTk::Subject *subj);
61 void updateAll(); 60 void updateAll();
62private: 61private:
63 void drawType(); 62 void drawType();
diff --git a/src/Window.cc b/src/Window.cc
index f91f741..c43ab36 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -260,7 +260,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
260 Focusable(client.screen(), this), 260 Focusable(client.screen(), this),
261 oplock(false), 261 oplock(false),
262 m_hintsig(*this), 262 m_hintsig(*this),
263 m_statesig(*this),
264 m_layersig(*this), 263 m_layersig(*this),
265 m_creation_time(0), 264 m_creation_time(0),
266 moving(false), resizing(false), 265 moving(false), resizing(false),
@@ -625,7 +624,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
625 // make sure that the state etc etc is updated for the new client 624 // make sure that the state etc etc is updated for the new client
626 // TODO: one day these should probably be neatened to only act on the 625 // TODO: one day these should probably be neatened to only act on the
627 // affected clients if possible 626 // affected clients if possible
628 m_statesig.notify(); 627 m_statesig.emit(*this);
629 m_workspacesig.emit(*this); 628 m_workspacesig.emit(*this);
630 m_layersig.notify(); 629 m_layersig.notify();
631 630
@@ -1336,7 +1335,7 @@ void FluxboxWindow::iconify() {
1336 return; 1335 return;
1337 1336
1338 m_state.iconic = true; 1337 m_state.iconic = true;
1339 m_statesig.notify(); 1338 m_statesig.emit(*this);
1340 1339
1341 hide(true); 1340 hide(true);
1342 1341
@@ -1365,7 +1364,7 @@ void FluxboxWindow::deiconify(bool do_raise) {
1365 // reassociate first, so it gets removed from screen's icon list 1364 // reassociate first, so it gets removed from screen's icon list
1366 screen().reassociateWindow(this, m_workspace_number, false); 1365 screen().reassociateWindow(this, m_workspace_number, false);
1367 m_state.iconic = false; 1366 m_state.iconic = false;
1368 m_statesig.notify(); 1367 m_statesig.emit(*this);
1369 1368
1370 // deiconify all transients 1369 // deiconify all transients
1371 ClientList::iterator client_it = clientList().begin(); 1370 ClientList::iterator client_it = clientList().begin();
@@ -1418,7 +1417,7 @@ void FluxboxWindow::setFullscreen(bool flag) {
1418 m_state.fullscreen = true; 1417 m_state.fullscreen = true;
1419 frame().applyState(); 1418 frame().applyState();
1420 1419
1421 setFullscreenLayer(); // calls stateSig().notify() 1420 setFullscreenLayer(); // calls stateSig().emit()
1422 if (!isFocused()) { 1421 if (!isFocused()) {
1423 join(screen().focusedWindowSig(), 1422 join(screen().focusedWindowSig(),
1424 FbTk::MemFun(*this, &FluxboxWindow::focusedWindowChanged)); 1423 FbTk::MemFun(*this, &FluxboxWindow::focusedWindowChanged));
@@ -1430,7 +1429,7 @@ void FluxboxWindow::setFullscreen(bool flag) {
1430 frame().applyState(); 1429 frame().applyState();
1431 1430
1432 moveToLayer(m_old_layernum); 1431 moveToLayer(m_old_layernum);
1433 stateSig().notify(); 1432 stateSig().emit(*this);
1434 } 1433 }
1435 1434
1436 attachWorkAreaSig(); 1435 attachWorkAreaSig();
@@ -1448,7 +1447,7 @@ void FluxboxWindow::setFullscreenLayer() {
1448 } else { 1447 } else {
1449 moveToLayer(::ResourceLayer::DESKTOP); 1448 moveToLayer(::ResourceLayer::DESKTOP);
1450 } 1449 }
1451 stateSig().notify(); 1450 stateSig().emit(*this);
1452 1451
1453} 1452}
1454 1453
@@ -1483,7 +1482,7 @@ void FluxboxWindow::setMaximizedState(int type) {
1483 1482
1484 if (isShaded()) { 1483 if (isShaded()) {
1485 // do not call ::shade() here to trigger frame().applyState() and 1484 // do not call ::shade() here to trigger frame().applyState() and
1486 // stateSig().notfiy() only once 1485 // stateSig().emit() only once
1487 m_state.shaded = false; 1486 m_state.shaded = false;
1488 } 1487 }
1489 1488
@@ -1493,7 +1492,7 @@ void FluxboxWindow::setMaximizedState(int type) {
1493 attachWorkAreaSig(); 1492 attachWorkAreaSig();
1494 1493
1495 // notify listeners that we changed state 1494 // notify listeners that we changed state
1496 stateSig().notify(); 1495 stateSig().emit(*this);
1497} 1496}
1498 1497
1499void FluxboxWindow::disableMaximization() { 1498void FluxboxWindow::disableMaximization() {
@@ -1504,7 +1503,7 @@ void FluxboxWindow::disableMaximization() {
1504 m_state.saveGeometry(frame().x(), frame().y(), 1503 m_state.saveGeometry(frame().x(), frame().y(),
1505 frame().width(), frame().height()); 1504 frame().width(), frame().height());
1506 frame().applyState(); 1505 frame().applyState();
1507 stateSig().notify(); 1506 stateSig().emit(*this);
1508} 1507}
1509 1508
1510 1509
@@ -1560,7 +1559,7 @@ void FluxboxWindow::shade() {
1560 return; 1559 return;
1561 1560
1562 frame().applyState(); 1561 frame().applyState();
1563 stateSig().notify(); 1562 stateSig().emit(*this);
1564 // TODO: this should set IconicState, but then we can't focus the window 1563 // TODO: this should set IconicState, but then we can't focus the window
1565} 1564}
1566 1565
@@ -1584,7 +1583,7 @@ void FluxboxWindow::stick() {
1584 m_state.stuck = !m_state.stuck; 1583 m_state.stuck = !m_state.stuck;
1585 1584
1586 if (m_initialized) { 1585 if (m_initialized) {
1587 stateSig().notify(); 1586 stateSig().emit(*this);
1588 // notify since some things consider "stuck" to be a pseudo-workspace 1587 // notify since some things consider "stuck" to be a pseudo-workspace
1589 m_workspacesig.emit(*this); 1588 m_workspacesig.emit(*this);
1590 } 1589 }
@@ -1726,13 +1725,13 @@ void FluxboxWindow::moveToLayer(int layernum, bool force) {
1726void FluxboxWindow::setFocusHidden(bool value) { 1725void FluxboxWindow::setFocusHidden(bool value) {
1727 m_state.focus_hidden = value; 1726 m_state.focus_hidden = value;
1728 if (m_initialized) 1727 if (m_initialized)
1729 m_statesig.notify(); 1728 m_statesig.emit(*this);
1730} 1729}
1731 1730
1732void FluxboxWindow::setIconHidden(bool value) { 1731void FluxboxWindow::setIconHidden(bool value) {
1733 m_state.icon_hidden = value; 1732 m_state.icon_hidden = value;
1734 if (m_initialized) 1733 if (m_initialized)
1735 m_statesig.notify(); 1734 m_statesig.emit(*this);
1736} 1735}
1737 1736
1738 1737
@@ -2843,7 +2842,7 @@ void FluxboxWindow::stopMoving(bool interrupted) {
2843 if (m_state.maximized || m_state.fullscreen) { 2842 if (m_state.maximized || m_state.fullscreen) {
2844 frame().applyState(); 2843 frame().applyState();
2845 attachWorkAreaSig(); 2844 attachWorkAreaSig();
2846 stateSig().notify(); 2845 stateSig().emit(*this);
2847 } 2846 }
2848} 2847}
2849 2848
@@ -3581,7 +3580,8 @@ void FluxboxWindow::updateButtons() {
3581 0, 0, 10, 10); 3580 0, 0, 10, 10);
3582 3581
3583 winbtn->setOnClick(close_cmd); 3582 winbtn->setOnClick(close_cmd);
3584 stateSig().attach(winbtn); 3583 winbtn->join(stateSig(),
3584 FbTk::MemFunIgnoreArgs(*winbtn, &WinButton::updateAll));
3585 } 3585 }
3586 break; 3586 break;
3587 case WinButton::STICK: 3587 case WinButton::STICK:
@@ -3592,7 +3592,8 @@ void FluxboxWindow::updateButtons() {
3592 frame().titlebar(), 3592 frame().titlebar(),
3593 0, 0, 10, 10); 3593 0, 0, 10, 10);
3594 3594
3595 stateSig().attach(winbtn); 3595 winbtn->join(stateSig(),
3596 FbTk::MemFunIgnoreArgs(*winbtn, &WinButton::updateAll));
3596 winbtn->setOnClick(stick_cmd); 3597 winbtn->setOnClick(stick_cmd);
3597 } 3598 }
3598 break; 3599 break;
@@ -3603,7 +3604,8 @@ void FluxboxWindow::updateButtons() {
3603 dir[i], 3604 dir[i],
3604 frame().titlebar(), 3605 frame().titlebar(),
3605 0, 0, 10, 10); 3606 0, 0, 10, 10);
3606 stateSig().attach(winbtn); 3607 winbtn->join(stateSig(),
3608 FbTk::MemFunIgnoreArgs(*winbtn, &WinButton::updateAll));
3607 winbtn->setOnClick(shade_cmd); 3609 winbtn->setOnClick(shade_cmd);
3608 } 3610 }
3609 break; 3611 break;
@@ -3749,7 +3751,7 @@ void FluxboxWindow::setOnHead(int head) {
3749 if (m_state.maximized || m_state.fullscreen) { 3751 if (m_state.maximized || m_state.fullscreen) {
3750 frame().applyState(); 3752 frame().applyState();
3751 attachWorkAreaSig(); 3753 attachWorkAreaSig();
3752 stateSig().notify(); 3754 stateSig().emit(*this);
3753 } 3755 }
3754} 3756}
3755 3757
diff --git a/src/Window.hh b/src/Window.hh
index a394401..26ae4ef 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -458,8 +458,7 @@ public:
458 @name signals 458 @name signals
459 @{ 459 @{
460 */ 460 */
461 FbTk::Subject &stateSig() { return m_statesig; } 461 FbTk::Signal<FluxboxWindow &> &stateSig() { return m_statesig; }
462 const FbTk::Subject &stateSig() const { return m_statesig; }
463 FbTk::Subject &layerSig() { return m_layersig; } 462 FbTk::Subject &layerSig() { return m_layersig; }
464 const FbTk::Subject &layerSig() const { return m_layersig; } 463 const FbTk::Subject &layerSig() const { return m_layersig; }
465 FbTk::Subject &hintSig() { return m_hintsig; } 464 FbTk::Subject &hintSig() { return m_hintsig; }
@@ -541,9 +540,8 @@ private:
541 540
542 // state and hint signals 541 // state and hint signals
543 WinSubject m_hintsig, 542 WinSubject m_hintsig,
544 m_statesig,
545 m_layersig; 543 m_layersig;
546 FbTk::Signal<FluxboxWindow &> m_workspacesig; 544 FbTk::Signal<FluxboxWindow &> m_workspacesig, m_statesig;
547 545
548 time_t m_creation_time; 546 time_t m_creation_time;
549 547
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index e319a2f..9c30b03 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -952,30 +952,7 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
952 fbwin = winsub->win().fbwindow(); 952 fbwin = winsub->win().fbwindow();
953 } 953 }
954 954
955 if (fbwin && &fbwin->stateSig() == changedsub) { // state signal 955 if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal
956 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
957 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateState, *fbwin));
958
959 // if window changed to iconic state
960 // add to icon list
961 if (fbwin->isIconic()) {
962 fbwin->screen().addIcon(fbwin);
963 Workspace *space = fbwin->screen().getWorkspace(fbwin->workspaceNumber());
964 if (space != 0)
965 space->removeWindow(fbwin, true);
966 }
967
968 if (fbwin->isStuck()) {
969 // if we're sticky then reassociate window
970 // to all workspaces
971 BScreen &scr = fbwin->screen();
972 if (scr.currentWorkspaceID() != fbwin->workspaceNumber()) {
973 scr.reassociateWindow(fbwin,
974 scr.currentWorkspaceID(),
975 true);
976 }
977 }
978 } else if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal
979 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update), 956 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
980 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin)); 957 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin));
981 } 958 }
@@ -1025,9 +1002,31 @@ void Fluxbox::windowWorkspaceChanged(FluxboxWindow &win) {
1025 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, win)); 1002 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateWorkspace, win));
1026} 1003}
1027 1004
1005void Fluxbox::windowStateChanged(FluxboxWindow &win) {
1006 STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
1007 CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateState, win));
1008
1009 // if window changed to iconic state
1010 // add to icon list
1011 if (win.isIconic()) {
1012 win.screen().addIcon(&win);
1013 Workspace *space = win.screen().getWorkspace(win.workspaceNumber());
1014 if (space != 0)
1015 space->removeWindow(&win, true);
1016 }
1017
1018 if (win.isStuck()) {
1019 // if we're sticky then reassociate window
1020 // to all workspaces
1021 BScreen &scr = win.screen();
1022 if (scr.currentWorkspaceID() != win.workspaceNumber())
1023 scr.reassociateWindow(&win, scr.currentWorkspaceID(), true);
1024 }
1025}
1026
1028void Fluxbox::attachSignals(FluxboxWindow &win) { 1027void Fluxbox::attachSignals(FluxboxWindow &win) {
1029 win.hintSig().attach(this); 1028 win.hintSig().attach(this);
1030 win.stateSig().attach(this); 1029 join(win.stateSig(), FbTk::MemFun(*this, &Fluxbox::windowStateChanged));
1031 join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged)); 1030 join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged));
1032 win.layerSig().attach(this); 1031 win.layerSig().attach(this);
1033 join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied)); 1032 join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied));
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 4c8fcdf..af28ac7 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -223,6 +223,8 @@ private:
223 void clientDied(Focusable &focusable); 223 void clientDied(Focusable &focusable);
224 /// Called when a window changes workspace 224 /// Called when a window changes workspace
225 void windowWorkspaceChanged(FluxboxWindow &win); 225 void windowWorkspaceChanged(FluxboxWindow &win);
226 /// Called when a window changes state
227 void windowStateChanged(FluxboxWindow &win);
226 228
227 std::auto_ptr<FbAtoms> m_fbatoms; 229 std::auto_ptr<FbAtoms> m_fbatoms;
228 230