more fixes for _NET_WM_STATE_MODAL and _NET_WM_STATE_DEMANDS_ATTENTION
This commit is contained in:
parent
61b757d872
commit
7783a8c84e
7 changed files with 49 additions and 15 deletions
|
@ -1,5 +1,10 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 1.0.0:
|
Changes for 1.0.0:
|
||||||
|
*07/07/01:
|
||||||
|
* More fixes for _NET_WM_STATE_MODAL and _NET_WM_STATE_DEMANDS_ATTENTION,
|
||||||
|
plus a minor fix for pixmap styles (Mark)
|
||||||
|
Ewmh.cc Window.cc AttentionNoticeHandler.cc/hh WinClient.cc
|
||||||
|
WinButtonTheme.cc
|
||||||
*07/06/30:
|
*07/06/30:
|
||||||
* Fixed implementation of _NET_WM_STATE_MODAL (Mark)
|
* Fixed implementation of _NET_WM_STATE_MODAL (Mark)
|
||||||
Ewmh.cc/hh WinClient.cc/hh Window.cc
|
Ewmh.cc/hh WinClient.cc/hh Window.cc
|
||||||
|
|
|
@ -95,15 +95,31 @@ void AttentionNoticeHandler::addAttention(WinClient &client) {
|
||||||
// attach signals that will make notice go away
|
// attach signals that will make notice go away
|
||||||
client.dieSig().attach(this);
|
client.dieSig().attach(this);
|
||||||
client.focusSig().attach(this);
|
client.focusSig().attach(this);
|
||||||
|
|
||||||
|
// update _NET_WM_STATE atom
|
||||||
|
if (client.fbwindow())
|
||||||
|
client.fbwindow()->stateSig().notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttentionNoticeHandler::update(FbTk::Subject *subj) {
|
void AttentionNoticeHandler::update(FbTk::Subject *subj) {
|
||||||
|
|
||||||
|
// we need to be able to get the window
|
||||||
|
if (typeid(*subj) != typeid(WinClient::WinClientSubj))
|
||||||
|
return;
|
||||||
|
|
||||||
// all signals results in destruction of the notice
|
// all signals results in destruction of the notice
|
||||||
|
|
||||||
WinClient::WinClientSubj *winsubj =
|
WinClient::WinClientSubj *winsubj =
|
||||||
static_cast<WinClient::WinClientSubj *>(subj);
|
static_cast<WinClient::WinClientSubj *>(subj);
|
||||||
delete m_attentions[&winsubj->winClient()];
|
delete m_attentions[&winsubj->winClient()];
|
||||||
m_attentions.erase(&winsubj->winClient());
|
m_attentions.erase(&winsubj->winClient());
|
||||||
|
|
||||||
|
// update _NET_WM_STATE atom
|
||||||
|
FluxboxWindow *fbwin = winsubj->winClient().fbwindow();
|
||||||
|
if (fbwin && winsubj != &winsubj->winClient().dieSig())
|
||||||
|
fbwin->stateSig().notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AttentionNoticeHandler::isDemandingAttention(WinClient &client) {
|
||||||
|
return m_attentions.find(&client) != m_attentions.end();
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ public:
|
||||||
/// removes the client from the attention map
|
/// removes the client from the attention map
|
||||||
void update(FbTk::Subject *subj);
|
void update(FbTk::Subject *subj);
|
||||||
|
|
||||||
|
bool isDemandingAttention(WinClient &client);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NoticeMap m_attentions;
|
NoticeMap m_attentions;
|
||||||
};
|
};
|
||||||
|
|
12
src/Ewmh.cc
12
src/Ewmh.cc
|
@ -629,21 +629,25 @@ void Ewmh::updateState(FluxboxWindow &win) {
|
||||||
state.push_back(m_net_wm_state_skip_taskbar);
|
state.push_back(m_net_wm_state_skip_taskbar);
|
||||||
if (win.isFullscreen())
|
if (win.isFullscreen())
|
||||||
state.push_back(m_net_wm_state_fullscreen);
|
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 = win.clientList().begin();
|
||||||
FluxboxWindow::ClientList::iterator it_end = win.clientList().end();
|
FluxboxWindow::ClientList::iterator it_end = win.clientList().end();
|
||||||
for (; it != it_end; ++it) {
|
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);
|
StateVec client_state(state);
|
||||||
Atom ret_type;
|
Atom ret_type;
|
||||||
int fmt;
|
int fmt;
|
||||||
unsigned long nitems, bytes_after;
|
unsigned long nitems, bytes_after;
|
||||||
unsigned char *data = 0;
|
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,
|
(*it)->property(m_net_wm_state, 0, 0x7fffffff, False, XA_ATOM,
|
||||||
&ret_type, &fmt, &nitems, &bytes_after,
|
&ret_type, &fmt, &nitems, &bytes_after,
|
||||||
&data);
|
&data);
|
||||||
|
|
|
@ -67,7 +67,8 @@ WinButtonTheme::~WinButtonTheme() {
|
||||||
void WinButtonTheme::reconfigTheme() {
|
void WinButtonTheme::reconfigTheme() {
|
||||||
// rescale the pixmaps to match frame theme height
|
// 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) {
|
if (m_frame_theme.titleHeight() == 0) {
|
||||||
// calculate height from font and border width to scale pixmaps
|
// calculate height from font and border width to scale pixmaps
|
||||||
size = m_frame_theme.font().height() + 2;
|
size = m_frame_theme.font().height() + 2;
|
||||||
|
|
|
@ -129,14 +129,6 @@ WinClient::~WinClient() {
|
||||||
|
|
||||||
clearStrut();
|
clearStrut();
|
||||||
|
|
||||||
if (m_win != 0)
|
|
||||||
m_win->removeClient(*this);
|
|
||||||
|
|
||||||
// this takes care of any focus issues
|
|
||||||
m_diesig.notify();
|
|
||||||
|
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// clear transients and transient_for
|
// clear transients and transient_for
|
||||||
//
|
//
|
||||||
|
@ -152,6 +144,15 @@ WinClient::~WinClient() {
|
||||||
transients.back()->transient_for = 0;
|
transients.back()->transient_for = 0;
|
||||||
transients.pop_back();
|
transients.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_win != 0)
|
||||||
|
m_win->removeClient(*this);
|
||||||
|
|
||||||
|
// this takes care of any focus issues
|
||||||
|
m_diesig.notify();
|
||||||
|
|
||||||
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
|
||||||
// This fixes issue 1 (see WinClient.hh):
|
// This fixes issue 1 (see WinClient.hh):
|
||||||
// If transients die before the transient_for is created
|
// If transients die before the transient_for is created
|
||||||
removeTransientFromWaitingList();
|
removeTransientFromWaitingList();
|
||||||
|
|
|
@ -978,6 +978,11 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
|
||||||
if (client.fbwindow() != this)
|
if (client.fbwindow() != this)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
FbTk::TextButton *button = m_labelbuttons[&client];
|
||||||
|
// in case the window is being destroyed, but this should never happen
|
||||||
|
if (!button)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (&client != m_client)
|
if (&client != m_client)
|
||||||
m_screen.focusControl().setScreenFocusedWindow(client);
|
m_screen.focusControl().setScreenFocusedWindow(client);
|
||||||
m_client = &client;
|
m_client = &client;
|
||||||
|
@ -987,10 +992,10 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<<
|
cerr<<"FluxboxWindow::"<<__FUNCTION__<<": labelbutton[client] = "<<
|
||||||
m_labelbuttons[m_client]<<endl;
|
button<<endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
// frame focused doesn't necessarily mean input focused
|
// frame focused doesn't necessarily mean input focused
|
||||||
frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
|
frame().setLabelButtonFocus(*button);
|
||||||
|
|
||||||
if (setinput && setInputFocus()) {
|
if (setinput && setInputFocus()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue