diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/WinClient.cc | 9 | ||||
-rw-r--r-- | src/WinClient.hh | 2 | ||||
-rw-r--r-- | src/Window.cc | 29 | ||||
-rw-r--r-- | 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() { | |||
356 | 356 | ||
357 | m_title = string(Xutil::getWMName(window()), 0, 512); | 357 | m_title = string(Xutil::getWMName(window()), 0, 512); |
358 | titleSig().notify(); | 358 | titleSig().notify(); |
359 | if (fbwindow()) | ||
360 | fbwindow()->updateTitleFromClient(*this); | ||
361 | } | 359 | } |
362 | 360 | ||
363 | void WinClient::setTitle(FbTk::FbString &title) { | 361 | void WinClient::setTitle(FbTk::FbString &title) { |
364 | m_title = title; | 362 | m_title = title; |
365 | m_title_override = true; | 363 | m_title_override = true; |
366 | titleSig().notify(); | 364 | titleSig().notify(); |
367 | if (fbwindow()) | ||
368 | fbwindow()->updateTitleFromClient(*this); | ||
369 | } | 365 | } |
370 | 366 | ||
371 | void WinClient::saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs) { | 367 | void WinClient::saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs, int nelements) { |
372 | changeProperty(FbAtoms::instance()->getFluxboxAttributesAtom(), | 368 | changeProperty(FbAtoms::instance()->getFluxboxAttributesAtom(), |
373 | XA_CARDINAL, 32, PropModeReplace, | 369 | XA_CARDINAL, 32, PropModeReplace, |
374 | (unsigned char *)&blackbox_attribs, | 370 | (unsigned char *)&blackbox_attribs, |
375 | FluxboxWindow::PropBlackboxAttributesElements | 371 | nelements); |
376 | ); | ||
377 | } | 372 | } |
378 | 373 | ||
379 | void WinClient::setFluxboxWindow(FluxboxWindow *win) { | 374 | 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: | |||
94 | 94 | ||
95 | void setGroupLeftWindow(Window win); | 95 | void setGroupLeftWindow(Window win); |
96 | 96 | ||
97 | void saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs); | 97 | void saveBlackboxAttribs(FluxboxWindow::BlackboxAttributes &blackbox_attribs, int nelements); |
98 | void setFluxboxWindow(FluxboxWindow *win); | 98 | void setFluxboxWindow(FluxboxWindow *win); |
99 | 99 | ||
100 | // does this client have a pending unmap or destroy event? | 100 | // 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) { | |||
628 | if (x >= 0 && button_insert_pos) | 628 | if (x >= 0 && button_insert_pos) |
629 | frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos); | 629 | frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos); |
630 | 630 | ||
631 | (*client_it)->saveBlackboxAttribs(m_blackbox_attrib); | 631 | (*client_it)->saveBlackboxAttribs(m_blackbox_attrib, |
632 | PropBlackboxAttributesElements); | ||
632 | } | 633 | } |
633 | 634 | ||
634 | // add client and move over all attached clients | 635 | // add client and move over all attached clients |
@@ -657,7 +658,8 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) { | |||
657 | m_focused = true; | 658 | m_focused = true; |
658 | focused_win = (focus_new || is_startup) ? &client : m_client; | 659 | focused_win = (focus_new || is_startup) ? &client : m_client; |
659 | 660 | ||
660 | client.saveBlackboxAttribs(m_blackbox_attrib); | 661 | client.saveBlackboxAttribs(m_blackbox_attrib, |
662 | PropBlackboxAttributesElements); | ||
661 | m_clientlist.push_back(&client); | 663 | m_clientlist.push_back(&client); |
662 | } | 664 | } |
663 | 665 | ||
@@ -1089,14 +1091,6 @@ void FluxboxWindow::reconfigure() { | |||
1089 | 1091 | ||
1090 | } | 1092 | } |
1091 | 1093 | ||
1092 | /// update current client title and title in our frame | ||
1093 | void FluxboxWindow::updateTitleFromClient(WinClient &client) { | ||
1094 | if (&client == m_client) { | ||
1095 | frame().setFocusTitle(client.title()); | ||
1096 | titleSig().notify(); | ||
1097 | } | ||
1098 | } | ||
1099 | |||
1100 | void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) { | 1094 | void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) { |
1101 | const WinClient::MwmHints *hint = client.getMwmHint(); | 1095 | const WinClient::MwmHints *hint = client.getMwmHint(); |
1102 | 1096 | ||
@@ -2917,6 +2911,20 @@ void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) { | |||
2917 | //installColormap(false); | 2911 | //installColormap(false); |
2918 | } | 2912 | } |
2919 | 2913 | ||
2914 | void FluxboxWindow::update(FbTk::Subject *subj) { | ||
2915 | if (subj && typeid(*subj) == typeid(Focusable::FocusSubject)) { | ||
2916 | Focusable::FocusSubject &fsubj = | ||
2917 | static_cast<Focusable::FocusSubject &>(*subj); | ||
2918 | Focusable &win = fsubj.win(); | ||
2919 | |||
2920 | if (&fsubj == &win.titleSig() && &win == m_client) { | ||
2921 | frame().setFocusTitle(win.title()); | ||
2922 | titleSig().notify(); | ||
2923 | } | ||
2924 | |||
2925 | } | ||
2926 | } | ||
2927 | |||
2920 | // commit current decoration values to actual displayed things | 2928 | // commit current decoration values to actual displayed things |
2921 | void FluxboxWindow::applyDecorations(bool initial) { | 2929 | void FluxboxWindow::applyDecorations(bool initial) { |
2922 | frame().clientArea().setBorderWidth(0); // client area bordered by other things | 2930 | frame().clientArea().setBorderWidth(0); // client area bordered by other things |
@@ -4043,6 +4051,7 @@ void FluxboxWindow::associateClient(WinClient &client) { | |||
4043 | evm.add(*this, btn->window()); // we take care of button events for this | 4051 | evm.add(*this, btn->window()); // we take care of button events for this |
4044 | evm.add(*this, client.window()); | 4052 | evm.add(*this, client.window()); |
4045 | client.setFluxboxWindow(this); | 4053 | client.setFluxboxWindow(this); |
4054 | client.titleSig().attach(this); | ||
4046 | } | 4055 | } |
4047 | 4056 | ||
4048 | int FluxboxWindow::getDecoMaskFromString(const string &str_label) { | 4057 | 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 @@ | |||
29 | 29 | ||
30 | #include "FbTk/Timer.hh" | 30 | #include "FbTk/Timer.hh" |
31 | #include "FbTk/Subject.hh" | 31 | #include "FbTk/Subject.hh" |
32 | #include "FbTk/Observer.hh" | ||
32 | #include "FbTk/EventHandler.hh" | 33 | #include "FbTk/EventHandler.hh" |
33 | #include "FbTk/XLayerItem.hh" | 34 | #include "FbTk/XLayerItem.hh" |
34 | #include "FbWinFrame.hh" | 35 | #include "FbWinFrame.hh" |
@@ -58,7 +59,8 @@ class Menu; | |||
58 | } | 59 | } |
59 | 60 | ||
60 | /// Creates the window frame and handles any window event for it | 61 | /// Creates the window frame and handles any window event for it |
61 | class FluxboxWindow: public Focusable, public FbTk::EventHandler { | 62 | class FluxboxWindow: public Focusable, public FbTk::Observer, |
63 | public FbTk::EventHandler { | ||
62 | public: | 64 | public: |
63 | /// Motif wm Hints | 65 | /// Motif wm Hints |
64 | enum { | 66 | enum { |
@@ -366,6 +368,9 @@ public: | |||
366 | void leaveNotifyEvent(XCrossingEvent &ev); | 368 | void leaveNotifyEvent(XCrossingEvent &ev); |
367 | //@} | 369 | //@} |
368 | 370 | ||
371 | /// handle Subject notifications | ||
372 | void update(FbTk::Subject *subj); | ||
373 | |||
369 | void applyDecorations(bool initial = false); | 374 | void applyDecorations(bool initial = false); |
370 | void toggleDecoration(); | 375 | void toggleDecoration(); |
371 | 376 | ||
@@ -536,9 +541,6 @@ private: | |||
536 | void attachTo(int x, int y, bool interrupted = false); | 541 | void attachTo(int x, int y, bool interrupted = false); |
537 | 542 | ||
538 | bool getState(); | 543 | bool getState(); |
539 | /// gets title string from client window and updates frame's title | ||
540 | void updateTitleFromClient(WinClient &client); | ||
541 | /// gets icon name from client window | ||
542 | void updateMWMHintsFromClient(WinClient &client); | 544 | void updateMWMHintsFromClient(WinClient &client); |
543 | void updateRememberStateFromClient(WinClient &client); | 545 | void updateRememberStateFromClient(WinClient &client); |
544 | void saveBlackboxAttribs(); | 546 | void saveBlackboxAttribs(); |
@@ -613,9 +615,6 @@ private: | |||
613 | typedef std::map<WinClient *, IconButton *> Client2ButtonMap; | 615 | typedef std::map<WinClient *, IconButton *> Client2ButtonMap; |
614 | Client2ButtonMap m_labelbuttons; | 616 | Client2ButtonMap m_labelbuttons; |
615 | 617 | ||
616 | // just temporary solution | ||
617 | friend class WinClient; | ||
618 | |||
619 | struct _decorations { | 618 | struct _decorations { |
620 | bool titlebar, handle, border, iconify, | 619 | bool titlebar, handle, border, iconify, |
621 | maximize, close, menu, sticky, shade, tab, enabled; | 620 | maximize, close, menu, sticky, shade, tab, enabled; |