all repos — fluxbox @ 10082d821d6691f42a8d8ad6fa2e42e5b3f44edd

custom fork of the fluxbox windowmanager

cosmetic patch from slava semushin, removes whitespaces and
uses only those things from "namespace std" what we really need.
mathias mathias
commit

10082d821d6691f42a8d8ad6fa2e42e5b3f44edd

parent

34b7f7ddfc3e914238fd0d30ff50c4f37c2a6dd8

M ChangeLogChangeLog

@@ -1,5 +1,12 @@

(Format: Year/Month/Day) Changes for 1.0rc3: +*06/10/27: + * Cosmetic patch from Slave Semushin + Slit.cc Screen.cc Keys.cc main.cc ToolbarTheme.cc FbTk/MultLayers.cc + FbTk/Transparent.cc FbTk/Resource.cc FbTk/Theme.cc FbTk/XLayer.cc + FbTk/Image.cc FbTk/Color.cc FbTk/FbString.cc Remember.cc RegExp.cc + WinClient.cc Shape.cc ClientPattern.cc FbWinFrame.cc + *06/10/16: * Added CachedPixmap (Henrik) FbTk/CachedPixmap.hh/cc
M src/ClientPattern.ccsrc/ClientPattern.cc

@@ -47,10 +47,10 @@ #include <stdio.h>

#endif // needed as well for index on some systems (e.g. solaris) -#include <strings.h> +#include <strings.h> +using std::string; -using namespace std; ClientPattern::ClientPattern(): m_matchlimit(0),

@@ -63,13 +63,13 @@ m_nummatches(0)

{ /* A rough grammar of a pattern is: PATTERN ::= MATCH+ LIMIT? - MATCH ::= '(' word ')' + MATCH ::= '(' word ')' | '(' propertyname '=' word ')' LIMIT ::= '{' number '}' - + i.e. one or more match definitions, followed by an optional limit on the number of apps to match to - + Match definitions are enclosed in parentheses, and if no property name is given, then CLASSNAME is assumed. If no limit is specified, no limit is applied (i.e. limit = infinity)

@@ -81,7 +81,7 @@ int pos = 0;

string match; int err = 1; // for starting first loop while (had_error == 0 && err > 0) { - err = FbTk::StringUtil::getStringBetween(match, + err = FbTk::StringUtil::getStringBetween(match, str + pos, '(', ')', " \t\n", true); if (err > 0) {

@@ -115,7 +115,7 @@ break;

} } pos += err; - } + } } if (pos == 0 && had_error == 0) { // no match terms given, this is not allowed

@@ -125,7 +125,7 @@

if (had_error == 0) { // otherwise, we check for a number string number; - err = FbTk::StringUtil::getStringBetween(number, + err = FbTk::StringUtil::getStringBetween(number, str+pos, '{', '}'); if (err > 0) {

@@ -134,7 +134,7 @@ iss >> m_matchlimit;

pos+=err; } // we don't care if there isn't one - + // there shouldn't be anything else on the line match = str + pos; size_t uerr;// need a special type here

@@ -154,7 +154,7 @@ delete term;

m_terms.pop_back(); } } -} +} ClientPattern::~ClientPattern() { // delete all the terms

@@ -165,7 +165,7 @@ }

} // return a string representation of this pattern -std::string ClientPattern::toString() const { +string ClientPattern::toString() const { string pat; Terms::const_iterator it = m_terms.begin(); Terms::const_iterator it_end = m_terms.end();

@@ -206,7 +206,7 @@ }

// does this client match this pattern? bool ClientPattern::match(const WinClient &win) const { - if (m_matchlimit != 0 && m_nummatches >= m_matchlimit || + if (m_matchlimit != 0 && m_nummatches >= m_matchlimit || m_terms.empty()) return false; // already matched out

@@ -225,7 +225,7 @@

// add an expression to match against // The first argument is a regular expression, the second is the member // function that we wish to match against. -bool ClientPattern::addTerm(const std::string &str, WinProperty prop) { +bool ClientPattern::addTerm(const string &str, WinProperty prop) { Term *term = new Term(str, true); term->orig = str;

@@ -239,7 +239,7 @@ m_terms.push_back(term);

return true; } -std::string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const { +string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const { switch (prop) { case TITLE: return client.title();
M src/FbTk/Color.ccsrc/FbTk/Color.cc

@@ -28,7 +28,10 @@ #include "StringUtil.hh"

#include "I18n.hh" #include <iostream> -using namespace std; + +using std::cerr; +using std::endl; +using std::string; namespace {

@@ -56,9 +59,9 @@ copy(col_copy);

} Color::Color(unsigned short red, unsigned short green, unsigned short blue, int screen): - m_red(red), m_green(green), m_blue(blue), + m_red(red), m_green(green), m_blue(blue), m_pixel(0), m_allocated(false), - m_screen(screen) { + m_screen(screen) { allocate(red, green, blue, screen); }

@@ -95,7 +98,7 @@ else if (! XAllocColor(disp, colm, &color))

return false; setPixel(color.pixel); - setRGB(maxValue(color.red), + setRGB(maxValue(color.red), maxValue(color.green), maxValue(color.blue)); setAllocated(true);

@@ -107,7 +110,7 @@

bool Color::validColorString(const char *color_string, int screen) { XColor color; Display *disp = App::instance()->display(); - Colormap colm = DefaultColormap(disp, screen); + Colormap colm = DefaultColormap(disp, screen); // trim white space string color_string_tmp = color_string; StringUtil::removeFirstWhitespace(color_string_tmp);

@@ -120,7 +123,7 @@ Color &Color::operator = (const Color &col_copy) {

// check for aliasing if (this == &col_copy) return *this; - + copy(col_copy); return *this; }

@@ -134,7 +137,7 @@ XFreeColors(disp, DefaultColormap(disp, m_screen), &pixel, 1, 0);

setPixel(0); setRGB(0, 0, 0); setAllocated(false); - } + } } void Color::copy(const Color &col_copy) {

@@ -144,12 +147,12 @@ setRGB(col_copy.red(), col_copy.green(), col_copy.blue());

setPixel(col_copy.pixel()); return; } - - allocate(col_copy.red()*0xFF, + + allocate(col_copy.red()*0xFF, col_copy.green()*0xFF, col_copy.blue()*0xFF, col_copy.m_screen); - + } void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, int screen) {

@@ -158,10 +161,10 @@ Display *disp = App::instance()->display();

XColor color; // fill xcolor structure color.red = red; - color.green = green; + color.green = green; color.blue = blue; - - + + if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) { _FB_USES_NLS; cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl;

@@ -173,7 +176,7 @@ maxValue(color.blue));

setPixel(color.pixel); setAllocated(true); } - + m_screen = screen; }
M src/FbTk/FbString.ccsrc/FbTk/FbString.cc

@@ -40,7 +40,13 @@ #include <langinfo.h>

#include <locale.h> #include <iostream> -using namespace std; + +using std::string; + +#ifdef DEBUG +using std::cerr; +using std::endl; +#endif // DEBUG namespace FbTk {

@@ -54,7 +60,7 @@ #else

static int iconv_convs[CONVSIZE]; #endif // HAVE_ICONV -static std::string locale_codeset; +static string locale_codeset; /// Initialise all of the iconv conversion descriptors void init() {

@@ -70,9 +76,9 @@ #ifdef CODESET

locale_codeset = nl_langinfo(CODESET); #else // openbsd doesnt have this (yet?) locale_codeset = ""; - std::string locale = setlocale(LC_CTYPE, NULL); + string locale = setlocale(LC_CTYPE, NULL); size_t pos = locale.find('.'); - if (pos != std::string::npos) + if (pos != string::npos) locale_codeset = locale.substr(pos); #endif // CODESET

@@ -85,7 +91,7 @@ iconv_convs[X2FB] = iconv_open("UTF-8", "ISO8859-1");

iconv_convs[FB2LOCALE] = iconv_open(locale_codeset.c_str(), "UTF-8"); iconv_convs[LOCALE2FB] = iconv_open("UTF-8", locale_codeset.c_str()); #else - for (int i=0; i < CONVSIZE; ++i) + for (int i=0; i < CONVSIZE; ++i) iconv_convs[i] = 0; #endif // HAVE_ICONV

@@ -96,7 +102,7 @@ #ifdef HAVE_ICONV

if (iconv_convs == 0) return; - for (int i=0; i < CONVSIZE; ++i) + for (int i=0; i < CONVSIZE; ++i) if (iconv_convs[i] != (iconv_t)(-1)) iconv_close(iconv_convs[i]);

@@ -118,18 +124,18 @@ @param size number of BYTES to convert

@return the recoded string, or 0 on failure */ -/** +/** --NOTE-- In the "C" locale, this will strip any high-bit characters because C means 7-bit ASCII charset. If you don't want this then you need to set your locale to something UTF-8, OR something ISO8859-1. */ -std::string recode(iconv_t cd, - const std::string &in) { +string recode(iconv_t cd, + const string &in) { // If empty message, yes this can happen, return - if (in.empty()) + if (in.empty()) return ""; if (cd == ((iconv_t)(-1)))

@@ -183,7 +189,7 @@ }

} // copy to our return string - std::string ret; + string ret; ret.append(out, outsize - outbytesleft); // reset the conversion descriptor

@@ -195,27 +201,27 @@

return ret; } #else -std::string recode(int cd, - const std::string &str) { +string recode(int cd, + const string &str) { return str; } #endif // HAVE_ICONV -FbString XStrToFb(const std::string &src) { +FbString XStrToFb(const string &src) { return recode(iconv_convs[X2FB], src); } -std::string FbStrToX(const FbString &src) { +string FbStrToX(const FbString &src) { return recode(iconv_convs[FB2X], src); } /// Handle thislocale string encodings (strings coming from userspace) -FbString LocaleStrToFb(const std::string &src) { +FbString LocaleStrToFb(const string &src) { return recode(iconv_convs[LOCALE2FB], src); } -std::string FbStrToLocale(const FbString &src) { +string FbStrToLocale(const FbString &src) { return recode(iconv_convs[FB2LOCALE], src); }

@@ -231,7 +237,7 @@

}; // end namespace StringUtil -StringConvertor::StringConvertor(EncodingTarget target): +StringConvertor::StringConvertor(EncodingTarget target): #ifdef HAVE_ICONV m_iconv((iconv_t)(-1)) { if (target == ToLocaleStr)

@@ -251,9 +257,9 @@ iconv_close(m_iconv);

#endif } -bool StringConvertor::setSource(const std::string &encoding) { +bool StringConvertor::setSource(const string &encoding) { #ifdef HAVE_ICONV - std::string tempenc = encoding; + string tempenc = encoding; if (encoding == "") tempenc = FbStringUtil::locale_codeset;

@@ -270,8 +276,8 @@ #else

return false; #endif } - -std::string StringConvertor::recode(const std::string &src) { + +string StringConvertor::recode(const string &src) { #ifdef HAVE_ICONV return FbStringUtil::recode(m_iconv, src); #else
M src/FbTk/Image.ccsrc/FbTk/Image.cc

@@ -39,7 +39,10 @@

#include <list> #include <iostream> #include <set> -using namespace std; + +using std::string; +using std::list; +using std::set; namespace FbTk {

@@ -60,9 +63,9 @@ }

void Image::shutdown() { - std::set<ImageBase*> handlers; - - // one imagehandler could be registered + set<ImageBase*> handlers; + + // one imagehandler could be registered // for more than one type ImageMap::iterator it = s_image_map.begin(); ImageMap::iterator it_end = s_image_map.end();

@@ -72,8 +75,8 @@ handlers.insert(it->second);

} // free the unique handlers - std::set<ImageBase*>::iterator handler_it = handlers.begin(); - std::set<ImageBase*>::iterator handler_it_end = handlers.end(); + set<ImageBase*>::iterator handler_it = handlers.begin(); + set<ImageBase*>::iterator handler_it_end = handlers.end(); for(; handler_it != handler_it_end; handler_it++) { delete (*handler_it); }

@@ -81,26 +84,26 @@

s_image_map.clear(); } -PixmapWithMask *Image::load(const std::string &filename, int screen_num) { +PixmapWithMask *Image::load(const string &filename, int screen_num) { if (filename == "") return false; // determine file ending - std::string extension(StringUtil::toUpper(StringUtil::findExtension(filename))); - + string extension(StringUtil::toUpper(StringUtil::findExtension(filename))); + // valid handle? if (s_image_map.find(extension) == s_image_map.end()) return false; - + // load file PixmapWithMask *pm = s_image_map[extension]->load(filename, screen_num); // failed?, try different search paths if (pm == 0 && s_search_paths.size()) { // first we need to get basename of current filename - std::string base_filename = StringUtil::basename(filename); - std::string path = ""; + string base_filename = StringUtil::basename(filename); + string path = ""; // append each search path and try to load StringList::iterator it = s_search_paths.begin(); StringList::iterator it_end = s_search_paths.end();

@@ -115,13 +118,13 @@

return pm; } -bool Image::registerType(const std::string &type, ImageBase &base) { +bool Image::registerType(const string &type, ImageBase &base) { string ucase_type = StringUtil::toUpper(type); // not empty and not this base? if (s_image_map[ucase_type] != 0 && - s_image_map[ucase_type] != &base) + s_image_map[ucase_type] != &base) return false; // already registered? if (s_image_map[ucase_type] == &base)

@@ -136,7 +139,7 @@ void Image::remove(ImageBase &base) {

// find and remove all referenses to base ImageMap::iterator it = s_image_map.begin(); ImageMap::iterator it_end = s_image_map.end(); - std::list<std::string> remove_list; + list<string> remove_list; for (; it != it_end; ++it) { if (it->second == &base) remove_list.push_back(it->first);

@@ -148,11 +151,11 @@ remove_list.pop_back();

} } -void Image::addSearchPath(const std::string &search_path) { +void Image::addSearchPath(const string &search_path) { s_search_paths.push_back(search_path); } -void Image::removeSearchPath(const std::string &search_path) { +void Image::removeSearchPath(const string &search_path) { s_search_paths.remove(search_path); }
M src/FbTk/MultLayers.ccsrc/FbTk/MultLayers.cc

@@ -28,14 +28,13 @@ #include "XLayerItem.hh"

#include "App.hh" #include <iostream> -using namespace std; using namespace FbTk; MultLayers::MultLayers(int numlayers) : - m_lock(0) + m_lock(0) { - for (int i=0; i < numlayers; ++i) + for (int i=0; i < numlayers; ++i) m_layers.push_back(new XLayer(*this, i)); }

@@ -48,7 +47,7 @@ }

XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) { - if (layernum >= static_cast<signed>(m_layers.size()) || layernum <= 0) + if (layernum >= static_cast<signed>(m_layers.size()) || layernum <= 0) return 0; layernum--; // next one up

@@ -57,7 +56,7 @@ while (layernum >= 0 && (item = m_layers[layernum]->getLowestItem()) == 0)

layernum--; return item; -} +} XLayerItem *MultLayers::getItemBelow(XLayerItem &item) { XLayer &curr_layer = item.getLayer();

@@ -74,24 +73,24 @@ }

} return ret; -} +} XLayerItem *MultLayers::getItemAbove(XLayerItem &item) { XLayer &curr_layer = item.getLayer(); - + // assume that the LayerItem does exist in a layer. XLayerItem *ret = curr_layer.getItemAbove(item); if (!ret) { ret = getLowestItemAboveLayer(curr_layer.getLayerNum()); - } + } return ret; -} +} void MultLayers::addToTop(XLayerItem &item, int layernum) { - if (layernum < 0) - layernum = 0; + if (layernum < 0) + layernum = 0; else if (layernum >= static_cast<signed>(m_layers.size())) layernum = m_layers.size()-1;

@@ -106,7 +105,7 @@ int layernum = layer.getLayerNum();

if (layernum >= static_cast<signed>(m_layers.size() - 1)) // already on top return; - + // not yet implemented }

@@ -116,7 +115,7 @@ int layernum = layer.getLayerNum();

if (layernum == 0) // already on bottom return; - + // not yet implemented }

@@ -143,16 +142,16 @@ if (curr_layer.getLayerNum() == layernum)

return; // clamp layer number - if (layernum < 0) - layernum = 0; - else if (layernum >= static_cast<signed>(m_layers.size())) + if (layernum < 0) + layernum = 0; + else if (layernum >= static_cast<signed>(m_layers.size())) layernum = m_layers.size()-1; - // remove item from old layer and insert it into the + // remove item from old layer and insert it into the item.setLayer(*m_layers[layernum]); } void MultLayers::restack() { - if (!isUpdatable()) + if (!isUpdatable()) return; int layernum=0, winnum=0, size = this->size();

@@ -162,13 +161,13 @@ for (layernum=0; layernum < static_cast<signed>(m_layers.size()); layernum++) {

XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin(); XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end(); - + // add all windows from each layeritem in each layer for (; it != it_end; ++it) { XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin(); XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end(); for (; wit != wit_end; ++wit) { - if ((*wit)->window()) + if ((*wit)->window()) winlist[winnum++] = (*wit)->window(); } }
M src/FbTk/Resource.ccsrc/FbTk/Resource.cc

@@ -32,7 +32,9 @@ #else

#include <assert.h> #endif -using namespace std; +using std::cerr; +using std::endl; +using std::string; namespace FbTk {

@@ -55,7 +57,7 @@

bool ResourceManager::m_init = false; /** - reloads all resources from resourcefile + reloads all resources from resourcefile @return true on success else false */ bool ResourceManager::load(const char *filename) {

@@ -72,18 +74,18 @@ if (!m_database) {

unlock(); return false; } - + XrmValue value; char *value_type; - + //get list and go throu all the resources and load them ResourceList::iterator i = m_resourcelist.begin(); - ResourceList::iterator i_end = m_resourcelist.end(); + ResourceList::iterator i_end = m_resourcelist.end(); for (; i != i_end; ++i) { - + Resource_base *resource = *i; if (XrmGetResource(**m_database, resource->name().c_str(), - resource->altName().c_str(), &value_type, &value)) + resource->altName().c_str(), &value_type, &value)) resource->setFromString(value.addr); else { _FB_USES_NLS;

@@ -104,11 +106,11 @@ @return 0 on success else negative value representing the error

*/ bool ResourceManager::save(const char *filename, const char *mergefilename) { assert(filename); - + // empty database XrmDatabaseHelper database; - string rc_string; + string rc_string; ResourceList::iterator i = m_resourcelist.begin(); ResourceList::iterator i_end = m_resourcelist.end(); //write all resources to database

@@ -125,7 +127,7 @@ //check if we want to merge a database

if (mergefilename) { // force reload of file m_filename = mergefilename; - if (m_database) + if (m_database) delete m_database; m_database = 0;

@@ -149,31 +151,31 @@ m_filename = filename;

return true; } -Resource_base *ResourceManager::findResource(const std::string &resname) { +Resource_base *ResourceManager::findResource(const string &resname) { // find resource name ResourceList::iterator i = m_resourcelist.begin(); ResourceList::iterator i_end = m_resourcelist.end(); for (; i != i_end; ++i) { if ((*i)->name() == resname || - (*i)->altName() == resname) + (*i)->altName() == resname) return *i; } return 0; } -const Resource_base *ResourceManager::findResource(const std::string &resname) const { +const Resource_base *ResourceManager::findResource(const string &resname) const { // find resource name ResourceList::const_iterator i = m_resourcelist.begin(); ResourceList::const_iterator i_end = m_resourcelist.end(); for (; i != i_end; ++i) { if ((*i)->name() == resname || - (*i)->altName() == resname) + (*i)->altName() == resname) return *i; } return 0; } -string ResourceManager::resourceValue(const std::string &resname) const { +string ResourceManager::resourceValue(const string &resname) const { const Resource_base *res = findResource(resname); if (res != 0) return res->getString();

@@ -181,7 +183,7 @@

return ""; } -void ResourceManager::setResourceValue(const std::string &resname, const std::string &value) { +void ResourceManager::setResourceValue(const string &resname, const string &value) { Resource_base *res = findResource(resname); if (res != 0) res->setFromString(value.c_str());
M src/FbTk/Theme.ccsrc/FbTk/Theme.cc

@@ -39,7 +39,9 @@ #include <memory>

#include <iostream> #include <algorithm> -using namespace std; +using std::cerr; +using std::endl; +using std::string; namespace FbTk {

@@ -49,8 +51,8 @@ void operator ()(Theme *tm) {

m_tm.loadTheme(*tm); } void operator ()(ThemeManager::ThemeList &tmlist) { - - for_each(tmlist.begin(), tmlist.end(), + + for_each(tmlist.begin(), tmlist.end(), *this); // send reconfiguration signal to theme and listeners ThemeManager::ThemeList::iterator it = tmlist.begin();

@@ -61,7 +63,7 @@ (*it)->reconfigSig().notify();

} } - ThemeManager &m_tm; + ThemeManager &m_tm; }; Theme::Theme(int screen_num):m_screen_num(screen_num) {

@@ -78,9 +80,9 @@ return tm;

} ThemeManager::ThemeManager(): - // max_screens: we initialize this later so we can set m_verbose + // max_screens: we initialize this later so we can set m_verbose // without having a display connection - m_max_screens(-1), + m_max_screens(-1), m_verbose(false), m_themelocation("") {

@@ -96,7 +98,7 @@ // valid screen num?

if (m_max_screens < tm.screenNum() || tm.screenNum() < 0) return false; // TODO: use find and return false if it's already there - // instead of unique + // instead of unique m_themes[tm.screenNum()].push_back(&tm); m_themes[tm.screenNum()].unique();

@@ -112,10 +114,10 @@

return true; } -bool ThemeManager::load(const std::string &filename, - const std::string &overlay_filename, int screen_num) { - std::string location = FbTk::StringUtil::expandFilename(filename); - std::string prefix = ""; +bool ThemeManager::load(const string &filename, + const string &overlay_filename, int screen_num) { + string location = FbTk::StringUtil::expandFilename(filename); + string prefix = ""; if (FileUtil::isDirectory(filename.c_str())) { prefix = location;

@@ -139,7 +141,7 @@ return false;

if (!overlay_filename.empty()) { - std::string overlay_location = FbTk::StringUtil::expandFilename(overlay_filename); + string overlay_location = FbTk::StringUtil::expandFilename(overlay_filename); if (FileUtil::isRegularFile(overlay_location.c_str())) { XrmDatabaseHelper overlay_db; if (overlay_db.load(overlay_location.c_str())) {

@@ -204,7 +206,7 @@ return loadItem(resource, resource.name(), resource.altName());

} /// handles resource item loading with specific name/altname -bool ThemeManager::loadItem(ThemeItem_base &resource, const std::string &name, const std::string &alt_name) { +bool ThemeManager::loadItem(ThemeItem_base &resource, const string &name, const string &alt_name) { XrmValue value; char *value_type; if (XrmGetResource(*m_database, name.c_str(),

@@ -217,7 +219,7 @@

return true; } -std::string ThemeManager::resourceValue(const std::string &name, const std::string &altname) { +string ThemeManager::resourceValue(const string &name, const string &altname) { XrmValue value; char *value_type; if (*m_database != 0 && XrmGetResource(*m_database, name.c_str(),

@@ -232,10 +234,10 @@ void ThemeManager::listItems() {

ThemeList::iterator it = m_themelist.begin(); ThemeList::iterator it_end = m_themelist.end(); for (; it != it_end; ++it) { - std::list<ThemeItem_base *>::iterator item = (*it)->itemList().begin(); - std::list<ThemeItem_base *>::iterator item_end = (*it)->itemList().end(); + list<ThemeItem_base *>::iterator item = (*it)->itemList().begin(); + list<ThemeItem_base *>::iterator item_end = (*it)->itemList().end(); for (; item != item_end; ++item) { - + if (typeid(**item) == typeid(ThemeItem<Texture>)) { cerr<<(*item)->name()<<": <texture type>"<<endl; cerr<<(*item)->name()<<".pixmap: <filename>"<<endl;

@@ -249,7 +251,7 @@ } else if (typeid(**item) == typeid(ThemeItem<bool>)) {

cerr<<(*item)->name()<<": <boolean>"<<endl; } else if (typeid(**item) == typeid(ThemeItem<PixmapWithMask>)) { cerr<<(*item)->name()<<": <filename>"<<endl; - } else if (typeid(**item) == typeid(ThemeItem<std::string>)) { + } else if (typeid(**item) == typeid(ThemeItem<string>)) { cerr<<(*item)->name()<<": <string>"<<endl; } else if (typeid(**item) == typeid(ThemeItem<Font>)) { cerr<<(*item)->name()<<": <font>"<<endl;

@@ -258,7 +260,7 @@ cerr<<(*item)->name()<<":"<<endl;

} } } - + } */ }; // end namespace FbTk
M src/FbTk/Transparent.ccsrc/FbTk/Transparent.cc

@@ -35,7 +35,13 @@ #endif // HAVE_XRENDER

#include <iostream> #include <stdio.h> -using namespace std; + + +#ifdef HAVE_XRENDER +using std::cerr; +using std::endl; +#endif // HAVE_XRENDER + namespace { #ifdef HAVE_XRENDER

@@ -52,8 +58,8 @@ XRenderPictFormat *format = XRenderFindFormat(disp, PictFormatType |

PictFormatDepth | PictFormatAlphaMask, &pic_format, 0); if (format == 0) { - cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderFormat, - "Warning: Failed to find valid format for alpha.", + cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderFormat, + "Warning: Failed to find valid format for alpha.", "transparency requires a pict format, can't get one...")<<endl; return 0; }

@@ -63,7 +69,7 @@ Pixmap alpha_pm = XCreatePixmap(disp, drawable,

1, 1, 8); if (alpha_pm == 0) { cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderPixmap, - "Warning: Failed to create alpha pixmap.", + "Warning: Failed to create alpha pixmap.", "XCreatePixmap failed for our transparency pixmap")<<endl; return 0; }

@@ -75,8 +81,8 @@ Picture alpha_pic = XRenderCreatePicture(disp, alpha_pm,

format, CPRepeat, &attr); if (alpha_pic == 0) { XFreePixmap(disp, alpha_pm); - cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderPicture, - "Warning: Failed to create alpha picture.", + cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderPicture, + "Warning: Failed to create alpha picture.", "XRenderCreatePicture failed")<<endl; return 0; }

@@ -234,15 +240,15 @@ freeDest();

// create new dest pic if we have a valid dest drawable if (dest != 0) { - XRenderPictFormat *format = + XRenderPictFormat *format = XRenderFindVisualFormat(disp, DefaultVisual(disp, screen_num)); if (format == 0) { _FB_USES_NLS; cerr<<"FbTk::Transparent: "; - fprintf(stderr, - _FBTK_CONSOLETEXT(Error, NoRenderVisualFormat, - "Failed to find format for screen(%d)", + fprintf(stderr, + _FBTK_CONSOLETEXT(Error, NoRenderVisualFormat, + "Failed to find format for screen(%d)", "XRenderFindVisualFormat failed... include %d for screen number"). c_str(), screen_num);

@@ -284,8 +290,8 @@ DefaultVisual(disp, screen_num));

if (format == 0) { _FB_USES_NLS; cerr<<"FbTk::Transparent: "; - fprintf(stderr, _FBTK_CONSOLETEXT(Error, NoRenderVisualFormat, - "Failed to find format for screen(%d)", + fprintf(stderr, _FBTK_CONSOLETEXT(Error, NoRenderVisualFormat, + "Failed to find format for screen(%d)", "XRenderFindVisualFormat failed... include %d for screen number"). c_str(), screen_num); cerr<<endl;
M src/FbTk/XLayer.ccsrc/FbTk/XLayer.cc

@@ -27,8 +27,14 @@ #include "XLayerItem.hh"

#include "App.hh" #include <iostream> -using namespace std; + +using std::find; using namespace FbTk; + +#ifdef DEBUG +using std::cerr; +using std::endl; +#endif // DEBUG XLayer::XLayer(MultLayers &manager, int layernum): m_manager(manager), m_layernum(layernum) {

@@ -51,7 +57,7 @@ it = itemList().begin();

it_end = itemList().end(); Window *winlist = new Window[num_windows]; size_t j=0; - + // add all the windows from each item for (; it != it_end; ++it) { XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();

@@ -87,13 +93,13 @@

Window *winlist; size_t winnum, size, num = item->numWindows(); - // if there are no windows provided for above us, + // if there are no windows provided for above us, // then we must have to go right to the top of the stack if (!above) { // must need to go right to top if (item->getWindows().front()->window()) XRaiseWindow(FbTk::App::instance()->display(), item->getWindows().front()->window()); - // if this XLayerItem has more than one window, + // if this XLayerItem has more than one window, // then we'll stack the rest in under the front one too // our size needs to be the number of windows in the group, since there isn't one above. if (num > 1) {

@@ -120,7 +126,7 @@ // fill the rest of the array

XLayerItem::Windows::iterator it = item->getWindows().begin(); XLayerItem::Windows::iterator it_end = item->getWindows().end(); for (; it != it_end; ++it) { - if ((*it)->window()) + if ((*it)->window()) winlist[winnum++] = (*it)->window(); }

@@ -128,7 +134,7 @@ // stack the windows

XRestackWindows(FbTk::App::instance()->display(), winlist, winnum); delete [] winlist; - + } // We can't just use Restack here, because it won't do anything if they're

@@ -139,17 +145,17 @@ stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));

return; } - // Note: some other things effectively assume that the window list is + // Note: some other things effectively assume that the window list is // sorted from highest to lowest // get our item - iterator myit = std::find(itemList().begin(), itemList().end(), &item); + iterator myit = find(itemList().begin(), itemList().end(), &item); iterator it = myit; // go to the one above it in our layer (top is front, so we decrement) --it; // keep going until we find one that is currently visible to the user - while (it != itemList().begin() && !(*it)->visible()) + while (it != itemList().begin() && !(*it)->visible()) --it; if (it == itemList().begin() && !(*it)->visible())

@@ -166,7 +172,7 @@ // at this point we don't support insertions into a layer other than at the top

if (pos != 0) cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in XLayer"<<endl; #endif // DEBUG - + itemList().push_front(&item); // restack below next window up stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));

@@ -188,9 +194,9 @@ void XLayer::cycleUp() {

// need to find highest visible window, and move it to bottom iterator it = itemList().begin(); iterator it_end = itemList().end(); - while (it != it_end && !(*it)->visible()) + while (it != it_end && !(*it)->visible()) ++it; - + // if there is something to do if (it != it_end) lower(**it);

@@ -202,34 +208,34 @@ // need to find lowest visible window, and move it to top

// so use a reverse iterator, and the same logic as cycleUp() reverse_iterator it = itemList().rbegin(); reverse_iterator it_end = itemList().rend(); - while (it != it_end && !(*it)->visible()) + while (it != it_end && !(*it)->visible()) ++it; - + // if there is something to do if (it != it_end) raise(**it); - + } void XLayer::stepUp(XLayerItem &item) { // need to find next visible window upwards, and put it above that - if (&item == itemList().front()) + if (&item == itemList().front()) return; // nothing to do // TODO: is there a better way of doing this? // get our item - iterator myit = std::find(itemList().begin(), itemList().end(), &item); + iterator myit = find(itemList().begin(), itemList().end(), &item); iterator it = myit; - + // go to the one above it in our layer (top is front, so we decrement) --it; // keep going until we find one that is currently visible to the user - while (it != itemList().begin() && !(*it)->visible()) + while (it != itemList().begin() && !(*it)->visible()) --it; - + if (it == itemList().begin() && !(*it)->visible()) { // reached front item, but it wasn't visible, therefore it was already raised } else {

@@ -243,7 +249,7 @@ // if we've reached the top of the layer, we need to stack below the next one up

if (it == itemList().begin()) { stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum)); } else { - // otherwise go up one in this layer (i.e. above the one we want to go above) + // otherwise go up one in this layer (i.e. above the one we want to go above) --it; // and stack below that. stackBelowItem(&item, *it);

@@ -255,11 +261,11 @@ void XLayer::stepDown(XLayerItem &item) {

// need to find next visible window down, and put it below that // if we're already the bottom of the layer - if (&item == itemList().back()) + if (&item == itemList().back()) return; // nothing to do // get our position - iterator myit = std::find(itemList().begin(), itemList().end(), &item); + iterator myit = find(itemList().begin(), itemList().end(), &item); iterator it = myit; // go one below it (top is front, so we must increment)

@@ -267,7 +273,7 @@ it++;

iterator it_end = itemList().end(); // keep going down until we find a visible one - while (it != it_end && !(*it)->visible()) + while (it != it_end && !(*it)->visible()) it++; // if we didn't reach the end, then stack below the

@@ -283,7 +289,7 @@

if (&item == itemList().front()) return; // nothing to do - iterator it = std::find(itemList().begin(), itemList().end(), &item); + iterator it = find(itemList().begin(), itemList().end(), &item); if (it != itemList().end()) itemList().erase(it); else {

@@ -295,7 +301,7 @@ }

itemList().push_front(&item); stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum)); - + } void XLayer::tempRaise(XLayerItem &item) {

@@ -304,7 +310,7 @@

if (&item == itemList().front()) return; // nothing to do - iterator it = std::find(itemList().begin(), itemList().end(), &item); + iterator it = find(itemList().begin(), itemList().end(), &item); if (it == itemList().end()) { #ifdef DEBUG cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl;

@@ -314,17 +320,17 @@ }

// don't add it back to the top stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum)); - + } void XLayer::lower(XLayerItem &item) { // assume already in this layer // is it already the lowest? - if (&item == itemList().back()) + if (&item == itemList().back()) return; // nothing to do - iterator it = std::find(itemList().begin(), itemList().end(), &item); + iterator it = find(itemList().begin(), itemList().end(), &item); if (it != itemList().end()) // remove this item itemList().erase(it);

@@ -344,13 +350,13 @@ it = itemList().end();

// go up one so we have an object (which must exist, since at least this item is in the layer) it--; - + // go down another one // must exist, otherwise our item must == itemList().back() - it--; + it--; // and restack our window below that one. - stackBelowItem(&item, *it); + stackBelowItem(&item, *it); } void XLayer::raiseLayer(XLayerItem &item) {

@@ -367,15 +373,15 @@ }

XLayerItem *XLayer::getLowestItem() { - if (itemList().empty()) + if (itemList().empty()) return 0; - else + else return itemList().back(); } XLayerItem *XLayer::getItemBelow(XLayerItem &item) { // get our iterator - iterator it = std::find(itemList().begin(), itemList().end(), &item); + iterator it = find(itemList().begin(), itemList().end(), &item); // go one lower it++;

@@ -389,12 +395,12 @@ }

XLayerItem *XLayer::getItemAbove(XLayerItem &item) { // get our iterator - iterator it = std::find(itemList().begin(), itemList().end(), &item); + iterator it = find(itemList().begin(), itemList().end(), &item); - // if this is the beginning (top-most item), do nothing, otherwise give the next one up + // if this is the beginning (top-most item), do nothing, otherwise give the next one up // the list (which must be there since we aren't the beginning) if (it == itemList().begin()) return 0; - else + else return *(--it); }
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -43,9 +43,11 @@ #include <algorithm>

#include <X11/X.h> #include <iostream> -using namespace std; // mem_fun -FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, +using std::mem_fun; +using std::string; + +FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, int x, int y, unsigned int width, unsigned int height):

@@ -55,7 +57,7 @@ m_imagectrl(imgctrl),

m_window(theme.screenNum(), x, y, width, height, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask, true), m_layeritem(window(), layer), - m_titlebar(m_window, 0, 0, 100, 16, + m_titlebar(m_window, 0, 0, 100, 16, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | ExposureMask | EnterWindowMask | LeaveWindowMask),

@@ -78,8 +80,8 @@ ButtonPressMask | ButtonReleaseMask |

ButtonMotionMask | ExposureMask | EnterWindowMask | LeaveWindowMask), m_bevel(1), - m_use_titlebar(true), - m_use_tabs(true), + m_use_titlebar(true), + m_use_tabs(true), m_use_handle(true), m_focused(false), m_visible(false),

@@ -104,7 +106,7 @@ removeEventHandler();

removeAllButtons(); } -bool FbWinFrame::setOnClickTitlebar(FbTk::RefCount<FbTk::Command> &ref, int mousebutton_num, +bool FbWinFrame::setOnClickTitlebar(FbTk::RefCount<FbTk::Command> &ref, int mousebutton_num, bool double_click, bool pressed) { // find mousebutton_num if (mousebutton_num < 1 || mousebutton_num > 5)

@@ -127,7 +129,7 @@ return false;

bool ret = true; - // setting tabmode to notset forces it through when + // setting tabmode to notset forces it through when // something is likely to change if (tabmode == NOTSET) tabmode = m_tabmode;

@@ -183,7 +185,7 @@ m_tab_container.clear();

m_tab_container.raise(); m_tab_container.show(); - + if (!m_use_tabs) ret = false;

@@ -234,7 +236,7 @@ m_window.resize(m_window.width(), m_titlebar.height());

alignTabs(); // need to update our shape if ( m_shape.get() ) - m_shape->update(); + m_shape->update(); } else { // should be unshaded m_window.resize(m_width_before_shade, m_height_before_shade); reconfigure();

@@ -251,10 +253,10 @@ moveResize(0, 0, width, height, false, true);

} // need an atomic moveresize where possible -void FbWinFrame::moveResizeForClient(int x, int y, - unsigned int width, unsigned int height, - int win_gravity, - unsigned int client_bw, +void FbWinFrame::moveResizeForClient(int x, int y, + unsigned int width, unsigned int height, + int win_gravity, + unsigned int client_bw, bool move, bool resize) { // total height for frame

@@ -266,16 +268,16 @@ setActiveGravity(win_gravity, client_bw);

moveResize(x, y, width, height, move, resize); } -void FbWinFrame::resizeForClient(unsigned int width, unsigned int height, +void FbWinFrame::resizeForClient(unsigned int width, unsigned int height, int win_gravity, unsigned int client_bw) { moveResizeForClient(0, 0, width, height, win_gravity, client_bw, false, true); } void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int height, bool move, bool resize) { - if (move && x == window().x() && y == window().y()) + if (move && x == window().x() && y == window().y()) move = false; - if (resize && width == FbWinFrame::width() && height == FbWinFrame::height()) + if (resize && width == FbWinFrame::width() && height == FbWinFrame::height()) resize = false; if (!move && !resize)

@@ -320,11 +322,11 @@ reconfigure();

} } -void FbWinFrame::quietMoveResize(int x, int y, +void FbWinFrame::quietMoveResize(int x, int y, unsigned int width, unsigned int height) { m_window.moveResize(x, y, width, height); if (m_tabmode == EXTERNAL) { - + switch(m_screen.getTabPlacement()) { case LEFTTOP: case RIGHTTOP:

@@ -444,7 +446,7 @@

void FbWinFrame::notifyMoved(bool clear) { // not important if no alpha... unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); - if (alpha == 255) + if (alpha == 255) return; if (m_tabmode == EXTERNAL && m_use_tabs || m_use_titlebar) {

@@ -516,7 +518,7 @@ }

if (currentLabel()) { if (newvalue) // focused - applyFocusLabel(*m_current_label); + applyFocusLabel(*m_current_label); else // unfocused applyActiveLabel(*m_current_label); }

@@ -536,7 +538,7 @@ if (btn == 0) // valid button?

return; applyButton(*btn); // setup theme and other stuff - + m_buttons_left.push_back(btn); }

@@ -562,7 +564,7 @@ m_buttons_right.pop_back();

} } -FbWinFrame::ButtonId FbWinFrame::createTab(const std::string &title, FbTk::Command *command, +FbWinFrame::ButtonId FbWinFrame::createTab(const string &title, FbTk::Command *command, int tabs_padding) { FbTk::TextButton *button = new FbTk::TextButton(m_tab_container, theme().font(),

@@ -573,7 +575,7 @@ button->setEventMask(ExposureMask | ButtonPressMask |

ButtonReleaseMask | ButtonMotionMask | EnterWindowMask); FbTk::EventManager::instance()->add(*button, button->window()); - + FbTk::RefCount<FbTk::Command> refcmd(command); button->setOnClick(refcmd);

@@ -681,7 +683,7 @@ // we need to mask this so we don't get unmap event

win.setEventMask(NoEventMask); win.reparent(m_window, 0, clientArea().y()); // remask window so we get events - win.setEventMask(PropertyChangeMask | StructureNotifyMask | + win.setEventMask(PropertyChangeMask | StructureNotifyMask | FocusChangeMask); m_window.setEventMask(ButtonPressMask | ButtonReleaseMask |

@@ -691,7 +693,7 @@ XFlush(win.display());

XSetWindowAttributes attrib_set; attrib_set.event_mask = PropertyChangeMask | StructureNotifyMask | FocusChangeMask; - attrib_set.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask | + attrib_set.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask | ButtonMotionMask; XChangeWindowAttributes(win.display(), win.window(), CWEventMask|CWDontPropagate, &attrib_set);

@@ -852,7 +854,7 @@ }

void FbWinFrame::buttonPressEvent(XButtonEvent &event) { // we can ignore which window the event was generated for - if (event.window == m_label.window() && m_current_label) + if (event.window == m_label.window() && m_current_label) event.window = m_current_label->window(); m_tab_container.tryButtonPressEvent(event);

@@ -871,9 +873,9 @@ }

void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { // we can ignore which window the event was generated for - if (event.window == m_label.window() && m_current_label) + if (event.window == m_label.window() && m_current_label) event.window = m_current_label->window(); - + // we continue even if a button got the event m_tab_container.tryButtonReleaseEvent(event);

@@ -891,7 +893,7 @@ static Time last_release_time = 0;

bool double_click = (event.time - last_release_time <= m_double_click_time); last_release_time = event.time; int real_button = event.button - 1; - + if (double_click && *m_commands[real_button].double_click) m_commands[real_button].double_click->execute(); else if (*m_commands[real_button].click)

@@ -918,7 +920,7 @@ if (m_tab_container.tryExposeEvent(event))

return; // create compare function - // that we should use with find_if + // that we should use with find_if FbTk::CompareEqual_base<FbTk::FbWindow, Window> compare(&FbTk::FbWindow::window, event.window);

@@ -966,18 +968,18 @@ if (m_use_handle && orig_handle_h != theme().handleWidth())

m_window.resize(m_window.width(), m_window.height() - orig_handle_h + theme().handleWidth()); - handle().resize(handle().width(), + handle().resize(handle().width(), theme().handleWidth()); - gripLeft().resize(buttonHeight(), + gripLeft().resize(buttonHeight(), theme().handleWidth()); - gripRight().resize(gripLeft().width(), + gripRight().resize(gripLeft().width(), gripLeft().height()); // align titlebar and render it if (m_use_titlebar) { reconfigureTitlebar(); m_titlebar.raise(); - } else + } else m_titlebar.lower(); if (m_tabmode == EXTERNAL) {

@@ -1009,7 +1011,7 @@ int titlebar_height = m_titlebar.height() + m_titlebar.borderWidth();

client_top += titlebar_height; client_height -= titlebar_height; } - + // align handle and grips const int grip_height = m_handle.height(); const int grip_width = 20; //TODO

@@ -1111,35 +1113,35 @@ return;

int orig_height = m_titlebar.height(); // resize titlebar to window size with font height - int title_height = m_theme.font().height() == 0 ? 16 : + int title_height = m_theme.font().height() == 0 ? 16 : m_theme.font().height() + m_bevel*2 + 2; if (m_theme.titleHeight() != 0) title_height = m_theme.titleHeight(); // if the titlebar grows in size, make sure the whole window does too - if (orig_height != title_height) + if (orig_height != title_height) m_window.resize(m_window.width(), m_window.height()-orig_height+title_height); m_titlebar.invalidateBackground(); m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(), m_window.width(), title_height); // draw left buttons first - unsigned int next_x = m_bevel; + unsigned int next_x = m_bevel; unsigned int button_size = buttonHeight(); m_button_size = button_size; for (size_t i=0; i < m_buttons_left.size(); i++, next_x += button_size + m_bevel) { // probably on theme reconfigure, leave bg alone for now m_buttons_left[i]->invalidateBackground(); - m_buttons_left[i]->moveResize(next_x, m_bevel, + m_buttons_left[i]->moveResize(next_x, m_bevel, button_size, button_size); } - + next_x += m_bevel; // space left on titlebar between left and right buttons int space_left = m_titlebar.width() - next_x; - if (!m_buttons_right.empty()) + if (!m_buttons_right.empty()) space_left -= m_buttons_right.size() * (button_size + m_bevel); space_left -= m_bevel;

@@ -1167,7 +1169,7 @@

next_x += m_label.width() + m_bevel; // finaly set new buttons to the right - for (size_t i=0; i < m_buttons_right.size(); + for (size_t i=0; i < m_buttons_right.size(); ++i, next_x += button_size + m_bevel) { m_buttons_right[i]->invalidateBackground(); m_buttons_right[i]->moveResize(next_x, m_bevel,

@@ -1201,21 +1203,21 @@ return;

} // render pixmaps - render(m_theme.titleFocusTexture(), m_title_focused_color, + render(m_theme.titleFocusTexture(), m_title_focused_color, m_title_focused_pm, m_titlebar.width(), m_titlebar.height()); - render(m_theme.titleUnfocusTexture(), m_title_unfocused_color, + render(m_theme.titleUnfocusTexture(), m_title_unfocused_color, m_title_unfocused_pm, m_titlebar.width(), m_titlebar.height()); //!! TODO: don't render label if internal tabs - render(m_theme.labelFocusTexture(), m_label_focused_color, + render(m_theme.labelFocusTexture(), m_label_focused_color, m_label_focused_pm, m_label.width(), m_label.height()); - render(m_theme.labelUnfocusTexture(), m_label_unfocused_color, + render(m_theme.labelUnfocusTexture(), m_label_unfocused_color, m_label_unfocused_pm, m_label.width(), m_label.height());

@@ -1235,23 +1237,23 @@ tc_focused = &m_theme.titleFocusTexture();

if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE) tc_unfocused = &m_theme.titleUnfocusTexture(); - render(*tc_focused, m_tabcontainer_focused_color, + render(*tc_focused, m_tabcontainer_focused_color, m_tabcontainer_focused_pm, m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); - render(*tc_unfocused, m_tabcontainer_unfocused_color, + render(*tc_unfocused, m_tabcontainer_unfocused_color, m_tabcontainer_unfocused_pm, m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); - render(m_theme.labelFocusTexture(), m_labelbutton_focused_color, + render(m_theme.labelFocusTexture(), m_labelbutton_focused_color, m_labelbutton_focused_pm, m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); - render(m_theme.labelUnfocusTexture(), m_labelbutton_unfocused_color, + render(m_theme.labelUnfocusTexture(), m_labelbutton_unfocused_color, m_labelbutton_unfocused_pm, m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation()); - render(m_theme.labelActiveTexture(), m_labelbutton_active_color, + render(m_theme.labelActiveTexture(), m_labelbutton_active_color, m_labelbutton_active_pm, m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());

@@ -1263,7 +1265,7 @@ void FbWinFrame::applyTitlebar() {

// set up pixmaps for titlebar windows Pixmap label_pm = None; - Pixmap title_pm = None; + Pixmap title_pm = None; FbTk::Color label_color; FbTk::Color title_color; getCurrentFocusPixmap(label_pm, title_pm,

@@ -1301,18 +1303,18 @@ m_need_render = true;

return; } - render(m_theme.handleFocusTexture(), m_handle_focused_color, + render(m_theme.handleFocusTexture(), m_handle_focused_color, m_handle_focused_pm, m_handle.width(), m_handle.height()); - - render(m_theme.handleUnfocusTexture(), m_handle_unfocused_color, + + render(m_theme.handleUnfocusTexture(), m_handle_unfocused_color, m_handle_unfocused_pm, m_handle.width(), m_handle.height()); render(m_theme.gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm, m_grip_left.width(), m_grip_left.height()); - render(m_theme.gripUnfocusTexture(), m_grip_unfocused_color, + render(m_theme.gripUnfocusTexture(), m_grip_unfocused_color, m_grip_unfocused_pm, m_grip_left.width(), m_grip_left.height());

@@ -1339,7 +1341,7 @@ m_grip_right.setBackgroundPixmap(m_grip_focused_pm);

} else { m_grip_left.setBackgroundColor(m_grip_focused_color); m_grip_right.setBackgroundColor(m_grip_focused_color); - } + } } else {

@@ -1347,7 +1349,7 @@ if (m_handle_unfocused_pm) {

m_handle.setBackgroundPixmap(m_handle_unfocused_pm); } else { m_handle.setBackgroundColor(m_handle_unfocused_color); - } + } if (m_grip_unfocused_pm) { m_grip_left.setBackgroundPixmap(m_grip_unfocused_pm);

@@ -1355,7 +1357,7 @@ m_grip_right.setBackgroundPixmap(m_grip_unfocused_pm);

} else { m_grip_left.setBackgroundColor(m_grip_unfocused_color); m_grip_right.setBackgroundColor(m_grip_unfocused_color); - } + } } }

@@ -1367,15 +1369,15 @@ m_need_render = true;

return; } - render(m_theme.buttonFocusTexture(), m_button_color, + render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm, m_button_size, m_button_size); - render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color, + render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color, m_button_unfocused_pm, m_button_size, m_button_size); - - render(m_theme.buttonPressedTexture(), m_button_pressed_color, + + render(m_theme.buttonPressedTexture(), m_button_pressed_color, m_button_pressed_pm, m_button_size, m_button_size); }

@@ -1477,7 +1479,7 @@ } else {

pm = m_imagectrl.renderImage(w, h, tex, orient); } - if (tmp) + if (tmp) m_imagectrl.removeImage(tmp); }

@@ -1489,7 +1491,7 @@ if (m_label_focused_pm != 0)

label_pm = m_label_focused_pm; else label_color = m_label_focused_color; - + if (m_title_focused_pm != 0) title_pm = m_title_focused_pm; else

@@ -1499,12 +1501,12 @@ if (m_label_unfocused_pm != 0)

label_pm = m_label_unfocused_pm; else label_color = m_label_unfocused_color; - + if (m_title_unfocused_pm != 0) title_pm = m_title_unfocused_pm; else title_color = m_title_unfocused_color; - } + } } void FbWinFrame::applyTabContainer() {

@@ -1553,11 +1555,11 @@ // negate gravity

gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false); - // we need to change the size of the window + // we need to change the size of the window // if the border width changes... - if (m_use_titlebar) + if (m_use_titlebar) bw_changes += static_cast<signed>(border_width - titlebar().borderWidth()); - if (m_use_handle) + if (m_use_handle) bw_changes += static_cast<signed>(border_width - handle().borderWidth()); window().setBorderWidth(border_width);

@@ -1662,7 +1664,7 @@

// this function translates its arguments according to win_gravity // if win_gravity is negative, it does an inverse translation // This function should be used when a window is mapped/unmapped/pos configured -void FbWinFrame::gravityTranslate(int &x, int &y, +void FbWinFrame::gravityTranslate(int &x, int &y, int win_gravity, unsigned int client_bw, bool move_frame) { bool invert = false; if (win_gravity < 0) {

@@ -1670,18 +1672,18 @@ invert = true;

win_gravity = -win_gravity; // make +ve } - /* Ok, so, gravity says which point of the frame is put where the + /* Ok, so, gravity says which point of the frame is put where the * corresponding bit of window would have been * Thus, x,y always refers to where top left of the WINDOW would be placed * but given that we're wrapping it in a frame, we actually place * it so that the given reference point is in the same spot as the * window's reference point would have been. - * i.e. east gravity says that the centre of the right hand side of the + * i.e. east gravity says that the centre of the right hand side of the * frame is placed where the centre of the rhs of the window would * have been if there was no frame. * Hope that makes enough sense. * - * NOTE: the gravity calculations are INDEPENDENT of the client + * NOTE: the gravity calculations are INDEPENDENT of the client * window width/height. * * If you get confused with the calculations, draw a picture.

@@ -1753,7 +1755,7 @@ }

} int FbWinFrame::widthOffset() const { - if (m_tabmode != EXTERNAL || !m_use_tabs) + if (m_tabmode != EXTERNAL || !m_use_tabs) return 0; // same height offset for top and bottom tabs

@@ -1771,7 +1773,7 @@ return 0;

} int FbWinFrame::heightOffset() const { - if (m_tabmode != EXTERNAL || !m_use_tabs) + if (m_tabmode != EXTERNAL || !m_use_tabs) return 0; switch (m_screen.getTabPlacement()) {

@@ -1788,7 +1790,7 @@ return 0;

} int FbWinFrame::xOffset() const { - if (m_tabmode != EXTERNAL || !m_use_tabs) + if (m_tabmode != EXTERNAL || !m_use_tabs) return 0; switch (m_screen.getTabPlacement()) {

@@ -1803,7 +1805,7 @@ return 0;

} int FbWinFrame::yOffset() const { - if (m_tabmode != EXTERNAL || !m_use_tabs) + if (m_tabmode != EXTERNAL || !m_use_tabs) return 0; switch (m_screen.getTabPlacement()) {
M src/Keys.ccsrc/Keys.cc

@@ -89,7 +89,11 @@ #include <vector>

#include <map> #include <memory> -using namespace std; +using std::cerr; +using std::endl; +using std::string; +using std::vector; +using std::ifstream; Keys::Keys(): m_display(FbTk::App::instance()->display())

@@ -171,7 +175,7 @@ return false;

// return true; } -bool Keys::addBinding(const std::string &linebuffer) { +bool Keys::addBinding(const string &linebuffer) { vector<string> val; // Parse arguments

@@ -187,7 +191,7 @@

unsigned int key = 0, mod = 0; t_key *current_key=0, *last_key=0; size_t argc = 0; - std::string keyMode = "default:"; + string keyMode = "default:"; if (val[0][val[0].length()-1] == ':') { argc++;

@@ -213,21 +217,21 @@ // 0x - hex

// +[1-9] - number between +1 and +9 // numbers 10 and above // - if (val[argc].size() > 1 && (isdigit(val[argc][0]) && - (isdigit(val[argc][1]) || val[argc][1] == 'x') || + if (val[argc].size() > 1 && (isdigit(val[argc][0]) && + (isdigit(val[argc][1]) || val[argc][1] == 'x') || val[argc][0] == '+' && isdigit(val[argc][1])) ) { - + key = strtoul(val[argc].c_str(), NULL, 0); if (errno == EINVAL || errno == ERANGE) key = 0; } else // convert from string symbol - key = FbTk::KeyUtil::getKey(val[argc].c_str()); + key = FbTk::KeyUtil::getKey(val[argc].c_str()); if (key == 0) { - cerr<<_FB_CONSOLETEXT(Keys, InvalidKeyMod, - "Keys: Invalid key/modifier on line", + cerr<<_FB_CONSOLETEXT(Keys, InvalidKeyMod, + "Keys: Invalid key/modifier on line", "A bad key/modifier string was found on line (number following)")<<" "<< m_current_line<<"): "<<linebuffer<<endl; return false;

@@ -391,7 +395,7 @@

return false; } -void Keys::keyMode(std::string keyMode = "default") { +void Keys::keyMode(string keyMode = "default") { keyspace_t::iterator it = m_map.find(keyMode + ":"); if (it == m_map.end()) m_keylist = m_map["default:"];
M src/RegExp.ccsrc/RegExp.cc

@@ -33,7 +33,12 @@

#include <string> #include <iostream> -using namespace std; +using std::string; + +#ifdef USE_REGEXP +using std::cerr; +using std::endl; +#endif // USE_REGEXP /********************************************************

@@ -42,7 +47,7 @@ **********/

// full_match is to say if we match on this regexp using the full string // or just a substring. Substrings aren't supported if not HAVE_REGEXP -RegExp::RegExp(const std::string &str, bool full_match): +RegExp::RegExp(const string &str, bool full_match): #ifdef USE_REGEXP m_regex(0) { string match;

@@ -83,7 +88,7 @@ }

#endif // USE_REGEXP } -bool RegExp::match(const std::string &str) const { +bool RegExp::match(const string &str) const { #ifdef USE_REGEXP if (m_regex) return regexec(m_regex, str.c_str(), 0, 0, 0) == 0;

@@ -97,7 +102,7 @@

bool RegExp::error() const { #ifdef USE_REGEXP - return m_regex == 0; + return m_regex == 0; #else return m_str == ""; #endif // USE_REGEXP
M src/Remember.ccsrc/Remember.cc

@@ -2,7 +2,7 @@ // Remember.cc for Fluxbox Window Manager

// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) // and Simon Bowden (rathnor at users.sourceforge.net) // Copyright (c) 2002 Xavier Brouckaert -// +// // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation

@@ -56,7 +56,17 @@ #include <memory>

#include <set> -using namespace std; +using std::cerr; +using std::endl; +using std::string; +using std::list; +using std::set; +using std::make_pair; +using std::ifstream; +using std::ofstream; +using std::hex; +using std::dec; + namespace {

@@ -254,7 +264,7 @@

// the patterns free the "Application"s // the client mapping shouldn't need cleaning Patterns::iterator it; - std::set<Application *> all_apps; // no duplicates + set<Application *> all_apps; // no duplicates while (!m_pats->empty()) { it = m_pats->begin(); delete it->first; // ClientPattern

@@ -262,7 +272,7 @@ all_apps.insert(it->second); // Application, not necessarily unique

m_pats->erase(it); } - std::set<Application *>::iterator ait = all_apps.begin(); // no duplicates + set<Application *>::iterator ait = all_apps.begin(); // no duplicates for (; ait != all_apps.end(); ++ait) { delete (*ait); }

@@ -300,7 +310,7 @@ m_pats->push_back(make_pair(p, app));

return app; } -int Remember::parseApp(std::ifstream &file, Application &app, std::string *first_line) { +int Remember::parseApp(ifstream &file, Application &app, string *first_line) { string line; _FB_USES_NLS; int row = 0;

@@ -346,13 +356,13 @@ if (!str_key.size())

continue; //read next line if (strcasecmp(str_key.c_str(), "Workspace") == 0) { unsigned int w; - if (getuint(str_label.c_str(), w)) + if (getuint(str_label.c_str(), w)) app.rememberWorkspace(w); else had_error = true; } else if (strcasecmp(str_key.c_str(), "Head") == 0) { unsigned int h; - if (getuint(str_label.c_str(), h)) + if (getuint(str_label.c_str(), h)) app.rememberHead(h); else had_error = true;

@@ -403,7 +413,7 @@ had_error = 1;

} } - if (!had_error && sscanf(str_label.c_str(), "%u %u", &x, &y) == 2) + if (!had_error && sscanf(str_label.c_str(), "%u %u", &x, &y) == 2) app.rememberPosition(x, y, r); else had_error = true;

@@ -476,8 +486,8 @@ /*

This function is used to search for old instances of the same pattern (when reloading apps file). More than one pattern might match, but only if the application is the same (also note that they'll be adjacent). - We REMOVE and delete any matching patterns from the old list, as they're - effectively moved into the new + We REMOVE and delete any matching patterns from the old list, as they're + effectively moved into the new */ Application *Remember::findMatchingPatterns(ClientPattern *pat, Patterns *patlist, bool is_group) {

@@ -519,10 +529,11 @@

time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(apps_string.c_str()); if (m_last_timestamp > 0 && m_last_timestamp == timestamp) return; - + #ifdef DEBUG cerr<<__FILE__<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl; #endif // DEBUG + ifstream apps_file(apps_string.c_str()); // we merge the old patterns with new ones

@@ -536,7 +547,7 @@ if (!apps_file.eof()) {

string line; int row = 0; bool in_group = false; - std::list<ClientPattern *> grouped_pats; + list<ClientPattern *> grouped_pats; while (getline(apps_file, line) && ! apps_file.eof()) { row++; FbTk::StringUtil::removeFirstWhitespace(line);

@@ -554,7 +565,7 @@ ClientPattern *pat = new ClientPattern(line.c_str() + pos);

if (!in_group) { if ((err = pat->error()) == 0) { Application *app = findMatchingPatterns(pat, old_pats, false); - if (!app) + if (!app) app = new Application(false); m_pats->push_back(make_pair(pat, app));

@@ -578,8 +589,8 @@ } else if (in_group) {

// otherwise assume that it is the start of the attributes Application *app = 0; // search for a matching app - std::list<ClientPattern *>::iterator it = grouped_pats.begin(); - std::list<ClientPattern *>::iterator it_end = grouped_pats.end(); + list<ClientPattern *>::iterator it = grouped_pats.begin(); + list<ClientPattern *>::iterator it_end = grouped_pats.end(); while (!app && it != it_end) { app = findMatchingPatterns(*it, old_pats, true); ++it;

@@ -617,9 +628,9 @@

// Clean up old state // can't just delete old patterns list. Need to delete the // patterns themselves, plus the applications! - + Patterns::iterator it; - std::set<Application *> old_apps; // no duplicates + set<Application *> old_apps; // no duplicates while (!old_pats->empty()) { it = old_pats->begin(); delete it->first; // ClientPattern

@@ -640,7 +651,7 @@ ++cit;

} } - std::set<Application *>::iterator ait = old_apps.begin(); // no duplicates + set<Application *>::iterator ait = old_apps.begin(); // no duplicates for (; ait != old_apps.end(); ++ait) { delete (*ait); }

@@ -667,7 +678,7 @@

Patterns::iterator it = m_pats->begin(); Patterns::iterator it_end = m_pats->end(); - std::set<Application *> grouped_apps; // no duplicates + set<Application *> grouped_apps; // no duplicates for (; it != it_end; ++it) { Application &a = *it->second;
M src/Screen.ccsrc/Screen.cc

@@ -135,19 +135,32 @@ }

#endif // XINERAMA #include <iostream> -#include <memory> #include <algorithm> #include <functional> #include <stack> -using namespace std; +using std::cerr; +using std::endl; +using std::string; +using std::make_pair; +using std::pair; +using std::list; +using std::vector; +using std::mem_fun; +using std::bind2nd; +using std::equal_to; + +#ifdef DEBUG +using std::hex; +using std::dec; +#endif // DEBUG static bool running = true; namespace { int anotherWMRunning(Display *display, XErrorEvent *) { _FB_USES_NLS; - cerr<<_FB_CONSOLETEXT(Screen, AnotherWMRunning, + cerr<<_FB_CONSOLETEXT(Screen, AnotherWMRunning, "BScreen::BScreen: an error occured while querying the X server.\n" " another window manager already running on display ", "Message when another WM is found already active on all screens")

@@ -161,8 +174,8 @@

class TabPlacementMenuItem: public FbTk::MenuItem { public: - TabPlacementMenuItem(FbTk::FbString & label, BScreen &screen, - FbWinFrame::TabPlacement place, + TabPlacementMenuItem(FbTk::FbString & label, BScreen &screen, + FbWinFrame::TabPlacement place, FbTk::RefCount<FbTk::Command> &cmd): FbTk::MenuItem(label, cmd), m_screen(screen),

@@ -244,9 +257,9 @@ }

} // end namespace FbTk -BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, - const std::string &scrname, - const std::string &altscrname): +BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, + const string &scrname, + const string &altscrname): image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"), opaque_move(rm, false, scrname + ".opaqueMove", altscrname+".OpaqueMove"), full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"),

@@ -274,9 +287,9 @@ tab_width(rm, 64, scrname + ".tab.width", altscrname+".Tab.Width"),

menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"), gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"), - gc_line_style(rm, - FbTk::GContext::LINESOLID, - scrname+".overlay.lineStyle", + gc_line_style(rm, + FbTk::GContext::LINESOLID, + scrname+".overlay.lineStyle", altscrname+".Overlay.LineStyle"), gc_join_style(rm, FbTk::GContext::JOINMITER,

@@ -290,24 +303,24 @@ scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"),

scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"), max_over_tabs(rm, false, scrname+".tabs.maxOver", altscrname+".Tabs.MaxOver"), default_internal_tabs(rm, false /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") { - + } BScreen::BScreen(FbTk::ResourceManager &rm, - const std::string &screenname, - const std::string &altscreenname, - int scrn, int num_layers) : + const string &screenname, + const string &altscreenname, + int scrn, int num_layers) : m_clientlist_sig(*this), // client signal m_iconlist_sig(*this), // icon list signal m_workspacecount_sig(*this), // workspace count signal - m_workspacenames_sig(*this), // workspace names signal + m_workspacenames_sig(*this), // workspace names signal m_workspace_area_sig(*this), // workspace area signal m_currentworkspace_sig(*this), // current workspace signal m_reconfigure_sig(*this), // reconfigure signal m_resize_sig(*this), m_layermanager(num_layers), - m_windowtheme(new FbWinFrameTheme(scrn)), + m_windowtheme(new FbWinFrameTheme(scrn)), // the order of windowtheme and winbutton theme is important // because winbutton need to rescale the pixmaps in winbutton theme // after fbwinframe have resized them

@@ -315,7 +328,7 @@ m_winbutton_theme(new WinButtonTheme(scrn, *m_windowtheme)),

m_menutheme(new MenuTheme(scrn)), m_root_window(scrn), m_geom_window(m_root_window, - 0, 0, 10, 10, + 0, 0, 10, 10, false, // override redirect true), // save under m_pos_window(m_root_window,

@@ -370,17 +383,17 @@ }

// TODO fluxgen: check if this is the right place m_head_areas = new HeadArea[numHeads() ? numHeads() : 1]; - + _FB_USES_NLS; - + fprintf(stderr, _FB_CONSOLETEXT(Screen, ManagingScreen, "BScreen::BScreen: managing screen %d " - "using visual 0x%lx, depth %d\n", + "using visual 0x%lx, depth %d\n", "informational message saying screen number (%d), visual (%lx), and colour depth (%d)").c_str(), screenNumber(), XVisualIDFromVisual(rootWindow().visual()), rootWindow().depth()); - + rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); // load this screens resources

@@ -388,7 +401,7 @@ Fluxbox *fluxbox = Fluxbox::instance();

fluxbox->load_rc(*this); // setup image cache engine - m_image_control.reset(new FbTk::ImageControl(scrn, true, + m_image_control.reset(new FbTk::ImageControl(scrn, true, fluxbox->colorsPerChannel(), fluxbox->getCacheLife(), fluxbox->getCacheMax())); imageControl().installRootColormap();

@@ -435,13 +448,13 @@ addWorkspace();

} m_current_workspace = m_workspaces_list.front(); - + //!! TODO: we shouldn't do this more than once, but since slit handles their // own resources we must do this. fluxbox->load_rc(*this); - m_configmenu.reset(createMenu(_FB_XTEXT(Menu, Configuration, + m_configmenu.reset(createMenu(_FB_XTEXT(Menu, Configuration, "Configuration", "Title of configuration menu"))); setupConfigmenu(*m_configmenu.get()); m_configmenu->setInternalMenu();

@@ -472,21 +485,21 @@ fluxbox->getSlitlistFilename().c_str()));

#endif // SLIT rm.unlock(); - + XFlush(disp); } BScreen::~BScreen() { - + if (! managed) return; - + if (m_rootmenu.get() != 0) m_rootmenu->removeAll(); - + // Since workspacemenu holds client list menus (from workspace) // we need to destroy it before we destroy workspaces m_workspacemenu.reset(0);

@@ -508,7 +521,7 @@ // let the parent clean it up

mit->second->setInternalMenu(false); } } - + if (geom_pixmap != None) imageControl().removeImage(geom_pixmap);

@@ -521,7 +534,7 @@ destroyAndClear(m_workspaces_list);

destroyAndClear(m_netizen_list); destroyAndClear(m_managed_resources); - //why not destroyAndClear(m_icon_list); ? + //why not destroyAndClear(m_icon_list); ? //problem with that: a delete FluxboxWindow* calls m_diesig.notify() //which leads to screen.removeWindow() which leads to removeIcon(win) //which would modify the m_icon_list anyways...

@@ -533,7 +546,7 @@ tmp.back()->restore(true);

delete (tmp.back()); tmp.pop_back(); } - + if (hasXinerama() && m_xinerama_headinfo) { delete [] m_xinerama_headinfo; }

@@ -654,8 +667,8 @@ XFree(children);

} -unsigned int BScreen::currentWorkspaceID() const { - return m_current_workspace->workspaceID(); +unsigned int BScreen::currentWorkspaceID() const { + return m_current_workspace->workspaceID(); } const Strut* BScreen::availableWorkspaceArea(int head) const {

@@ -663,10 +676,10 @@ return m_head_areas[head ? head-1 : 0].availableWorkspaceArea();

} unsigned int BScreen::maxLeft(int head) const { - + // we ignore strut if we're doing full maximization if (hasXinerama()) - return doFullMax() ? getHeadX(head) : + return doFullMax() ? getHeadX(head) : getHeadX(head) + availableWorkspaceArea(head)->left(); else return doFullMax() ? 0 : availableWorkspaceArea(head)->left();

@@ -675,7 +688,7 @@

unsigned int BScreen::maxRight(int head) const { // we ignore strut if we're doing full maximization if (hasXinerama()) - return doFullMax() ? getHeadX(head) + getHeadWidth(head) : + return doFullMax() ? getHeadX(head) + getHeadWidth(head) : getHeadX(head) + getHeadWidth(head) - availableWorkspaceArea(head)->right(); else return doFullMax() ? width() : width() - availableWorkspaceArea(head)->right();

@@ -723,21 +736,21 @@ Icons::iterator it = iconList().begin();

const Icons::iterator it_end = iconList().end(); for (; it != it_end; ++it) fluxbox->updateFrameExtents(**it); - + } -FbTk::Menu *BScreen::createMenu(const std::string &label) { - FbTk::Menu *menu = new FbMenu(menuTheme(), - imageControl(), +FbTk::Menu *BScreen::createMenu(const string &label) { + FbTk::Menu *menu = new FbMenu(menuTheme(), + imageControl(), *layerManager().getLayer(Layer::MENU)); if (!label.empty()) menu->setLabel(label); return menu; } -FbTk::Menu *BScreen::createToggleMenu(const std::string &label) { - FbTk::Menu *menu = new ToggleMenu(menuTheme(), - imageControl(), +FbTk::Menu *BScreen::createToggleMenu(const string &label) { + FbTk::Menu *menu = new ToggleMenu(menuTheme(), + imageControl(), *layerManager().getLayer(Layer::MENU)); if (!label.empty()) menu->setLabel(label);

@@ -748,7 +761,7 @@

void BScreen::addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu) { menu->setInternalMenu(); menu->disableTitle(); - m_extramenus.push_back(std::make_pair(label, menu)); + m_extramenus.push_back(make_pair(label, menu)); // recreate window menu m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber())); m_windowmenu->setInternalMenu();

@@ -772,7 +785,7 @@ for (; it != it_end; ++it)

(*it)->menu().hide(); } // hide all client menus - hideWindowMenus(); + hideWindowMenus(); }

@@ -843,7 +856,7 @@ m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));

m_windowmenu->setInternalMenu(); // We need to check to see if the timestamps - // changed before we actually can restore the menus + // changed before we actually can restore the menus // in the same way, since we can't really say if // any submenu is in the same place as before if the // menu changed.

@@ -873,7 +886,7 @@ // restore submenus, no timestamp changed

FbTk::Menu *menu = m_rootmenu.get(); for (size_t i = 0; i < remember_sub.size(); i++ ) { int sub = remember_sub[i]; - if (!menu || sub < 0) + if (!menu || sub < 0) break; FbTk::MenuItem *item = menu->find(sub); if (item != 0) {

@@ -889,12 +902,12 @@ // reconfigure workspaces

for_each(m_workspaces_list.begin(), m_workspaces_list.end(), mem_fun(&Workspace::reconfigure)); - + // reconfigure Icons for_each(m_icon_list.begin(), m_icon_list.end(), mem_fun(&FluxboxWindow::reconfigure)); - + imageControl().cleanCache(); // notify objects that the screen is reconfigured m_reconfigure_sig.notify();

@@ -952,7 +965,7 @@ m_workspacenames_sig.notify();

} void BScreen::addIcon(FluxboxWindow *w) { - if (w == 0) + if (w == 0) return; // make sure we have a unique list

@@ -973,7 +986,7 @@

Icons::iterator erase_it = remove_if(iconList().begin(), iconList().end(), bind2nd(equal_to<FluxboxWindow *>(), w)); - // no need to send iconlist signal if we didn't + // no need to send iconlist signal if we didn't // change the iconlist if (erase_it != m_icon_list.end()) { iconList().erase(erase_it);

@@ -985,7 +998,7 @@ void BScreen::removeWindow(FluxboxWindow *win) {

#ifdef DEBUG cerr<<"BScreen::removeWindow("<<win<<")"<<endl; #endif // DEBUG - // extra precaution, if for some reason, the + // extra precaution, if for some reason, the // icon list should be out of sync removeIcon(win); // remove from workspace

@@ -1022,20 +1035,20 @@

int BScreen::addWorkspace() { bool save_name = getNameOfWorkspace(m_workspaces_list.size()) != "" ? false : true; - Workspace *wkspc = new Workspace(*this, m_layermanager, + Workspace *wkspc = new Workspace(*this, m_layermanager, getNameOfWorkspace(m_workspaces_list.size()), m_workspaces_list.size()); m_workspaces_list.push_back(wkspc); - + if (save_name) addWorkspaceName(wkspc->name().c_str()); //update names saveWorkspaces(m_workspaces_list.size()); - - updateNetizenWorkspaceCount(); - + + updateNetizenWorkspaceCount(); + return m_workspaces_list.size(); - + } /// removes last workspace

@@ -1059,7 +1072,7 @@ }

m_clientlist_sig.notify(); //remove last workspace - m_workspaces_list.pop_back(); + m_workspaces_list.pop_back(); updateNetizenWorkspaceCount(); saveWorkspaces(m_workspaces_list.size());

@@ -1104,10 +1117,10 @@

// set new workspace m_current_workspace = getWorkspace(id); - // This is a little tricks to reduce flicker + // This is a little tricks to reduce flicker // this way we can set focus pixmap on frame before we show it // and using ExposeEvent to redraw without flicker - /* + /* WinClient *win = getLastFocusedWindow(currentWorkspaceID()); if (win && win->fbwindow()) win->fbwindow()->setFocusFlag(true);

@@ -1146,7 +1159,7 @@ if (win->isIconic())

win->deiconify(); // if the window isn't on current workspace, hide it - if (id != currentWorkspace()->workspaceID()) + if (id != currentWorkspace()->workspaceID()) win->withdraw(true); windowMenu().hide();

@@ -1182,7 +1195,7 @@ for (; it != it_end; ++it) {

Workspace::Windows::iterator win_it = (*it)->windowList().begin(); Workspace::Windows::iterator win_it_end = (*it)->windowList().end(); for (; win_it != win_it_end; ++win_it) { - net->sendWindowAdd((*win_it)->clientWindow(), + net->sendWindowAdd((*win_it)->clientWindow(), (*it)->workspaceID()); } }

@@ -1199,7 +1212,7 @@ for (; it != it_end; ++it) {

if ((*it)->window() == w) { Netizen *n = *it; delete n; - m_netizen_list.erase(it); + m_netizen_list.erase(it); break; } }

@@ -1218,7 +1231,7 @@ void BScreen::updateNetizenWorkspaceCount() {

for_each(m_netizen_list.begin(), m_netizen_list.end(), mem_fun(&Netizen::sendWorkspaceCount)); - m_workspacecount_sig.notify(); + m_workspacecount_sig.notify(); }

@@ -1235,14 +1248,14 @@ void BScreen::updateNetizenWindowAdd(Window w, unsigned long p) {

// update the list of clients m_clientlist_sig.notify(); - + // and then send the signal to listeners Netizens::iterator it = m_netizen_list.begin(); Netizens::iterator it_end = m_netizen_list.end(); for (; it != it_end; ++it) { (*it)->sendWindowAdd(w, p); } - + }

@@ -1250,7 +1263,7 @@ void BScreen::updateNetizenWindowDel(Window w) {

for_each(m_netizen_list.begin(), m_netizen_list.end(), bind2nd(mem_fun(&Netizen::sendWindowDel), w)); - + m_clientlist_sig.notify(); }

@@ -1285,12 +1298,12 @@ unsigned long *data = 0, uljunk;

Display *disp = FbTk::App::instance()->display(); // Check if KDE v2.x dock applet if (XGetWindowProperty(disp, client, - XInternAtom(FbTk::App::instance()->display(), + XInternAtom(FbTk::App::instance()->display(), "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False), 0l, 1l, False, XA_WINDOW, &ajunk, &ijunk, &uljunk, &uljunk, (unsigned char **) &data) == Success) { - + if (data) iskdedockapp = true; XFree((void *) data);

@@ -1299,7 +1312,7 @@ }

// Check if KDE v1.x dock applet if (!iskdedockapp) { - Atom kwm1 = XInternAtom(FbTk::App::instance()->display(), + Atom kwm1 = XInternAtom(FbTk::App::instance()->display(), "KWM_DOCKWINDOW", False); if (XGetWindowProperty(disp, client, kwm1, 0l, 1l, False,

@@ -1309,7 +1322,7 @@ iskdedockapp = (data && data[0] != 0);

XFree((void *) data); data = 0; } - } + } return iskdedockapp; }

@@ -1317,9 +1330,9 @@

bool BScreen::addKdeDockapp(Window client) { XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask); - char intbuff[16]; + char intbuff[16]; sprintf(intbuff, "%d", screenNumber()); - std::string atom_name("_NET_SYSTEM_TRAY_S"); + string atom_name("_NET_SYSTEM_TRAY_S"); atom_name += intbuff; // append number // find the right atomhandler that has the name: _NET_SYSTEM_TRAY_S<num> AtomHandler *handler = Fluxbox::instance()->getAtomHandler(atom_name);

@@ -1333,7 +1346,7 @@ else

#endif // SLIT return false; } else { - // this handler is a special case + // this handler is a special case // so we call setupClient in it WinClient winclient(client, *this); handler->setupClient(winclient);

@@ -1381,14 +1394,14 @@ else {

win = new FluxboxWindow(*winclient, winFrameTheme(), *layerManager().getLayer(Layer::NORMAL)); - + if (!win->isManaged()) { delete win; return 0; - } + } } } - + // always put on end of focused list, if it gets focused it'll get pushed up // there is only the one win client at this stage focusControl().addFocusBack(*winclient);

@@ -1422,7 +1435,7 @@ if (win->initialState() == WithdrawnState && slit() != 0) {

slit()->addClient(win->clientWindow()); } #endif // SLIT - + if (!win->isManaged()) { delete win;

@@ -1440,7 +1453,7 @@ }

Strut *BScreen::requestStrut(int head, int left, int right, int top, int bottom) { if (head > numHeads() && head != 1) { - // head does not exist (if head == 1, then numHeads() == 0, + // head does not exist (if head == 1, then numHeads() == 0, // which means no xinerama, but there's a head after all head = numHeads(); }

@@ -1462,7 +1475,7 @@ return next;

} void BScreen::clearStrut(Strut *str) { - if (str->next()) + if (str->next()) clearStrut(str->next()); int head = str->head() ? str->head() - 1 : 0; m_head_areas[head].clearStrut(str);

@@ -1493,7 +1506,7 @@ else

return ""; } -void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, +void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) { if (w == 0) return;

@@ -1510,10 +1523,10 @@ removeIcon(w);

getWorkspace(wkspc_id)->addWindow(*w); // client list need to notify now even though // we didn't remove/add any window, - // so listeners that uses the client list to + // so listeners that uses the client list to // show whats on current/other workspace // gets updated - m_clientlist_sig.notify(); + m_clientlist_sig.notify(); } else if (ignore_sticky || ! w->isStuck()) { // fresh windows have workspaceNumber == -1, which leads to // an invalid workspace (unsigned int)

@@ -1534,12 +1547,12 @@ }

void BScreen::initMenu() { - + if (m_rootmenu.get()) { // since all menus in root is submenus in m_rootmenu // just remove every item in m_rootmenu and then clear m_rootmenu_list while (m_rootmenu->numberOfItems()) - m_rootmenu->remove(0); + m_rootmenu->remove(0); m_rootmenu_list.clear(); } else

@@ -1571,7 +1584,7 @@ }

void BScreen::addConfigMenu(const FbTk::FbString &label, FbTk::Menu &menu) { - m_configmenu_list.push_back(std::make_pair(label, &menu)); + m_configmenu_list.push_back(make_pair(label, &menu)); setupConfigmenu(*m_configmenu.get()); }

@@ -1585,7 +1598,7 @@ m_configmenu_list.erase(erase_it);

setupConfigmenu(*m_configmenu.get()); -} +} void BScreen::addManagedResource(FbTk::Resource_base *resource) {

@@ -1600,12 +1613,12 @@

FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand(); FbTk::MacroCommand *s_a_reconftabs_macro = new FbTk::MacroCommand(); FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>( - *Fluxbox::instance(), + *Fluxbox::instance(), &Fluxbox::save_rc)); FbTk::RefCount<FbTk::Command> reconf_cmd(CommandParser::instance().parseLine("reconfigure")); FbTk::RefCount<FbTk::Command> reconftabs_cmd(new FbTk::SimpleCommand<BScreen>( - *this, + *this, &BScreen::reconfigureTabs)); s_a_reconf_macro->add(saverc_cmd); s_a_reconf_macro->add(reconf_cmd);

@@ -1614,15 +1627,15 @@ s_a_reconftabs_macro->add(reconftabs_cmd);

FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro); FbTk::RefCount<FbTk::Command> save_and_reconftabs(s_a_reconftabs_macro); // create focus menu - // we don't set this to internal menu so will + // we don't set this to internal menu so will // be deleted toghether with the parent FbTk::FbString focusmenu_label = _FB_XTEXT(Configmenu, FocusModel, - "Focus Model", + "Focus Model", "Method used to give focus to windows"); FbTk::Menu *focus_menu = createMenu(focusmenu_label); #define _BOOLITEM(m,a, b, c, d, e, f) (m).insert(new BoolMenuItem(_FB_XTEXT(a, b, c, d), e, f)) - + #define _FOCUSITEM(a, b, c, d, e) \ focus_menu->insert(new FocusModelMenuItem(_FB_XTEXT(a, b, c, d), focusControl(), \

@@ -1641,9 +1654,9 @@ ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"),

focusControl(), FocusControl::CLICKTABFOCUS, save_and_reconfigure)); focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"), - focusControl(), FocusControl::MOUSETABFOCUS, save_and_reconfigure)); + focusControl(), FocusControl::MOUSETABFOCUS, save_and_reconfigure)); - focus_menu->insert(new BoolMenuItem(_FB_XTEXT(Configmenu, + focus_menu->insert(new BoolMenuItem(_FB_XTEXT(Configmenu, AutoRaise, "Auto Raise", "Auto Raise windows on sloppy"),

@@ -1659,7 +1672,7 @@

// BEGIN tab menu FbTk::FbString tabmenu_label = _FB_XTEXT(Configmenu, TabMenu, - "Tab Options", + "Tab Options", "heading for tab-related options"); FbTk::Menu *tab_menu = createMenu(tabmenu_label); FbTk::FbString tabplacement_label = _FB_XTEXT(Menu, Placement, "Placement", "Title of Placement menu");

@@ -1675,7 +1688,7 @@ "Maximize Over", "Maximize over this thing when maximizing"),

*resource.max_over_tabs, save_and_reconfigure)); FbTk::MenuItem *tab_width_item = - new IntResMenuItem(_FB_XTEXT(Configmenu, ExternalTabWidth, + new IntResMenuItem(_FB_XTEXT(Configmenu, ExternalTabWidth, "External Tab Width", "Width of external-style tabs"), resource.tab_width, 10, 3000, /* silly number */

@@ -1722,7 +1735,7 @@ _BOOLITEM(menu, Configmenu, ImageDithering,

"Image Dithering", "Image Dithering", *resource.image_dither, save_and_reconfigure); _BOOLITEM(menu, Configmenu, OpaqueMove, - "Opaque Window Moving", + "Opaque Window Moving", "Window Moving with whole window visible (as opposed to outline moving)", *resource.opaque_move, saverc_cmd); _BOOLITEM(menu, Configmenu, FullMax,

@@ -1747,7 +1760,7 @@ cerr<<e.what()<<endl;

} _BOOLITEM(menu, Configmenu, WorkspaceWarping, - "Workspace Warping", + "Workspace Warping", "Workspace Warping - dragging windows to the edge and onto the next workspace", *resource.workspace_warping, saverc_cmd); _BOOLITEM(menu, Configmenu, DesktopWheeling,

@@ -1757,7 +1770,7 @@ _BOOLITEM(menu, Configmenu, DecorateTransient,

"Decorate Transient Windows", "Decorate Transient Windows", *resource.decorate_transient, saverc_cmd); _BOOLITEM(menu, Configmenu, ClickRaises, - "Click Raises", "Click Raises", + "Click Raises", "Click Raises", *resource.click_raises, saverc_cmd); #ifdef HAVE_XRENDER

@@ -1765,37 +1778,37 @@ if (FbTk::Transparent::haveRender() ||

FbTk::Transparent::haveComposite()) { FbTk::FbString alphamenu_label = _FB_XTEXT(Configmenu, Transparency, - "Transparency", + "Transparency", "Menu containing various transparency options"); FbTk::Menu *alpha_menu = createMenu(alphamenu_label); if (FbTk::Transparent::haveComposite(true)) { alpha_menu->insert(new BoolMenuItem(_FB_XTEXT(Configmenu, ForcePseudoTrans, - "Force Pseudo-Transparency", + "Force Pseudo-Transparency", "When composite is available, still use old pseudo-transparency"), Fluxbox::instance()->getPseudoTrans(), save_and_reconfigure)); } FbTk::MenuItem *focused_alpha_item = - new IntResMenuItem(_FB_XTEXT(Configmenu, FocusedAlpha, + new IntResMenuItem(_FB_XTEXT(Configmenu, FocusedAlpha, "Focused Window Alpha", "Transparency level of the focused window"), resource.focused_alpha, 0, 255, *alpha_menu); focused_alpha_item->setCommand(saverc_cmd); alpha_menu->insert(focused_alpha_item); - FbTk::MenuItem *unfocused_alpha_item = - new IntResMenuItem(_FB_XTEXT(Configmenu, - UnfocusedAlpha, - "Unfocused Window Alpha", + FbTk::MenuItem *unfocused_alpha_item = + new IntResMenuItem(_FB_XTEXT(Configmenu, + UnfocusedAlpha, + "Unfocused Window Alpha", "Transparency level of unfocused windows"), resource.unfocused_alpha, 0, 255, *alpha_menu); unfocused_alpha_item->setCommand(saverc_cmd); alpha_menu->insert(unfocused_alpha_item); - FbTk::MenuItem *menu_alpha_item = - new IntResMenuItem(_FB_XTEXT(Configmenu, MenuAlpha, + FbTk::MenuItem *menu_alpha_item = + new IntResMenuItem(_FB_XTEXT(Configmenu, MenuAlpha, "Menu Alpha", "Transparency level of menu"), resource.menu_alpha, 0, 255, *alpha_menu); menu_alpha_item->setCommand(saverc_cmd);

@@ -1807,7 +1820,7 @@ }

#endif // HAVE_XRENDER #undef _BOOLITEM - // finaly update menu + // finaly update menu menu.updateMenu(); }

@@ -1833,9 +1846,9 @@ unsigned int head = getCurrHead();

m_pos_window.move(getHeadX(head) + (getHeadWidth(head) - m_pos_window.width()) / 2, getHeadY(head) + (getHeadHeight(head) - m_pos_window.height()) / 2); - + } else { - m_pos_window.move((width() - m_pos_window.width()) / 2, + m_pos_window.move((width() - m_pos_window.width()) / 2, (height() - m_pos_window.height()) / 2); }

@@ -1854,10 +1867,10 @@ winFrameTheme().font().drawText(m_pos_window,

screenNumber(), winFrameTheme().labelTextFocusGC(), label, strlen(label), - winFrameTheme().bevelWidth(), - winFrameTheme().bevelWidth() + + winFrameTheme().bevelWidth(), + winFrameTheme().bevelWidth() + winFrameTheme().font().ascent()); - + }

@@ -1880,7 +1893,7 @@

m_geom_window.move(getHeadX(head) + (getHeadWidth(head) - m_geom_window.width()) / 2, getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2); } else { - m_geom_window.move((width() - m_geom_window.width()) / 2, + m_geom_window.move((width() - m_geom_window.width()) / 2, (height() - m_geom_window.height()) / 2); }

@@ -1889,7 +1902,7 @@ m_geom_window.raise();

geom_visible = true; } - + char label[256]; _FB_USES_NLS;

@@ -1906,9 +1919,9 @@ winFrameTheme().font().drawText(m_geom_window,

screenNumber(), winFrameTheme().labelTextFocusGC(), label, strlen(label), - winFrameTheme().bevelWidth(), - winFrameTheme().bevelWidth() + - winFrameTheme().font().ascent()); + winFrameTheme().bevelWidth(), + winFrameTheme().bevelWidth() + + winFrameTheme().font().ascent()); }

@@ -2106,7 +2119,7 @@

if (!XineramaIsActive(display)) { #ifdef DEBUG cerr<<"BScreen::initXinerama(): dont have Xinerama"<<endl; -#endif // DEBUG +#endif // DEBUG m_xinerama_avail = false; m_xinerama_headinfo = 0; m_xinerama_num_heads = 0;

@@ -2114,7 +2127,7 @@ return;

} #ifdef DEBUG cerr<<"BScreen::initXinerama(): have Xinerama"<<endl; -#endif // DEBUG +#endif // DEBUG m_xinerama_avail = true; XineramaScreenInfo *screen_info;

@@ -2161,7 +2174,7 @@

int BScreen::getHead(FbTk::FbWindow &win) const { if (hasXinerama()) return getHead(win.x() + win.width()/2, win.y() + win.height()/2); - else + else return 0; }

@@ -2176,7 +2189,7 @@

Window ignore_w; XQueryPointer(FbTk::App::instance()->display(), - rootWindow().window(), &ignore_w, + rootWindow().window(), &ignore_w, &ignore_w, &root_x, &root_y, &ignore_i, &ignore_i, &ignore_ui); #endif // XINERAMA

@@ -2225,17 +2238,17 @@ // if there are multiple heads, head=0 is not valid

// a better way would be to search the closest head if (head == 0 && numHeads() != 0) head = 1; - + int hx = getHeadX(head); int hy = getHeadY(head); int hw = getHeadWidth(head); int hh = getHeadHeight(head); - + if (x + w > hx + hw) x = hx + hw - w; if (y + h > hy + hh) y = hy + hh - h; - + if (x < hx) x = hx; if (y < hy)
M src/Shape.ccsrc/Shape.cc

@@ -1,6 +1,6 @@

// Shape.cc // Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -// +// // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation

@@ -28,6 +28,10 @@ #include "FbTk/App.hh"

#include "FbTk/GContext.hh" #include "FbTk/FbPixmap.hh" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // HAVE_CONFIG_H + #ifdef HAVE_CSTRING #include <cstring> #else

@@ -35,9 +39,6 @@ #include <string.h>

#endif #include <X11/Xutil.h> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H #ifdef SHAPE #include <X11/extensions/shape.h>

@@ -45,15 +46,16 @@ #endif // SHAPE

#include <iostream> #include <algorithm> -using namespace std; + +using std::min; namespace { FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) { - if (win.window() == 0 || place == 0 || + if (win.window() == 0 || place == 0 || win.width() < 3 || win.height() < 3) return 0; - + static char left_bits[] = { 0xc0, 0xf8, 0xfc, 0xfe, 0xfe, 0xfe, 0xff, 0xff }; static char right_bits[] = { 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff}; static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 };

@@ -74,7 +76,7 @@ if (data == 0)

return 0; memset(data, 0xFF, data_size); - + XImage *ximage = XCreateImage(disp, DefaultVisual(disp, win.screenNumber()), 1,

@@ -96,20 +98,20 @@ XPutPixel(ximage, x, y, (left_bits[y] & (0x01 << x)) ? 1 : 0);

} } } - + if (place & Shape::TOPRIGHT) { for (int y=0; y<pixmap_height; y++) { for (int x=0; x<pixmap_width; x++) { - XPutPixel(ximage, x + win_width - pixmap_width, y, + XPutPixel(ximage, x + win_width - pixmap_width, y, (right_bits[y] & (0x01 << x)) ? 1 : 0); - } + } } } - + if (place & Shape::BOTTOMLEFT) { for (int y=0; y<pixmap_height; y++) { for (int x=0; x<pixmap_width; x++) { - XPutPixel(ximage, x, y + win_height - pixmap_height, + XPutPixel(ximage, x, y + win_height - pixmap_height, (bottom_left_bits[y] & (0x01 << x)) ? 1 : 0); } }

@@ -128,7 +130,7 @@ FbTk::FbPixmap *pm = new FbTk::FbPixmap(win, win_width, win_height, 1);

FbTk::GContext gc(*pm); - + XPutImage(disp, pm->drawable(), gc.gc(), ximage, 0, 0, 0, 0, win_width, win_height);

@@ -177,7 +179,7 @@ m_shape.reset(createShape(*m_win, m_shapeplaces));

} // the m_shape can be = 0 which will just reset the shape mask - // and make the window normal + // and make the window normal XShapeCombineMask(FbTk::App::instance()->display(), m_win->window(), ShapeBounding,

@@ -197,7 +199,7 @@ }

void Shape::setShapeNotify(const FbTk::FbWindow &win) { #ifdef SHAPE - XShapeSelectInput(FbTk::App::instance()->display(), + XShapeSelectInput(FbTk::App::instance()->display(), win.window(), ShapeNotifyMask); #endif // SHAPE }

@@ -209,7 +211,7 @@ #ifdef SHAPE

int not_used; unsigned int not_used2; XShapeQueryExtents(FbTk::App::instance()->display(), - win.window(), + win.window(), &shaped, /// bShaped &not_used, &not_used, // xbs, ybs &not_used2, &not_used2, // wbs, hbs
M src/Slit.ccsrc/Slit.cc

@@ -78,7 +78,19 @@ #include <X11/Xlib.h>

#include <iostream> #include <algorithm> -using namespace std; + +using std::string; +using std::pair; +using std::list; +using std::ifstream; +using std::ofstream; +using std::endl; + +#ifdef DEBUG +using std::cerr; +using std::hex; +using std::dec; +#endif // DEBUG namespace FbTk {

@@ -108,9 +120,9 @@ }

template<> void FbTk::Resource<Slit::Direction>::setFromString(const char *strval) { - if (strcasecmp(strval, "Vertical") == 0) + if (strcasecmp(strval, "Vertical") == 0) m_value = Slit::VERTICAL; - else if (strcasecmp(strval, "Horizontal") == 0) + else if (strcasecmp(strval, "Horizontal") == 0) m_value = Slit::HORIZONTAL; else setDefaultValue();

@@ -130,7 +142,7 @@ return string("BottomLeft");

break; case Slit::TOPCENTER: return string("TopCenter"); - break; + break; case Slit::BOTTOMCENTER: return string("BottomCenter"); break;

@@ -162,7 +174,7 @@ // default string

return string("Vertical"); } } // end namespace FbTk -namespace { +namespace { class SlitClientMenuItem: public FbTk::MenuItem{ public:

@@ -172,7 +184,7 @@ setCommand(cmd);

FbTk::MenuItem::setSelected(client.visible()); setToggleItem(true); } - const std::string &label() const { + const string &label() const { return m_client.matchName(); } bool isSelected() const {

@@ -197,9 +209,9 @@

class SlitDirMenuItem: public FbTk::MenuItem { public: SlitDirMenuItem(const FbTk::FbString &label, Slit &slit, FbTk::RefCount<FbTk::Command> &cmd) - :FbTk::MenuItem(label,cmd), - m_slit(slit), - m_label(label) { + :FbTk::MenuItem(label,cmd), + m_slit(slit), + m_label(label) { setLabel(m_label); // update label }

@@ -216,23 +228,23 @@

void setLabel(const FbTk::FbString &label) { _FB_USES_NLS; m_label = (label); - std::string reallabel = m_label + " " + - ( m_slit.direction() == Slit::HORIZONTAL ? - + string reallabel = m_label + " " + + ( m_slit.direction() == Slit::HORIZONTAL ? + _FB_XTEXT(Align, Horizontal, "Horizontal", "Horizontal"): _FB_XTEXT(Align, Vertical, "Vertical", "Vertical")); FbTk::MenuItem::setLabel(reallabel); } private: Slit &m_slit; - std::string m_label; + string m_label; }; class PlaceSlitMenuItem: public FbTk::MenuItem { public: PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command> &cmd): FbTk::MenuItem(label, cmd), m_slit(slit), m_place(place) { - + } bool isEnabled() const { return m_slit.placement() != m_place; } void click(int button, int time) {

@@ -246,13 +258,13 @@ };

}; // End anonymous namespace -unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask | +unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask | EnterWindowMask | LeaveWindowMask | ExposureMask; Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) : m_hidden(false), m_screen(scr), - m_slitmenu(scr.menuTheme(), + m_slitmenu(scr.menuTheme(), scr.imageControl(), *scr.layerManager().getLayer(Layer::MENU)), m_clientlist_menu(scr.menuTheme(),

@@ -260,9 +272,9 @@ scr.imageControl(),

*scr.layerManager().getLayer(Layer::MENU)), frame(scr.rootWindow()), //For KDE dock applets - m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(), + m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(), "KWM_DOCKWINDOW", False)), //KDE v1.x - m_kwm2_dockwindow(XInternAtom(FbTk::App::instance()->display(), + m_kwm2_dockwindow(XInternAtom(FbTk::App::instance()->display(), "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False)), //KDE v2.x m_layeritem(0),

@@ -271,20 +283,20 @@ m_slit_theme(new SlitTheme(scr.rootWindow().screenNumber())),

m_strut(0), // resources // lock in first resource - m_rc_auto_hide(scr.resourceManager().lock(), false, + m_rc_auto_hide(scr.resourceManager().lock(), false, scr.name() + ".slit.autoHide", scr.altName() + ".Slit.AutoHide"), // TODO: this resource name must change m_rc_maximize_over(scr.resourceManager(), false, scr.name() + ".slit.maxOver", scr.altName() + ".Slit.MaxOver"), m_rc_placement(scr.resourceManager(), BOTTOMRIGHT, scr.name() + ".slit.placement", scr.altName() + ".Slit.Placement"), - m_rc_direction(scr.resourceManager(), VERTICAL, + m_rc_direction(scr.resourceManager(), VERTICAL, scr.name() + ".slit.direction", scr.altName() + ".Slit.Direction"), - m_rc_alpha(scr.resourceManager(), 255, + m_rc_alpha(scr.resourceManager(), 255, scr.name() + ".slit.alpha", scr.altName() + ".Slit.Alpha"), m_rc_on_head(scr.resourceManager(), 0, scr.name() + ".slit.onhead", scr.altName() + ".Slit.onHead"), - m_rc_layernum(scr.resourceManager(), Layer(Layer::DOCK), + m_rc_layernum(scr.resourceManager(), Layer(Layer::DOCK), scr.name() + ".slit.layer", scr.altName() + ".Slit.Layer") { _FB_USES_NLS;

@@ -307,7 +319,7 @@ m_timer.setCommand(toggle_hidden);

FbTk::EventManager::instance()->add(*this, frame.window); - + if (FbTk::Transparent::haveComposite()) { frame.window.setOpaque(*m_rc_alpha); } else {

@@ -319,7 +331,7 @@

m_layermenu.reset(new LayerMenu(scr.menuTheme(), scr.imageControl(), *scr.layerManager(). - getLayer(Layer::MENU), + getLayer(Layer::MENU), this, true)); m_layermenu->setLabel(_FB_XTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu"));

@@ -343,7 +355,7 @@ if (frame.pixmap != 0)

screen().imageControl().removeImage(frame.pixmap); // otherwise it will try to access it on deletion - screen().removeConfigMenu(m_slitmenu); + screen().removeConfigMenu(m_slitmenu); shutdown(); }

@@ -429,7 +441,7 @@ return;

// Look for slot in client list by name SlitClient *client = 0; - std::string match_name; + string match_name; match_name = Xutil::getWMClassName(w); SlitClients::iterator it = m_client_list.begin(); SlitClients::iterator it_end = m_client_list.end();

@@ -445,7 +457,7 @@ break;

} // Otherwise keep looking for an unused match or a non-match found_match = true; // Possibly redundant - + } else if (found_match) { // Insert before first non-match after a previously found match? client = new SlitClient(&screen(), w);

@@ -466,7 +478,7 @@ if (wmhints != 0) {

if ((wmhints->flags & IconWindowHint) && (wmhints->icon_window != None)) { XMoveWindow(disp, client->clientWindow(), screen().width() + 10, - screen().height() + 10); + screen().height() + 10); XMapWindow(disp, client->clientWindow()); client->setIconWindow(wmhints->icon_window); client->setWindow(client->iconWindow());

@@ -486,12 +498,12 @@ int num_return = 0;

FbAtoms *fbatoms = FbAtoms::instance(); if (XGetWMProtocols(disp, w, &proto, &num_return)) { - + for (int i = 0; i < num_return; ++i) { if (proto[i] == fbatoms->getFluxboxStructureMessagesAtom()) screen().addNetizen(w); } - + XFree((void *) proto); #ifdef DEBUG } else {

@@ -500,13 +512,13 @@ #endif // DEBUG

} XWindowAttributes attrib; - + #ifdef KDE - if (screen().isKdeDockapp(w)) + if (screen().isKdeDockapp(w)) client->resize(24, 24); else #endif // KDE - + { if (XGetWindowAttributes(disp, client->window(), &attrib)) { client->resize(attrib.width, attrib.height);

@@ -521,7 +533,7 @@

// disable events to frame.window frame.window.setEventMask(NoEventMask); client->disableEvents(); - + XReparentWindow(disp, client->window(), frame.window.window(), 0, 0); XMapRaised(disp, client->window());

@@ -530,7 +542,7 @@ // reactivate events for frame.window

frame.window.setEventMask(s_eventmask); // setup event for slit client window client->enableEvents(); - + // flush events // XFlush(disp);

@@ -651,9 +663,9 @@ if ((*client_it)->window() != None && (*client_it)->visible()) {

num_windows++; if (height_inc) { // increase height of slit for each client (VERTICAL mode) - frame.height += (*client_it)->height() + bevel_width; + frame.height += (*client_it)->height() + bevel_width; // the slit should always have the width of the largest client - if (frame.width < (*client_it)->width()) + if (frame.width < (*client_it)->width()) frame.width = (*client_it)->width(); } else { // increase width of slit for each client (HORIZONTAL mode)

@@ -695,7 +707,7 @@ else

frame.window.setBackgroundPixmap(frame.pixmap); } - if (tmp) + if (tmp) image_ctrl.removeImage(tmp); if (FbTk::Transparent::haveComposite()) {

@@ -733,7 +745,7 @@ if ((*client_it)->window() == None)

continue; //client created window? - if ((*client_it)->visible()) + if ((*client_it)->visible()) (*client_it)->show(); else { (*client_it)->disableEvents();

@@ -776,7 +788,7 @@ else

x += (*client_it)->width() + bevel_width; } // end for - if (doAutoHide() && !isHidden() && !m_timer.isTiming()) + if (doAutoHide() && !isHidden() && !m_timer.isTiming()) m_timer.start(); else if (!doAutoHide() && isHidden()) toggleHidden(); // restore visible

@@ -891,12 +903,12 @@ case BOTTOMRIGHT:

frame.x = head_x + head_w - frame.width - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2; if (direction() == VERTICAL) { - frame.x_hidden = head_x + head_w - + frame.x_hidden = head_x + head_w - bevel_width - border_width; frame.y_hidden = frame.y; } else { frame.x_hidden = frame.x; - frame.y_hidden = head_y + head_h - + frame.y_hidden = head_y + head_h - bevel_width - border_width; } break;

@@ -924,12 +936,12 @@

void Slit::clientUp(SlitClient* client) { if (!client || m_client_list.size() < 2) return; - + if (client == m_client_list.front()) { cycleClientsUp(); return; } - + SlitClients::iterator it = m_client_list.begin(); for(it++; it != m_client_list.end(); it++) { if ((*it) == client) {

@@ -945,12 +957,12 @@

void Slit::clientDown(SlitClient* client) { if (!client || m_client_list.size() < 2) return; - + if (client == m_client_list.back()) { cycleClientsDown(); return; } - + SlitClients::reverse_iterator it = m_client_list.rbegin(); for(it++; it != m_client_list.rend(); it++) { if ((*it) == client) {

@@ -1000,13 +1012,13 @@ }

} void Slit::buttonPressEvent(XButtonEvent &e) { - if (e.window != frame.window.window()) + if (e.window != frame.window.window()) return; if (e.button == Button3) { if (! m_slitmenu.isVisible()) { int x = e.x_root - (m_slitmenu.width() / 2), - y = e.y_root - (m_slitmenu.height() / 2); + y = e.y_root - (m_slitmenu.height() / 2); if (x < 0) x = 0;

@@ -1032,10 +1044,10 @@ if (! doAutoHide())

return; if (isHidden()) { - if (! m_timer.isTiming()) + if (! m_timer.isTiming()) m_timer.start(); } else { - if (m_timer.isTiming()) + if (m_timer.isTiming()) m_timer.stop(); } }

@@ -1046,12 +1058,12 @@ if (! doAutoHide())

return; if (isHidden()) { - if (m_timer.isTiming()) + if (m_timer.isTiming()) m_timer.stop(); } else { if (! m_timer.isTiming()) { // the menu is open, keep it firing until it closes - if (m_slitmenu.isVisible()) + if (m_slitmenu.isVisible()) m_timer.fireOnce(false); m_timer.start(); }

@@ -1072,7 +1084,7 @@ xwc.border_width = 0;

xwc.sibling = event.above; xwc.stack_mode = event.detail; - XConfigureWindow(FbTk::App::instance()->display(), + XConfigureWindow(FbTk::App::instance()->display(), event.window, event.value_mask, &xwc); SlitClients::iterator it = m_client_list.begin();

@@ -1090,12 +1102,12 @@ }

} } - if (reconf) + if (reconf) reconfigure(); } void Slit::exposeEvent(XExposeEvent &ev) { - // we don't need to clear the entire window + // we don't need to clear the entire window // just the are that gets exposed frame.window.clearArea(ev.x, ev.y, ev.width, ev.height); }

@@ -1112,11 +1124,11 @@ void Slit::toggleHidden() {

if (doAutoHide()) { if (!m_slitmenu.isVisible()) { m_timer.fireOnce(true); - } else + } else return; - } else + } else if (!isHidden()) return; - + m_hidden = ! m_hidden; // toggle hidden state if (isHidden()) frame.window.move(frame.x_hidden, frame.y_hidden);

@@ -1130,18 +1142,18 @@ return;

// save filename so we can save client list later m_filename = filename; - std::string real_filename= FbTk::StringUtil::expandFilename(filename); + string real_filename= FbTk::StringUtil::expandFilename(filename); struct stat buf; if (stat(real_filename.c_str(), &buf) == 0) { - std::ifstream file(real_filename.c_str()); - std::string name; + ifstream file(real_filename.c_str()); + string name; while (! file.eof()) { name = ""; - std::getline(file, name); // get the entire line + getline(file, name); // get the entire line if (name.empty()) continue; - + // remove whitespaces from start and end FbTk::StringUtil::removeFirstWhitespace(name);

@@ -1159,7 +1171,7 @@ }

} void Slit::updateClientmenu() { - if (screen().isShuttingdown()) + if (screen().isShuttingdown()) return; _FB_USES_NLS;

@@ -1183,9 +1195,9 @@ }

m_clientlist_menu.insert(new FbTk::MenuSeparator()); FbTk::RefCount<FbTk::Command> savecmd(new FbTk::SimpleCommand<Slit>(*this, &Slit::saveClientList)); - m_clientlist_menu.insert(_FB_XTEXT(Slit, + m_clientlist_menu.insert(_FB_XTEXT(Slit, SaveSlitList, - "Save SlitList", "Saves the current order in the slit"), + "Save SlitList", "Saves the current order in the slit"), savecmd); m_clientlist_menu.updateMenu();

@@ -1193,15 +1205,15 @@ }

void Slit::saveClientList() { - std::ofstream file(FbTk::StringUtil::expandFilename(m_filename).c_str()); + ofstream file(FbTk::StringUtil::expandFilename(m_filename).c_str()); SlitClients::iterator it = m_client_list.begin(); SlitClients::iterator it_end = m_client_list.end(); - std::string prevName; - std::string name; + string prevName; + string name; for (; it != it_end; ++it) { name = (*it)->matchName(); if (name != prevName) - file << name.c_str() << std::endl; + file << name.c_str() << endl; prevName = name; }

@@ -1231,7 +1243,7 @@ // it'll be freed by the slitmenu (since not marked internal)

FbMenu *placement_menu = new FbMenu(m_screen.menuTheme(), m_screen.imageControl(), *m_screen.layerManager().getLayer(::Layer::MENU)); - + // setup base menu m_slitmenu.setLabel(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"));

@@ -1258,17 +1270,17 @@ m_slitmenu.insert(new BoolMenuItem(_FB_XTEXT(Common, AutoHide, "Auto hide", "This thing automatically hides when not close by"),

*m_rc_auto_hide, save_and_reconfigure_slit)); - m_slitmenu.insert(new BoolMenuItem(_FB_XTEXT(Common, MaximizeOver,"Maximize Over", "Maximize over this thing when maximizing"), - *m_rc_maximize_over, + m_slitmenu.insert(new BoolMenuItem(_FB_XTEXT(Common, MaximizeOver,"Maximize Over", "Maximize over this thing when maximizing"), + *m_rc_maximize_over, save_and_reconfigure_slit)); // this saves resources and clears the slit window to update alpha value - FbTk::MenuItem *alpha_menuitem = + FbTk::MenuItem *alpha_menuitem = new IntResMenuItem(_FB_XTEXT(Common, Alpha, "Alpha", "Transparency level"), m_rc_alpha, 0, 255, m_slitmenu); // setup command for alpha value - MacroCommand *alpha_macrocmd = new MacroCommand(); + MacroCommand *alpha_macrocmd = new MacroCommand(); RefCount<Command> alpha_cmd(new SimpleCommand<Slit>(*this, &Slit::updateAlpha)); alpha_macrocmd->add(saverc_cmd); alpha_macrocmd->add(alpha_cmd);

@@ -1277,7 +1289,7 @@ alpha_menuitem->setCommand(set_alpha_cmd);

m_slitmenu.insert(alpha_menuitem); - m_slitmenu.insert(new SlitDirMenuItem(_FB_XTEXT(Slit, Direction, "Slit Direction", "Orientation of slit"), + m_slitmenu.insert(new SlitDirMenuItem(_FB_XTEXT(Slit, Direction, "Slit Direction", "Orientation of slit"), *this, save_and_reconfigure)); m_slitmenu.insert(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"), &m_clientlist_menu);

@@ -1289,7 +1301,7 @@ placement_menu->setMinimumSublevels(3);

m_layermenu->setInternalMenu(); m_clientlist_menu.setInternalMenu(); m_slitmenu.setInternalMenu(); - + typedef pair<FbTk::FbString, Slit::Placement> PlacementP; typedef list<PlacementP> Placements; Placements place_menu;

@@ -1304,7 +1316,7 @@ place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Slit::BOTTOMCENTER));

place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Slit::TOPRIGHT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Slit::RIGHTCENTER)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Slit::BOTTOMRIGHT)); - + // create items in sub menu for (size_t i=0; i<9; ++i) {

@@ -1316,9 +1328,9 @@ placement_menu->insert("");

placement_menu->setItemEnabled(i, false); } else { placement_menu->insert(new PlaceSlitMenuItem(str, *this, - placement, + placement, save_and_reconfigure)); - + } place_menu.pop_front(); }
M src/ToolbarTheme.ccsrc/ToolbarTheme.cc

@@ -26,14 +26,16 @@

#include "FbTk/App.hh" #include <iostream> -using namespace std; +#include <string> + +using std::string; ToolbarTheme::ToolbarTheme(int screen_num): FbTk::Theme(screen_num), m_toolbar(*this, "toolbar", "Toolbar"), m_border(*this, "toolbar", "Toolbar"), m_bevel_width(*this, "toolbar.bevelWidth", "Toolbar.BevelWidth"), - m_shape(*this, "toolbar.shaped", "Toolbar.Shaped"), + m_shape(*this, "toolbar.shaped", "Toolbar.Shaped"), m_height(*this, "toolbar.height", "Toolbar.Height"), m_button_size(*this, "toolbar.button.size", "Toolbar.Button.Size") { // set default value

@@ -48,9 +50,9 @@

} bool ToolbarTheme::fallback(FbTk::ThemeItem_base &item) { - if (item.name().find(".borderWidth") != std::string::npos) { + if (item.name().find(".borderWidth") != string::npos) { return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth"); - } else if (item.name().find(".borderColor") != std::string::npos) { + } else if (item.name().find(".borderColor") != string::npos) { return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor"); } else if (item.name() == "toolbar.bevelWidth") { return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "BevelWidth");
M src/WinClient.ccsrc/WinClient.cc

@@ -44,8 +44,16 @@ #else

#include <assert.h> #endif -using namespace std; +using std::string; +using std::list; +using std::mem_fun; +#ifdef DEBUG +using std::cerr; +using std::endl; +using std::hex; +using std::dec; +#endif // DEBUG WinClient::TransientWaitMap WinClient::s_transient_wait;

@@ -75,7 +83,7 @@ m_blackbox_hint(0),

m_mwm_hint(0), m_focus_mode(F_PASSIVE), m_diesig(*this), m_focussig(*this), - m_screen(screen), + m_screen(screen), m_strut(0) { updateWMProtocols(); updateBlackboxHints();

@@ -86,7 +94,7 @@ updateWMClassHint();

updateTitle(); updateIconTitle(); Fluxbox::instance()->saveWindowSearch(win, this); - if (window_group != None) + if (window_group != None) Fluxbox::instance()->saveGroupSearch(window_group, this); // search for this in transient waiting list

@@ -127,7 +135,7 @@ assert(transient_for != this);

transient_for->transientList().remove(this); transient_for = 0; } - + while (!transients.empty()) { transients.back()->transient_for = 0; transients.pop_back();

@@ -158,8 +166,8 @@ m_win = 0;

} bool WinClient::acceptsFocus() const { - return (m_focus_mode == F_LOCALLYACTIVE || - m_focus_mode == F_PASSIVE || + return (m_focus_mode == F_LOCALLYACTIVE || + m_focus_mode == F_PASSIVE || m_focus_mode == F_GLOBALLYACTIVE && send_focus_message); }

@@ -222,11 +230,11 @@ bool WinClient::getWMIconName(XTextProperty &textprop) const {

return XGetWMName(display(), window(), &textprop); } -const std::string &WinClient::getWMClassName() const { +const string &WinClient::getWMClassName() const { return m_instance_name; } -const std::string &WinClient::getWMClassClass() const { +const string &WinClient::getWMClassClass() const { return m_class_name; }

@@ -236,15 +244,15 @@ if (XGetClassHint(display(), window(), &ch) == 0) {

#ifdef DEBUG cerr<<"WinClient: Failed to read class hint!"<<endl; #endif //DEBUG - } else { + } else { if (ch.res_name != 0) { m_instance_name = const_cast<char *>(ch.res_name); XFree(ch.res_name); ch.res_name = 0; - } else + } else m_instance_name = ""; - + if (ch.res_class != 0) { m_class_name = const_cast<char *>(ch.res_class); XFree(ch.res_class);

@@ -266,7 +274,7 @@ // remove this from parent

if (transientFor() != 0) { transientFor()->transientList().remove(this); } - + transient_for = 0; // determine if this is a transient window Window win = 0;

@@ -284,24 +292,24 @@ cerr<<__FUNCTION__<<": transient to ourself"<<endl;

#endif // DEBUG return; } - + if (win != None && m_win->screen().rootWindow() == win) { // transient for root window... = transient for group // I don't think we are group-aware yet - return; + return; } transient_for = Fluxbox::instance()->searchWindow(win); // if we did not find a transient WinClient but still - // have a transient X window, then we have to put the + // have a transient X window, then we have to put the // X transient_for window in a waiting list and update this clients transient // list later when the transient_for has a Winclient if (!transient_for) { // We might also already waiting for an old transient_for; - // + // // this call fixes issue 2: - // If transients changes to new transient_for before the old transient_for is created. + // If transients changes to new transient_for before the old transient_for is created. // (see comment in WinClient.hh) // removeTransientFromWaitingList();

@@ -335,11 +343,11 @@ }

void WinClient::updateTitle() { - // why 512? very very long wmnames seem to either + // why 512? very very long wmnames seem to either // crash fluxbox or to make it have high cpuload - // see also: + // see also: // http://www.securityfocus.com/archive/1/382398/2004-11-24/2004-11-30/2 - // + // // TODO: - find out why this mostly happens when using xft-fonts // - why other windowmanagers (pekwm/pwm3/openbox etc) are // also influenced

@@ -492,7 +500,7 @@ else

m_focus_mode = F_NOINPUT; } } else // InputHint not present: ignoring send_focus_message and assuming F_PASSIVE - m_focus_mode = F_PASSIVE; + m_focus_mode = F_PASSIVE; if (wmhint->flags & StateHint) initial_state = wmhint->initial_state;

@@ -626,7 +634,7 @@ void WinClient::setGroupLeftWindow(Window win) {

if (m_screen.isShuttingdown()) return; Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False); - changeProperty(group_left_hint, XA_WINDOW, 32, + changeProperty(group_left_hint, XA_WINDOW, 32, PropModeReplace, (unsigned char *) &win, 1); }

@@ -672,7 +680,7 @@ FbTk::App::instance()->sync(false);

XEvent e; if (( XCheckTypedWindowEvent(display(), window(), DestroyNotify, &e) || - XCheckTypedWindowEvent(display(), window(), UnmapNotify, &e)) + XCheckTypedWindowEvent(display(), window(), UnmapNotify, &e)) && XPutBackEvent(display(), &e)) { Fluxbox::instance()->ungrab(); return false;

@@ -681,7 +689,7 @@

return true; } -void WinClient::setStrut(Strut *strut) { +void WinClient::setStrut(Strut *strut) { clearStrut(); m_strut = strut; }

@@ -736,14 +744,14 @@ /* For aspect ratios

Note that its slightly simplified in that only the line gradient is given - this is because for aspect ratios, we always have the line going through the origin - + * Based on this formula: http://astronomy.swin.edu.au/~pbourke/geometry/pointline/ Note that a gradient from origin goes through ( grad , 1 ) */ -void closestPointToLine(double &ret_x, double &ret_y, +void closestPointToLine(double &ret_x, double &ret_y, double point_x, double point_y, double gradient) { double u = (point_x * gradient + point_y) /

@@ -763,13 +771,13 @@ * We use pointers for display_* since they are optional.

* * See ICCCM section 4.1.2.3 */ -void WinClient::applySizeHints(int &width, int &height, +void WinClient::applySizeHints(int &width, int &height, int *display_width, int *display_height) { int i = width, j = height; // Check minimum size - if (width < 0 || width < static_cast<signed>(min_width)) + if (width < 0 || width < static_cast<signed>(min_width)) width = min_width; if (height < 0 || height < static_cast<signed>(min_height))

@@ -783,8 +791,8 @@ if (max_height > 0 && height > static_cast<signed>(max_height))

height = max_height; // we apply aspect ratios before incrementals - // Too difficult to exactly satisfy both incremental+aspect - // in most situations + // Too difficult to exactly satisfy both incremental+aspect + // in most situations // (they really shouldn't happen at the same time anyway). /* aspect ratios are applied exclusive to the base_width

@@ -809,11 +817,11 @@ (height - base_height) > 0) {

double widthd = static_cast<double>(width - base_width); double heightd = static_cast<double>(height - base_height); - double min = static_cast<double>(min_aspect_x) / - static_cast<double>(min_aspect_y); + double min = static_cast<double>(min_aspect_x) / + static_cast<double>(min_aspect_y); - double max = static_cast<double>(max_aspect_x) / - static_cast<double>(max_aspect_y); + double max = static_cast<double>(max_aspect_x) / + static_cast<double>(max_aspect_y); double actual = widthd / heightd;

@@ -836,7 +844,7 @@ }

// enforce incremental size limits, wrt base size // only calculate this if we really need to - i = (width - static_cast<signed>(base_width)) / + i = (width - static_cast<signed>(base_width)) / static_cast<signed>(width_inc); width = i*static_cast<signed>(width_inc) + static_cast<signed>(base_width);

@@ -857,9 +865,9 @@ void WinClient::removeTransientFromWaitingList() {

// holds the windows that dont have empty // transient waiting list - std::list<Window> remove_list; + list<Window> remove_list; - // The worst case complexity is huge, but since we usually do not (virtualy never) + // The worst case complexity is huge, but since we usually do not (virtualy never) // have a large transient waiting list the time spent here is neglectable TransientWaitMap::iterator t_it = s_transient_wait.begin(); TransientWaitMap::iterator t_it_end = s_transient_wait.end();

@@ -872,8 +880,8 @@ remove_list.push_back((*t_it).first);

} // erase empty waiting lists - std::list<Window>::iterator it = remove_list.begin(); - std::list<Window>::iterator it_end = remove_list.end(); + list<Window>::iterator it = remove_list.begin(); + list<Window>::iterator it_end = remove_list.end(); for (; it != it_end; ++it) s_transient_wait.erase(*it); }
M src/main.ccsrc/main.cc

@@ -59,8 +59,21 @@ #include <fstream>

#include <stdexcept> #include <typeinfo> -using namespace std; -void showInfo(ostream &ostr) { +using std::cout; +using std::cerr; +using std::endl; +using std::string; +using std::ostream; +using std::ofstream; +using std::streambuf; +using std::auto_ptr; +using std::out_of_range; +using std::runtime_error; +using std::bad_cast; +using std::bad_alloc; +using std::exception; + +static void showInfo(ostream &ostr) { _FB_USES_NLS; ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl;

@@ -73,7 +86,7 @@ #ifdef __fluxbox_compiler

ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl; #endif // __fluxbox_compiler #ifdef __fluxbox_compiler_version - ostr<<_FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl; + ostr<<_FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl; #endif // __fluxbox_compiler_version ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl;

@@ -177,9 +190,9 @@ }

int main(int argc, char **argv) { - std::string session_display = ""; - std::string rc_file; - std::string log_filename; + string session_display = ""; + string rc_file; + string log_filename; FbTk::NLSInit("fluxbox.cat"); _FB_USES_NLS;

@@ -191,7 +204,7 @@ // look for alternative rc file to use

if ((++i) >= argc) { cerr<<_FB_CONSOLETEXT(main, RCRequiresArg, - "error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl;; + "error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl; exit(1); }

@@ -208,7 +221,7 @@ exit(1);

} session_display = argv[i]; - std::string display_env = "DISPLAY=" + session_display; + string display_env = "DISPLAY=" + session_display; if (putenv(const_cast<char *>(display_env.c_str()))) { cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv, "warning: couldn't set environment variable 'DISPLAY'",

@@ -252,7 +265,7 @@

#ifdef __EMX__ _chdir2(getenv("X11ROOT")); #endif // __EMX__ - std::auto_ptr<Fluxbox> fluxbox; + auto_ptr<Fluxbox> fluxbox; int exitcode=EXIT_FAILURE; streambuf *outbuf = 0;

@@ -279,17 +292,17 @@ fluxbox->eventLoop();

exitcode = EXIT_SUCCESS; - } catch (std::out_of_range &oor) { + } catch (out_of_range &oor) { cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl; - } catch (std::runtime_error &re) { + } catch (runtime_error &re) { cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl; - } catch (std::bad_cast &bc) { - cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl; - } catch (std::bad_alloc &ba) { + } catch (bad_cast &bc) { + cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl; + } catch (bad_alloc &ba) { cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl; - } catch (std::exception &e) { + } catch (exception &e) { cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl; - } catch (std::string error_str) { + } catch (string error_str) { cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl; } catch (...) { cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl;

@@ -297,11 +310,11 @@ abort();

} bool restarting = false; - std::string restart_argument; - + string restart_argument; + if (fluxbox.get()) { restarting = fluxbox->isRestarting(); - restart_argument = fluxbox->getRestartArgument(); + restart_argument = fluxbox->getRestartArgument(); } // destroy fluxbox