added support for _NET_WM_WINDOW_TYPE_DIALOG and _NET_FRAME_EXTENTS

This commit is contained in:
fluxgen 2006-06-18 21:23:24 +00:00
parent 7d5f6e382b
commit 85f45be727
6 changed files with 63 additions and 5 deletions

View file

@ -53,7 +53,7 @@ public:
virtual void updateState(FluxboxWindow &win) = 0; virtual void updateState(FluxboxWindow &win) = 0;
virtual void updateHints(FluxboxWindow &win) = 0; virtual void updateHints(FluxboxWindow &win) = 0;
virtual void updateLayer(FluxboxWindow &win) = 0; virtual void updateLayer(FluxboxWindow &win) = 0;
virtual void updateFrameExtents(FluxboxWindow &win) { }
virtual bool checkClientMessage(const XClientMessageEvent &ce, virtual bool checkClientMessage(const XClientMessageEvent &ce,
BScreen * screen, WinClient * const winclient) = 0; BScreen * screen, WinClient * const winclient) = 0;

View file

@ -140,6 +140,7 @@ void Ewmh::initForScreen(BScreen &screen) {
m_net_wm_window_type_dock, m_net_wm_window_type_dock,
m_net_wm_window_type_desktop, m_net_wm_window_type_desktop,
m_net_wm_window_type_splash, m_net_wm_window_type_splash,
m_net_wm_window_type_dialog,
m_net_wm_window_type_normal, m_net_wm_window_type_normal,
// window actions // window actions
@ -168,6 +169,7 @@ void Ewmh::initForScreen(BScreen &screen) {
m_net_wm_moveresize, m_net_wm_moveresize,
m_net_frame_extents,
// desktop properties // desktop properties
m_net_wm_desktop, m_net_wm_desktop,
@ -259,7 +261,6 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
// we also assume it shouldn't be visible in any toolbar // we also assume it shouldn't be visible in any toolbar
win.setFocusHidden(true); win.setFocusHidden(true);
win.setIconHidden(true); win.setIconHidden(true);
break;
} else if (atoms[l] == m_net_wm_window_type_desktop) { } else if (atoms[l] == m_net_wm_window_type_desktop) {
/* /*
* _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window * _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window
@ -284,13 +285,27 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
* is starting up. * is starting up.
*/ */
win.setDecoration(FluxboxWindow::DECOR_NONE); win.setDecoration(FluxboxWindow::DECOR_NONE);
win.setFocusHidden(true);
win.setIconHidden(true);
win.setMovable(false); win.setMovable(false);
} else if (atoms[l] == m_net_wm_window_type_normal) { } else if (atoms[l] == m_net_wm_window_type_normal) {
// do nothing, this is ..normal.. // do nothing, this is ..normal..
} else if (atoms[l] == m_net_wm_window_type_dialog) {
// dialog windows should not be tabable
win.setTabable(false);
} }
} }
XFree(data); XFree(data);
} else {
// if _NET_WM_WINDOW_TYPE not set and this window
// has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG
if ( win.winClient().isTransient() ) {
win.winClient().
changeProperty(m_net_wm_window_type,
XA_ATOM, 32, PropModeReplace,
(unsigned char*)&m_net_wm_window_type_dialog, 1);
}
} }
setupState(win); setupState(win);
@ -305,8 +320,11 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
win.setWorkspace(desktop); win.setWorkspace(desktop);
XFree(data); XFree(data);
} else } else {
updateWorkspace(win); updateWorkspace(win);
}
updateFrameExtents(win);
} }
@ -940,6 +958,7 @@ void Ewmh::createAtoms() {
m_net_wm_window_type_dock = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_DOCK", False); m_net_wm_window_type_dock = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_DOCK", False);
m_net_wm_window_type_desktop = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_DESKTOP", False); m_net_wm_window_type_desktop = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_DESKTOP", False);
m_net_wm_window_type_splash = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_SPLASH", False); m_net_wm_window_type_splash = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_SPLASH", False);
m_net_wm_window_type_dialog = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_DIALOG", False);
m_net_wm_window_type_normal = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_NORMAL", False); m_net_wm_window_type_normal = XInternAtom(disp, "_NET_WM_WINDOW_TYPE_NORMAL", False);
// state atom and the supported state atoms // state atom and the supported state atoms
@ -976,6 +995,8 @@ void Ewmh::createAtoms() {
m_net_wm_pid = XInternAtom(disp, "_NET_WM_PID", False); m_net_wm_pid = XInternAtom(disp, "_NET_WM_PID", False);
m_net_wm_handled_icons = XInternAtom(disp, "_NET_WM_HANDLED_ICONS", False); m_net_wm_handled_icons = XInternAtom(disp, "_NET_WM_HANDLED_ICONS", False);
m_net_frame_extents = XInternAtom(disp, "_NET_FRAME_EXTENTS", False);
m_net_wm_ping = XInternAtom(disp, "_NET_WM_PING", False); m_net_wm_ping = XInternAtom(disp, "_NET_WM_PING", False);
utf8_string = XInternAtom(disp, "UTF8_STRING", False); utf8_string = XInternAtom(disp, "UTF8_STRING", False);
} }
@ -1220,6 +1241,23 @@ void Ewmh::setupState(FluxboxWindow &win) {
} }
} }
void Ewmh::updateFrameExtents(FluxboxWindow &win) {
int extents[4];
extents[0] = win.frame().x();
extents[1] = win.frame().x() + win.frame().width();
extents[2] = win.frame().y();
extents[3] = win.frame().y() + win.frame().height();
FluxboxWindow::ClientList::iterator it = win.clientList().begin();
FluxboxWindow::ClientList::iterator it_end = win.clientList().end();
for (; it != it_end; ++it) {
(*it)->changeProperty(m_net_frame_extents,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *)extents, 4);
}
}
Ewmh::WindowState::WindowState(int t_x, int t_y, Ewmh::WindowState::WindowState(int t_x, int t_y,
unsigned int t_width, unsigned int t_width,
unsigned int t_height, unsigned int t_height,
@ -1255,3 +1293,4 @@ void Ewmh::saveState(FluxboxWindow &win, WindowState *state) {
m_savedstate[&win] = state; m_savedstate[&win] = state;
} }

View file

@ -64,6 +64,7 @@ public:
void setFullscreen(FluxboxWindow &win, bool value); void setFullscreen(FluxboxWindow &win, bool value);
void updateFrameExtents(FluxboxWindow &win);
private: private:
typedef struct WindowState { typedef struct WindowState {
@ -83,6 +84,7 @@ private:
void setupState(FluxboxWindow &win); void setupState(FluxboxWindow &win);
// root window properties // root window properties
Atom m_net_supported, Atom m_net_supported,
m_net_client_list, m_net_client_list,
@ -110,6 +112,7 @@ private:
m_net_wm_window_type_dock, m_net_wm_window_type_dock,
m_net_wm_window_type_desktop, m_net_wm_window_type_desktop,
m_net_wm_window_type_splash, m_net_wm_window_type_splash,
m_net_wm_window_type_dialog,
m_net_wm_window_type_normal, m_net_wm_window_type_normal,
// states // states
@ -137,7 +140,9 @@ private:
m_net_wm_action_close, m_net_wm_action_close,
m_net_wm_strut, m_net_wm_icon_geometry, m_net_wm_icon, m_net_wm_pid, m_net_wm_strut, m_net_wm_icon_geometry, m_net_wm_icon, m_net_wm_pid,
m_net_wm_handled_icons; m_net_wm_handled_icons,
m_net_frame_extents;
// application protocols // application protocols
Atom m_net_wm_ping; Atom m_net_wm_ping;

View file

@ -3900,6 +3900,10 @@ void FluxboxWindow::sendConfigureNotify(bool send_to_netizens) {
screen().updateNetizenConfigNotify(event); screen().updateNetizenConfigNotify(event);
} }
} // end for } // end for
if (send_to_netizens) {
Fluxbox::instance()->updateFrameExtents(*this);
}
} }

View file

@ -1847,3 +1847,11 @@ void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) {
screen.rootWindow().window(), True, screen.rootWindow().window(), True,
GrabModeAsync, GrabModeAsync, CurrentTime); GrabModeAsync, GrabModeAsync, CurrentTime);
} }
void Fluxbox::updateFrameExtents(FluxboxWindow &win) {
AtomHandlerContainerIt it = m_atomhandler.begin();
AtomHandlerContainerIt it_end = m_atomhandler.end();
for (; it != it_end; ++it ) {
(*it).first->updateFrameExtents(win);
}
}

View file

@ -182,6 +182,8 @@ public:
* @param old_screen the old screen if any, can be the same as new screen * @param old_screen the old screen if any, can be the same as new screen
*/ */
void updateFocusedWindow(BScreen *screen, BScreen *old_screen); void updateFocusedWindow(BScreen *screen, BScreen *old_screen);
/// todo, remove this. just temporary
void updateFrameExtents(FluxboxWindow &win);
void attachSignals(FluxboxWindow &win); void attachSignals(FluxboxWindow &win);
void attachSignals(WinClient &winclient); void attachSignals(WinClient &winclient);