From a2aca6a343af4f5263c31069c984dfdd1ee6a0fa Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 1 Jul 2007 18:10:19 +0000 Subject: random fixes --- src/AttentionNoticeHandler.cc | 17 +++++++++++++++-- src/AttentionNoticeHandler.hh | 2 ++ src/Ewmh.cc | 12 ++++++++---- src/WinButtonTheme.cc | 3 ++- src/WinClient.cc | 17 +++++++++-------- src/Window.cc | 12 ++++++++---- 6 files changed, 44 insertions(+), 19 deletions(-) diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc index fec3933..3f28695 100644 --- a/src/AttentionNoticeHandler.cc +++ b/src/AttentionNoticeHandler.cc @@ -23,7 +23,7 @@ #include "AttentionNoticeHandler.hh" -#include "Focusable.hh" +#include "Window.hh" #include "Screen.hh" #include "STLUtil.hh" @@ -94,12 +94,16 @@ void AttentionNoticeHandler::addAttention(Focusable &client) { // attach signals that will make notice go away client.dieSig().attach(this); client.focusSig().attach(this); + + // update _NET_WM_STATE atom + if (client.fbwindow()) + client.fbwindow()->stateSig().notify(); } void AttentionNoticeHandler::update(FbTk::Subject *subj) { // we need to be able to get the window - if (typeid(*subj) != typeid(Focusable::FocusSubject)) + if (!subj || typeid(*subj) != typeid(Focusable::FocusSubject)) return; // all signals results in destruction of the notice @@ -109,5 +113,14 @@ void AttentionNoticeHandler::update(FbTk::Subject *subj) { delete m_attentions[&winsubj->win()]; m_attentions.erase(&winsubj->win()); winsubj->win().setAttentionState(false); + + // update _NET_WM_STATE atom + FluxboxWindow *fbwin = winsubj->win().fbwindow(); + if (fbwin && winsubj != &winsubj->win().dieSig()) + fbwin->stateSig().notify(); + } +bool AttentionNoticeHandler::isDemandingAttention(Focusable &client) { + return m_attentions.find(&client) != m_attentions.end(); +} diff --git a/src/AttentionNoticeHandler.hh b/src/AttentionNoticeHandler.hh index ddef42d..ed2245d 100644 --- a/src/AttentionNoticeHandler.hh +++ b/src/AttentionNoticeHandler.hh @@ -47,6 +47,8 @@ public: void addAttention(Focusable &client); /// removes the client from the attention map void update(FbTk::Subject *subj); + + bool isDemandingAttention(Focusable &client); private: NoticeMap m_attentions; diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 3ff4e76..afa138c 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -622,21 +622,25 @@ void Ewmh::updateState(FluxboxWindow &win) { state.push_back(m_net_wm_state_skip_taskbar); if (win.isFullscreen()) state.push_back(m_net_wm_state_fullscreen); - if (win.winClient().isStateModal()) - state.push_back(m_net_wm_state_modal); FluxboxWindow::ClientList::iterator it = win.clientList().begin(); FluxboxWindow::ClientList::iterator it_end = win.clientList().end(); for (; it != it_end; ++it) { - // search the old states for _NET_WM_STATE_SKIP_PAGER and append it - // to the current state, so it wont get deleted by us. StateVec client_state(state); Atom ret_type; int fmt; unsigned long nitems, bytes_after; unsigned char *data = 0; + // set client-specific state + if ((*it)->isStateModal()) + client_state.push_back(m_net_wm_state_modal); + if (Fluxbox::instance()->attentionHandler().isDemandingAttention(**it)) + client_state.push_back(m_net_wm_state_demands_attention); + + // search the old states for _NET_WM_STATE_SKIP_PAGER and append it + // to the current state, so it wont get deleted by us. (*it)->property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM, &ret_type, &fmt, &nitems, &bytes_after, &data); diff --git a/src/WinButtonTheme.cc b/src/WinButtonTheme.cc index 22e86fc..fa8e50f 100644 --- a/src/WinButtonTheme.cc +++ b/src/WinButtonTheme.cc @@ -67,7 +67,8 @@ WinButtonTheme::~WinButtonTheme() { void WinButtonTheme::reconfigTheme() { // rescale the pixmaps to match frame theme height - unsigned int size = m_frame_theme.titleHeight(); + unsigned int size = m_frame_theme.titleHeight() + - 2 * m_frame_theme.bevelWidth();; if (m_frame_theme.titleHeight() == 0) { // calculate height from font and border width to scale pixmaps size = m_frame_theme.font().height() + 2; diff --git a/src/WinClient.cc b/src/WinClient.cc index b731c34..ddf0599 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc @@ -126,14 +126,6 @@ WinClient::~WinClient() { clearStrut(); - if (fbwindow() != 0) - fbwindow()->removeClient(*this); - - // this takes care of any focus issues - m_diesig.notify(); - - Fluxbox *fluxbox = Fluxbox::instance(); - // // clear transients and transient_for // @@ -149,6 +141,15 @@ WinClient::~WinClient() { transients.back()->transient_for = 0; transients.pop_back(); } + + if (fbwindow() != 0) + fbwindow()->removeClient(*this); + + // this takes care of any focus issues + m_diesig.notify(); + + Fluxbox *fluxbox = Fluxbox::instance(); + // This fixes issue 1 (see WinClient.hh): // If transients die before the transient_for is created removeTransientFromWaitingList(); diff --git a/src/Window.cc b/src/Window.cc index 5c27c45..4ddd8c8 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1002,6 +1002,11 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { if (client.fbwindow() != this) return false; + IconButton *button = m_labelbuttons[&client]; + // in case the window is being destroyed, but this should never happen + if (!button) + return false; + m_client = &client; m_client->raise(); m_client->focusSig().notify(); @@ -1009,10 +1014,10 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { #ifdef DEBUG cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<< - m_labelbuttons[m_client]<isTyping() && (!client->window_group || - client->window_group != m_client->window_group) && + if (cur && client && cur->isTyping() && getRootTransientFor(m_client) != getRootTransientFor(client)) return false; -- cgit v0.11.2