converted the remaining LinkedLists in Screen to STL objects.
This commit is contained in:
parent
addc23faf5
commit
57fb41c806
6 changed files with 101 additions and 104 deletions
152
src/Screen.cc
152
src/Screen.cc
|
@ -1,3 +1,4 @@
|
||||||
|
#include <iostream.h>
|
||||||
// Screen.cc for Openbox
|
// Screen.cc for Openbox
|
||||||
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
|
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||||
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
|
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
|
||||||
|
@ -237,10 +238,6 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
XDefineCursor(getBaseDisplay().getXDisplay(), getRootWindow(),
|
XDefineCursor(getBaseDisplay().getXDisplay(), getRootWindow(),
|
||||||
openbox.getSessionCursor());
|
openbox.getSessionCursor());
|
||||||
|
|
||||||
workspaceNames = new LinkedList<char>;
|
|
||||||
workspacesList = new LinkedList<Workspace>;
|
|
||||||
iconList = new LinkedList<OpenboxWindow>;
|
|
||||||
|
|
||||||
image_control =
|
image_control =
|
||||||
new BImageControl(openbox, *this, True, openbox.getColorsPerChannel(),
|
new BImageControl(openbox, *this, True, openbox.getColorsPerChannel(),
|
||||||
openbox.getCacheLife(), openbox.getCacheMax());
|
openbox.getCacheLife(), openbox.getCacheMax());
|
||||||
|
@ -403,13 +400,14 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
Workspace *wkspc = NULL;
|
Workspace *wkspc = NULL;
|
||||||
if (resource.workspaces != 0) {
|
if (resource.workspaces != 0) {
|
||||||
for (int i = 0; i < resource.workspaces; ++i) {
|
for (int i = 0; i < resource.workspaces; ++i) {
|
||||||
wkspc = new Workspace(*this, workspacesList->count());
|
wkspc = new Workspace(*this, workspacesList.size());
|
||||||
workspacesList->insert(wkspc);
|
workspacesList.push_back(wkspc);
|
||||||
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wkspc = new Workspace(*this, workspacesList->count());
|
setWorkspaceCount(1);
|
||||||
workspacesList->insert(wkspc);
|
wkspc = new Workspace(*this, workspacesList.size());
|
||||||
|
workspacesList.push_back(wkspc);
|
||||||
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
||||||
}
|
}
|
||||||
saveWorkspaceNames();
|
saveWorkspaceNames();
|
||||||
|
@ -418,7 +416,7 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
iconmenu);
|
iconmenu);
|
||||||
workspacemenu->update();
|
workspacemenu->update();
|
||||||
|
|
||||||
current_workspace = workspacesList->first();
|
current_workspace = workspacesList.front();
|
||||||
workspacemenu->setItemSelected(2, True);
|
workspacemenu->setItemSelected(2, True);
|
||||||
|
|
||||||
toolbar = new Toolbar(*this, config);
|
toolbar = new Toolbar(*this, config);
|
||||||
|
@ -504,17 +502,10 @@ BScreen::~BScreen(void) {
|
||||||
|
|
||||||
removeWorkspaceNames();
|
removeWorkspaceNames();
|
||||||
|
|
||||||
while (workspacesList->count())
|
std::for_each(workspacesList.begin(), workspacesList.end(),
|
||||||
delete workspacesList->remove(0);
|
PointerAssassin());
|
||||||
|
std::for_each(iconList.begin(), iconList.end(), PointerAssassin());
|
||||||
while (!rootmenuList.empty())
|
std::for_each(netizenList.begin(), netizenList.end(), PointerAssassin());
|
||||||
rootmenuList.erase(rootmenuList.begin());
|
|
||||||
|
|
||||||
while (iconList->count())
|
|
||||||
delete iconList->remove(0);
|
|
||||||
|
|
||||||
while (!netizenList.empty())
|
|
||||||
netizenList.erase(netizenList.begin());
|
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
if (resource.strftime_format)
|
if (resource.strftime_format)
|
||||||
|
@ -533,10 +524,6 @@ BScreen::~BScreen(void) {
|
||||||
delete toolbar;
|
delete toolbar;
|
||||||
delete image_control;
|
delete image_control;
|
||||||
|
|
||||||
delete workspacesList;
|
|
||||||
delete workspaceNames;
|
|
||||||
delete iconList;
|
|
||||||
|
|
||||||
if (resource.wstyle.fontset)
|
if (resource.wstyle.fontset)
|
||||||
XFreeFontSet(getBaseDisplay().getXDisplay(), resource.wstyle.fontset);
|
XFreeFontSet(getBaseDisplay().getXDisplay(), resource.wstyle.fontset);
|
||||||
if (resource.mstyle.t_fontset)
|
if (resource.mstyle.t_fontset)
|
||||||
|
@ -1091,6 +1078,7 @@ void BScreen::setStrftimeFormat(const char *f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // !HAVE_STRFTIME
|
#else // !HAVE_STRFTIME
|
||||||
|
|
||||||
void BScreen::setDateFormat(int f) {
|
void BScreen::setDateFormat(int f) {
|
||||||
resource.date_format = f;
|
resource.date_format = f;
|
||||||
ostrstream s;
|
ostrstream s;
|
||||||
|
@ -1100,6 +1088,7 @@ void BScreen::setDateFormat(int f) {
|
||||||
s.rdbuf()->freeze(0);
|
s.rdbuf()->freeze(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BScreen::setClock24Hour(Bool c) {
|
void BScreen::setClock24Hour(Bool c) {
|
||||||
resource.clock24hour = c;
|
resource.clock24hour = c;
|
||||||
ostrstream s;
|
ostrstream s;
|
||||||
|
@ -1109,6 +1098,7 @@ void BScreen::setClock24Hour(Bool c) {
|
||||||
}
|
}
|
||||||
#endif // HAVE_STRFTIME
|
#endif // HAVE_STRFTIME
|
||||||
|
|
||||||
|
|
||||||
void BScreen::setHideToolbar(bool b) {
|
void BScreen::setHideToolbar(bool b) {
|
||||||
resource.hide_toolbar = b;
|
resource.hide_toolbar = b;
|
||||||
if (resource.hide_toolbar)
|
if (resource.hide_toolbar)
|
||||||
|
@ -1121,17 +1111,17 @@ void BScreen::setHideToolbar(bool b) {
|
||||||
s.rdbuf()->freeze(0);
|
s.rdbuf()->freeze(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BScreen::saveWorkspaceNames() {
|
void BScreen::saveWorkspaceNames() {
|
||||||
ostrstream rc, names;
|
ostrstream rc, names;
|
||||||
|
|
||||||
for (int i = 0; i < resource.workspaces; i++) {
|
wkspList::iterator it;
|
||||||
Workspace *w = getWorkspace(i);
|
wkspList::iterator last = workspacesList.end() - 1;
|
||||||
if (w != NULL) {
|
for (it = workspacesList.begin(); it != workspacesList.end(); ++it) {
|
||||||
names << w->getName();
|
names << (*it)->getName();
|
||||||
if (i < resource.workspaces-1)
|
if (it != last)
|
||||||
names << ",";
|
names << ",";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
names << ends;
|
names << ends;
|
||||||
|
|
||||||
rc << "session.screen" << getScreenNumber() << ".workspaceNames" << ends;
|
rc << "session.screen" << getScreenNumber() << ".workspaceNames" << ends;
|
||||||
|
@ -1551,14 +1541,14 @@ void BScreen::reconfigure(void) {
|
||||||
slit->reconfigure();
|
slit->reconfigure();
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
LinkedListIterator<Workspace> wit(workspacesList);
|
wkspList::iterator wit;
|
||||||
for (Workspace *w = wit.current(); w; wit++, w = wit.current())
|
for (wit = workspacesList.begin(); wit != workspacesList.end(); ++wit)
|
||||||
w->reconfigure();
|
(*wit)->reconfigure();
|
||||||
|
|
||||||
LinkedListIterator<OpenboxWindow> iit(iconList);
|
winList::iterator iit;
|
||||||
for (OpenboxWindow *bw = iit.current(); bw; iit++, bw = iit.current())
|
for (iit = iconList.begin(); iit != iconList.end(); ++iit)
|
||||||
if (bw->validateClient())
|
if ((*iit)->validateClient())
|
||||||
bw->reconfigure();
|
(*iit)->reconfigure();
|
||||||
|
|
||||||
image_control->timeout();
|
image_control->timeout();
|
||||||
}
|
}
|
||||||
|
@ -1573,8 +1563,7 @@ void BScreen::rereadMenu(void) {
|
||||||
|
|
||||||
|
|
||||||
void BScreen::removeWorkspaceNames(void) {
|
void BScreen::removeWorkspaceNames(void) {
|
||||||
while (workspaceNames->count())
|
workspaceNames.clear();
|
||||||
delete [] workspaceNames->remove(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1898,9 +1887,9 @@ void BScreen::addIcon(OpenboxWindow *w) {
|
||||||
if (! w) return;
|
if (! w) return;
|
||||||
|
|
||||||
w->setWorkspace(-1);
|
w->setWorkspace(-1);
|
||||||
w->setWindowNumber(iconList->count());
|
w->setWindowNumber(iconList.size());
|
||||||
|
|
||||||
iconList->insert(w);
|
iconList.push_back(w);
|
||||||
|
|
||||||
iconmenu->insert((const char **) w->getIconTitle());
|
iconmenu->insert((const char **) w->getIconTitle());
|
||||||
iconmenu->update();
|
iconmenu->update();
|
||||||
|
@ -1910,29 +1899,30 @@ void BScreen::addIcon(OpenboxWindow *w) {
|
||||||
void BScreen::removeIcon(OpenboxWindow *w) {
|
void BScreen::removeIcon(OpenboxWindow *w) {
|
||||||
if (! w) return;
|
if (! w) return;
|
||||||
|
|
||||||
iconList->remove(w->getWindowNumber());
|
iconList.remove(w);
|
||||||
|
|
||||||
iconmenu->remove(w->getWindowNumber());
|
iconmenu->remove(w->getWindowNumber());
|
||||||
iconmenu->update();
|
iconmenu->update();
|
||||||
|
|
||||||
LinkedListIterator<OpenboxWindow> it(iconList);
|
winList::iterator it = iconList.begin();
|
||||||
OpenboxWindow *bw = it.current();
|
for (int i = 0; it != iconList.end(); ++it, ++i)
|
||||||
for (int i = 0; bw; it++, bw = it.current())
|
(*it)->setWindowNumber(i);
|
||||||
bw->setWindowNumber(i++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OpenboxWindow *BScreen::getIcon(int index) {
|
OpenboxWindow *BScreen::getIcon(int index) {
|
||||||
if (index >= 0 && index < iconList->count())
|
if (index < 0 || index >= iconList.size())
|
||||||
return iconList->find(index);
|
return (OpenboxWindow *) 0;
|
||||||
|
|
||||||
return NULL;
|
winList::iterator it = iconList.begin();
|
||||||
|
for (; index > 0; --index, ++it); // increment to index
|
||||||
|
return *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BScreen::addWorkspace(void) {
|
int BScreen::addWorkspace(void) {
|
||||||
Workspace *wkspc = new Workspace(*this, workspacesList->count());
|
Workspace *wkspc = new Workspace(*this, workspacesList.size());
|
||||||
workspacesList->insert(wkspc);
|
workspacesList.push_back(wkspc);
|
||||||
setWorkspaceCount(workspaceCount()+1);
|
setWorkspaceCount(workspaceCount()+1);
|
||||||
saveWorkspaceNames();
|
saveWorkspaceNames();
|
||||||
|
|
||||||
|
@ -1944,15 +1934,15 @@ int BScreen::addWorkspace(void) {
|
||||||
|
|
||||||
updateNetizenWorkspaceCount();
|
updateNetizenWorkspaceCount();
|
||||||
|
|
||||||
return workspacesList->count();
|
return workspacesList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BScreen::removeLastWorkspace(void) {
|
int BScreen::removeLastWorkspace(void) {
|
||||||
if (workspacesList->count() == 1)
|
if (workspacesList.size() == 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Workspace *wkspc = workspacesList->last();
|
Workspace *wkspc = workspacesList.back();
|
||||||
|
|
||||||
if (current_workspace->getWorkspaceID() == wkspc->getWorkspaceID())
|
if (current_workspace->getWorkspaceID() == wkspc->getWorkspaceID())
|
||||||
changeWorkspaceID(current_workspace->getWorkspaceID() - 1);
|
changeWorkspaceID(current_workspace->getWorkspaceID() - 1);
|
||||||
|
@ -1962,8 +1952,9 @@ int BScreen::removeLastWorkspace(void) {
|
||||||
workspacemenu->remove(wkspc->getWorkspaceID() + 2);
|
workspacemenu->remove(wkspc->getWorkspaceID() + 2);
|
||||||
workspacemenu->update();
|
workspacemenu->update();
|
||||||
|
|
||||||
workspacesList->remove(wkspc);
|
workspacesList.pop_back();
|
||||||
delete wkspc;
|
delete wkspc;
|
||||||
|
|
||||||
setWorkspaceCount(workspaceCount()-1);
|
setWorkspaceCount(workspaceCount()-1);
|
||||||
saveWorkspaceNames();
|
saveWorkspaceNames();
|
||||||
|
|
||||||
|
@ -1971,7 +1962,7 @@ int BScreen::removeLastWorkspace(void) {
|
||||||
|
|
||||||
updateNetizenWorkspaceCount();
|
updateNetizenWorkspaceCount();
|
||||||
|
|
||||||
return workspacesList->count();
|
return workspacesList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2015,11 +2006,11 @@ void BScreen::addNetizen(Netizen *n) {
|
||||||
n->sendWorkspaceCount();
|
n->sendWorkspaceCount();
|
||||||
n->sendCurrentWorkspace();
|
n->sendCurrentWorkspace();
|
||||||
|
|
||||||
LinkedListIterator<Workspace> it(workspacesList);
|
wkspList::iterator it;
|
||||||
for (Workspace *w = it.current(); w; it++, w = it.current()) {
|
for (it = workspacesList.begin(); it != workspacesList.end(); ++it) {
|
||||||
for (int i = 0; i < w->getCount(); i++)
|
for (int i = 0; i < (*it)->getCount(); i++)
|
||||||
n->sendWindowAdd(w->getWindow(i)->getClientWindow(),
|
n->sendWindowAdd((*it)->getWindow(i)->getClientWindow(),
|
||||||
w->getWorkspaceID());
|
(*it)->getWorkspaceID());
|
||||||
}
|
}
|
||||||
|
|
||||||
Window f = ((openbox.focusedWindow()) ?
|
Window f = ((openbox.focusedWindow()) ?
|
||||||
|
@ -2101,15 +2092,15 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) {
|
||||||
|
|
||||||
void BScreen::raiseWindows(Window *workspace_stack, int num) {
|
void BScreen::raiseWindows(Window *workspace_stack, int num) {
|
||||||
Window *session_stack = new
|
Window *session_stack = new
|
||||||
Window[(num + workspacesList->count() + rootmenuList.size() + 13)];
|
Window[(num + workspacesList.size() + rootmenuList.size() + 13)];
|
||||||
int i = 0, k = num;
|
int i = 0, k = num;
|
||||||
|
|
||||||
XRaiseWindow(getBaseDisplay().getXDisplay(), iconmenu->getWindowID());
|
XRaiseWindow(getBaseDisplay().getXDisplay(), iconmenu->getWindowID());
|
||||||
*(session_stack + i++) = iconmenu->getWindowID();
|
*(session_stack + i++) = iconmenu->getWindowID();
|
||||||
|
|
||||||
LinkedListIterator<Workspace> wit(workspacesList);
|
wkspList::iterator it;
|
||||||
for (Workspace *tmp = wit.current(); tmp; wit++, tmp = wit.current())
|
for (it = workspacesList.begin(); it != workspacesList.end(); ++it)
|
||||||
*(session_stack + i++) = tmp->getMenu()->getWindowID();
|
*(session_stack + i++) = (*it)->getMenu()->getWindowID();
|
||||||
|
|
||||||
*(session_stack + i++) = workspacemenu->getWindowID();
|
*(session_stack + i++) = workspacemenu->getWindowID();
|
||||||
|
|
||||||
|
@ -2150,19 +2141,14 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) {
|
||||||
|
|
||||||
|
|
||||||
void BScreen::addWorkspaceName(const char *name) {
|
void BScreen::addWorkspaceName(const char *name) {
|
||||||
workspaceNames->insert(bstrdup(name));
|
workspaceNames.push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* BScreen::getNameOfWorkspace(int id) {
|
|
||||||
char *name = NULL;
|
|
||||||
|
|
||||||
if (id >= 0 && id < workspaceNames->count()) {
|
const char *BScreen::getNameOfWorkspace(int id) {
|
||||||
char *wkspc_name = workspaceNames->find(id);
|
if (id < 0 || id >= workspaceNames.size())
|
||||||
|
return (const char *) 0;
|
||||||
if (wkspc_name)
|
return workspaceNames[id].c_str();
|
||||||
name = wkspc_name;
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2273,9 +2259,7 @@ void BScreen::raiseFocus(void) {
|
||||||
|
|
||||||
void BScreen::InitMenu(void) {
|
void BScreen::InitMenu(void) {
|
||||||
if (rootmenu) {
|
if (rootmenu) {
|
||||||
while (!rootmenuList.empty())
|
rootmenuList.clear();
|
||||||
rootmenuList.erase(rootmenuList.begin());
|
|
||||||
|
|
||||||
while (rootmenu->getCount())
|
while (rootmenu->getCount())
|
||||||
rootmenu->remove(0);
|
rootmenu->remove(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2753,14 +2737,12 @@ void BScreen::shutdown(void) {
|
||||||
XSelectInput(getBaseDisplay().getXDisplay(), getRootWindow(), NoEventMask);
|
XSelectInput(getBaseDisplay().getXDisplay(), getRootWindow(), NoEventMask);
|
||||||
XSync(getBaseDisplay().getXDisplay(), False);
|
XSync(getBaseDisplay().getXDisplay(), False);
|
||||||
|
|
||||||
LinkedListIterator<Workspace> it(workspacesList);
|
wkspList::iterator it;
|
||||||
for (Workspace *w = it.current(); w; it++, w = it.current())
|
for (it = workspacesList.begin(); it != workspacesList.end(); ++it)
|
||||||
w->shutdown();
|
(*it)->shutdown();
|
||||||
|
|
||||||
while (iconList->count()) {
|
while (!iconList.empty())
|
||||||
iconList->first()->restore();
|
iconList.front()->restore();
|
||||||
delete iconList->first();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
slit->shutdown();
|
slit->shutdown();
|
||||||
|
|
22
src/Screen.h
22
src/Screen.h
|
@ -40,7 +40,6 @@
|
||||||
#include "BaseDisplay.h"
|
#include "BaseDisplay.h"
|
||||||
#include "Configmenu.h"
|
#include "Configmenu.h"
|
||||||
#include "Iconmenu.h"
|
#include "Iconmenu.h"
|
||||||
#include "LinkedList.h"
|
|
||||||
#include "Netizen.h"
|
#include "Netizen.h"
|
||||||
#include "Rootmenu.h"
|
#include "Rootmenu.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
@ -52,10 +51,14 @@
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
#include "Resource.h"
|
#include "Resource.h"
|
||||||
|
#include "Util.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
typedef std::list<Rootmenu *> menuList;
|
typedef std::list<Rootmenu *> menuList;
|
||||||
typedef std::list<Netizen *> netList;
|
typedef std::list<Netizen *> netList;
|
||||||
|
typedef std::vector<Workspace *> wkspList;
|
||||||
|
typedef std::vector<std::string> wkspNameList;
|
||||||
|
|
||||||
// forward declaration
|
// forward declaration
|
||||||
class BScreen;
|
class BScreen;
|
||||||
|
@ -115,7 +118,7 @@ private:
|
||||||
|
|
||||||
menuList rootmenuList;
|
menuList rootmenuList;
|
||||||
netList netizenList;
|
netList netizenList;
|
||||||
LinkedList<OpenboxWindow> *iconList;
|
winList iconList; // winList is declared in Workspace.h
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
Slit *slit;
|
Slit *slit;
|
||||||
|
@ -128,8 +131,8 @@ private:
|
||||||
unsigned int geom_w, geom_h;
|
unsigned int geom_w, geom_h;
|
||||||
unsigned long event_mask;
|
unsigned long event_mask;
|
||||||
|
|
||||||
LinkedList<char> *workspaceNames;
|
wkspNameList workspaceNames;
|
||||||
LinkedList<Workspace> *workspacesList;
|
wkspList workspacesList;
|
||||||
|
|
||||||
struct resource {
|
struct resource {
|
||||||
WindowStyle wstyle;
|
WindowStyle wstyle;
|
||||||
|
@ -193,7 +196,10 @@ public:
|
||||||
|
|
||||||
Rect availableArea() const;
|
Rect availableArea() const;
|
||||||
|
|
||||||
inline Workspace *getWorkspace(int w) { return workspacesList->find(w); }
|
inline Workspace *getWorkspace(int w) {
|
||||||
|
ASSERT(w < workspacesList.size());
|
||||||
|
return workspacesList[w];
|
||||||
|
}
|
||||||
inline Workspace *getCurrentWorkspace() { return current_workspace; }
|
inline Workspace *getCurrentWorkspace() { return current_workspace; }
|
||||||
|
|
||||||
inline Workspacemenu *getWorkspacemenu() { return workspacemenu; }
|
inline Workspacemenu *getWorkspacemenu() { return workspacemenu; }
|
||||||
|
@ -211,8 +217,8 @@ public:
|
||||||
|
|
||||||
inline const int getCurrentWorkspaceID()
|
inline const int getCurrentWorkspaceID()
|
||||||
{ return current_workspace->getWorkspaceID(); }
|
{ return current_workspace->getWorkspaceID(); }
|
||||||
inline const int getWorkspaceCount() { return workspacesList->count(); }
|
inline const int getWorkspaceCount() { return workspacesList.size(); }
|
||||||
inline const int getIconCount() { return iconList->count(); }
|
inline const int getIconCount() { return iconList.size(); }
|
||||||
|
|
||||||
inline const Bool &isRootColormapInstalled() const
|
inline const Bool &isRootColormapInstalled() const
|
||||||
{ return root_colormap_installed; }
|
{ return root_colormap_installed; }
|
||||||
|
@ -291,7 +297,7 @@ public:
|
||||||
void removeNetizen(Window);
|
void removeNetizen(Window);
|
||||||
void addIcon(OpenboxWindow *);
|
void addIcon(OpenboxWindow *);
|
||||||
void removeIcon(OpenboxWindow *);
|
void removeIcon(OpenboxWindow *);
|
||||||
char* getNameOfWorkspace(int);
|
const char *getNameOfWorkspace(int);
|
||||||
void changeWorkspaceID(int);
|
void changeWorkspaceID(int);
|
||||||
void raiseWindows(Window *, int);
|
void raiseWindows(Window *, int);
|
||||||
void reassociateWindow(OpenboxWindow *, int, Bool);
|
void reassociateWindow(OpenboxWindow *, int, Bool);
|
||||||
|
|
|
@ -29,4 +29,11 @@
|
||||||
# define ASSERT(x)
|
# define ASSERT(x)
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
|
struct PointerAssassin {
|
||||||
|
template<typename T>
|
||||||
|
inline void operator()(const T ptr) const {
|
||||||
|
delete ptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif // __Util_hh
|
#endif // __Util_hh
|
||||||
|
|
|
@ -3054,6 +3054,8 @@ void OpenboxWindow::restore(void) {
|
||||||
XMapWindow(display, client.window);
|
XMapWindow(display, client.window);
|
||||||
|
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
|
|
||||||
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,7 @@ Workspace::Workspace(BScreen &scrn, int i) : screen(scrn) {
|
||||||
lastfocus = (OpenboxWindow *) 0;
|
lastfocus = (OpenboxWindow *) 0;
|
||||||
|
|
||||||
name = (char *) 0;
|
name = (char *) 0;
|
||||||
char *tmp = screen.getNameOfWorkspace(id);
|
setName(screen.getNameOfWorkspace(id));
|
||||||
setName(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,7 +296,7 @@ void Workspace::setCurrent(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Workspace::setName(char *new_name) {
|
void Workspace::setName(const char *new_name) {
|
||||||
if (name)
|
if (name)
|
||||||
delete [] name;
|
delete [] name;
|
||||||
|
|
||||||
|
@ -316,10 +315,8 @@ void Workspace::setName(char *new_name) {
|
||||||
|
|
||||||
|
|
||||||
void Workspace::shutdown(void) {
|
void Workspace::shutdown(void) {
|
||||||
while (!_windows.empty()) {
|
while (!_windows.empty())
|
||||||
_windows[0]->restore();
|
_windows[0]->restore();
|
||||||
delete _windows[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static rectList calcSpace(const Rect &win, const rectList &spaces) {
|
static rectList calcSpace(const Rect &win, const rectList &spaces) {
|
||||||
|
@ -420,7 +417,8 @@ Point *Workspace::bestFitPlacement(const Size &win_size, const Rect &space) {
|
||||||
spaces.push_back(space); //initially the entire screen is free
|
spaces.push_back(space); //initially the entire screen is free
|
||||||
|
|
||||||
//Find Free Spaces
|
//Find Free Spaces
|
||||||
for (winVect::iterator it = _windows.begin(); it != _windows.end(); ++it)
|
winVect::iterator it;
|
||||||
|
for (it = _windows.begin(); it != _windows.end(); ++it)
|
||||||
spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4),
|
spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4),
|
||||||
spaces);
|
spaces);
|
||||||
|
|
||||||
|
@ -474,7 +472,8 @@ Point *Workspace::rowSmartPlacement(const Size &win_size, const Rect &space) {
|
||||||
spaces.push_back(space); //initially the entire screen is free
|
spaces.push_back(space); //initially the entire screen is free
|
||||||
|
|
||||||
//Find Free Spaces
|
//Find Free Spaces
|
||||||
for (winVect::iterator it = _windows.begin(); it != _windows.end(); ++it)
|
winVect::iterator it;
|
||||||
|
for (it = _windows.begin(); it != _windows.end(); ++it)
|
||||||
spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4),
|
spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4),
|
||||||
spaces);
|
spaces);
|
||||||
//Sort spaces by preference
|
//Sort spaces by preference
|
||||||
|
@ -514,7 +513,8 @@ Point *Workspace::colSmartPlacement(const Size &win_size, const Rect &space) {
|
||||||
spaces.push_back(space); //initially the entire screen is free
|
spaces.push_back(space); //initially the entire screen is free
|
||||||
|
|
||||||
//Find Free Spaces
|
//Find Free Spaces
|
||||||
for (winVect::iterator it = _windows.begin(); it != _windows.end(); ++it)
|
winVect::iterator it;
|
||||||
|
for (it = _windows.begin(); it != _windows.end(); ++it)
|
||||||
spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4),
|
spaces = calcSpace((*it)->area().Inflate(screen.getBorderWidth() * 4),
|
||||||
spaces);
|
spaces);
|
||||||
//Sort spaces by user preference
|
//Sort spaces by user preference
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
void update();
|
void update();
|
||||||
void setCurrent(void);
|
void setCurrent(void);
|
||||||
void setName(char *);
|
void setName(const char *);
|
||||||
void shutdown(void);
|
void shutdown(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue