diff options
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 864bc50..39cfa7b 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.101 2003/02/02 16:32:38 rathnor Exp $ | 25 | // $Id: Screen.cc,v 1.102 2003/02/03 13:52:31 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -45,6 +45,7 @@ | |||
45 | #include "MacroCommand.hh" | 45 | #include "MacroCommand.hh" |
46 | #include "XLayerItem.hh" | 46 | #include "XLayerItem.hh" |
47 | #include "MultLayers.hh" | 47 | #include "MultLayers.hh" |
48 | #include "LayeredMenu.hh" | ||
48 | 49 | ||
49 | //use GNU extensions | 50 | //use GNU extensions |
50 | #ifndef _GNU_SOURCE | 51 | #ifndef _GNU_SOURCE |
@@ -134,10 +135,10 @@ int dcmp(const void *one, const void *two) { | |||
134 | } | 135 | } |
135 | 136 | ||
136 | FbTk::Menu *createMenuFromScreen(BScreen &screen) { | 137 | FbTk::Menu *createMenuFromScreen(BScreen &screen) { |
137 | FbTk::Menu *menu = new FbTk::Menu(*screen.menuTheme(), screen.getScreenNumber(), *screen.getImageControl()); | 138 | FbTk::Menu *menu = new LayeredMenu(*screen.menuTheme(), |
138 | menu->setLayerItem(new FbTk::XLayerItem(menu->windowID())); | 139 | screen.getScreenNumber(), |
139 | 140 | *screen.getImageControl(), | |
140 | screen.setLayer(*menu->getLayerItem(), Fluxbox::instance()->getMenuLayer()); | 141 | *screen.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())); |
141 | return menu; | 142 | return menu; |
142 | } | 143 | } |
143 | }; | 144 | }; |
@@ -341,12 +342,12 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm, | |||
341 | 342 | ||
342 | BScreen::BScreen(ResourceManager &rm, | 343 | BScreen::BScreen(ResourceManager &rm, |
343 | const string &screenname, const string &altscreenname, | 344 | const string &screenname, const string &altscreenname, |
344 | int scrn) : ScreenInfo(scrn), | 345 | int scrn, int num_layers) : ScreenInfo(scrn), |
345 | m_clientlist_sig(*this), // client signal | 346 | m_clientlist_sig(*this), // client signal |
346 | m_workspacecount_sig(*this), // workspace count signal | 347 | m_workspacecount_sig(*this), // workspace count signal |
347 | m_workspacenames_sig(*this), // workspace names signal | 348 | m_workspacenames_sig(*this), // workspace names signal |
348 | m_currentworkspace_sig(*this), // current workspace signal | 349 | m_currentworkspace_sig(*this), // current workspace signal |
349 | m_layermanager(0), | 350 | m_layermanager(num_layers), |
350 | theme(0), m_windowtheme(scrn), | 351 | theme(0), m_windowtheme(scrn), |
351 | m_menutheme(new FbTk::MenuTheme(scrn)), | 352 | m_menutheme(new FbTk::MenuTheme(scrn)), |
352 | resource(rm, screenname, altscreenname), | 353 | resource(rm, screenname, altscreenname), |
@@ -399,7 +400,6 @@ BScreen::BScreen(ResourceManager &rm, | |||
399 | 400 | ||
400 | fluxbox->load_rc(this); | 401 | fluxbox->load_rc(this); |
401 | 402 | ||
402 | m_layermanager = new FbTk::MultLayers(fluxbox->getNumberOfLayers()); | ||
403 | image_control->setDither(*resource.image_dither); | 403 | image_control->setDither(*resource.image_dither); |
404 | theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(), | 404 | theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(), |
405 | fluxbox->getStyleFilename(), getRootCommand().c_str()); | 405 | fluxbox->getStyleFilename(), getRootCommand().c_str()); |
@@ -469,12 +469,12 @@ BScreen::BScreen(ResourceManager &rm, | |||
469 | Workspace *wkspc = (Workspace *) 0; | 469 | Workspace *wkspc = (Workspace *) 0; |
470 | if (*resource.workspaces != 0) { | 470 | if (*resource.workspaces != 0) { |
471 | for (int i = 0; i < *resource.workspaces; ++i) { | 471 | for (int i = 0; i < *resource.workspaces; ++i) { |
472 | wkspc = new Workspace(this, *m_layermanager, workspacesList.size()); | 472 | wkspc = new Workspace(this, m_layermanager, workspacesList.size()); |
473 | workspacesList.push_back(wkspc); | 473 | workspacesList.push_back(wkspc); |
474 | workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); | 474 | workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); |
475 | } | 475 | } |
476 | } else { | 476 | } else { |
477 | wkspc = new Workspace(this, *m_layermanager, workspacesList.size()); | 477 | wkspc = new Workspace(this, m_layermanager, workspacesList.size()); |
478 | workspacesList.push_back(wkspc); | 478 | workspacesList.push_back(wkspc); |
479 | workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); | 479 | workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu()); |
480 | } | 480 | } |
@@ -816,7 +816,7 @@ void BScreen::setAntialias(bool value) { | |||
816 | } | 816 | } |
817 | 817 | ||
818 | int BScreen::addWorkspace() { | 818 | int BScreen::addWorkspace() { |
819 | Workspace *wkspc = new Workspace(this, *m_layermanager, workspacesList.size()); | 819 | Workspace *wkspc = new Workspace(this, m_layermanager, workspacesList.size()); |
820 | workspacesList.push_back(wkspc); | 820 | workspacesList.push_back(wkspc); |
821 | addWorkspaceName(wkspc->name().c_str()); // update names | 821 | addWorkspaceName(wkspc->name().c_str()); // update names |
822 | //add workspace to workspacemenu | 822 | //add workspace to workspacemenu |
@@ -1086,7 +1086,8 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) { | |||
1086 | 1086 | ||
1087 | FluxboxWindow *BScreen::createWindow(Window client) { | 1087 | FluxboxWindow *BScreen::createWindow(Window client) { |
1088 | FluxboxWindow *win = new FluxboxWindow(client, this, getScreenNumber(), *getImageControl(), | 1088 | FluxboxWindow *win = new FluxboxWindow(client, this, getScreenNumber(), *getImageControl(), |
1089 | winFrameTheme(), *menuTheme()); | 1089 | winFrameTheme(), *menuTheme(), |
1090 | *layerManager().getLayer(0)); | ||
1090 | 1091 | ||
1091 | #ifdef SLIT | 1092 | #ifdef SLIT |
1092 | if (win->initialState() == WithdrawnState) | 1093 | if (win->initialState() == WithdrawnState) |
@@ -1946,15 +1947,14 @@ void BScreen::lower(FbTk::XLayerItem &item) { | |||
1946 | } | 1947 | } |
1947 | 1948 | ||
1948 | void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) { | 1949 | void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) { |
1949 | m_layermanager->moveToLayer(item, layernum); | 1950 | m_layermanager.moveToLayer(item, layernum); |
1950 | } | 1951 | } |
1951 | 1952 | ||
1952 | void BScreen::removeLayerItem(FbTk::XLayerItem *item) { | ||
1953 | m_layermanager->remove(*item); | ||
1954 | delete item; | ||
1955 | } | ||
1956 | 1953 | ||
1957 | void BScreen::raiseWindow(FluxboxWindow *w) { | 1954 | void BScreen::raiseWindow(FluxboxWindow *w) { |
1955 | if (w == 0) | ||
1956 | return; | ||
1957 | |||
1958 | FluxboxWindow *win = w; | 1958 | FluxboxWindow *win = w; |
1959 | 1959 | ||
1960 | while (win->getTransientFor()) { | 1960 | while (win->getTransientFor()) { |
@@ -1962,16 +1962,20 @@ void BScreen::raiseWindow(FluxboxWindow *w) { | |||
1962 | assert(win != win->getTransientFor()); | 1962 | assert(win != win->getTransientFor()); |
1963 | } | 1963 | } |
1964 | 1964 | ||
1965 | if (win == 0) | ||
1966 | win = w; | ||
1967 | |||
1965 | if (!win->isIconic()) { | 1968 | if (!win->isIconic()) { |
1966 | updateNetizenWindowRaise(win->getClientWindow()); | 1969 | updateNetizenWindowRaise(win->getClientWindow()); |
1967 | win->getLayerItem()->raise(); | 1970 | win->getLayerItem().raise(); |
1968 | } | 1971 | } |
1972 | |||
1969 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 1973 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); |
1970 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | 1974 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); |
1971 | for (; it != it_end; ++it) { | 1975 | for (; it != it_end; ++it) { |
1972 | if (!(*it)->isIconic()) { | 1976 | if (!(*it)->isIconic()) { |
1973 | updateNetizenWindowRaise((*it)->getClientWindow()); | 1977 | updateNetizenWindowRaise((*it)->getClientWindow()); |
1974 | (*it)->getLayerItem()->raise(); | 1978 | (*it)->getLayerItem().raise(); |
1975 | } | 1979 | } |
1976 | } | 1980 | } |
1977 | } | 1981 | } |
@@ -1988,14 +1992,14 @@ void BScreen::lowerWindow(FluxboxWindow *w) { | |||
1988 | 1992 | ||
1989 | if (!win->isIconic()) { | 1993 | if (!win->isIconic()) { |
1990 | updateNetizenWindowLower(win->getClientWindow()); | 1994 | updateNetizenWindowLower(win->getClientWindow()); |
1991 | win->getLayerItem()->lower(); | 1995 | win->getLayerItem().lower(); |
1992 | } | 1996 | } |
1993 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 1997 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); |
1994 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | 1998 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); |
1995 | for (; it != it_end; ++it) { | 1999 | for (; it != it_end; ++it) { |
1996 | if (!(*it)->isIconic()) { | 2000 | if (!(*it)->isIconic()) { |
1997 | updateNetizenWindowLower((*it)->getClientWindow()); | 2001 | updateNetizenWindowLower((*it)->getClientWindow()); |
1998 | (*it)->getLayerItem()->lower(); | 2002 | (*it)->getLayerItem().lower(); |
1999 | } | 2003 | } |
2000 | } | 2004 | } |
2001 | 2005 | ||
@@ -2011,15 +2015,16 @@ void BScreen::raiseWindowLayer(FluxboxWindow *w) { | |||
2011 | 2015 | ||
2012 | if (!win->isIconic()) { | 2016 | if (!win->isIconic()) { |
2013 | updateNetizenWindowRaise(win->getClientWindow()); | 2017 | updateNetizenWindowRaise(win->getClientWindow()); |
2014 | m_layermanager->raise(*win->getLayerItem()); | 2018 | win->getLayerItem().raise(); |
2015 | win->setLayerNum(win->getLayerNum()-1); | 2019 | win->setLayerNum(win->getLayerNum()-1); |
2016 | } | 2020 | } |
2021 | |||
2017 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 2022 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); |
2018 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | 2023 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); |
2019 | for (; it != it_end; ++it) { | 2024 | for (; it != it_end; ++it) { |
2020 | if (!(*it)->isIconic()) { | 2025 | if (!(*it)->isIconic()) { |
2021 | updateNetizenWindowRaise((*it)->getClientWindow()); | 2026 | updateNetizenWindowRaise((*it)->getClientWindow()); |
2022 | m_layermanager->raise(*(*it)->getLayerItem()); | 2027 | (*it)->getLayerItem().raise(); |
2023 | (*it)->setLayerNum((*it)->getLayerNum()-1); | 2028 | (*it)->setLayerNum((*it)->getLayerNum()-1); |
2024 | } | 2029 | } |
2025 | } | 2030 | } |
@@ -2037,7 +2042,7 @@ void BScreen::lowerWindowLayer(FluxboxWindow *w) { | |||
2037 | 2042 | ||
2038 | if (!win->isIconic()) { | 2043 | if (!win->isIconic()) { |
2039 | updateNetizenWindowLower(win->getClientWindow()); | 2044 | updateNetizenWindowLower(win->getClientWindow()); |
2040 | m_layermanager->lower(*win->getLayerItem()); | 2045 | win->getLayerItem().lower(); |
2041 | win->setLayerNum(win->getLayerNum()+1); | 2046 | win->setLayerNum(win->getLayerNum()+1); |
2042 | } | 2047 | } |
2043 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 2048 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); |
@@ -2045,7 +2050,7 @@ void BScreen::lowerWindowLayer(FluxboxWindow *w) { | |||
2045 | for (; it != it_end; ++it) { | 2050 | for (; it != it_end; ++it) { |
2046 | if (!(*it)->isIconic()) { | 2051 | if (!(*it)->isIconic()) { |
2047 | updateNetizenWindowLower((*it)->getClientWindow()); | 2052 | updateNetizenWindowLower((*it)->getClientWindow()); |
2048 | m_layermanager->lower(*(*it)->getLayerItem()); | 2053 | (*it)->getLayerItem().lower(); |
2049 | (*it)->setLayerNum((*it)->getLayerNum()+1); | 2054 | (*it)->setLayerNum((*it)->getLayerNum()+1); |
2050 | } | 2055 | } |
2051 | } | 2056 | } |
@@ -2067,7 +2072,8 @@ void BScreen::moveWindowToLayer(FluxboxWindow *win, int layernum) { | |||
2067 | 2072 | ||
2068 | if (!win->isIconic()) { | 2073 | if (!win->isIconic()) { |
2069 | updateNetizenWindowRaise(win->getClientWindow()); | 2074 | updateNetizenWindowRaise(win->getClientWindow()); |
2070 | m_layermanager->moveToLayer(*win->getLayerItem(),layernum); | 2075 | //!! TODO |
2076 | //anager->moveToLayer(*win->getLayerItem(),layernum); | ||
2071 | win->setLayerNum(layernum); | 2077 | win->setLayerNum(layernum); |
2072 | } | 2078 | } |
2073 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 2079 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); |
@@ -2075,7 +2081,8 @@ void BScreen::moveWindowToLayer(FluxboxWindow *win, int layernum) { | |||
2075 | for (; it != it_end; ++it) { | 2081 | for (; it != it_end; ++it) { |
2076 | if (!(*it)->isIconic()) { | 2082 | if (!(*it)->isIconic()) { |
2077 | updateNetizenWindowRaise((*it)->getClientWindow()); | 2083 | updateNetizenWindowRaise((*it)->getClientWindow()); |
2078 | m_layermanager->moveToLayer(*(*it)->getLayerItem(), layernum); | 2084 | //!! TODO |
2085 | //m_layermanager->moveToLayer(*(*it)->getLayerItem(), layernum); | ||
2079 | (*it)->setLayerNum(layernum); | 2086 | (*it)->setLayerNum(layernum); |
2080 | } | 2087 | } |
2081 | } | 2088 | } |