aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-05-06 21:17:13 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-05-10 11:00:46 (GMT)
commit2073ae12a4e633d18f49559111131fffbc495dbd (patch)
tree66d42e79fc90f58ddb38fa105e4cc68b63362cb5 /src
parentff49160b120edd8d9396f10dab5a97bace8724ec (diff)
downloadfluxbox-2073ae12a4e633d18f49559111131fffbc495dbd.zip
fluxbox-2073ae12a4e633d18f49559111131fffbc495dbd.tar.bz2
Convert FbWinFrame::frameExtentSig to FbTk::Signal
Also, I spotted a potential bug in the code. I marked the place with XXX. Someone should take a look at that.
Diffstat (limited to 'src')
-rw-r--r--src/FbWinFrame.cc6
-rw-r--r--src/FbWinFrame.hh7
-rw-r--r--src/Window.cc9
-rw-r--r--src/Window.hh14
4 files changed, 13 insertions, 23 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 2b64fa5..a8ee4d5 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -533,7 +533,7 @@ void FbWinFrame::applyState() {
533 } 533 }
534 534
535 moveResize(new_x, new_y, new_w, new_h); 535 moveResize(new_x, new_y, new_w, new_h);
536 frameExtentSig().notify(); 536 frameExtentSig().emit();
537} 537}
538 538
539void FbWinFrame::setAlpha(bool focused, int alpha) { 539void FbWinFrame::setAlpha(bool focused, int alpha) {
@@ -1478,7 +1478,7 @@ void FbWinFrame::applyDecorations(bool do_move) {
1478 m_state.saveGeometry(x(), y(), width(), height()); 1478 m_state.saveGeometry(x(), y(), width(), height());
1479 } 1479 }
1480 if (client_move) 1480 if (client_move)
1481 frameExtentSig().notify(); 1481 frameExtentSig().emit();
1482} 1482}
1483 1483
1484bool FbWinFrame::setBorderWidth(bool do_move) { 1484bool FbWinFrame::setBorderWidth(bool do_move) {
@@ -1529,7 +1529,7 @@ bool FbWinFrame::setBorderWidth(bool do_move) {
1529 alignTabs(); 1529 alignTabs();
1530 1530
1531 if (do_move) { 1531 if (do_move) {
1532 frameExtentSig().notify(); 1532 frameExtentSig().emit();
1533 gravityTranslate(grav_x, grav_y, sizeHints().win_gravity, 1533 gravityTranslate(grav_x, grav_y, sizeHints().win_gravity,
1534 m_active_orig_client_bw, false); 1534 m_active_orig_client_bw, false);
1535 // if the location changes, shift it 1535 // if the location changes, shift it
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 6c52566..5e13301 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -27,13 +27,13 @@
27#include "FbTk/FbWindow.hh" 27#include "FbTk/FbWindow.hh"
28#include "FbTk/EventHandler.hh" 28#include "FbTk/EventHandler.hh"
29#include "FbTk/RefCount.hh" 29#include "FbTk/RefCount.hh"
30#include "FbTk/Subject.hh"
31#include "FbTk/Color.hh" 30#include "FbTk/Color.hh"
32#include "FbTk/LayerItem.hh" 31#include "FbTk/LayerItem.hh"
33#include "FbTk/TextButton.hh" 32#include "FbTk/TextButton.hh"
34#include "FbTk/DefaultValue.hh" 33#include "FbTk/DefaultValue.hh"
35#include "FbTk/Container.hh" 34#include "FbTk/Container.hh"
36#include "FbTk/Shape.hh" 35#include "FbTk/Shape.hh"
36#include "FbTk/Signal.hh"
37 37
38#include <vector> 38#include <vector>
39#include <memory> 39#include <memory>
@@ -231,8 +231,7 @@ public:
231 const FbTk::LayerItem &layerItem() const { return m_layeritem; } 231 const FbTk::LayerItem &layerItem() const { return m_layeritem; }
232 FbTk::LayerItem &layerItem() { return m_layeritem; } 232 FbTk::LayerItem &layerItem() { return m_layeritem; }
233 233
234 const FbTk::Subject &frameExtentSig() const { return m_frame_extent_sig; } 234 FbTk::Signal<> &frameExtentSig() { return m_frame_extent_sig; }
235 FbTk::Subject &frameExtentSig() { return m_frame_extent_sig; }
236 /// @returns true if the window is inside titlebar, 235 /// @returns true if the window is inside titlebar,
237 /// assuming window is an event window that was generated for this frame. 236 /// assuming window is an event window that was generated for this frame.
238 bool insideTitlebar(Window win) const; 237 bool insideTitlebar(Window win) const;
@@ -318,7 +317,7 @@ private:
318 FbTk::FbWindow m_clientarea; ///< window that sits behind client window to fill gaps @see setClientWindow 317 FbTk::FbWindow m_clientarea; ///< window that sits behind client window to fill gaps @see setClientWindow
319 //@} 318 //@}
320 319
321 FbTk::Subject m_frame_extent_sig; 320 FbTk::Signal<> m_frame_extent_sig;
322 321
323 typedef std::vector<FbTk::Button *> ButtonList; 322 typedef std::vector<FbTk::Button *> ButtonList;
324 ButtonList m_buttons_left, ///< buttons to the left 323 ButtonList m_buttons_left, ///< buttons to the left
diff --git a/src/Window.cc b/src/Window.cc
index b3c0698..6e60a80 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -288,7 +288,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
288 m_resize_corner(RIGHTBOTTOM) { 288 m_resize_corner(RIGHTBOTTOM) {
289 289
290 join(m_theme.reconfigSig(), FbTk::MemFun(*this, &FluxboxWindow::themeReconfigured)); 290 join(m_theme.reconfigSig(), FbTk::MemFun(*this, &FluxboxWindow::themeReconfigured));
291 m_frame.frameExtentSig().attach(this); 291 join(m_frame.frameExtentSig(), FbTk::MemFun(*this, &FluxboxWindow::frameExtentChanged));
292 292
293 init(); 293 init();
294 294
@@ -538,7 +538,7 @@ void FluxboxWindow::init() {
538 gettimeofday(&now, NULL); 538 gettimeofday(&now, NULL);
539 m_creation_time = now.tv_sec; 539 m_creation_time = now.tv_sec;
540 540
541 frame().frameExtentSig().notify(); 541 frame().frameExtentSig().emit();
542 542
543 setupWindow(); 543 setupWindow();
544 544
@@ -1452,6 +1452,7 @@ void FluxboxWindow::setFullscreenLayer() {
1452void FluxboxWindow::attachWorkAreaSig() { 1452void FluxboxWindow::attachWorkAreaSig() {
1453 // notify when struts change, so we can resize accordingly 1453 // notify when struts change, so we can resize accordingly
1454 // Subject checks for duplicates for us 1454 // Subject checks for duplicates for us
1455 // XXX: this is no longer true with signals
1455 if (m_state.maximized || m_state.fullscreen) 1456 if (m_state.maximized || m_state.fullscreen)
1456 join(screen().workspaceAreaSig(), 1457 join(screen().workspaceAreaSig(),
1457 FbTk::MemFun(*this, &FluxboxWindow::workspaceAreaChanged)); 1458 FbTk::MemFun(*this, &FluxboxWindow::workspaceAreaChanged));
@@ -2677,8 +2678,8 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) {
2677 titleSig().emit(title, *this); 2678 titleSig().emit(title, *this);
2678} 2679}
2679 2680
2680void FluxboxWindow::update(FbTk::Subject *subj) { 2681void FluxboxWindow::frameExtentChanged() {
2681 if (m_initialized && subj == &m_frame.frameExtentSig()) { 2682 if (m_initialized) {
2682 Fluxbox::instance()->updateFrameExtents(*this); 2683 Fluxbox::instance()->updateFrameExtents(*this);
2683 sendConfigureNotify(); 2684 sendConfigureNotify();
2684 } 2685 }
diff --git a/src/Window.hh b/src/Window.hh
index 966631d..4ecfe05 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -33,8 +33,6 @@
33 33
34#include "FbTk/DefaultValue.hh" 34#include "FbTk/DefaultValue.hh"
35#include "FbTk/Timer.hh" 35#include "FbTk/Timer.hh"
36#include "FbTk/Subject.hh"
37#include "FbTk/Observer.hh"
38#include "FbTk/EventHandler.hh" 36#include "FbTk/EventHandler.hh"
39#include "FbTk/LayerItem.hh" 37#include "FbTk/LayerItem.hh"
40#include "FbTk/Signal.hh" 38#include "FbTk/Signal.hh"
@@ -58,7 +56,7 @@ class Layer;
58} 56}
59 57
60/// Creates the window frame and handles any window event for it 58/// Creates the window frame and handles any window event for it
61class FluxboxWindow: public Focusable, public FbTk::Observer, 59class FluxboxWindow: public Focusable,
62 public FbTk::EventHandler, 60 public FbTk::EventHandler,
63 private FbTk::SignalTracker { 61 private FbTk::SignalTracker {
64public: 62public:
@@ -466,15 +464,6 @@ public:
466 464
467 //@} 465 //@}
468 466
469 class WinSubject: public FbTk::Subject {
470 public:
471 WinSubject(FluxboxWindow &w):m_win(w) { }
472 FluxboxWindow &win() { return m_win; }
473 const FluxboxWindow &win() const { return m_win; }
474 private:
475 FluxboxWindow &m_win;
476 };
477
478 bool oplock; ///< Used to help stop transient loops occurring by locking a window during certain operations 467 bool oplock; ///< Used to help stop transient loops occurring by locking a window during certain operations
479 468
480private: 469private:
@@ -534,6 +523,7 @@ private:
534 void focusedWindowChanged(BScreen &screen, FluxboxWindow *focused_win, WinClient* client); 523 void focusedWindowChanged(BScreen &screen, FluxboxWindow *focused_win, WinClient* client);
535 /// Called when workspace area on screen changed. 524 /// Called when workspace area on screen changed.
536 void workspaceAreaChanged(BScreen &screen); 525 void workspaceAreaChanged(BScreen &screen);
526 void frameExtentChanged();
537 527
538 528
539 // state and hint signals 529 // state and hint signals