move some things from FluxboxWindow to WindowState

This commit is contained in:
Mark Tiefenbruck 2008-08-27 18:29:33 -04:00
parent a2ec0c9bdd
commit 82047e6a39
10 changed files with 85 additions and 96 deletions

View file

@ -586,22 +586,22 @@ void Ewmh::setupClient(WinClient &winclient) {
winclient.property(m_net->wm_window_type, 0, 0x7fffffff, False, XA_ATOM, winclient.property(m_net->wm_window_type, 0, 0x7fffffff, False, XA_ATOM,
&ret_type, &fmt, &nitems, &bytes_after, &ret_type, &fmt, &nitems, &bytes_after,
&data); &data);
Focusable::WindowType type = Focusable::TYPE_NORMAL; WindowState::WindowType type = WindowState::TYPE_NORMAL;
if (data) { if (data) {
Atom *atoms = (unsigned long *)data; Atom *atoms = (unsigned long *)data;
for (unsigned long l = 0; l < nitems; ++l) { for (unsigned long l = 0; l < nitems; ++l) {
if (atoms[l] == m_net->wm_window_type_dock) 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) 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) 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) 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) 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) 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) else if (atoms[l] != m_net->wm_window_type_normal)
continue; continue;
/* /*
@ -615,7 +615,7 @@ void Ewmh::setupClient(WinClient &winclient) {
// if _NET_WM_WINDOW_TYPE not set and this window // if _NET_WM_WINDOW_TYPE not set and this window
// has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG // has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG
if (winclient.isTransient()) { if (winclient.isTransient()) {
type = Focusable::TYPE_DIALOG; type = WindowState::TYPE_DIALOG;
winclient. winclient.
changeProperty(m_net->wm_window_type, changeProperty(m_net->wm_window_type,
XA_ATOM, 32, PropModeReplace, XA_ATOM, 32, PropModeReplace,

View file

@ -41,9 +41,8 @@
using std::mem_fun; using std::mem_fun;
using std::string; using std::string;
FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state,
FocusableTheme<FbWinFrameTheme> &theme, FocusableTheme<FbWinFrameTheme> &theme):
FbTk::XLayer &layer, WindowState &state):
m_screen(screen), m_screen(screen),
m_theme(theme), m_theme(theme),
m_imagectrl(screen.imageControl()), m_imagectrl(screen.imageControl()),
@ -52,7 +51,7 @@ FbWinFrame::FbWinFrame(BScreen &screen,
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask | ButtonMotionMask | EnterWindowMask |
LeaveWindowMask, true), LeaveWindowMask, true),
m_layeritem(window(), layer), m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)),
m_titlebar(m_window, 0, 0, 100, 16, m_titlebar(m_window, 0, 0, 100, 16,
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | ExposureMask | ButtonMotionMask | ExposureMask |

View file

@ -71,8 +71,8 @@ public:
}; };
/// create a top level window /// create a top level window
FbWinFrame(BScreen &screen, FocusableTheme<FbWinFrameTheme> &theme, FbWinFrame(BScreen &screen, WindowState &state,
FbTk::XLayer &layer, WindowState &state); FocusableTheme<FbWinFrameTheme> &theme);
/* /// create a frame window inside another FbWindow, NOT IMPLEMENTED! /* /// create a frame window inside another FbWindow, NOT IMPLEMENTED!
FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,

View file

@ -45,16 +45,6 @@ public:
m_attentionsig(*this) { } m_attentionsig(*this) { }
virtual ~Focusable() { } virtual ~Focusable() { }
enum WindowType {
TYPE_NORMAL,
TYPE_DOCK,
TYPE_DESKTOP,
TYPE_SPLASH,
TYPE_DIALOG,
TYPE_MENU,
TYPE_TOOLBAR
};
/** /**
* Take focus. * Take focus.
* @return true if the focuable took focus * @return true if the focuable took focus
@ -96,9 +86,6 @@ public:
/// @return wm role string (for pattern matching) /// @return wm role string (for pattern matching)
virtual std::string getWMRole() const { return "Focusable"; } 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) /// @return whether this window is a transient (for pattern matching)
virtual bool isTransient() const { return false; } virtual bool isTransient() const { return false; }

View file

@ -1357,8 +1357,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
if (workspace) if (workspace)
workspace->updateClientmenu(); workspace->updateClientmenu();
} else { } else {
win = new FluxboxWindow(*winclient, win = new FluxboxWindow(*winclient);
*layerManager().getLayer(Layer::NORMAL));
if (!win->isManaged()) { if (!win->isManaged()) {
delete win; delete win;
@ -1394,8 +1393,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
return 0; return 0;
} }
FluxboxWindow *win = new FluxboxWindow(client, FluxboxWindow *win = new FluxboxWindow(client);
*layerManager().getLayer(Layer::NORMAL));
#ifdef SLIT #ifdef SLIT
if (win->initialState() == WithdrawnState && slit() != 0) { if (win->initialState() == WithdrawnState && slit() != 0) {

View file

@ -77,7 +77,7 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin):
send_close_message(false), send_close_message(false),
m_title_override(false), m_title_override(false),
m_icon_override(false), m_icon_override(false),
m_window_type(Focusable::TYPE_NORMAL), m_window_type(WindowState::TYPE_NORMAL),
m_mwm_hint(0), m_mwm_hint(0),
m_strut(0) { m_strut(0) {
@ -163,8 +163,8 @@ WinClient::~WinClient() {
bool WinClient::acceptsFocus() const { bool WinClient::acceptsFocus() const {
return ((accepts_input || send_focus_message) && return ((accepts_input || send_focus_message) &&
// focusing fbpanel messes up quite a few things // focusing fbpanel messes up quite a few things
m_window_type != Focusable::TYPE_DOCK && m_window_type != WindowState::TYPE_DOCK &&
m_window_type != Focusable::TYPE_SPLASH); m_window_type != WindowState::TYPE_SPLASH);
} }
bool WinClient::sendFocus() { bool WinClient::sendFocus() {

View file

@ -95,8 +95,8 @@ public:
bool getWMName(XTextProperty &textprop) const; bool getWMName(XTextProperty &textprop) const;
bool getWMIconName(XTextProperty &textprop) const; bool getWMIconName(XTextProperty &textprop) const;
std::string getWMRole() const; std::string getWMRole() const;
Focusable::WindowType getWindowType() const { return m_window_type; } WindowState::WindowType getWindowType() const { return m_window_type; }
void setWindowType(Focusable::WindowType type) { m_window_type = type; } void setWindowType(WindowState::WindowType type) { m_window_type = type; }
WinClient *transientFor() { return transient_for; } WinClient *transientFor() { return transient_for; }
const WinClient *transientFor() const { return transient_for; } const WinClient *transientFor() const { return transient_for; }
@ -156,7 +156,7 @@ private:
bool m_title_override; bool m_title_override;
bool m_icon_override; bool m_icon_override;
Focusable::WindowType m_window_type; WindowState::WindowType m_window_type;
MwmHints *m_mwm_hint; MwmHints *m_mwm_hint;
SizeHints m_size_hints; SizeHints m_size_hints;

View file

@ -39,7 +39,6 @@
#include "Remember.hh" #include "Remember.hh"
#include "MenuCreator.hh" #include "MenuCreator.hh"
#include "FocusControl.hh" #include "FocusControl.hh"
#include "Layer.hh"
#include "IconButton.hh" #include "IconButton.hh"
#include "ScreenPlacement.hh" #include "ScreenPlacement.hh"
@ -261,7 +260,7 @@ private:
int FluxboxWindow::s_num_grabs = 0; int FluxboxWindow::s_num_grabs = 0;
FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer): FluxboxWindow::FluxboxWindow(WinClient &client):
Focusable(client.screen(), this), Focusable(client.screen(), this),
oplock(false), oplock(false),
m_hintsig(*this), m_hintsig(*this),
@ -269,7 +268,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer):
m_layersig(*this), m_layersig(*this),
m_workspacesig(*this), m_workspacesig(*this),
m_creation_time(0), m_creation_time(0),
moving(false), resizing(false), iconic(false), stuck(false), moving(false), resizing(false),
m_initialized(false), m_initialized(false),
m_attaching_tab(0), m_attaching_tab(0),
display(FbTk::App::instance()->display()), display(FbTk::App::instance()->display()),
@ -281,8 +280,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer):
m_old_decoration_mask(0), m_old_decoration_mask(0),
m_client(&client), m_client(&client),
m_toggled_decos(false), m_toggled_decos(false),
m_icon_hidden(false),
m_focus_hidden(false),
m_focus_new(BoolAcc(screen().focusControl(), &FocusControl::focusNew)), m_focus_new(BoolAcc(screen().focusControl(), &FocusControl::focusNew)),
m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)), m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)),
m_click_focus(true), m_click_focus(true),
@ -291,9 +288,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer):
screen().unfocusedWinButtonTheme()), screen().unfocusedWinButtonTheme()),
m_theme(*this, screen().focusedWinFrameTheme(), m_theme(*this, screen().focusedWinFrameTheme(),
screen().unfocusedWinFrameTheme()), screen().unfocusedWinFrameTheme()),
m_frame(client.screen(), m_theme, layer, m_state), m_frame(client.screen(), m_state, m_theme),
m_placed(false), m_placed(false),
m_layernum(layer.getLayerNum()),
m_old_layernum(0), m_old_layernum(0),
m_parent(client.screen().rootWindow()), m_parent(client.screen().rootWindow()),
m_resize_corner(RIGHTBOTTOM) { m_resize_corner(RIGHTBOTTOM) {
@ -440,7 +436,7 @@ void FluxboxWindow::init() {
/**************************************************/ /**************************************************/
if (m_client->isTransient() && m_client->transientFor()->fbwindow()) 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()) { if (!m_client->sizeHints().isResizable()) {
functions.resize = functions.maximize = false; functions.resize = functions.maximize = false;
@ -485,7 +481,7 @@ void FluxboxWindow::init() {
m_client->transientFor()->fbwindow() != this) m_client->transientFor()->fbwindow() != this)
layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer()); layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer());
else // if no parent then set default layer 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 // transients should be on the same workspace as parent
if (m_client->isTransient() && if (m_client->isTransient() &&
@ -515,8 +511,8 @@ void FluxboxWindow::init() {
setFocusFlag(false); // update graphics before mapping setFocusFlag(false); // update graphics before mapping
if (stuck) { if (m_state.stuck) {
stuck = false; m_state.stuck = false;
stick(); stick();
} }
@ -525,11 +521,11 @@ void FluxboxWindow::init() {
shade(); shade();
} }
if (iconic) { if (m_state.iconic) {
iconic = false; m_state.iconic = false;
iconify(); iconify();
} else if (m_workspace_number == screen().currentWorkspaceID()) { } else if (m_workspace_number == screen().currentWorkspaceID()) {
iconic = true; m_state.iconic = true;
deiconify(false); deiconify(false);
// check if we should prevent this window from gaining focus // check if we should prevent this window from gaining focus
m_focused = false; // deiconify sets this m_focused = false; // deiconify sets this
@ -1374,7 +1370,7 @@ void FluxboxWindow::iconify() {
if (isIconic()) // no need to iconify if we're already if (isIconic()) // no need to iconify if we're already
return; return;
iconic = true; m_state.iconic = true;
m_statesig.notify(); m_statesig.notify();
hide(true); hide(true);
@ -1396,14 +1392,14 @@ void FluxboxWindow::iconify() {
} }
void FluxboxWindow::deiconify(bool do_raise) { void FluxboxWindow::deiconify(bool do_raise) {
if (numClients() == 0 || !iconic || oplock) if (numClients() == 0 || !m_state.iconic || oplock)
return; return;
oplock = true; oplock = true;
// reassociate first, so it gets removed from screen's icon list // reassociate first, so it gets removed from screen's icon list
screen().reassociateWindow(this, m_workspace_number, false); screen().reassociateWindow(this, m_workspace_number, false);
iconic = false; m_state.iconic = false;
m_statesig.notify(); m_statesig.notify();
// deiconify all transients // deiconify all transients
@ -1544,7 +1540,7 @@ void FluxboxWindow::setWorkspace(int n) {
m_workspace_number = n; m_workspace_number = n;
// notify workspace change // notify workspace change
if (m_initialized && !stuck && old_wkspc != m_workspace_number) { if (m_initialized && old_wkspc != m_workspace_number) {
#ifdef DEBUG #ifdef DEBUG
cerr<<this<<" notify workspace signal"<<endl; cerr<<this<<" notify workspace signal"<<endl;
#endif // DEBUG #endif // DEBUG
@ -1553,7 +1549,7 @@ void FluxboxWindow::setWorkspace(int n) {
} }
void FluxboxWindow::setLayerNum(int layernum) { void FluxboxWindow::setLayerNum(int layernum) {
m_layernum = layernum; m_state.layernum = layernum;
if (m_initialized) { if (m_initialized) {
#ifdef DEBUG #ifdef DEBUG
@ -1595,7 +1591,7 @@ void FluxboxWindow::setShaded(bool val) {
void FluxboxWindow::stick() { void FluxboxWindow::stick() {
stuck = !stuck; m_state.stuck = !m_state.stuck;
if (m_initialized) { if (m_initialized) {
stateSig().notify(); stateSig().notify();
@ -1611,7 +1607,7 @@ void FluxboxWindow::stick() {
WinClient::TransientList::const_iterator it_end = (*client_it)->transientList().end(); WinClient::TransientList::const_iterator it_end = (*client_it)->transientList().end();
for (; it != it_end; ++it) { for (; it != it_end; ++it) {
if ((*it)->fbwindow()) if ((*it)->fbwindow())
(*it)->fbwindow()->setStuck(stuck); (*it)->fbwindow()->setStuck(m_state.stuck);
} }
} }
@ -1619,7 +1615,7 @@ void FluxboxWindow::stick() {
} }
void FluxboxWindow::setStuck(bool val) { void FluxboxWindow::setStuck(bool val) {
if (val != stuck) if (val != m_state.stuck)
stick(); stick();
} }
@ -1685,11 +1681,11 @@ void FluxboxWindow::tempRaise() {
void FluxboxWindow::raiseLayer() { void FluxboxWindow::raiseLayer() {
moveToLayer(m_layernum-1); moveToLayer(m_state.layernum-1);
} }
void FluxboxWindow::lowerLayer() { void FluxboxWindow::lowerLayer() {
moveToLayer(m_layernum+1); moveToLayer(m_state.layernum+1);
} }
@ -1705,9 +1701,9 @@ void FluxboxWindow::moveToLayer(int layernum, bool force) {
layernum = ::Layer::NUM_LAYERS - 1; layernum = ::Layer::NUM_LAYERS - 1;
if (!m_initialized) 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; return;
// get root window // get root window
@ -1741,13 +1737,13 @@ void FluxboxWindow::moveToLayer(int layernum, bool force) {
} }
void FluxboxWindow::setFocusHidden(bool value) { void FluxboxWindow::setFocusHidden(bool value) {
m_focus_hidden = value; m_state.focus_hidden = value;
if (m_initialized) if (m_initialized)
m_statesig.notify(); m_statesig.notify();
} }
void FluxboxWindow::setIconHidden(bool value) { void FluxboxWindow::setIconHidden(bool value) {
m_icon_hidden= value; m_state.icon_hidden = value;
if (m_initialized) if (m_initialized)
m_statesig.notify(); m_statesig.notify();
} }
@ -2058,7 +2054,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
if (ne.override_redirect || !isVisible() || !client->validateClient()) if (ne.override_redirect || !isVisible() || !client->validateClient())
return; return;
iconic = false; m_state.iconic = false;
// setting state will cause all tabs to be mapped, but we only want the // setting state will cause all tabs to be mapped, but we only want the
// original tab to be focused // original tab to be focused
@ -3415,10 +3411,6 @@ std::string FluxboxWindow::getWMRole() const {
return (m_client ? m_client->getWMRole() : "FluxboxWindow"); 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 { bool FluxboxWindow::isTransient() const {
return (m_client && m_client->isTransient()); return (m_client && m_client->isTransient());
} }
@ -3803,9 +3795,10 @@ void FluxboxWindow::placeWindow(int head) {
move(new_x, new_y); move(new_x, new_y);
} }
void FluxboxWindow::setWindowType(Focusable::WindowType type) { void FluxboxWindow::setWindowType(WindowState::WindowType type) {
m_state.type = type;
switch (type) { switch (type) {
case Focusable::TYPE_DOCK: case WindowState::TYPE_DOCK:
/* From Extended Window Manager Hints, draft 1.3: /* From Extended Window Manager Hints, draft 1.3:
* *
* _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature. * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature.
@ -3821,7 +3814,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
setDecorationMask(WindowState::DECOR_NONE); setDecorationMask(WindowState::DECOR_NONE);
moveToLayer(::Layer::DOCK); moveToLayer(::Layer::DOCK);
break; break;
case Focusable::TYPE_DESKTOP: case WindowState::TYPE_DESKTOP:
/* /*
* _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window * _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window
* We let it be the size it wants, but it gets no decoration, * We let it be the size it wants, but it gets no decoration,
@ -3837,9 +3830,9 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
setTabable(false); setTabable(false);
setMovable(false); setMovable(false);
setResizable(false); setResizable(false);
stick(); setStuck(true);
break; break;
case Focusable::TYPE_SPLASH: case WindowState::TYPE_SPLASH:
/* /*
* _NET_WM_WINDOW_TYPE_SPLASH indicates that the * _NET_WM_WINDOW_TYPE_SPLASH indicates that the
* window is a splash screen displayed as an application * window is a splash screen displayed as an application
@ -3853,11 +3846,11 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
setClickFocus(false); setClickFocus(false);
setMovable(false); setMovable(false);
break; break;
case Focusable::TYPE_DIALOG: case WindowState::TYPE_DIALOG:
setTabable(false); setTabable(false);
break; break;
case Focusable::TYPE_MENU: case WindowState::TYPE_MENU:
case Focusable::TYPE_TOOLBAR: case WindowState::TYPE_TOOLBAR:
/* /*
* _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU * _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU
* indicate toolbar and pinnable menu windows, respectively * indicate toolbar and pinnable menu windows, respectively
@ -3869,7 +3862,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
setIconHidden(true); setIconHidden(true);
moveToLayer(::Layer::ABOVE_DOCK); moveToLayer(::Layer::ABOVE_DOCK);
break; break;
case Focusable::TYPE_NORMAL: case WindowState::TYPE_NORMAL:
default: default:
break; break;
} }

View file

@ -122,7 +122,7 @@ public:
typedef std::list<WinClient *> ClientList; typedef std::list<WinClient *> ClientList;
/// create a window from a client /// create a window from a client
FluxboxWindow(WinClient &client, FbTk::XLayer &layer); FluxboxWindow(WinClient &client);
virtual ~FluxboxWindow(); virtual ~FluxboxWindow();
@ -366,11 +366,11 @@ public:
void setMovable(bool movable) { functions.move = movable; } void setMovable(bool movable) { functions.move = movable; }
void setResizable(bool resizable) { functions.resize = resizable; } void setResizable(bool resizable) { functions.resize = resizable; }
bool isFocusHidden() const { return m_focus_hidden; } bool isFocusHidden() const { return m_state.focus_hidden; }
bool isIconHidden() const { return m_icon_hidden; } bool isIconHidden() const { return m_state.icon_hidden; }
bool isManaged() const { return m_initialized; } bool isManaged() const { return m_initialized; }
bool isVisible() const; bool isVisible() const;
bool isIconic() const { return iconic; } bool isIconic() const { return m_state.iconic; }
bool isShaded() const { return m_state.shaded; } bool isShaded() const { return m_state.shaded; }
bool isFullscreen() const { return m_state.fullscreen; } bool isFullscreen() const { return m_state.fullscreen; }
bool isMaximized() const { return m_state.isMaximized(); } bool isMaximized() const { return m_state.isMaximized(); }
@ -382,7 +382,7 @@ public:
bool isResizable() const { return functions.resize; } bool isResizable() const { return functions.resize; }
bool isClosable() const { return functions.close; } bool isClosable() const { return functions.close; }
bool isMoveable() const { return functions.move; } 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 hasTitlebar() const { return decorations.titlebar; }
bool isMoving() const { return moving; } bool isMoving() const { return moving; }
bool isResizing() const { return resizing; } bool isResizing() const { return resizing; }
@ -416,8 +416,7 @@ public:
const std::string &getWMClassName() const; const std::string &getWMClassName() const;
const std::string &getWMClassClass() const; const std::string &getWMClassClass() const;
std::string getWMRole() const; std::string getWMRole() const;
Focusable::WindowType getWindowType() const; void setWindowType(WindowState::WindowType type);
void setWindowType(Focusable::WindowType type);
bool isTransient() const; bool isTransient() const;
int x() const { return frame().x(); } int x() const { return frame().x(); }
@ -437,7 +436,7 @@ public:
unsigned int workspaceNumber() const { return m_workspace_number; } 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); void setLayerNum(int layernum);
unsigned int titlebarHeight() const; unsigned int titlebarHeight() const;
@ -531,7 +530,7 @@ private:
time_t m_creation_time; time_t m_creation_time;
// Window states // Window states
bool moving, resizing, iconic, stuck, m_initialized; bool moving, resizing, m_initialized;
WinClient *m_attaching_tab; WinClient *m_attaching_tab;
@ -568,8 +567,6 @@ private:
bool resize, move, iconify, maximize, close, tabable; bool resize, move, iconify, maximize, close, tabable;
} functions; } 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; typedef FbTk::ConstObjectAccessor<bool, FocusControl> BoolAcc;
/// if the window is normally focused when mapped /// if the window is normally focused when mapped
FbTk::DefaultValue<bool, BoolAcc> m_focus_new; FbTk::DefaultValue<bool, BoolAcc> m_focus_new;
@ -587,7 +584,6 @@ private:
bool m_placed; ///< determine whether or not we should place the window bool m_placed; ///< determine whether or not we should place the window
int m_layernum;
int m_old_layernum; int m_old_layernum;
FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window") FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window")

View file

@ -22,6 +22,8 @@
#ifndef WINDOWSTATE_HH #ifndef WINDOWSTATE_HH
#define WINDOWSTATE_HH #define WINDOWSTATE_HH
#include "Layer.hh"
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <string> #include <string>
@ -93,11 +95,24 @@ public:
DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB 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(): WindowState():
size_hints(), size_hints(),
deco_mask(DECOR_NORMAL), deco_mask(DECOR_NORMAL),
type(TYPE_NORMAL),
focused(false), 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) { } x(0), y(0), width(1), height(1) { }
void saveGeometry(int x, int y, unsigned int width, unsigned int height, void saveGeometry(int x, int y, unsigned int width, unsigned int height,
@ -112,15 +127,16 @@ public:
bool useTitlebar() const; bool useTitlebar() const;
bool isMaximized() const { return maximized == MAX_FULL; } bool isMaximized() const { return maximized == MAX_FULL; }
bool isMaximizedHorz() const { return (bool)(maximized & MAX_HORZ); } bool isMaximizedHorz() const { return maximized & MAX_HORZ; }
bool isMaximizedVert() const { return (bool)(maximized & MAX_VERT); } bool isMaximizedVert() const { return maximized & MAX_VERT; }
static int getDecoMaskFromString(const std::string &str); static int getDecoMaskFromString(const std::string &str);
SizeHints size_hints; SizeHints size_hints;
unsigned int deco_mask; unsigned int deco_mask;
bool focused, shaded, fullscreen; WindowType type;
int maximized; bool focused, shaded, fullscreen, stuck, iconic, focus_hidden, icon_hidden;
int maximized, layernum;
int x, y; int x, y;
unsigned int width, height; unsigned int width, height;
}; };