aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-07-01 17:59:57 (GMT)
committermarkt <markt>2007-07-01 17:59:57 (GMT)
commit7783a8c84e57c4a58d270b9722800a031f50ed62 (patch)
tree2c6f8f4ff4aede78907466a6b15bfd25fdd3600c /src
parent61b757d872778131aa773aadc9c59fdfb3fe2238 (diff)
downloadfluxbox_paul-7783a8c84e57c4a58d270b9722800a031f50ed62.zip
fluxbox_paul-7783a8c84e57c4a58d270b9722800a031f50ed62.tar.bz2
more fixes for _NET_WM_STATE_MODAL and _NET_WM_STATE_DEMANDS_ATTENTION
Diffstat (limited to 'src')
-rw-r--r--src/AttentionNoticeHandler.cc16
-rw-r--r--src/AttentionNoticeHandler.hh2
-rw-r--r--src/Ewmh.cc12
-rw-r--r--src/WinButtonTheme.cc3
-rw-r--r--src/WinClient.cc17
-rw-r--r--src/Window.cc9
6 files changed, 44 insertions, 15 deletions
diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc
index a80934a..10a087c 100644
--- a/src/AttentionNoticeHandler.cc
+++ b/src/AttentionNoticeHandler.cc
@@ -95,15 +95,31 @@ void AttentionNoticeHandler::addAttention(WinClient &client) {
95 // attach signals that will make notice go away 95 // attach signals that will make notice go away
96 client.dieSig().attach(this); 96 client.dieSig().attach(this);
97 client.focusSig().attach(this); 97 client.focusSig().attach(this);
98
99 // update _NET_WM_STATE atom
100 if (client.fbwindow())
101 client.fbwindow()->stateSig().notify();
98} 102}
99 103
100void AttentionNoticeHandler::update(FbTk::Subject *subj) { 104void AttentionNoticeHandler::update(FbTk::Subject *subj) {
101 105
106 // we need to be able to get the window
107 if (typeid(*subj) != typeid(WinClient::WinClientSubj))
108 return;
109
102 // all signals results in destruction of the notice 110 // all signals results in destruction of the notice
103 111
104 WinClient::WinClientSubj *winsubj = 112 WinClient::WinClientSubj *winsubj =
105 static_cast<WinClient::WinClientSubj *>(subj); 113 static_cast<WinClient::WinClientSubj *>(subj);
106 delete m_attentions[&winsubj->winClient()]; 114 delete m_attentions[&winsubj->winClient()];
107 m_attentions.erase(&winsubj->winClient()); 115 m_attentions.erase(&winsubj->winClient());
116
117 // update _NET_WM_STATE atom
118 FluxboxWindow *fbwin = winsubj->winClient().fbwindow();
119 if (fbwin && winsubj != &winsubj->winClient().dieSig())
120 fbwin->stateSig().notify();
108} 121}
109 122
123bool AttentionNoticeHandler::isDemandingAttention(WinClient &client) {
124 return m_attentions.find(&client) != m_attentions.end();
125}
diff --git a/src/AttentionNoticeHandler.hh b/src/AttentionNoticeHandler.hh
index 836a023..ed38d20 100644
--- a/src/AttentionNoticeHandler.hh
+++ b/src/AttentionNoticeHandler.hh
@@ -47,6 +47,8 @@ public:
47 void addAttention(WinClient &client); 47 void addAttention(WinClient &client);
48 /// removes the client from the attention map 48 /// removes the client from the attention map
49 void update(FbTk::Subject *subj); 49 void update(FbTk::Subject *subj);
50
51 bool isDemandingAttention(WinClient &client);
50 52
51private: 53private:
52 NoticeMap m_attentions; 54 NoticeMap m_attentions;
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index ef2fc09..8fede5e 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -629,21 +629,25 @@ void Ewmh::updateState(FluxboxWindow &win) {
629 state.push_back(m_net_wm_state_skip_taskbar); 629 state.push_back(m_net_wm_state_skip_taskbar);
630 if (win.isFullscreen()) 630 if (win.isFullscreen())
631 state.push_back(m_net_wm_state_fullscreen); 631 state.push_back(m_net_wm_state_fullscreen);
632 if (win.winClient().isStateModal())
633 state.push_back(m_net_wm_state_modal);
634 632
635 FluxboxWindow::ClientList::iterator it = win.clientList().begin(); 633 FluxboxWindow::ClientList::iterator it = win.clientList().begin();
636 FluxboxWindow::ClientList::iterator it_end = win.clientList().end(); 634 FluxboxWindow::ClientList::iterator it_end = win.clientList().end();
637 for (; it != it_end; ++it) { 635 for (; it != it_end; ++it) {
638 636
639 // search the old states for _NET_WM_STATE_SKIP_PAGER and append it
640 // to the current state, so it wont get deleted by us.
641 StateVec client_state(state); 637 StateVec client_state(state);
642 Atom ret_type; 638 Atom ret_type;
643 int fmt; 639 int fmt;
644 unsigned long nitems, bytes_after; 640 unsigned long nitems, bytes_after;
645 unsigned char *data = 0; 641 unsigned char *data = 0;
646 642
643 // set client-specific state
644 if ((*it)->isStateModal())
645 client_state.push_back(m_net_wm_state_modal);
646 if (Fluxbox::instance()->attentionHandler().isDemandingAttention(**it))
647 client_state.push_back(m_net_wm_state_demands_attention);
648
649 // search the old states for _NET_WM_STATE_SKIP_PAGER and append it
650 // to the current state, so it wont get deleted by us.
647 (*it)->property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM, 651 (*it)->property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM,
648 &ret_type, &fmt, &nitems, &bytes_after, 652 &ret_type, &fmt, &nitems, &bytes_after,
649 &data); 653 &data);
diff --git a/src/WinButtonTheme.cc b/src/WinButtonTheme.cc
index 22e86fc..ac6d5f7 100644
--- a/src/WinButtonTheme.cc
+++ b/src/WinButtonTheme.cc
@@ -67,7 +67,8 @@ WinButtonTheme::~WinButtonTheme() {
67void WinButtonTheme::reconfigTheme() { 67void WinButtonTheme::reconfigTheme() {
68 // rescale the pixmaps to match frame theme height 68 // rescale the pixmaps to match frame theme height
69 69
70 unsigned int size = m_frame_theme.titleHeight(); 70 unsigned int size = m_frame_theme.titleHeight()
71 - 2 * m_frame_theme.bevelWidth();
71 if (m_frame_theme.titleHeight() == 0) { 72 if (m_frame_theme.titleHeight() == 0) {
72 // calculate height from font and border width to scale pixmaps 73 // calculate height from font and border width to scale pixmaps
73 size = m_frame_theme.font().height() + 2; 74 size = m_frame_theme.font().height() + 2;
diff --git a/src/WinClient.cc b/src/WinClient.cc
index fd1944b..d4e3e72 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -129,14 +129,6 @@ WinClient::~WinClient() {
129 129
130 clearStrut(); 130 clearStrut();
131 131
132 if (m_win != 0)
133 m_win->removeClient(*this);
134
135 // this takes care of any focus issues
136 m_diesig.notify();
137
138 Fluxbox *fluxbox = Fluxbox::instance();
139
140 // 132 //
141 // clear transients and transient_for 133 // clear transients and transient_for
142 // 134 //
@@ -152,6 +144,15 @@ WinClient::~WinClient() {
152 transients.back()->transient_for = 0; 144 transients.back()->transient_for = 0;
153 transients.pop_back(); 145 transients.pop_back();
154 } 146 }
147
148 if (m_win != 0)
149 m_win->removeClient(*this);
150
151 // this takes care of any focus issues
152 m_diesig.notify();
153
154 Fluxbox *fluxbox = Fluxbox::instance();
155
155 // This fixes issue 1 (see WinClient.hh): 156 // This fixes issue 1 (see WinClient.hh):
156 // If transients die before the transient_for is created 157 // If transients die before the transient_for is created
157 removeTransientFromWaitingList(); 158 removeTransientFromWaitingList();
diff --git a/src/Window.cc b/src/Window.cc
index b44f9f7..2434d31 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -978,6 +978,11 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
978 if (client.fbwindow() != this) 978 if (client.fbwindow() != this)
979 return false; 979 return false;
980 980
981 FbTk::TextButton *button = m_labelbuttons[&client];
982 // in case the window is being destroyed, but this should never happen
983 if (!button)
984 return false;
985
981 if (&client != m_client) 986 if (&client != m_client)
982 m_screen.focusControl().setScreenFocusedWindow(client); 987 m_screen.focusControl().setScreenFocusedWindow(client);
983 m_client = &client; 988 m_client = &client;
@@ -987,10 +992,10 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
987 992
988#ifdef DEBUG 993#ifdef DEBUG
989 cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<< 994 cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<<
990 m_labelbuttons[m_client]<<endl; 995 button<<endl;
991#endif // DEBUG 996#endif // DEBUG
992 // frame focused doesn't necessarily mean input focused 997 // frame focused doesn't necessarily mean input focused
993 frame().setLabelButtonFocus(*m_labelbuttons[m_client]); 998 frame().setLabelButtonFocus(*button);
994 999
995 if (setinput && setInputFocus()) { 1000 if (setinput && setInputFocus()) {
996 return true; 1001 return true;