Convert FluxboxWindow::layerSig to FbTk::Signal
This commit is contained in:
parent
e53d14e910
commit
6a0280aa4d
6 changed files with 33 additions and 85 deletions
|
@ -107,17 +107,6 @@ void FocusableList::init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusableList::update(FbTk::Subject *subj) {
|
|
||||||
if (subj == 0 || m_screen.isShuttingdown())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
|
|
||||||
FluxboxWindow::WinSubject *fsubj =
|
|
||||||
static_cast<FluxboxWindow::WinSubject *>(subj);
|
|
||||||
windowUpdated(fsubj->win());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FocusableList::windowUpdated(FluxboxWindow &fbwin) {
|
void FocusableList::windowUpdated(FluxboxWindow &fbwin) {
|
||||||
if (m_screen.isShuttingdown())
|
if (m_screen.isShuttingdown())
|
||||||
return;
|
return;
|
||||||
|
@ -243,7 +232,7 @@ void FocusableList::remove(Focusable &win) {
|
||||||
// if the window isn't already in this list, we could send a bad signal
|
// if the window isn't already in this list, we could send a bad signal
|
||||||
bool contained = contains(win);
|
bool contained = contains(win);
|
||||||
|
|
||||||
detachSignals(win);
|
m_signal_map.erase(&win);
|
||||||
if (!contained) {
|
if (!contained) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +246,9 @@ void FocusableList::updateTitle(Focusable& win) {
|
||||||
#include "Debug.hh"
|
#include "Debug.hh"
|
||||||
|
|
||||||
void FocusableList::attachSignals(Focusable &win) {
|
void FocusableList::attachSignals(Focusable &win) {
|
||||||
if (m_parent) {
|
if (m_parent == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
FluxboxWindow *fbwin = win.fbwindow();
|
FluxboxWindow *fbwin = win.fbwindow();
|
||||||
|
|
||||||
// attach various signals for matching
|
// attach various signals for matching
|
||||||
|
@ -268,39 +259,17 @@ void FocusableList::attachSignals(Focusable &win) {
|
||||||
tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle));
|
tracker->join(win.titleSig(), MemFunSelectArg1(*this, &FocusableList::updateTitle));
|
||||||
tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove));
|
tracker->join(win.dieSig(), MemFun(*this, &FocusableList::remove));
|
||||||
if(fbwin) {
|
if(fbwin) {
|
||||||
tracker->join(fbwin->workspaceSig(),
|
tracker->join(fbwin->workspaceSig(), MemFun(*this, &FocusableList::windowUpdated));
|
||||||
MemFun(*this, &FocusableList::windowUpdated)
|
tracker->join(fbwin->stateSig(), MemFun(*this, &FocusableList::windowUpdated));
|
||||||
);
|
tracker->join(fbwin->layerSig(), MemFun(*this, &FocusableList::windowUpdated));
|
||||||
tracker->join(fbwin->stateSig(),
|
|
||||||
MemFun(*this, &FocusableList::windowUpdated)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fbwin)
|
|
||||||
return;
|
|
||||||
fbwin->layerSig().attach(this);
|
|
||||||
// TODO: can't watch (head=...) yet
|
// TODO: can't watch (head=...) yet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusableList::detachSignals(Focusable &win) {
|
|
||||||
m_signal_map.erase(&win);
|
|
||||||
if (m_parent) {
|
|
||||||
// detach various signals for matching
|
|
||||||
FluxboxWindow *fbwin = win.fbwindow();
|
|
||||||
if (!fbwin)
|
|
||||||
return;
|
|
||||||
fbwin->layerSig().detach(this);
|
|
||||||
// TODO: can't watch (head=...) yet
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusableList::reset() {
|
void FocusableList::reset() {
|
||||||
while (!m_list.empty()) {
|
m_signal_map.clear();
|
||||||
detachSignals(*m_list.back());
|
m_list.clear();
|
||||||
m_list.pop_back();
|
|
||||||
}
|
|
||||||
m_pat->resetMatches();
|
m_pat->resetMatches();
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
addMatching();
|
addMatching();
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Focusable;
|
||||||
class WinClient;
|
class WinClient;
|
||||||
class FluxboxWindow;
|
class FluxboxWindow;
|
||||||
|
|
||||||
class FocusableList: public FbTk::Observer, private FbTk::NotCopyable,
|
class FocusableList: private FbTk::NotCopyable,
|
||||||
private FbTk::SignalTracker {
|
private FbTk::SignalTracker {
|
||||||
public:
|
public:
|
||||||
typedef std::list<Focusable *> Focusables;
|
typedef std::list<Focusable *> Focusables;
|
||||||
|
@ -58,8 +58,6 @@ public:
|
||||||
static void parseArgs(const std::string &in, int &opts, std::string &out);
|
static void parseArgs(const std::string &in, int &opts, std::string &out);
|
||||||
static const FocusableList *getListFromOptions(BScreen &scr, int opts);
|
static const FocusableList *getListFromOptions(BScreen &scr, int opts);
|
||||||
|
|
||||||
void update(FbTk::Subject *subj);
|
|
||||||
|
|
||||||
/// functions for modifying the list contents
|
/// functions for modifying the list contents
|
||||||
void pushFront(Focusable &win);
|
void pushFront(Focusable &win);
|
||||||
void pushBack(Focusable &win);
|
void pushBack(Focusable &win);
|
||||||
|
@ -94,7 +92,6 @@ private:
|
||||||
void checkUpdate(Focusable &win);
|
void checkUpdate(Focusable &win);
|
||||||
bool insertFromParent(Focusable &win);
|
bool insertFromParent(Focusable &win);
|
||||||
void attachSignals(Focusable &win);
|
void attachSignals(Focusable &win);
|
||||||
void detachSignals(Focusable &win);
|
|
||||||
void reset();
|
void reset();
|
||||||
void attachChild(FocusableList &child) const;
|
void attachChild(FocusableList &child) const;
|
||||||
void workspaceChanged(BScreen &screen);
|
void workspaceChanged(BScreen &screen);
|
||||||
|
|
|
@ -260,7 +260,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
|
||||||
Focusable(client.screen(), this),
|
Focusable(client.screen(), this),
|
||||||
oplock(false),
|
oplock(false),
|
||||||
m_hintsig(*this),
|
m_hintsig(*this),
|
||||||
m_layersig(*this),
|
|
||||||
m_creation_time(0),
|
m_creation_time(0),
|
||||||
moving(false), resizing(false),
|
moving(false), resizing(false),
|
||||||
m_initialized(false),
|
m_initialized(false),
|
||||||
|
@ -626,7 +625,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
|
||||||
// affected clients if possible
|
// affected clients if possible
|
||||||
m_statesig.emit(*this);
|
m_statesig.emit(*this);
|
||||||
m_workspacesig.emit(*this);
|
m_workspacesig.emit(*this);
|
||||||
m_layersig.notify();
|
m_layersig.emit(*this);
|
||||||
|
|
||||||
if (was_focused) {
|
if (was_focused) {
|
||||||
// don't ask me why, but client doesn't seem to keep focus in new window
|
// don't ask me why, but client doesn't seem to keep focus in new window
|
||||||
|
@ -1545,7 +1544,7 @@ void FluxboxWindow::setLayerNum(int layernum) {
|
||||||
|
|
||||||
if (m_initialized) {
|
if (m_initialized) {
|
||||||
fbdbg<<this<<" notify layer signal"<<endl;
|
fbdbg<<this<<" notify layer signal"<<endl;
|
||||||
m_layersig.notify();
|
m_layersig.emit(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -459,8 +459,7 @@ public:
|
||||||
@{
|
@{
|
||||||
*/
|
*/
|
||||||
FbTk::Signal<FluxboxWindow &> &stateSig() { return m_statesig; }
|
FbTk::Signal<FluxboxWindow &> &stateSig() { return m_statesig; }
|
||||||
FbTk::Subject &layerSig() { return m_layersig; }
|
FbTk::Signal<FluxboxWindow &> &layerSig() { return m_layersig; }
|
||||||
const FbTk::Subject &layerSig() const { return m_layersig; }
|
|
||||||
FbTk::Subject &hintSig() { return m_hintsig; }
|
FbTk::Subject &hintSig() { return m_hintsig; }
|
||||||
const FbTk::Subject &hintSig() const { return m_hintsig; }
|
const FbTk::Subject &hintSig() const { return m_hintsig; }
|
||||||
FbTk::Signal<FluxboxWindow &> &workspaceSig() { return m_workspacesig; }
|
FbTk::Signal<FluxboxWindow &> &workspaceSig() { return m_workspacesig; }
|
||||||
|
@ -539,9 +538,8 @@ private:
|
||||||
|
|
||||||
|
|
||||||
// state and hint signals
|
// state and hint signals
|
||||||
WinSubject m_hintsig,
|
WinSubject m_hintsig;
|
||||||
m_layersig;
|
FbTk::Signal<FluxboxWindow &> m_workspacesig, m_statesig, m_layersig;
|
||||||
FbTk::Signal<FluxboxWindow &> m_workspacesig, m_statesig;
|
|
||||||
|
|
||||||
time_t m_creation_time;
|
time_t m_creation_time;
|
||||||
|
|
||||||
|
|
|
@ -940,24 +940,6 @@ void Fluxbox::handleSignal(int signum) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::update(FbTk::Subject *changedsub) {
|
|
||||||
//TODO: fix signaling, this does not look good
|
|
||||||
FluxboxWindow *fbwin = 0;
|
|
||||||
|
|
||||||
if (typeid(*changedsub) == typeid(FluxboxWindow::WinSubject)) {
|
|
||||||
FluxboxWindow::WinSubject *winsub = dynamic_cast<FluxboxWindow::WinSubject *>(changedsub);
|
|
||||||
fbwin = &winsub->win();
|
|
||||||
} else if (typeid(*changedsub) == typeid(Focusable::FocusSubject)) {
|
|
||||||
Focusable::FocusSubject *winsub = dynamic_cast<Focusable::FocusSubject *>(changedsub);
|
|
||||||
fbwin = winsub->win().fbwindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fbwin && &fbwin->layerSig() == changedsub) { // layer signal
|
|
||||||
STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
|
|
||||||
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, *fbwin));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Fluxbox::windowDied(Focusable &focusable) {
|
void Fluxbox::windowDied(Focusable &focusable) {
|
||||||
FluxboxWindow *fbwin = focusable.fbwindow();
|
FluxboxWindow *fbwin = focusable.fbwindow();
|
||||||
|
|
||||||
|
@ -1024,11 +1006,15 @@ void Fluxbox::windowStateChanged(FluxboxWindow &win) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Fluxbox::windowLayerChanged(FluxboxWindow &win) {
|
||||||
|
STLUtil::forAllIf(m_atomhandler, mem_fun(&AtomHandler::update),
|
||||||
|
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::updateLayer, win));
|
||||||
|
}
|
||||||
|
|
||||||
void Fluxbox::attachSignals(FluxboxWindow &win) {
|
void Fluxbox::attachSignals(FluxboxWindow &win) {
|
||||||
win.hintSig().attach(this);
|
|
||||||
join(win.stateSig(), FbTk::MemFun(*this, &Fluxbox::windowStateChanged));
|
join(win.stateSig(), FbTk::MemFun(*this, &Fluxbox::windowStateChanged));
|
||||||
join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged));
|
join(win.workspaceSig(), FbTk::MemFun(*this, &Fluxbox::windowWorkspaceChanged));
|
||||||
win.layerSig().attach(this);
|
join(win.layerSig(), FbTk::MemFun(*this, &Fluxbox::windowLayerChanged));
|
||||||
join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied));
|
join(win.dieSig(), FbTk::MemFun(*this, &Fluxbox::windowDied));
|
||||||
STLUtil::forAll(m_atomhandler,
|
STLUtil::forAll(m_atomhandler,
|
||||||
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::setupFrame, win));
|
CallMemFunWithRefArg<AtomHandler, FluxboxWindow&, void>(&AtomHandler::setupFrame, win));
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "FbTk/App.hh"
|
#include "FbTk/App.hh"
|
||||||
#include "FbTk/Resource.hh"
|
#include "FbTk/Resource.hh"
|
||||||
#include "FbTk/Timer.hh"
|
#include "FbTk/Timer.hh"
|
||||||
#include "FbTk/Observer.hh"
|
|
||||||
#include "FbTk/SignalHandler.hh"
|
#include "FbTk/SignalHandler.hh"
|
||||||
#include "FbTk/Signal.hh"
|
#include "FbTk/Signal.hh"
|
||||||
|
|
||||||
|
@ -76,7 +75,6 @@ class FbAtoms;
|
||||||
*/
|
*/
|
||||||
class Fluxbox : public FbTk::App,
|
class Fluxbox : public FbTk::App,
|
||||||
public FbTk::SignalEventHandler,
|
public FbTk::SignalEventHandler,
|
||||||
public FbTk::Observer,
|
|
||||||
private FbTk::SignalTracker {
|
private FbTk::SignalTracker {
|
||||||
public:
|
public:
|
||||||
Fluxbox(int argc, char **argv,
|
Fluxbox(int argc, char **argv,
|
||||||
|
@ -156,7 +154,6 @@ public:
|
||||||
|
|
||||||
/// handle any system signal sent to the application
|
/// handle any system signal sent to the application
|
||||||
void handleSignal(int signum);
|
void handleSignal(int signum);
|
||||||
void update(FbTk::Subject *changed);
|
|
||||||
/// todo, remove this. just temporary
|
/// todo, remove this. just temporary
|
||||||
void updateFrameExtents(FluxboxWindow &win);
|
void updateFrameExtents(FluxboxWindow &win);
|
||||||
|
|
||||||
|
@ -225,6 +222,8 @@ private:
|
||||||
void windowWorkspaceChanged(FluxboxWindow &win);
|
void windowWorkspaceChanged(FluxboxWindow &win);
|
||||||
/// Called when a window changes state
|
/// Called when a window changes state
|
||||||
void windowStateChanged(FluxboxWindow &win);
|
void windowStateChanged(FluxboxWindow &win);
|
||||||
|
/// Called when a window layer changes
|
||||||
|
void windowLayerChanged(FluxboxWindow &win);
|
||||||
|
|
||||||
std::auto_ptr<FbAtoms> m_fbatoms;
|
std::auto_ptr<FbAtoms> m_fbatoms;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue