remove 'friend' declaration in Window.hh

This commit is contained in:
Mark Tiefenbruck 2007-12-21 16:48:11 -08:00
parent a10b308b4e
commit f6ee704a1d
4 changed files with 28 additions and 25 deletions

View file

@ -356,24 +356,19 @@ void WinClient::updateTitle() {
m_title = string(Xutil::getWMName(window()), 0, 512); m_title = string(Xutil::getWMName(window()), 0, 512);
titleSig().notify(); titleSig().notify();
if (fbwindow())
fbwindow()->updateTitleFromClient(*this);
} }
void WinClient::setTitle(FbTk::FbString &title) { void WinClient::setTitle(FbTk::FbString &title) {
m_title = title; m_title = title;
m_title_override = true; m_title_override = true;
titleSig().notify(); titleSig().notify();
if (fbwindow())
fbwindow()->updateTitleFromClient(*this);
} }
void WinClient::saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs) { void WinClient::saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs, int nelements) {
changeProperty(FbAtoms::instance()->getFluxboxAttributesAtom(), changeProperty(FbAtoms::instance()->getFluxboxAttributesAtom(),
XA_CARDINAL, 32, PropModeReplace, XA_CARDINAL, 32, PropModeReplace,
(unsigned char *)&blackbox_attribs, (unsigned char *)&blackbox_attribs,
FluxboxWindow::PropBlackboxAttributesElements nelements);
);
} }
void WinClient::setFluxboxWindow(FluxboxWindow *win) { void WinClient::setFluxboxWindow(FluxboxWindow *win) {

View file

@ -94,7 +94,7 @@ public:
void setGroupLeftWindow(Window win); void setGroupLeftWindow(Window win);
void saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs); void saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs, int nelements);
void setFluxboxWindow(FluxboxWindow *win); void setFluxboxWindow(FluxboxWindow *win);
// does this client have a pending unmap or destroy event? // does this client have a pending unmap or destroy event?

View file

@ -628,7 +628,8 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
if (x >= 0 && button_insert_pos) if (x >= 0 && button_insert_pos)
frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos); frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos);
(*client_it)->saveBlackboxAttribs(m_blackbox_attrib); (*client_it)->saveBlackboxAttribs(m_blackbox_attrib,
PropBlackboxAttributesElements);
} }
// add client and move over all attached clients // add client and move over all attached clients
@ -657,7 +658,8 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
m_focused = true; m_focused = true;
focused_win = (focus_new || is_startup) ? &client : m_client; focused_win = (focus_new || is_startup) ? &client : m_client;
client.saveBlackboxAttribs(m_blackbox_attrib); client.saveBlackboxAttribs(m_blackbox_attrib,
PropBlackboxAttributesElements);
m_clientlist.push_back(&client); m_clientlist.push_back(&client);
} }
@ -1089,14 +1091,6 @@ void FluxboxWindow::reconfigure() {
} }
/// update current client title and title in our frame
void FluxboxWindow::updateTitleFromClient(WinClient &client) {
if (&client == m_client) {
frame().setFocusTitle(client.title());
titleSig().notify();
}
}
void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) { void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) {
const WinClient::MwmHints *hint = client.getMwmHint(); const WinClient::MwmHints *hint = client.getMwmHint();
@ -2917,6 +2911,20 @@ void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) {
//installColormap(false); //installColormap(false);
} }
void FluxboxWindow::update(FbTk::Subject *subj) {
if (subj && typeid(*subj) == typeid(Focusable::FocusSubject)) {
Focusable::FocusSubject &fsubj =
static_cast<Focusable::FocusSubject &>(*subj);
Focusable &win = fsubj.win();
if (&fsubj == &win.titleSig() && &win == m_client) {
frame().setFocusTitle(win.title());
titleSig().notify();
}
}
}
// commit current decoration values to actual displayed things // commit current decoration values to actual displayed things
void FluxboxWindow::applyDecorations(bool initial) { void FluxboxWindow::applyDecorations(bool initial) {
frame().clientArea().setBorderWidth(0); // client area bordered by other things frame().clientArea().setBorderWidth(0); // client area bordered by other things
@ -4043,6 +4051,7 @@ void FluxboxWindow::associateClient(WinClient &client) {
evm.add(*this, btn->window()); // we take care of button events for this evm.add(*this, btn->window()); // we take care of button events for this
evm.add(*this, client.window()); evm.add(*this, client.window());
client.setFluxboxWindow(this); client.setFluxboxWindow(this);
client.titleSig().attach(this);
} }
int FluxboxWindow::getDecoMaskFromString(const string &str_label) { int FluxboxWindow::getDecoMaskFromString(const string &str_label) {

View file

@ -29,6 +29,7 @@
#include "FbTk/Timer.hh" #include "FbTk/Timer.hh"
#include "FbTk/Subject.hh" #include "FbTk/Subject.hh"
#include "FbTk/Observer.hh"
#include "FbTk/EventHandler.hh" #include "FbTk/EventHandler.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/XLayerItem.hh"
#include "FbWinFrame.hh" #include "FbWinFrame.hh"
@ -58,7 +59,8 @@ class Menu;
} }
/// Creates the window frame and handles any window event for it /// Creates the window frame and handles any window event for it
class FluxboxWindow: public Focusable, public FbTk::EventHandler { class FluxboxWindow: public Focusable, public FbTk::Observer,
public FbTk::EventHandler {
public: public:
/// Motif wm Hints /// Motif wm Hints
enum { enum {
@ -366,6 +368,9 @@ public:
void leaveNotifyEvent(XCrossingEvent &ev); void leaveNotifyEvent(XCrossingEvent &ev);
//@} //@}
/// handle Subject notifications
void update(FbTk::Subject *subj);
void applyDecorations(bool initial = false); void applyDecorations(bool initial = false);
void toggleDecoration(); void toggleDecoration();
@ -536,9 +541,6 @@ private:
void attachTo(int x, int y, bool interrupted = false); void attachTo(int x, int y, bool interrupted = false);
bool getState(); bool getState();
/// gets title string from client window and updates frame's title
void updateTitleFromClient(WinClient &client);
/// gets icon name from client window
void updateMWMHintsFromClient(WinClient &client); void updateMWMHintsFromClient(WinClient &client);
void updateRememberStateFromClient(WinClient &client); void updateRememberStateFromClient(WinClient &client);
void saveBlackboxAttribs(); void saveBlackboxAttribs();
@ -613,9 +615,6 @@ private:
typedef std::map<WinClient *, IconButton *> Client2ButtonMap; typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
Client2ButtonMap m_labelbuttons; Client2ButtonMap m_labelbuttons;
// just temporary solution
friend class WinClient;
struct _decorations { struct _decorations {
bool titlebar, handle, border, iconify, bool titlebar, handle, border, iconify,
maximize, close, menu, sticky, shade, tab, enabled; maximize, close, menu, sticky, shade, tab, enabled;