~ubuntu-branches/ubuntu/trusty/fluxbox/trusty-proposed

« back to all changes in this revision

Viewing changes to src/FocusableList.cc

  • Committer: Package Import Robot
  • Author(s): Paul Tagliamonte
  • Date: 2010-08-12 21:16:02 UTC
  • mfrom: (0.1.1) (1.1.10)
  • Revision ID: package-import@ubuntu.com-20100812211602-3tsmzl9in5nmwz7z
Tags: 1.1.1+git20100807.0cc08f9-1
* debian/ dir has been cleaned out, complete repackage
  of most files.
* pulled new archive from git.fluxbox.org HEAD, saved as
  tar.gz.
* Added in fluxbox.* files from the old dfsg tree.
* Added in system.fluxbox-menu file from the old dfsg tree
* Added the source/format file to bump package source
  version from 1.0 to 3.0 (quilt). 
* Changed rules file to match the old dfsg setup so that
  fluxbox behaves nicely.
* Removed entries from copyright that no longer apply.
* Added theme based on Denis Brand ( naran )'s old theme.
* Added a background I whipped up.
* Changed compile flags to point to debian theme by default
* Adding a patch to have fluxbox use x-terminal-emulator
  over xterm. Closes: #591694 (LP: #580485)
* Adding a patch to allow titlebar-window dragging.
* Changed the flags in rules to pull from a script. This script
  lets us un-hardcode what theme is default. Be sure there
  is a theme pack!
* Added comments to my patches.
* Removing debian/docs, empty file.
* Fixing fluxbox.desktop to remove all the warnings from
  desktop-file-validate
* Fixing libtool issue by running an update before
  configure in the rules script.
* Added a compile flag script to auto-detect what platform
  we are running on, and apply the correct theme. This
  should solve Ubuntnu issues later on.
* adding in a get-orig-source rule
* fixing the upstream version number to pinpoint
  the commit ( thanks, lfaraone ).
* adding a rule for get-orig-source. ( thanks again,
  lfaraone ).
* Updated rules to actually allow us to do a build from it
* Removed Denis from the uploaders ( as per an email
  conversation )
* Removing madduck from the uploaders ( thanks for asking,
  lfaraone. ). Thanks for your hard work, madduck.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "Window.hh"
29
29
 
30
30
#include "FbTk/StringUtil.hh"
 
31
#include "FbTk/MemFun.hh"
31
32
 
32
33
#include <vector>
33
34
 
95
96
    m_parent->attachChild(*this);
96
97
 
97
98
    // TODO: can't handle (head=[mouse]) yet
98
 
    if (m_pat->dependsOnCurrentWorkspace())
99
 
        m_screen.currentWorkspaceSig().attach(this);
100
 
    if (m_pat->dependsOnFocusedWindow())
101
 
        m_screen.focusedWindowSig().attach(this);
 
99
    if (m_pat->dependsOnCurrentWorkspace()) {
 
100
        join(m_screen.currentWorkspaceSig(),
 
101
             FbTk::MemFun(*this, &FocusableList::workspaceChanged));
 
102
    }
 
103
    if (m_pat->dependsOnFocusedWindow()) {
 
104
        join(m_screen.focusedWindowSig(),
 
105
             FbTk::MemFun(*this, &FocusableList::focusedWindowChanged));
 
106
    }
102
107
}
103
108
 
104
109
void FocusableList::update(FbTk::Subject *subj) {
108
113
    if (typeid(*subj) == typeid(Focusable::FocusSubject)) {
109
114
        Focusable::FocusSubject *fsubj =
110
115
            static_cast<Focusable::FocusSubject *>(subj);
111
 
        if (fsubj == &fsubj->win().dieSig())
 
116
        if (fsubj == &fsubj->win().dieSig()) {
112
117
            remove(fsubj->win());
113
 
        else if (fsubj == &fsubj->win().titleSig())
114
 
            checkUpdate(fsubj->win());
 
118
        }
115
119
    }
116
120
    if (typeid(*subj) == typeid(FluxboxWindow::WinSubject)) {
117
121
        FluxboxWindow::WinSubject *fsubj =
147
151
            if (insertFromParent(*win))
148
152
                m_ordersig.notify(win);
149
153
        }
150
 
    } else if (subj == &m_screen.currentWorkspaceSig() ||
151
 
               subj == &m_screen.focusedWindowSig())
152
 
        reset();
 
154
    }
153
155
}
154
156
 
155
157
void FocusableList::checkUpdate(Focusable &win) {
241
243
    bool contained = contains(win);
242
244
 
243
245
    detachSignals(win);
244
 
    if (!contained)
 
246
    if (!contained) {
245
247
        return;
 
248
    }
246
249
    m_list.remove(&win);
247
250
    m_removesig.notify(&win);
248
251
}
249
252
 
 
253
void FocusableList::updateTitle(Focusable& win) {
 
254
    checkUpdate(win);
 
255
}
 
256
 
250
257
void FocusableList::attachSignals(Focusable &win) {
251
258
    win.dieSig().attach(this);
252
259
    if (m_parent) {
253
260
        // attach various signals for matching
254
 
        win.titleSig().attach(this);
 
261
        if (m_signal_map.find(&win) == m_signal_map.end()) {
 
262
            m_signal_map[&win] = join(win.titleSig(),
 
263
                                      MemFunSelectArg1(*this,
 
264
                                                       &FocusableList::updateTitle));
 
265
        }
 
266
 
255
267
        FluxboxWindow *fbwin = win.fbwindow();
256
268
        if (!fbwin)
257
269
            return;
265
277
void FocusableList::detachSignals(Focusable &win) {
266
278
    win.dieSig().detach(this);
267
279
    if (m_parent) {
 
280
        // disconnect client
 
281
        SignalMap::iterator sigIt = m_signal_map.find(&win);
 
282
        if (sigIt != m_signal_map.end()) {
 
283
            leave(sigIt->second);
 
284
            m_signal_map.erase(sigIt);
 
285
        }
 
286
 
268
287
        // detach various signals for matching
269
 
        win.titleSig().detach(this);
270
288
        FluxboxWindow *fbwin = win.fbwindow();
271
289
        if (!fbwin)
272
290
            return;
309
327
    m_resetsig.attach(&child);
310
328
    m_ordersig.attach(&child);
311
329
}
 
330
 
 
331
void FocusableList::workspaceChanged(BScreen &screen) {
 
332
    reset();
 
333
}
 
334
 
 
335
void FocusableList::focusedWindowChanged(BScreen &screen,
 
336
                                         FluxboxWindow *focused_win,
 
337
                                         WinClient *client) {
 
338
    reset();
 
339
}