move getDecoMaskFromString to FbWinFrame

This commit is contained in:
Mark Tiefenbruck 2008-08-15 04:42:13 -07:00
parent 06d696f99b
commit 0689a0a4a8
5 changed files with 24 additions and 24 deletions

View file

@ -1407,6 +1407,26 @@ void FbWinFrame::applyTabContainer() {
}
}
int FbWinFrame::getDecoMaskFromString(const string &str_label) {
if (strcasecmp(str_label.c_str(), "NONE") == 0)
return DECOR_NONE;
if (strcasecmp(str_label.c_str(), "NORMAL") == 0)
return DECOR_NORMAL;
if (strcasecmp(str_label.c_str(), "TINY") == 0)
return DECOR_TINY;
if (strcasecmp(str_label.c_str(), "TOOL") == 0)
return DECOR_TOOL;
if (strcasecmp(str_label.c_str(), "BORDER") == 0)
return DECOR_BORDER;
if (strcasecmp(str_label.c_str(), "TAB") == 0)
return DECOR_TAB;
int mask = -1;
if (str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x' ||
str_label.size() > 0 && isdigit(str_label[0]))
mask = strtol(str_label.c_str(), NULL, 0);
return mask;
}
void FbWinFrame::applyDecorations() {
int grav_x=0, grav_y=0;
// negate gravity

View file

@ -228,6 +228,7 @@ public:
bool maximizing = false) const;
void displaySize(unsigned int width, unsigned int height) const;
static int getDecoMaskFromString(const std::string &str);
void setDecorationMask(unsigned int mask) { m_state.deco_mask = mask; }
void applyDecorations();

View file

@ -513,7 +513,7 @@ int parseApp(ifstream &file, Application &app, string *first_line = 0) {
app.rememberIconHiddenstate((strcasecmp(str_label.c_str(), "yes") == 0));
app.rememberFocusHiddenstate((strcasecmp(str_label.c_str(), "yes") == 0));
} else if (str_key == "deco") {
int deco = FluxboxWindow::getDecoMaskFromString(str_label);
int deco = FbWinFrame::getDecoMaskFromString(str_label);
if (deco == -1)
had_error = 1;
else

View file

@ -427,7 +427,8 @@ void FluxboxWindow::init() {
m_blackbox_attrib.premax_w = m_blackbox_attrib.premax_h = 0;
// set default decorations but don't apply them
setDecorationMask(getDecoMaskFromString(screen().defaultDeco()), false);
setDecorationMask(FbWinFrame::getDecoMaskFromString(screen().defaultDeco()),
false);
functions.resize = functions.move = functions.iconify = functions.maximize
= functions.close = functions.tabable = true;
@ -4035,26 +4036,6 @@ void FluxboxWindow::associateClient(WinClient &client) {
client.titleSig().attach(this);
}
int FluxboxWindow::getDecoMaskFromString(const string &str_label) {
if (strcasecmp(str_label.c_str(), "NONE") == 0)
return FbWinFrame::DECOR_NONE;
if (strcasecmp(str_label.c_str(), "NORMAL") == 0)
return FbWinFrame::DECOR_NORMAL;
if (strcasecmp(str_label.c_str(), "TINY") == 0)
return FbWinFrame::DECOR_TINY;
if (strcasecmp(str_label.c_str(), "TOOL") == 0)
return FbWinFrame::DECOR_TOOL;
if (strcasecmp(str_label.c_str(), "BORDER") == 0)
return FbWinFrame::DECOR_BORDER;
if (strcasecmp(str_label.c_str(), "TAB") == 0)
return FbWinFrame::DECOR_TAB;
int mask = -1;
if (str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x' ||
str_label.size() > 0 && isdigit(str_label[0]))
mask = strtol(str_label.c_str(), NULL, 0);
return mask;
}
int FluxboxWindow::getOnHead() const {
return screen().getHead(fbWindow());
}

View file

@ -465,8 +465,6 @@ public:
int layerNum() const { return m_layernum; }
void setLayerNum(int layernum);
static int getDecoMaskFromString(const std::string &str);
unsigned int titlebarHeight() const;
int initialState() const;