all repos — fluxbox @ 2073ae12a4e633d18f49559111131fffbc495dbd

custom fork of the fluxbox windowmanager

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.
Pavel Labath pavelo@centrum.sk
commit

2073ae12a4e633d18f49559111131fffbc495dbd

parent

ff49160b120edd8d9396f10dab5a97bace8724ec

4 files changed, 13 insertions(+), 23 deletions(-)

jump to
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -533,7 +533,7 @@ new_h = m_screen.getHeadHeight(head);

} moveResize(new_x, new_y, new_w, new_h); - frameExtentSig().notify(); + frameExtentSig().emit(); } void FbWinFrame::setAlpha(bool focused, int alpha) {

@@ -1478,7 +1478,7 @@ reconfigure();

m_state.saveGeometry(x(), y(), width(), height()); } if (client_move) - frameExtentSig().notify(); + frameExtentSig().emit(); } bool FbWinFrame::setBorderWidth(bool do_move) {

@@ -1529,7 +1529,7 @@ if (m_tabmode == EXTERNAL)

alignTabs(); if (do_move) { - frameExtentSig().notify(); + frameExtentSig().emit(); gravityTranslate(grav_x, grav_y, sizeHints().win_gravity, m_active_orig_client_bw, false); // if the location changes, shift it
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -27,13 +27,13 @@

#include "FbTk/FbWindow.hh" #include "FbTk/EventHandler.hh" #include "FbTk/RefCount.hh" -#include "FbTk/Subject.hh" #include "FbTk/Color.hh" #include "FbTk/LayerItem.hh" #include "FbTk/TextButton.hh" #include "FbTk/DefaultValue.hh" #include "FbTk/Container.hh" #include "FbTk/Shape.hh" +#include "FbTk/Signal.hh" #include <vector> #include <memory>

@@ -231,8 +231,7 @@

const FbTk::LayerItem &layerItem() const { return m_layeritem; } FbTk::LayerItem &layerItem() { return m_layeritem; } - const FbTk::Subject &frameExtentSig() const { return m_frame_extent_sig; } - FbTk::Subject &frameExtentSig() { return m_frame_extent_sig; } + FbTk::Signal<> &frameExtentSig() { return m_frame_extent_sig; } /// @returns true if the window is inside titlebar, /// assuming window is an event window that was generated for this frame. bool insideTitlebar(Window win) const;

@@ -318,7 +317,7 @@ m_grip_left; ///< left grip

FbTk::FbWindow m_clientarea; ///< window that sits behind client window to fill gaps @see setClientWindow //@} - FbTk::Subject m_frame_extent_sig; + FbTk::Signal<> m_frame_extent_sig; typedef std::vector<FbTk::Button *> ButtonList; ButtonList m_buttons_left, ///< buttons to the left
M src/Window.ccsrc/Window.cc

@@ -288,7 +288,7 @@ m_parent(client.screen().rootWindow()),

m_resize_corner(RIGHTBOTTOM) { join(m_theme.reconfigSig(), FbTk::MemFun(*this, &FluxboxWindow::themeReconfigured)); - m_frame.frameExtentSig().attach(this); + join(m_frame.frameExtentSig(), FbTk::MemFun(*this, &FluxboxWindow::frameExtentChanged)); init();

@@ -538,7 +538,7 @@ struct timeval now;

gettimeofday(&now, NULL); m_creation_time = now.tv_sec; - frame().frameExtentSig().notify(); + frame().frameExtentSig().emit(); setupWindow();

@@ -1452,6 +1452,7 @@

void FluxboxWindow::attachWorkAreaSig() { // notify when struts change, so we can resize accordingly // Subject checks for duplicates for us + // XXX: this is no longer true with signals if (m_state.maximized || m_state.fullscreen) join(screen().workspaceAreaSig(), FbTk::MemFun(*this, &FluxboxWindow::workspaceAreaChanged));

@@ -2677,8 +2678,8 @@ // relay title to others that display the focus title

titleSig().emit(title, *this); } -void FluxboxWindow::update(FbTk::Subject *subj) { - if (m_initialized && subj == &m_frame.frameExtentSig()) { +void FluxboxWindow::frameExtentChanged() { + if (m_initialized) { Fluxbox::instance()->updateFrameExtents(*this); sendConfigureNotify(); }
M src/Window.hhsrc/Window.hh

@@ -33,8 +33,6 @@ #include "WinButton.hh"

#include "FbTk/DefaultValue.hh" #include "FbTk/Timer.hh" -#include "FbTk/Subject.hh" -#include "FbTk/Observer.hh" #include "FbTk/EventHandler.hh" #include "FbTk/LayerItem.hh" #include "FbTk/Signal.hh"

@@ -58,7 +56,7 @@ class Layer;

} /// Creates the window frame and handles any window event for it -class FluxboxWindow: public Focusable, public FbTk::Observer, +class FluxboxWindow: public Focusable, public FbTk::EventHandler, private FbTk::SignalTracker { public:

@@ -466,15 +464,6 @@ /** @} */ // end group signals

//@} - class WinSubject: public FbTk::Subject { - public: - WinSubject(FluxboxWindow &w):m_win(w) { } - FluxboxWindow &win() { return m_win; } - const FluxboxWindow &win() const { return m_win; } - private: - FluxboxWindow &m_win; - }; - bool oplock; ///< Used to help stop transient loops occurring by locking a window during certain operations private:

@@ -534,6 +523,7 @@ /// Called when focused changed, and is attached when it is not in fullscreen mode

void focusedWindowChanged(BScreen &screen, FluxboxWindow *focused_win, WinClient* client); /// Called when workspace area on screen changed. void workspaceAreaChanged(BScreen &screen); + void frameExtentChanged(); // state and hint signals