From 41adf369ddc24d8fae4dfa9cd804420435d7a6aa Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 4 Jan 2007 20:34:24 +0000 Subject: little cleanup --- src/Ewmh.cc | 77 ++----------------------------------------------------------- src/Ewmh.hh | 16 ------------- 2 files changed, 2 insertions(+), 91 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 3942fb9..646fa0e 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -357,7 +357,6 @@ void Ewmh::setupFrame(FluxboxWindow &win) { } void Ewmh::updateFrameClose(FluxboxWindow &win) { - clearState(win); } void Ewmh::updateFocusedWindow(BScreen &screen, Window win) { @@ -1029,40 +1028,6 @@ void Ewmh::createAtoms() { utf8_string = XInternAtom(disp, "UTF8_STRING", False); } - -void Ewmh::setFullscreen(FluxboxWindow &win, bool value) { - // fullscreen implies maximised, above dock layer, - // and no decorations (or decorations offscreen) - // - // TODO: do we need the WindowState etc here anymore? - // FluxboxWindow::setFullscreen() remembering old values - // already and set them... - // only reason i can see is that the user manually - // moved the (fullscreened) window - WindowState *saved_state = getState(win); - if (value) { - // fullscreen on - if (!saved_state) { // not already fullscreen - saved_state = new WindowState(win.x(), win.y(), win.width(), - win.height(), win.layerNum(), win.decorationMask()); - saveState(win, saved_state); - win.setFullscreen(true); - } - } else { // turn off fullscreen - if (saved_state) { // no saved state, can't restore it - win.setFullscreen(false); - /* - win.setDecorationMask(saved_state->decor); - win.moveResize(saved_state->x, saved_state->y, - saved_state->width, saved_state->height); - win.moveToLayer(saved_state->layer); - */ - clearState(win); - saved_state = 0; - } - } -} - // set window state void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) { if (state == m_net_wm_state_sticky) { // STICKY @@ -1084,7 +1049,7 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) { } else if (state == m_net_wm_state_fullscreen) { // fullscreen if ((value && !win.isFullscreen()) || (!value && win.isFullscreen())) - setFullscreen(win, value); + win.setFullscreen(value); } else if (state == m_net_wm_state_hidden) { // minimized if (value && !win.isIconic()) win.iconify(); @@ -1126,7 +1091,7 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) { } else if (state == m_net_wm_state_maximized_vert) { // maximized Vertical win.maximizeVertical(); } else if (state == m_net_wm_state_fullscreen) { // fullscreen - setFullscreen(win, getState(win) == 0); // toggle current state + win.setFullscreen(!win.isFullscreen()); // toggle current state } else if (state == m_net_wm_state_hidden) { // minimized if(win.isIconic()) win.deiconify(); @@ -1289,41 +1254,3 @@ void Ewmh::updateFrameExtents(FluxboxWindow &win) { (unsigned char *)extents, 4); } } - - -Ewmh::WindowState::WindowState(int t_x, int t_y, - unsigned int t_width, - unsigned int t_height, - int t_layer, unsigned int t_decor) : - x(t_x), y(t_y), - layer(t_layer), - width(t_width), - height(t_height), - decor(t_decor) -{} - -Ewmh::WindowState *Ewmh::getState(FluxboxWindow &win) { - SavedState::iterator it = m_savedstate.find(&win); - if (it == m_savedstate.end()) - return 0; - else - return it->second; -} - -void Ewmh::clearState(FluxboxWindow &win) { - WindowState *state = 0; - SavedState::iterator it = m_savedstate.find(&win); - if (it == m_savedstate.end()) - return; - - state = it->second; - - m_savedstate.erase(it); - delete state; -} - -void Ewmh::saveState(FluxboxWindow &win, WindowState *state) { - m_savedstate[&win] = state; -} - - diff --git a/src/Ewmh.hh b/src/Ewmh.hh index 8652c6b..f917390 100644 --- a/src/Ewmh.hh +++ b/src/Ewmh.hh @@ -60,20 +60,10 @@ public: void updateFrameClose(FluxboxWindow &win); void updateClientClose(WinClient &winclient); - - - void setFullscreen(FluxboxWindow &win, bool value); void updateFrameExtents(FluxboxWindow &win); private: - typedef struct WindowState { - WindowState(int x, int y, unsigned int width, unsigned int height, - int layer, unsigned int decor); - int x, y, layer; - unsigned int width, height, decor; - } WindowState; - enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2}; void setState(FluxboxWindow &win, Atom state, bool value); @@ -153,12 +143,6 @@ private: Atom utf8_string; std::vector m_windows; - typedef std::map SavedState; - SavedState m_savedstate; - - WindowState *getState(FluxboxWindow &win); - void clearState(FluxboxWindow &win); - void saveState(FluxboxWindow &win, WindowState *state); FbTk::FbString getUTF8Property(Atom property); }; -- cgit v0.11.2