all repos — fluxbox @ 82047e6a391a12be9583168f28ac72c1154108d6

custom fork of the fluxbox windowmanager

move some things from FluxboxWindow to WindowState
Mark Tiefenbruck mark@fluxbox.org
commit

82047e6a391a12be9583168f28ac72c1154108d6

parent

a2ec0c9bdd9ebcc713426a79209b9ca90b4db301

M src/Ewmh.ccsrc/Ewmh.cc

@@ -586,22 +586,22 @@

winclient.property(m_net->wm_window_type, 0, 0x7fffffff, False, XA_ATOM, &ret_type, &fmt, &nitems, &bytes_after, &data); - Focusable::WindowType type = Focusable::TYPE_NORMAL; + WindowState::WindowType type = WindowState::TYPE_NORMAL; if (data) { Atom *atoms = (unsigned long *)data; for (unsigned long l = 0; l < nitems; ++l) { if (atoms[l] == m_net->wm_window_type_dock) - type = Focusable::TYPE_DOCK; + type = WindowState::TYPE_DOCK; else if (atoms[l] == m_net->wm_window_type_desktop) - type = Focusable::TYPE_DESKTOP; + type = WindowState::TYPE_DESKTOP; else if (atoms[l] == m_net->wm_window_type_splash) - type = Focusable::TYPE_SPLASH; + type = WindowState::TYPE_SPLASH; else if (atoms[l] == m_net->wm_window_type_dialog) - type = Focusable::TYPE_DIALOG; + type = WindowState::TYPE_DIALOG; else if (atoms[l] == m_net->wm_window_type_menu) - type = Focusable::TYPE_MENU; + type = WindowState::TYPE_MENU; else if (atoms[l] == m_net->wm_window_type_toolbar) - type = Focusable::TYPE_TOOLBAR; + type = WindowState::TYPE_TOOLBAR; else if (atoms[l] != m_net->wm_window_type_normal) continue; /*

@@ -615,7 +615,7 @@ } else if (winclient.isTransient()) {

// 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 (winclient.isTransient()) { - type = Focusable::TYPE_DIALOG; + type = WindowState::TYPE_DIALOG; winclient. changeProperty(m_net->wm_window_type, XA_ATOM, 32, PropModeReplace,
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -41,9 +41,8 @@

using std::mem_fun; using std::string; -FbWinFrame::FbWinFrame(BScreen &screen, - FocusableTheme<FbWinFrameTheme> &theme, - FbTk::XLayer &layer, WindowState &state): +FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state, + FocusableTheme<FbWinFrameTheme> &theme): m_screen(screen), m_theme(theme), m_imagectrl(screen.imageControl()),

@@ -52,7 +51,7 @@ m_window(theme->screenNum(), state.x, state.y, state.width, state.height,

ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask, true), - m_layeritem(window(), layer), + m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)), m_titlebar(m_window, 0, 0, 100, 16, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | ExposureMask |
M src/FbWinFrame.hhsrc/FbWinFrame.hh

@@ -71,8 +71,8 @@ RIGHTBOTTOM, RIGHT, RIGHTTOP

}; /// create a top level window - FbWinFrame(BScreen &screen, FocusableTheme<FbWinFrameTheme> &theme, - FbTk::XLayer &layer, WindowState &state); + FbWinFrame(BScreen &screen, WindowState &state, + FocusableTheme<FbWinFrameTheme> &theme); /* /// create a frame window inside another FbWindow, NOT IMPLEMENTED! FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
M src/Focusable.hhsrc/Focusable.hh

@@ -45,16 +45,6 @@ m_titlesig(*this), m_focussig(*this), m_diesig(*this),

m_attentionsig(*this) { } virtual ~Focusable() { } - enum WindowType { - TYPE_NORMAL, - TYPE_DOCK, - TYPE_DESKTOP, - TYPE_SPLASH, - TYPE_DIALOG, - TYPE_MENU, - TYPE_TOOLBAR - }; - /** * Take focus. * @return true if the focuable took focus

@@ -95,9 +85,6 @@ /// @return WM_CLASS name string (for pattern matching)

virtual const std::string &getWMClassName() const { return m_instance_name; } /// @return wm role string (for pattern matching) virtual std::string getWMRole() const { return "Focusable"; } - - /// @return window type - virtual WindowType getWindowType() const { return TYPE_NORMAL; } /// @return whether this window is a transient (for pattern matching) virtual bool isTransient() const { return false; }
M src/Screen.ccsrc/Screen.cc

@@ -1357,8 +1357,7 @@ Workspace *workspace = getWorkspace(win->workspaceNumber());

if (workspace) workspace->updateClientmenu(); } else { - win = new FluxboxWindow(*winclient, - *layerManager().getLayer(Layer::NORMAL)); + win = new FluxboxWindow(*winclient); if (!win->isManaged()) { delete win;

@@ -1394,8 +1393,7 @@ if (isKdeDockapp(client.window()) && addKdeDockapp(client.window())) {

return 0; } - FluxboxWindow *win = new FluxboxWindow(client, - *layerManager().getLayer(Layer::NORMAL)); + FluxboxWindow *win = new FluxboxWindow(client); #ifdef SLIT if (win->initialState() == WithdrawnState && slit() != 0) {
M src/WinClient.ccsrc/WinClient.cc

@@ -77,7 +77,7 @@ send_focus_message(false),

send_close_message(false), m_title_override(false), m_icon_override(false), - m_window_type(Focusable::TYPE_NORMAL), + m_window_type(WindowState::TYPE_NORMAL), m_mwm_hint(0), m_strut(0) {

@@ -163,8 +163,8 @@

bool WinClient::acceptsFocus() const { return ((accepts_input || send_focus_message) && // focusing fbpanel messes up quite a few things - m_window_type != Focusable::TYPE_DOCK && - m_window_type != Focusable::TYPE_SPLASH); + m_window_type != WindowState::TYPE_DOCK && + m_window_type != WindowState::TYPE_SPLASH); } bool WinClient::sendFocus() {
M src/WinClient.hhsrc/WinClient.hh

@@ -95,8 +95,8 @@ bool getAttrib(XWindowAttributes &attr) const;

bool getWMName(XTextProperty &textprop) const; bool getWMIconName(XTextProperty &textprop) const; std::string getWMRole() const; - Focusable::WindowType getWindowType() const { return m_window_type; } - void setWindowType(Focusable::WindowType type) { m_window_type = type; } + WindowState::WindowType getWindowType() const { return m_window_type; } + void setWindowType(WindowState::WindowType type) { m_window_type = type; } WinClient *transientFor() { return transient_for; } const WinClient *transientFor() const { return transient_for; }

@@ -156,7 +156,7 @@

bool m_title_override; bool m_icon_override; - Focusable::WindowType m_window_type; + WindowState::WindowType m_window_type; MwmHints *m_mwm_hint; SizeHints m_size_hints;
M src/Window.ccsrc/Window.cc

@@ -39,7 +39,6 @@ #include "WindowCmd.hh"

#include "Remember.hh" #include "MenuCreator.hh" #include "FocusControl.hh" -#include "Layer.hh" #include "IconButton.hh" #include "ScreenPlacement.hh"

@@ -261,7 +260,7 @@

int FluxboxWindow::s_num_grabs = 0; -FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer): +FluxboxWindow::FluxboxWindow(WinClient &client): Focusable(client.screen(), this), oplock(false), m_hintsig(*this),

@@ -269,7 +268,7 @@ m_statesig(*this),

m_layersig(*this), m_workspacesig(*this), m_creation_time(0), - moving(false), resizing(false), iconic(false), stuck(false), + moving(false), resizing(false), m_initialized(false), m_attaching_tab(0), display(FbTk::App::instance()->display()),

@@ -281,8 +280,6 @@ m_current_state(0),

m_old_decoration_mask(0), m_client(&client), m_toggled_decos(false), - m_icon_hidden(false), - m_focus_hidden(false), m_focus_new(BoolAcc(screen().focusControl(), &FocusControl::focusNew)), m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)), m_click_focus(true),

@@ -291,9 +288,8 @@ m_button_theme(*this, screen().focusedWinButtonTheme(),

screen().unfocusedWinButtonTheme()), m_theme(*this, screen().focusedWinFrameTheme(), screen().unfocusedWinFrameTheme()), - m_frame(client.screen(), m_theme, layer, m_state), + m_frame(client.screen(), m_state, m_theme), m_placed(false), - m_layernum(layer.getLayerNum()), m_old_layernum(0), m_parent(client.screen().rootWindow()), m_resize_corner(RIGHTBOTTOM) {

@@ -440,7 +436,7 @@ /* Read state above here, apply state below here. */

/**************************************************/ if (m_client->isTransient() && m_client->transientFor()->fbwindow()) - stuck = m_client->transientFor()->fbwindow()->isStuck(); + m_state.stuck = m_client->transientFor()->fbwindow()->isStuck(); if (!m_client->sizeHints().isResizable()) { functions.resize = functions.maximize = false;

@@ -485,7 +481,7 @@ m_client->transientFor()->fbwindow() &&

m_client->transientFor()->fbwindow() != this) layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer()); else // if no parent then set default layer - moveToLayer(m_layernum, m_layernum != ::Layer::NORMAL); + moveToLayer(m_state.layernum, m_state.layernum != ::Layer::NORMAL); // transients should be on the same workspace as parent if (m_client->isTransient() &&

@@ -515,8 +511,8 @@ placeWindow(getOnHead());

setFocusFlag(false); // update graphics before mapping - if (stuck) { - stuck = false; + if (m_state.stuck) { + m_state.stuck = false; stick(); }

@@ -525,11 +521,11 @@ m_state.shaded = false;

shade(); } - if (iconic) { - iconic = false; + if (m_state.iconic) { + m_state.iconic = false; iconify(); } else if (m_workspace_number == screen().currentWorkspaceID()) { - iconic = true; + m_state.iconic = true; deiconify(false); // check if we should prevent this window from gaining focus m_focused = false; // deiconify sets this

@@ -1374,7 +1370,7 @@ void FluxboxWindow::iconify() {

if (isIconic()) // no need to iconify if we're already return; - iconic = true; + m_state.iconic = true; m_statesig.notify(); hide(true);

@@ -1396,14 +1392,14 @@ // focus revert is done elsewhere (based on signal)

} void FluxboxWindow::deiconify(bool do_raise) { - if (numClients() == 0 || !iconic || oplock) + if (numClients() == 0 || !m_state.iconic || oplock) return; oplock = true; // reassociate first, so it gets removed from screen's icon list screen().reassociateWindow(this, m_workspace_number, false); - iconic = false; + m_state.iconic = false; m_statesig.notify(); // deiconify all transients

@@ -1544,7 +1540,7 @@

m_workspace_number = n; // notify workspace change - if (m_initialized && !stuck && old_wkspc != m_workspace_number) { + if (m_initialized && old_wkspc != m_workspace_number) { #ifdef DEBUG cerr<<this<<" notify workspace signal"<<endl; #endif // DEBUG

@@ -1553,7 +1549,7 @@ }

} void FluxboxWindow::setLayerNum(int layernum) { - m_layernum = layernum; + m_state.layernum = layernum; if (m_initialized) { #ifdef DEBUG

@@ -1595,7 +1591,7 @@ }

void FluxboxWindow::stick() { - stuck = !stuck; + m_state.stuck = !m_state.stuck; if (m_initialized) { stateSig().notify();

@@ -1611,7 +1607,7 @@ WinClient::TransientList::const_iterator it = (*client_it)->transientList().begin();

WinClient::TransientList::const_iterator it_end = (*client_it)->transientList().end(); for (; it != it_end; ++it) { if ((*it)->fbwindow()) - (*it)->fbwindow()->setStuck(stuck); + (*it)->fbwindow()->setStuck(m_state.stuck); } }

@@ -1619,7 +1615,7 @@

} void FluxboxWindow::setStuck(bool val) { - if (val != stuck) + if (val != m_state.stuck) stick(); }

@@ -1685,11 +1681,11 @@ }

void FluxboxWindow::raiseLayer() { - moveToLayer(m_layernum-1); + moveToLayer(m_state.layernum-1); } void FluxboxWindow::lowerLayer() { - moveToLayer(m_layernum+1); + moveToLayer(m_state.layernum+1); }

@@ -1705,9 +1701,9 @@ else if (layernum >= ::Layer::NUM_LAYERS)

layernum = ::Layer::NUM_LAYERS - 1; if (!m_initialized) - m_layernum = layernum; + m_state.layernum = layernum; - if ((m_layernum == layernum && !force) || !m_client) + if ((m_state.layernum == layernum && !force) || !m_client) return; // get root window

@@ -1741,13 +1737,13 @@

} void FluxboxWindow::setFocusHidden(bool value) { - m_focus_hidden = value; + m_state.focus_hidden = value; if (m_initialized) m_statesig.notify(); } void FluxboxWindow::setIconHidden(bool value) { - m_icon_hidden= value; + m_state.icon_hidden = value; if (m_initialized) m_statesig.notify(); }

@@ -2058,7 +2054,7 @@

if (ne.override_redirect || !isVisible() || !client->validateClient()) return; - iconic = false; + m_state.iconic = false; // setting state will cause all tabs to be mapped, but we only want the // original tab to be focused

@@ -3415,10 +3411,6 @@ std::string FluxboxWindow::getWMRole() const {

return (m_client ? m_client->getWMRole() : "FluxboxWindow"); } -Focusable::WindowType FluxboxWindow::getWindowType() const { - return (m_client ? m_client->getWindowType() : Focusable::TYPE_NORMAL); -} - bool FluxboxWindow::isTransient() const { return (m_client && m_client->isTransient()); }

@@ -3803,9 +3795,10 @@ m_state.saveGeometry(new_x, new_y, frame().width(), frame().height(), true);

move(new_x, new_y); } -void FluxboxWindow::setWindowType(Focusable::WindowType type) { +void FluxboxWindow::setWindowType(WindowState::WindowType type) { + m_state.type = type; switch (type) { - case Focusable::TYPE_DOCK: + case WindowState::TYPE_DOCK: /* From Extended Window Manager Hints, draft 1.3: * * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature.

@@ -3821,7 +3814,7 @@ setClickFocus(false);

setDecorationMask(WindowState::DECOR_NONE); moveToLayer(::Layer::DOCK); break; - case Focusable::TYPE_DESKTOP: + case WindowState::TYPE_DESKTOP: /* * _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window * We let it be the size it wants, but it gets no decoration,

@@ -3837,9 +3830,9 @@ setDecorationMask(WindowState::DECOR_NONE);

setTabable(false); setMovable(false); setResizable(false); - stick(); + setStuck(true); break; - case Focusable::TYPE_SPLASH: + case WindowState::TYPE_SPLASH: /* * _NET_WM_WINDOW_TYPE_SPLASH indicates that the * window is a splash screen displayed as an application

@@ -3853,11 +3846,11 @@ setMouseFocus(false);

setClickFocus(false); setMovable(false); break; - case Focusable::TYPE_DIALOG: + case WindowState::TYPE_DIALOG: setTabable(false); break; - case Focusable::TYPE_MENU: - case Focusable::TYPE_TOOLBAR: + case WindowState::TYPE_MENU: + case WindowState::TYPE_TOOLBAR: /* * _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU * indicate toolbar and pinnable menu windows, respectively

@@ -3869,7 +3862,7 @@ setDecorationMask(WindowState::DECOR_TOOL);

setIconHidden(true); moveToLayer(::Layer::ABOVE_DOCK); break; - case Focusable::TYPE_NORMAL: + case WindowState::TYPE_NORMAL: default: break; }
M src/Window.hhsrc/Window.hh

@@ -122,7 +122,7 @@

typedef std::list<WinClient *> ClientList; /// create a window from a client - FluxboxWindow(WinClient &client, FbTk::XLayer &layer); + FluxboxWindow(WinClient &client); virtual ~FluxboxWindow();

@@ -366,11 +366,11 @@ bool isTabable() const { return functions.tabable; }

void setMovable(bool movable) { functions.move = movable; } void setResizable(bool resizable) { functions.resize = resizable; } - bool isFocusHidden() const { return m_focus_hidden; } - bool isIconHidden() const { return m_icon_hidden; } + bool isFocusHidden() const { return m_state.focus_hidden; } + bool isIconHidden() const { return m_state.icon_hidden; } bool isManaged() const { return m_initialized; } bool isVisible() const; - bool isIconic() const { return iconic; } + bool isIconic() const { return m_state.iconic; } bool isShaded() const { return m_state.shaded; } bool isFullscreen() const { return m_state.fullscreen; } bool isMaximized() const { return m_state.isMaximized(); }

@@ -382,7 +382,7 @@ bool isMaximizable() const { return functions.maximize; }

bool isResizable() const { return functions.resize; } bool isClosable() const { return functions.close; } bool isMoveable() const { return functions.move; } - bool isStuck() const { return stuck; } + bool isStuck() const { return m_state.stuck; } bool hasTitlebar() const { return decorations.titlebar; } bool isMoving() const { return moving; } bool isResizing() const { return resizing; }

@@ -416,8 +416,7 @@ const std::string &title() const;

const std::string &getWMClassName() const; const std::string &getWMClassClass() const; std::string getWMRole() const; - Focusable::WindowType getWindowType() const; - void setWindowType(Focusable::WindowType type); + void setWindowType(WindowState::WindowType type); bool isTransient() const; int x() const { return frame().x(); }

@@ -437,7 +436,7 @@ int heightOffset() const { return frame().heightOffset(); }

unsigned int workspaceNumber() const { return m_workspace_number; } - int layerNum() const { return m_layernum; } + int layerNum() const { return m_state.layernum; } void setLayerNum(int layernum); unsigned int titlebarHeight() const;

@@ -531,7 +530,7 @@

time_t m_creation_time; // Window states - bool moving, resizing, iconic, stuck, m_initialized; + bool moving, resizing, m_initialized; WinClient *m_attaching_tab;

@@ -568,8 +567,6 @@ struct _functions {

bool resize, move, iconify, maximize, close, tabable; } functions; - bool m_icon_hidden; ///< if the window is in the iconbar - bool m_focus_hidden; ///< if the window is in the NextWindow list typedef FbTk::ConstObjectAccessor<bool, FocusControl> BoolAcc; /// if the window is normally focused when mapped FbTk::DefaultValue<bool, BoolAcc> m_focus_new;

@@ -587,7 +584,6 @@ FbWinFrame m_frame; ///< the actual window frame

bool m_placed; ///< determine whether or not we should place the window - int m_layernum; int m_old_layernum; FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window")
M src/WindowState.hhsrc/WindowState.hh

@@ -22,6 +22,8 @@

#ifndef WINDOWSTATE_HH #define WINDOWSTATE_HH +#include "Layer.hh" + #include <X11/Xutil.h> #include <string>

@@ -93,11 +95,24 @@ DECOR_BORDER = DECORM_BORDER|DECORM_MENU,

DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB }; + enum WindowType { + TYPE_NORMAL, + TYPE_DOCK, + TYPE_DESKTOP, + TYPE_SPLASH, + TYPE_DIALOG, + TYPE_MENU, + TYPE_TOOLBAR + }; + WindowState(): size_hints(), deco_mask(DECOR_NORMAL), + type(TYPE_NORMAL), focused(false), - shaded(false), fullscreen(false), maximized(0), + shaded(false), fullscreen(false), stuck(false), iconic(false), + focus_hidden(false), icon_hidden(false), + maximized(0), layernum(Layer::NORMAL), x(0), y(0), width(1), height(1) { } void saveGeometry(int x, int y, unsigned int width, unsigned int height,

@@ -112,15 +127,16 @@ bool useTabs() const;

bool useTitlebar() const; bool isMaximized() const { return maximized == MAX_FULL; } - bool isMaximizedHorz() const { return (bool)(maximized & MAX_HORZ); } - bool isMaximizedVert() const { return (bool)(maximized & MAX_VERT); } + bool isMaximizedHorz() const { return maximized & MAX_HORZ; } + bool isMaximizedVert() const { return maximized & MAX_VERT; } static int getDecoMaskFromString(const std::string &str); SizeHints size_hints; unsigned int deco_mask; - bool focused, shaded, fullscreen; - int maximized; + WindowType type; + bool focused, shaded, fullscreen, stuck, iconic, focus_hidden, icon_hidden; + int maximized, layernum; int x, y; unsigned int width, height; };