From f6ee704a1d3429c6dedb03d84b4d70103cf8db15 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Fri, 21 Dec 2007 16:48:11 -0800 Subject: remove 'friend' declaration in Window.hh --- src/WinClient.cc | 9 ++------- src/WinClient.hh | 2 +- src/Window.cc | 29 +++++++++++++++++++---------- src/Window.hh | 13 ++++++------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/WinClient.cc b/src/WinClient.cc index fb9fec6..5a3c924 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc @@ -356,24 +356,19 @@ void WinClient::updateTitle() { m_title = string(Xutil::getWMName(window()), 0, 512); titleSig().notify(); - if (fbwindow()) - fbwindow()->updateTitleFromClient(*this); } void WinClient::setTitle(FbTk::FbString &title) { m_title = title; m_title_override = true; 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(), XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&blackbox_attribs, - FluxboxWindow::PropBlackboxAttributesElements - ); + nelements); } void WinClient::setFluxboxWindow(FluxboxWindow *win) { diff --git a/src/WinClient.hh b/src/WinClient.hh index 035ece5..2441af8 100644 --- a/src/WinClient.hh +++ b/src/WinClient.hh @@ -94,7 +94,7 @@ public: void setGroupLeftWindow(Window win); - void saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs); + void saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs, int nelements); void setFluxboxWindow(FluxboxWindow *win); // does this client have a pending unmap or destroy event? diff --git a/src/Window.cc b/src/Window.cc index d99d1c1..fed465e 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -628,7 +628,8 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { if (x >= 0 && 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 @@ -657,7 +658,8 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { m_focused = true; 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); } @@ -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) { const WinClient::MwmHints *hint = client.getMwmHint(); @@ -2917,6 +2911,20 @@ void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) { //installColormap(false); } +void FluxboxWindow::update(FbTk::Subject *subj) { + if (subj && typeid(*subj) == typeid(Focusable::FocusSubject)) { + Focusable::FocusSubject &fsubj = + static_cast(*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 void FluxboxWindow::applyDecorations(bool initial) { 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, client.window()); client.setFluxboxWindow(this); + client.titleSig().attach(this); } int FluxboxWindow::getDecoMaskFromString(const string &str_label) { diff --git a/src/Window.hh b/src/Window.hh index 66c6f2b..032ea07 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -29,6 +29,7 @@ #include "FbTk/Timer.hh" #include "FbTk/Subject.hh" +#include "FbTk/Observer.hh" #include "FbTk/EventHandler.hh" #include "FbTk/XLayerItem.hh" #include "FbWinFrame.hh" @@ -58,7 +59,8 @@ class Menu; } /// 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: /// Motif wm Hints enum { @@ -366,6 +368,9 @@ public: void leaveNotifyEvent(XCrossingEvent &ev); //@} + /// handle Subject notifications + void update(FbTk::Subject *subj); + void applyDecorations(bool initial = false); void toggleDecoration(); @@ -536,9 +541,6 @@ private: void attachTo(int x, int y, bool interrupted = false); 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 updateRememberStateFromClient(WinClient &client); void saveBlackboxAttribs(); @@ -613,9 +615,6 @@ private: typedef std::map Client2ButtonMap; Client2ButtonMap m_labelbuttons; - // just temporary solution - friend class WinClient; - struct _decorations { bool titlebar, handle, border, iconify, maximize, close, menu, sticky, shade, tab, enabled; -- cgit v0.11.2