fixed workspace name to std string
This commit is contained in:
parent
5a0014f410
commit
6c10acb3cb
2 changed files with 28 additions and 27 deletions
|
@ -19,8 +19,9 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// stupid macros needed to access some functions in version 2 of the GNU C
|
// $Id: Workspace.cc,v 1.6 2002/01/20 02:08:12 fluxgen Exp $
|
||||||
// library
|
|
||||||
|
// use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif // _GNU_SOURCE
|
#endif // _GNU_SOURCE
|
||||||
|
@ -29,9 +30,6 @@
|
||||||
# include "../config.h"
|
# include "../config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
|
|
||||||
#include "i18n.hh"
|
#include "i18n.hh"
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
#include "Clientmenu.hh"
|
#include "Clientmenu.hh"
|
||||||
|
@ -50,7 +48,15 @@
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
#endif // STDC_HEADERS
|
#endif // STDC_HEADERS
|
||||||
|
|
||||||
Workspace::Workspace(BScreen *scrn, int i) {
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
|
Workspace::Workspace(BScreen *scrn, int i):
|
||||||
|
screen(scrn),
|
||||||
|
lastfocus(0),
|
||||||
|
name(""),
|
||||||
|
cascade_x(32), cascade_y(32)
|
||||||
|
{
|
||||||
screen = scrn;
|
screen = scrn;
|
||||||
|
|
||||||
cascade_x = cascade_y = 32;
|
cascade_x = cascade_y = 32;
|
||||||
|
@ -61,10 +67,7 @@ Workspace::Workspace(BScreen *scrn, int i) {
|
||||||
windowList = new LinkedList<FluxboxWindow>;
|
windowList = new LinkedList<FluxboxWindow>;
|
||||||
clientmenu = new Clientmenu(this);
|
clientmenu = new Clientmenu(this);
|
||||||
|
|
||||||
lastfocus = (FluxboxWindow *) 0;
|
|
||||||
|
|
||||||
char *tmp;
|
char *tmp;
|
||||||
name = (char *) 0;
|
|
||||||
screen->getNameOfWorkspace(id, &tmp);
|
screen->getNameOfWorkspace(id, &tmp);
|
||||||
setName(tmp);
|
setName(tmp);
|
||||||
|
|
||||||
|
@ -73,20 +76,19 @@ Workspace::Workspace(BScreen *scrn, int i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Workspace::~Workspace(void) {
|
Workspace::~Workspace() {
|
||||||
delete stackingList;
|
delete stackingList;
|
||||||
delete windowList;
|
delete windowList;
|
||||||
delete clientmenu;
|
delete clientmenu;
|
||||||
|
|
||||||
if (name)
|
|
||||||
delete [] name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const int Workspace::addWindow(FluxboxWindow *w, Bool place) {
|
const int Workspace::addWindow(FluxboxWindow *w, Bool place) {
|
||||||
if (! w) return -1;
|
if (! w)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (place) placeWindow(w);
|
if (place)
|
||||||
|
placeWindow(w);
|
||||||
|
|
||||||
w->setWorkspace(id);
|
w->setWorkspace(id);
|
||||||
w->setWindowNumber(windowList->count());
|
w->setWindowNumber(windowList->count());
|
||||||
|
@ -123,8 +125,8 @@ const int Workspace::removeWindow(FluxboxWindow *w) {
|
||||||
if (! top || ! top->setInputFocus()) {
|
if (! top || ! top->setInputFocus()) {
|
||||||
Fluxbox::instance()->setFocusedWindow((FluxboxWindow *) 0);
|
Fluxbox::instance()->setFocusedWindow((FluxboxWindow *) 0);
|
||||||
XSetInputFocus(Fluxbox::instance()->getXDisplay(),
|
XSetInputFocus(Fluxbox::instance()->getXDisplay(),
|
||||||
screen->getToolbar()->getWindowID(),
|
screen->getToolbar()->getWindowID(),
|
||||||
RevertToParent, CurrentTime);
|
RevertToParent, CurrentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,14 +304,12 @@ void Workspace::setCurrent(void) {
|
||||||
|
|
||||||
|
|
||||||
void Workspace::setName(char *new_name) {
|
void Workspace::setName(char *new_name) {
|
||||||
if (name)
|
|
||||||
delete [] name;
|
|
||||||
|
|
||||||
if (new_name) {
|
if (new_name) {
|
||||||
name = StringUtil::strdup(new_name);
|
name = new_name;
|
||||||
} else {
|
} else {
|
||||||
name = new char[128];
|
char tname[128];
|
||||||
sprintf(name, I18n::instance()->
|
sprintf(tname, I18n::instance()->
|
||||||
getMessage(
|
getMessage(
|
||||||
#ifdef NLS
|
#ifdef NLS
|
||||||
WorkspaceSet, WorkspaceDefaultNameFormat,
|
WorkspaceSet, WorkspaceDefaultNameFormat,
|
||||||
|
@ -317,11 +317,12 @@ void Workspace::setName(char *new_name) {
|
||||||
0, 0,
|
0, 0,
|
||||||
#endif // NLS
|
#endif // NLS
|
||||||
"Workspace %d"), id + 1);
|
"Workspace %d"), id + 1);
|
||||||
|
name = tname;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->updateWorkspaceNamesAtom();
|
screen->updateWorkspaceNamesAtom();
|
||||||
|
|
||||||
clientmenu->setLabel(name);
|
clientmenu->setLabel(name.c_str());
|
||||||
clientmenu->update();
|
clientmenu->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,15 @@
|
||||||
#ifndef _WORKSPACE_HH_
|
#ifndef _WORKSPACE_HH_
|
||||||
#define _WORKSPACE_HH_
|
#define _WORKSPACE_HH_
|
||||||
|
|
||||||
|
#include "LinkedList.hh"
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class BScreen;
|
class BScreen;
|
||||||
class Clientmenu;
|
class Clientmenu;
|
||||||
class Workspace;
|
class Workspace;
|
||||||
class FluxboxWindow;
|
class FluxboxWindow;
|
||||||
|
|
||||||
#include "LinkedList.hh"
|
|
||||||
|
|
||||||
|
|
||||||
class Workspace {
|
class Workspace {
|
||||||
private:
|
private:
|
||||||
|
@ -40,7 +40,7 @@ private:
|
||||||
|
|
||||||
LinkedList<FluxboxWindow> *stackingList, *windowList;
|
LinkedList<FluxboxWindow> *stackingList, *windowList;
|
||||||
|
|
||||||
char *name;
|
std::string name;
|
||||||
int id, cascade_x, cascade_y;
|
int id, cascade_x, cascade_y;
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
|
|
||||||
inline Clientmenu *getMenu(void) { return clientmenu; }
|
inline Clientmenu *getMenu(void) { return clientmenu; }
|
||||||
|
|
||||||
inline const char *getName(void) const { return name; }
|
inline const char *getName(void) const { return name.c_str(); }
|
||||||
|
|
||||||
inline const int &getWorkspaceID(void) const { return id; }
|
inline const int &getWorkspaceID(void) const { return id; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue