aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
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 /src/Window.cc
parenta2ec0c9bdd9ebcc713426a79209b9ca90b4db301 (diff)
downloadfluxbox_pavel-82047e6a391a12be9583168f28ac72c1154108d6.zip
fluxbox_pavel-82047e6a391a12be9583168f28ac72c1154108d6.tar.bz2
move some things from FluxboxWindow to WindowState
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc77
1 files changed, 35 insertions, 42 deletions
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 }