aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-27 22:29:33 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-27 22:29:33 (GMT)
commit82047e6a391a12be9583168f28ac72c1154108d6 (patch)
tree68cc4865da7bdf95052907c6d8ce9cf0fb19c90b
parenta2ec0c9bdd9ebcc713426a79209b9ca90b4db301 (diff)
downloadfluxbox_pavel-82047e6a391a12be9583168f28ac72c1154108d6.zip
fluxbox_pavel-82047e6a391a12be9583168f28ac72c1154108d6.tar.bz2
move some things from FluxboxWindow to WindowState
-rw-r--r--src/Ewmh.cc16
-rw-r--r--src/FbWinFrame.cc7
-rw-r--r--src/FbWinFrame.hh4
-rw-r--r--src/Focusable.hh13
-rw-r--r--src/Screen.cc6
-rw-r--r--src/WinClient.cc6
-rw-r--r--src/WinClient.hh6
-rw-r--r--src/Window.cc77
-rw-r--r--src/Window.hh20
-rw-r--r--src/WindowState.hh26
10 files changed, 85 insertions, 96 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 2617491..aacb2ed 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -586,22 +586,22 @@ void Ewmh::setupClient(WinClient &winclient) {
586 winclient.property(m_net->wm_window_type, 0, 0x7fffffff, False, XA_ATOM, 586 winclient.property(m_net->wm_window_type, 0, 0x7fffffff, False, XA_ATOM,
587 &ret_type, &fmt, &nitems, &bytes_after, 587 &ret_type, &fmt, &nitems, &bytes_after,
588 &data); 588 &data);
589 Focusable::WindowType type = Focusable::TYPE_NORMAL; 589 WindowState::WindowType type = WindowState::TYPE_NORMAL;
590 if (data) { 590 if (data) {
591 Atom *atoms = (unsigned long *)data; 591 Atom *atoms = (unsigned long *)data;
592 for (unsigned long l = 0; l < nitems; ++l) { 592 for (unsigned long l = 0; l < nitems; ++l) {
593 if (atoms[l] == m_net->wm_window_type_dock) 593 if (atoms[l] == m_net->wm_window_type_dock)
594 type = Focusable::TYPE_DOCK; 594 type = WindowState::TYPE_DOCK;
595 else if (atoms[l] == m_net->wm_window_type_desktop) 595 else if (atoms[l] == m_net->wm_window_type_desktop)
596 type = Focusable::TYPE_DESKTOP; 596 type = WindowState::TYPE_DESKTOP;
597 else if (atoms[l] == m_net->wm_window_type_splash) 597 else if (atoms[l] == m_net->wm_window_type_splash)
598 type = Focusable::TYPE_SPLASH; 598 type = WindowState::TYPE_SPLASH;
599 else if (atoms[l] == m_net->wm_window_type_dialog) 599 else if (atoms[l] == m_net->wm_window_type_dialog)
600 type = Focusable::TYPE_DIALOG; 600 type = WindowState::TYPE_DIALOG;
601 else if (atoms[l] == m_net->wm_window_type_menu) 601 else if (atoms[l] == m_net->wm_window_type_menu)
602 type = Focusable::TYPE_MENU; 602 type = WindowState::TYPE_MENU;
603 else if (atoms[l] == m_net->wm_window_type_toolbar) 603 else if (atoms[l] == m_net->wm_window_type_toolbar)
604 type = Focusable::TYPE_TOOLBAR; 604 type = WindowState::TYPE_TOOLBAR;
605 else if (atoms[l] != m_net->wm_window_type_normal) 605 else if (atoms[l] != m_net->wm_window_type_normal)
606 continue; 606 continue;
607 /* 607 /*
@@ -615,7 +615,7 @@ void Ewmh::setupClient(WinClient &winclient) {
615 // if _NET_WM_WINDOW_TYPE not set and this window 615 // if _NET_WM_WINDOW_TYPE not set and this window
616 // has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG 616 // has transient_for the type must be set to _NET_WM_WINDOW_TYPE_DIALOG
617 if (winclient.isTransient()) { 617 if (winclient.isTransient()) {
618 type = Focusable::TYPE_DIALOG; 618 type = WindowState::TYPE_DIALOG;
619 winclient. 619 winclient.
620 changeProperty(m_net->wm_window_type, 620 changeProperty(m_net->wm_window_type,
621 XA_ATOM, 32, PropModeReplace, 621 XA_ATOM, 32, PropModeReplace,
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 0fa71d5..8617c1b 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -41,9 +41,8 @@
41using std::mem_fun; 41using std::mem_fun;
42using std::string; 42using std::string;
43 43
44FbWinFrame::FbWinFrame(BScreen &screen, 44FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state,
45 FocusableTheme<FbWinFrameTheme> &theme, 45 FocusableTheme<FbWinFrameTheme> &theme):
46 FbTk::XLayer &layer, WindowState &state):
47 m_screen(screen), 46 m_screen(screen),
48 m_theme(theme), 47 m_theme(theme),
49 m_imagectrl(screen.imageControl()), 48 m_imagectrl(screen.imageControl()),
@@ -52,7 +51,7 @@ FbWinFrame::FbWinFrame(BScreen &screen,
52 ButtonPressMask | ButtonReleaseMask | 51 ButtonPressMask | ButtonReleaseMask |
53 ButtonMotionMask | EnterWindowMask | 52 ButtonMotionMask | EnterWindowMask |
54 LeaveWindowMask, true), 53 LeaveWindowMask, true),
55 m_layeritem(window(), layer), 54 m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)),
56 m_titlebar(m_window, 0, 0, 100, 16, 55 m_titlebar(m_window, 0, 0, 100, 16,
57 ButtonPressMask | ButtonReleaseMask | 56 ButtonPressMask | ButtonReleaseMask |
58 ButtonMotionMask | ExposureMask | 57 ButtonMotionMask | ExposureMask |
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 7891c36..45953ba 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -71,8 +71,8 @@ public:
71 }; 71 };
72 72
73 /// create a top level window 73 /// create a top level window
74 FbWinFrame(BScreen &screen, FocusableTheme<FbWinFrameTheme> &theme, 74 FbWinFrame(BScreen &screen, WindowState &state,
75 FbTk::XLayer &layer, WindowState &state); 75 FocusableTheme<FbWinFrameTheme> &theme);
76 76
77/* /// create a frame window inside another FbWindow, NOT IMPLEMENTED! 77/* /// create a frame window inside another FbWindow, NOT IMPLEMENTED!
78 FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, 78 FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
diff --git a/src/Focusable.hh b/src/Focusable.hh
index 007aea9..453a114 100644
--- a/src/Focusable.hh
+++ b/src/Focusable.hh
@@ -45,16 +45,6 @@ public:
45 m_attentionsig(*this) { } 45 m_attentionsig(*this) { }
46 virtual ~Focusable() { } 46 virtual ~Focusable() { }
47 47
48 enum WindowType {
49 TYPE_NORMAL,
50 TYPE_DOCK,
51 TYPE_DESKTOP,
52 TYPE_SPLASH,
53 TYPE_DIALOG,
54 TYPE_MENU,
55 TYPE_TOOLBAR
56 };
57
58 /** 48 /**
59 * Take focus. 49 * Take focus.
60 * @return true if the focuable took focus 50 * @return true if the focuable took focus
@@ -96,9 +86,6 @@ public:
96 /// @return wm role string (for pattern matching) 86 /// @return wm role string (for pattern matching)
97 virtual std::string getWMRole() const { return "Focusable"; } 87 virtual std::string getWMRole() const { return "Focusable"; }
98 88
99 /// @return window type
100 virtual WindowType getWindowType() const { return TYPE_NORMAL; }
101
102 /// @return whether this window is a transient (for pattern matching) 89 /// @return whether this window is a transient (for pattern matching)
103 virtual bool isTransient() const { return false; } 90 virtual bool isTransient() const { return false; }
104 91
diff --git a/src/Screen.cc b/src/Screen.cc
index 34cb829..4340ef1 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1357,8 +1357,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
1357 if (workspace) 1357 if (workspace)
1358 workspace->updateClientmenu(); 1358 workspace->updateClientmenu();
1359 } else { 1359 } else {
1360 win = new FluxboxWindow(*winclient, 1360 win = new FluxboxWindow(*winclient);
1361 *layerManager().getLayer(Layer::NORMAL));
1362 1361
1363 if (!win->isManaged()) { 1362 if (!win->isManaged()) {
1364 delete win; 1363 delete win;
@@ -1394,8 +1393,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
1394 return 0; 1393 return 0;
1395 } 1394 }
1396 1395
1397 FluxboxWindow *win = new FluxboxWindow(client, 1396 FluxboxWindow *win = new FluxboxWindow(client);
1398 *layerManager().getLayer(Layer::NORMAL));
1399 1397
1400#ifdef SLIT 1398#ifdef SLIT
1401 if (win->initialState() == WithdrawnState && slit() != 0) { 1399 if (win->initialState() == WithdrawnState && slit() != 0) {
diff --git a/src/WinClient.cc b/src/WinClient.cc
index aa8c6ed..3a22e4a 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -77,7 +77,7 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin):
77 send_close_message(false), 77 send_close_message(false),
78 m_title_override(false), 78 m_title_override(false),
79 m_icon_override(false), 79 m_icon_override(false),
80 m_window_type(Focusable::TYPE_NORMAL), 80 m_window_type(WindowState::TYPE_NORMAL),
81 m_mwm_hint(0), 81 m_mwm_hint(0),
82 m_strut(0) { 82 m_strut(0) {
83 83
@@ -163,8 +163,8 @@ WinClient::~WinClient() {
163bool WinClient::acceptsFocus() const { 163bool WinClient::acceptsFocus() const {
164 return ((accepts_input || send_focus_message) && 164 return ((accepts_input || send_focus_message) &&
165 // focusing fbpanel messes up quite a few things 165 // focusing fbpanel messes up quite a few things
166 m_window_type != Focusable::TYPE_DOCK && 166 m_window_type != WindowState::TYPE_DOCK &&
167 m_window_type != Focusable::TYPE_SPLASH); 167 m_window_type != WindowState::TYPE_SPLASH);
168} 168}
169 169
170bool WinClient::sendFocus() { 170bool WinClient::sendFocus() {
diff --git a/src/WinClient.hh b/src/WinClient.hh
index 1903040..90c5b14 100644
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
@@ -95,8 +95,8 @@ public:
95 bool getWMName(XTextProperty &textprop) const; 95 bool getWMName(XTextProperty &textprop) const;
96 bool getWMIconName(XTextProperty &textprop) const; 96 bool getWMIconName(XTextProperty &textprop) const;
97 std::string getWMRole() const; 97 std::string getWMRole() const;
98 Focusable::WindowType getWindowType() const { return m_window_type; } 98 WindowState::WindowType getWindowType() const { return m_window_type; }
99 void setWindowType(Focusable::WindowType type) { m_window_type = type; } 99 void setWindowType(WindowState::WindowType type) { m_window_type = type; }
100 100
101 WinClient *transientFor() { return transient_for; } 101 WinClient *transientFor() { return transient_for; }
102 const WinClient *transientFor() const { return transient_for; } 102 const WinClient *transientFor() const { return transient_for; }
@@ -156,7 +156,7 @@ private:
156 bool m_title_override; 156 bool m_title_override;
157 bool m_icon_override; 157 bool m_icon_override;
158 158
159 Focusable::WindowType m_window_type; 159 WindowState::WindowType m_window_type;
160 MwmHints *m_mwm_hint; 160 MwmHints *m_mwm_hint;
161 SizeHints m_size_hints; 161 SizeHints m_size_hints;
162 162
diff --git a/src/Window.cc b/src/Window.cc
index 57fa1f5..7c3e36c 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -39,7 +39,6 @@
39#include "Remember.hh" 39#include "Remember.hh"
40#include "MenuCreator.hh" 40#include "MenuCreator.hh"
41#include "FocusControl.hh" 41#include "FocusControl.hh"
42#include "Layer.hh"
43#include "IconButton.hh" 42#include "IconButton.hh"
44#include "ScreenPlacement.hh" 43#include "ScreenPlacement.hh"
45 44
@@ -261,7 +260,7 @@ private:
261 260
262int FluxboxWindow::s_num_grabs = 0; 261int FluxboxWindow::s_num_grabs = 0;
263 262
264FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer): 263FluxboxWindow::FluxboxWindow(WinClient &client):
265 Focusable(client.screen(), this), 264 Focusable(client.screen(), this),
266 oplock(false), 265 oplock(false),
267 m_hintsig(*this), 266 m_hintsig(*this),
@@ -269,7 +268,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer):
269 m_layersig(*this), 268 m_layersig(*this),
270 m_workspacesig(*this), 269 m_workspacesig(*this),
271 m_creation_time(0), 270 m_creation_time(0),
272 moving(false), resizing(false), iconic(false), stuck(false), 271 moving(false), resizing(false),
273 m_initialized(false), 272 m_initialized(false),
274 m_attaching_tab(0), 273 m_attaching_tab(0),
275 display(FbTk::App::instance()->display()), 274 display(FbTk::App::instance()->display()),
@@ -281,8 +280,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer):
281 m_old_decoration_mask(0), 280 m_old_decoration_mask(0),
282 m_client(&client), 281 m_client(&client),
283 m_toggled_decos(false), 282 m_toggled_decos(false),
284 m_icon_hidden(false),
285 m_focus_hidden(false),
286 m_focus_new(BoolAcc(screen().focusControl(), &FocusControl::focusNew)), 283 m_focus_new(BoolAcc(screen().focusControl(), &FocusControl::focusNew)),
287 m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)), 284 m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)),
288 m_click_focus(true), 285 m_click_focus(true),
@@ -291,9 +288,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer):
291 screen().unfocusedWinButtonTheme()), 288 screen().unfocusedWinButtonTheme()),
292 m_theme(*this, screen().focusedWinFrameTheme(), 289 m_theme(*this, screen().focusedWinFrameTheme(),
293 screen().unfocusedWinFrameTheme()), 290 screen().unfocusedWinFrameTheme()),
294 m_frame(client.screen(), m_theme, layer, m_state), 291 m_frame(client.screen(), m_state, m_theme),
295 m_placed(false), 292 m_placed(false),
296 m_layernum(layer.getLayerNum()),
297 m_old_layernum(0), 293 m_old_layernum(0),
298 m_parent(client.screen().rootWindow()), 294 m_parent(client.screen().rootWindow()),
299 m_resize_corner(RIGHTBOTTOM) { 295 m_resize_corner(RIGHTBOTTOM) {
@@ -440,7 +436,7 @@ void FluxboxWindow::init() {
440 /**************************************************/ 436 /**************************************************/
441 437
442 if (m_client->isTransient() && m_client->transientFor()->fbwindow()) 438 if (m_client->isTransient() && m_client->transientFor()->fbwindow())
443 stuck = m_client->transientFor()->fbwindow()->isStuck(); 439 m_state.stuck = m_client->transientFor()->fbwindow()->isStuck();
444 440
445 if (!m_client->sizeHints().isResizable()) { 441 if (!m_client->sizeHints().isResizable()) {
446 functions.resize = functions.maximize = false; 442 functions.resize = functions.maximize = false;
@@ -485,7 +481,7 @@ void FluxboxWindow::init() {
485 m_client->transientFor()->fbwindow() != this) 481 m_client->transientFor()->fbwindow() != this)
486 layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer()); 482 layerItem().setLayer(m_client->transientFor()->fbwindow()->layerItem().getLayer());
487 else // if no parent then set default layer 483 else // if no parent then set default layer
488 moveToLayer(m_layernum, m_layernum != ::Layer::NORMAL); 484 moveToLayer(m_state.layernum, m_state.layernum != ::Layer::NORMAL);
489 485
490 // transients should be on the same workspace as parent 486 // transients should be on the same workspace as parent
491 if (m_client->isTransient() && 487 if (m_client->isTransient() &&
@@ -515,8 +511,8 @@ void FluxboxWindow::init() {
515 511
516 setFocusFlag(false); // update graphics before mapping 512 setFocusFlag(false); // update graphics before mapping
517 513
518 if (stuck) { 514 if (m_state.stuck) {
519 stuck = false; 515 m_state.stuck = false;
520 stick(); 516 stick();
521 } 517 }
522 518
@@ -525,11 +521,11 @@ void FluxboxWindow::init() {
525 shade(); 521 shade();
526 } 522 }
527 523
528 if (iconic) { 524 if (m_state.iconic) {
529 iconic = false; 525 m_state.iconic = false;
530 iconify(); 526 iconify();
531 } else if (m_workspace_number == screen().currentWorkspaceID()) { 527 } else if (m_workspace_number == screen().currentWorkspaceID()) {
532 iconic = true; 528 m_state.iconic = true;
533 deiconify(false); 529 deiconify(false);
534 // check if we should prevent this window from gaining focus 530 // check if we should prevent this window from gaining focus
535 m_focused = false; // deiconify sets this 531 m_focused = false; // deiconify sets this
@@ -1374,7 +1370,7 @@ void FluxboxWindow::iconify() {
1374 if (isIconic()) // no need to iconify if we're already 1370 if (isIconic()) // no need to iconify if we're already
1375 return; 1371 return;
1376 1372
1377 iconic = true; 1373 m_state.iconic = true;
1378 m_statesig.notify(); 1374 m_statesig.notify();
1379 1375
1380 hide(true); 1376 hide(true);
@@ -1396,14 +1392,14 @@ void FluxboxWindow::iconify() {
1396} 1392}
1397 1393
1398void FluxboxWindow::deiconify(bool do_raise) { 1394void FluxboxWindow::deiconify(bool do_raise) {
1399 if (numClients() == 0 || !iconic || oplock) 1395 if (numClients() == 0 || !m_state.iconic || oplock)
1400 return; 1396 return;
1401 1397
1402 oplock = true; 1398 oplock = true;
1403 1399
1404 // reassociate first, so it gets removed from screen's icon list 1400 // reassociate first, so it gets removed from screen's icon list
1405 screen().reassociateWindow(this, m_workspace_number, false); 1401 screen().reassociateWindow(this, m_workspace_number, false);
1406 iconic = false; 1402 m_state.iconic = false;
1407 m_statesig.notify(); 1403 m_statesig.notify();
1408 1404
1409 // deiconify all transients 1405 // deiconify all transients
@@ -1544,7 +1540,7 @@ void FluxboxWindow::setWorkspace(int n) {
1544 m_workspace_number = n; 1540 m_workspace_number = n;
1545 1541
1546 // notify workspace change 1542 // notify workspace change
1547 if (m_initialized && !stuck && old_wkspc != m_workspace_number) { 1543 if (m_initialized && old_wkspc != m_workspace_number) {
1548#ifdef DEBUG 1544#ifdef DEBUG
1549 cerr<<this<<" notify workspace signal"<<endl; 1545 cerr<<this<<" notify workspace signal"<<endl;
1550#endif // DEBUG 1546#endif // DEBUG
@@ -1553,7 +1549,7 @@ void FluxboxWindow::setWorkspace(int n) {
1553} 1549}
1554 1550
1555void FluxboxWindow::setLayerNum(int layernum) { 1551void FluxboxWindow::setLayerNum(int layernum) {
1556 m_layernum = layernum; 1552 m_state.layernum = layernum;
1557 1553
1558 if (m_initialized) { 1554 if (m_initialized) {
1559#ifdef DEBUG 1555#ifdef DEBUG
@@ -1595,7 +1591,7 @@ void FluxboxWindow::setShaded(bool val) {
1595 1591
1596void FluxboxWindow::stick() { 1592void FluxboxWindow::stick() {
1597 1593
1598 stuck = !stuck; 1594 m_state.stuck = !m_state.stuck;
1599 1595
1600 if (m_initialized) { 1596 if (m_initialized) {
1601 stateSig().notify(); 1597 stateSig().notify();
@@ -1611,7 +1607,7 @@ void FluxboxWindow::stick() {
1611 WinClient::TransientList::const_iterator it_end = (*client_it)->transientList().end(); 1607 WinClient::TransientList::const_iterator it_end = (*client_it)->transientList().end();
1612 for (; it != it_end; ++it) { 1608 for (; it != it_end; ++it) {
1613 if ((*it)->fbwindow()) 1609 if ((*it)->fbwindow())
1614 (*it)->fbwindow()->setStuck(stuck); 1610 (*it)->fbwindow()->setStuck(m_state.stuck);
1615 } 1611 }
1616 1612
1617 } 1613 }
@@ -1619,7 +1615,7 @@ void FluxboxWindow::stick() {
1619} 1615}
1620 1616
1621void FluxboxWindow::setStuck(bool val) { 1617void FluxboxWindow::setStuck(bool val) {
1622 if (val != stuck) 1618 if (val != m_state.stuck)
1623 stick(); 1619 stick();
1624} 1620}
1625 1621
@@ -1685,11 +1681,11 @@ void FluxboxWindow::tempRaise() {
1685 1681
1686 1682
1687void FluxboxWindow::raiseLayer() { 1683void FluxboxWindow::raiseLayer() {
1688 moveToLayer(m_layernum-1); 1684 moveToLayer(m_state.layernum-1);
1689} 1685}
1690 1686
1691void FluxboxWindow::lowerLayer() { 1687void FluxboxWindow::lowerLayer() {
1692 moveToLayer(m_layernum+1); 1688 moveToLayer(m_state.layernum+1);
1693} 1689}
1694 1690
1695 1691
@@ -1705,9 +1701,9 @@ void FluxboxWindow::moveToLayer(int layernum, bool force) {
1705 layernum = ::Layer::NUM_LAYERS - 1; 1701 layernum = ::Layer::NUM_LAYERS - 1;
1706 1702
1707 if (!m_initialized) 1703 if (!m_initialized)
1708 m_layernum = layernum; 1704 m_state.layernum = layernum;
1709 1705
1710 if ((m_layernum == layernum && !force) || !m_client) 1706 if ((m_state.layernum == layernum && !force) || !m_client)
1711 return; 1707 return;
1712 1708
1713 // get root window 1709 // get root window
@@ -1741,13 +1737,13 @@ void FluxboxWindow::moveToLayer(int layernum, bool force) {
1741} 1737}
1742 1738
1743void FluxboxWindow::setFocusHidden(bool value) { 1739void FluxboxWindow::setFocusHidden(bool value) {
1744 m_focus_hidden = value; 1740 m_state.focus_hidden = value;
1745 if (m_initialized) 1741 if (m_initialized)
1746 m_statesig.notify(); 1742 m_statesig.notify();
1747} 1743}
1748 1744
1749void FluxboxWindow::setIconHidden(bool value) { 1745void FluxboxWindow::setIconHidden(bool value) {
1750 m_icon_hidden= value; 1746 m_state.icon_hidden = value;
1751 if (m_initialized) 1747 if (m_initialized)
1752 m_statesig.notify(); 1748 m_statesig.notify();
1753} 1749}
@@ -2058,7 +2054,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
2058 if (ne.override_redirect || !isVisible() || !client->validateClient()) 2054 if (ne.override_redirect || !isVisible() || !client->validateClient())
2059 return; 2055 return;
2060 2056
2061 iconic = false; 2057 m_state.iconic = false;
2062 2058
2063 // setting state will cause all tabs to be mapped, but we only want the 2059 // setting state will cause all tabs to be mapped, but we only want the
2064 // original tab to be focused 2060 // original tab to be focused
@@ -3415,10 +3411,6 @@ std::string FluxboxWindow::getWMRole() const {
3415 return (m_client ? m_client->getWMRole() : "FluxboxWindow"); 3411 return (m_client ? m_client->getWMRole() : "FluxboxWindow");
3416} 3412}
3417 3413
3418Focusable::WindowType FluxboxWindow::getWindowType() const {
3419 return (m_client ? m_client->getWindowType() : Focusable::TYPE_NORMAL);
3420}
3421
3422bool FluxboxWindow::isTransient() const { 3414bool FluxboxWindow::isTransient() const {
3423 return (m_client && m_client->isTransient()); 3415 return (m_client && m_client->isTransient());
3424} 3416}
@@ -3803,9 +3795,10 @@ void FluxboxWindow::placeWindow(int head) {
3803 move(new_x, new_y); 3795 move(new_x, new_y);
3804} 3796}
3805 3797
3806void FluxboxWindow::setWindowType(Focusable::WindowType type) { 3798void FluxboxWindow::setWindowType(WindowState::WindowType type) {
3799 m_state.type = type;
3807 switch (type) { 3800 switch (type) {
3808 case Focusable::TYPE_DOCK: 3801 case WindowState::TYPE_DOCK:
3809 /* From Extended Window Manager Hints, draft 1.3: 3802 /* From Extended Window Manager Hints, draft 1.3:
3810 * 3803 *
3811 * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature. 3804 * _NET_WM_WINDOW_TYPE_DOCK indicates a dock or panel feature.
@@ -3821,7 +3814,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
3821 setDecorationMask(WindowState::DECOR_NONE); 3814 setDecorationMask(WindowState::DECOR_NONE);
3822 moveToLayer(::Layer::DOCK); 3815 moveToLayer(::Layer::DOCK);
3823 break; 3816 break;
3824 case Focusable::TYPE_DESKTOP: 3817 case WindowState::TYPE_DESKTOP:
3825 /* 3818 /*
3826 * _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window 3819 * _NET_WM_WINDOW_TYPE_DESKTOP indicates a "false desktop" window
3827 * We let it be the size it wants, but it gets no decoration, 3820 * We let it be the size it wants, but it gets no decoration,
@@ -3837,9 +3830,9 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
3837 setTabable(false); 3830 setTabable(false);
3838 setMovable(false); 3831 setMovable(false);
3839 setResizable(false); 3832 setResizable(false);
3840 stick(); 3833 setStuck(true);
3841 break; 3834 break;
3842 case Focusable::TYPE_SPLASH: 3835 case WindowState::TYPE_SPLASH:
3843 /* 3836 /*
3844 * _NET_WM_WINDOW_TYPE_SPLASH indicates that the 3837 * _NET_WM_WINDOW_TYPE_SPLASH indicates that the
3845 * window is a splash screen displayed as an application 3838 * window is a splash screen displayed as an application
@@ -3853,11 +3846,11 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
3853 setClickFocus(false); 3846 setClickFocus(false);
3854 setMovable(false); 3847 setMovable(false);
3855 break; 3848 break;
3856 case Focusable::TYPE_DIALOG: 3849 case WindowState::TYPE_DIALOG:
3857 setTabable(false); 3850 setTabable(false);
3858 break; 3851 break;
3859 case Focusable::TYPE_MENU: 3852 case WindowState::TYPE_MENU:
3860 case Focusable::TYPE_TOOLBAR: 3853 case WindowState::TYPE_TOOLBAR:
3861 /* 3854 /*
3862 * _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU 3855 * _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU
3863 * indicate toolbar and pinnable menu windows, respectively 3856 * indicate toolbar and pinnable menu windows, respectively
@@ -3869,7 +3862,7 @@ void FluxboxWindow::setWindowType(Focusable::WindowType type) {
3869 setIconHidden(true); 3862 setIconHidden(true);
3870 moveToLayer(::Layer::ABOVE_DOCK); 3863 moveToLayer(::Layer::ABOVE_DOCK);
3871 break; 3864 break;
3872 case Focusable::TYPE_NORMAL: 3865 case WindowState::TYPE_NORMAL:
3873 default: 3866 default:
3874 break; 3867 break;
3875 } 3868 }
diff --git a/src/Window.hh b/src/Window.hh
index b0b8248..220cedb 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -122,7 +122,7 @@ public:
122 typedef std::list<WinClient *> ClientList; 122 typedef std::list<WinClient *> ClientList;
123 123
124 /// create a window from a client 124 /// create a window from a client
125 FluxboxWindow(WinClient &client, FbTk::XLayer &layer); 125 FluxboxWindow(WinClient &client);
126 126
127 virtual ~FluxboxWindow(); 127 virtual ~FluxboxWindow();
128 128
@@ -366,11 +366,11 @@ public:
366 void setMovable(bool movable) { functions.move = movable; } 366 void setMovable(bool movable) { functions.move = movable; }
367 void setResizable(bool resizable) { functions.resize = resizable; } 367 void setResizable(bool resizable) { functions.resize = resizable; }
368 368
369 bool isFocusHidden() const { return m_focus_hidden; } 369 bool isFocusHidden() const { return m_state.focus_hidden; }
370 bool isIconHidden() const { return m_icon_hidden; } 370 bool isIconHidden() const { return m_state.icon_hidden; }
371 bool isManaged() const { return m_initialized; } 371 bool isManaged() const { return m_initialized; }
372 bool isVisible() const; 372 bool isVisible() const;
373 bool isIconic() const { return iconic; } 373 bool isIconic() const { return m_state.iconic; }
374 bool isShaded() const { return m_state.shaded; } 374 bool isShaded() const { return m_state.shaded; }
375 bool isFullscreen() const { return m_state.fullscreen; } 375 bool isFullscreen() const { return m_state.fullscreen; }
376 bool isMaximized() const { return m_state.isMaximized(); } 376 bool isMaximized() const { return m_state.isMaximized(); }
@@ -382,7 +382,7 @@ public:
382 bool isResizable() const { return functions.resize; } 382 bool isResizable() const { return functions.resize; }
383 bool isClosable() const { return functions.close; } 383 bool isClosable() const { return functions.close; }
384 bool isMoveable() const { return functions.move; } 384 bool isMoveable() const { return functions.move; }
385 bool isStuck() const { return stuck; } 385 bool isStuck() const { return m_state.stuck; }
386 bool hasTitlebar() const { return decorations.titlebar; } 386 bool hasTitlebar() const { return decorations.titlebar; }
387 bool isMoving() const { return moving; } 387 bool isMoving() const { return moving; }
388 bool isResizing() const { return resizing; } 388 bool isResizing() const { return resizing; }
@@ -416,8 +416,7 @@ public:
416 const std::string &getWMClassName() const; 416 const std::string &getWMClassName() const;
417 const std::string &getWMClassClass() const; 417 const std::string &getWMClassClass() const;
418 std::string getWMRole() const; 418 std::string getWMRole() const;
419 Focusable::WindowType getWindowType() const; 419 void setWindowType(WindowState::WindowType type);
420 void setWindowType(Focusable::WindowType type);
421 bool isTransient() const; 420 bool isTransient() const;
422 421
423 int x() const { return frame().x(); } 422 int x() const { return frame().x(); }
@@ -437,7 +436,7 @@ public:
437 436
438 unsigned int workspaceNumber() const { return m_workspace_number; } 437 unsigned int workspaceNumber() const { return m_workspace_number; }
439 438
440 int layerNum() const { return m_layernum; } 439 int layerNum() const { return m_state.layernum; }
441 void setLayerNum(int layernum); 440 void setLayerNum(int layernum);
442 441
443 unsigned int titlebarHeight() const; 442 unsigned int titlebarHeight() const;
@@ -531,7 +530,7 @@ private:
531 time_t m_creation_time; 530 time_t m_creation_time;
532 531
533 // Window states 532 // Window states
534 bool moving, resizing, iconic, stuck, m_initialized; 533 bool moving, resizing, m_initialized;
535 534
536 WinClient *m_attaching_tab; 535 WinClient *m_attaching_tab;
537 536
@@ -568,8 +567,6 @@ private:
568 bool resize, move, iconify, maximize, close, tabable; 567 bool resize, move, iconify, maximize, close, tabable;
569 } functions; 568 } functions;
570 569
571 bool m_icon_hidden; ///< if the window is in the iconbar
572 bool m_focus_hidden; ///< if the window is in the NextWindow list
573 typedef FbTk::ConstObjectAccessor<bool, FocusControl> BoolAcc; 570 typedef FbTk::ConstObjectAccessor<bool, FocusControl> BoolAcc;
574 /// if the window is normally focused when mapped 571 /// if the window is normally focused when mapped
575 FbTk::DefaultValue<bool, BoolAcc> m_focus_new; 572 FbTk::DefaultValue<bool, BoolAcc> m_focus_new;
@@ -587,7 +584,6 @@ private:
587 584
588 bool m_placed; ///< determine whether or not we should place the window 585 bool m_placed; ///< determine whether or not we should place the window
589 586
590 int m_layernum;
591 int m_old_layernum; 587 int m_old_layernum;
592 588
593 FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window") 589 FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window")
diff --git a/src/WindowState.hh b/src/WindowState.hh
index ea9b635..883443a 100644
--- a/src/WindowState.hh
+++ b/src/WindowState.hh
@@ -22,6 +22,8 @@
22#ifndef WINDOWSTATE_HH 22#ifndef WINDOWSTATE_HH
23#define WINDOWSTATE_HH 23#define WINDOWSTATE_HH
24 24
25#include "Layer.hh"
26
25#include <X11/Xutil.h> 27#include <X11/Xutil.h>
26 28
27#include <string> 29#include <string>
@@ -93,11 +95,24 @@ public:
93 DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB 95 DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB
94 }; 96 };
95 97
98 enum WindowType {
99 TYPE_NORMAL,
100 TYPE_DOCK,
101 TYPE_DESKTOP,
102 TYPE_SPLASH,
103 TYPE_DIALOG,
104 TYPE_MENU,
105 TYPE_TOOLBAR
106 };
107
96 WindowState(): 108 WindowState():
97 size_hints(), 109 size_hints(),
98 deco_mask(DECOR_NORMAL), 110 deco_mask(DECOR_NORMAL),
111 type(TYPE_NORMAL),
99 focused(false), 112 focused(false),
100 shaded(false), fullscreen(false), maximized(0), 113 shaded(false), fullscreen(false), stuck(false), iconic(false),
114 focus_hidden(false), icon_hidden(false),
115 maximized(0), layernum(Layer::NORMAL),
101 x(0), y(0), width(1), height(1) { } 116 x(0), y(0), width(1), height(1) { }
102 117
103 void saveGeometry(int x, int y, unsigned int width, unsigned int height, 118 void saveGeometry(int x, int y, unsigned int width, unsigned int height,
@@ -112,15 +127,16 @@ public:
112 bool useTitlebar() const; 127 bool useTitlebar() const;
113 128
114 bool isMaximized() const { return maximized == MAX_FULL; } 129 bool isMaximized() const { return maximized == MAX_FULL; }
115 bool isMaximizedHorz() const { return (bool)(maximized & MAX_HORZ); } 130 bool isMaximizedHorz() const { return maximized & MAX_HORZ; }
116 bool isMaximizedVert() const { return (bool)(maximized & MAX_VERT); } 131 bool isMaximizedVert() const { return maximized & MAX_VERT; }
117 132
118 static int getDecoMaskFromString(const std::string &str); 133 static int getDecoMaskFromString(const std::string &str);
119 134
120 SizeHints size_hints; 135 SizeHints size_hints;
121 unsigned int deco_mask; 136 unsigned int deco_mask;
122 bool focused, shaded, fullscreen; 137 WindowType type;
123 int maximized; 138 bool focused, shaded, fullscreen, stuck, iconic, focus_hidden, icon_hidden;
139 int maximized, layernum;
124 int x, y; 140 int x, y;
125 unsigned int width, height; 141 unsigned int width, height;
126}; 142};