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.
This commit is contained in:
Pavel Labath 2011-05-06 23:17:13 +02:00
parent ff49160b12
commit 2073ae12a4
4 changed files with 13 additions and 23 deletions

View file

@ -533,7 +533,7 @@ void FbWinFrame::applyState() {
}
moveResize(new_x, new_y, new_w, new_h);
frameExtentSig().notify();
frameExtentSig().emit();
}
void FbWinFrame::setAlpha(bool focused, int alpha) {
@ -1478,7 +1478,7 @@ void FbWinFrame::applyDecorations(bool do_move) {
m_state.saveGeometry(x(), y(), width(), height());
}
if (client_move)
frameExtentSig().notify();
frameExtentSig().emit();
}
bool FbWinFrame::setBorderWidth(bool do_move) {
@ -1529,7 +1529,7 @@ bool FbWinFrame::setBorderWidth(bool do_move) {
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

View file

@ -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 @@ public:
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 @@ private:
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

View file

@ -288,7 +288,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
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 @@ void FluxboxWindow::init() {
gettimeofday(&now, NULL);
m_creation_time = now.tv_sec;
frame().frameExtentSig().notify();
frame().frameExtentSig().emit();
setupWindow();
@ -1452,6 +1452,7 @@ void FluxboxWindow::setFullscreenLayer() {
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 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) {
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();
}

View file

@ -33,8 +33,6 @@
#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 @@ public:
//@}
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 @@ private:
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