cosmetic patch from slava semushin, removes whitespaces and
uses only those things from "namespace std" what we really need.
This commit is contained in:
parent
34b7f7ddfc
commit
10082d821d
20 changed files with 677 additions and 571 deletions
|
@ -1,5 +1,12 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 1.0rc3:
|
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:
|
*06/10/16:
|
||||||
* Added CachedPixmap (Henrik)
|
* Added CachedPixmap (Henrik)
|
||||||
FbTk/CachedPixmap.hh/cc
|
FbTk/CachedPixmap.hh/cc
|
||||||
|
|
|
@ -47,10 +47,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// needed as well for index on some systems (e.g. solaris)
|
// 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():
|
ClientPattern::ClientPattern():
|
||||||
m_matchlimit(0),
|
m_matchlimit(0),
|
||||||
|
@ -63,13 +63,13 @@ ClientPattern::ClientPattern(const char *str):
|
||||||
{
|
{
|
||||||
/* A rough grammar of a pattern is:
|
/* A rough grammar of a pattern is:
|
||||||
PATTERN ::= MATCH+ LIMIT?
|
PATTERN ::= MATCH+ LIMIT?
|
||||||
MATCH ::= '(' word ')'
|
MATCH ::= '(' word ')'
|
||||||
| '(' propertyname '=' word ')'
|
| '(' propertyname '=' word ')'
|
||||||
LIMIT ::= '{' number '}'
|
LIMIT ::= '{' number '}'
|
||||||
|
|
||||||
i.e. one or more match definitions, followed by
|
i.e. one or more match definitions, followed by
|
||||||
an optional limit on the number of apps to match to
|
an optional limit on the number of apps to match to
|
||||||
|
|
||||||
Match definitions are enclosed in parentheses, and if no
|
Match definitions are enclosed in parentheses, and if no
|
||||||
property name is given, then CLASSNAME is assumed.
|
property name is given, then CLASSNAME is assumed.
|
||||||
If no limit is specified, no limit is applied (i.e. limit = infinity)
|
If no limit is specified, no limit is applied (i.e. limit = infinity)
|
||||||
|
@ -81,7 +81,7 @@ ClientPattern::ClientPattern(const char *str):
|
||||||
string match;
|
string match;
|
||||||
int err = 1; // for starting first loop
|
int err = 1; // for starting first loop
|
||||||
while (had_error == 0 && err > 0) {
|
while (had_error == 0 && err > 0) {
|
||||||
err = FbTk::StringUtil::getStringBetween(match,
|
err = FbTk::StringUtil::getStringBetween(match,
|
||||||
str + pos,
|
str + pos,
|
||||||
'(', ')', " \t\n", true);
|
'(', ')', " \t\n", true);
|
||||||
if (err > 0) {
|
if (err > 0) {
|
||||||
|
@ -115,7 +115,7 @@ ClientPattern::ClientPattern(const char *str):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos += err;
|
pos += err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pos == 0 && had_error == 0) {
|
if (pos == 0 && had_error == 0) {
|
||||||
// no match terms given, this is not allowed
|
// no match terms given, this is not allowed
|
||||||
|
@ -125,7 +125,7 @@ ClientPattern::ClientPattern(const char *str):
|
||||||
if (had_error == 0) {
|
if (had_error == 0) {
|
||||||
// otherwise, we check for a number
|
// otherwise, we check for a number
|
||||||
string number;
|
string number;
|
||||||
err = FbTk::StringUtil::getStringBetween(number,
|
err = FbTk::StringUtil::getStringBetween(number,
|
||||||
str+pos,
|
str+pos,
|
||||||
'{', '}');
|
'{', '}');
|
||||||
if (err > 0) {
|
if (err > 0) {
|
||||||
|
@ -134,7 +134,7 @@ ClientPattern::ClientPattern(const char *str):
|
||||||
pos+=err;
|
pos+=err;
|
||||||
}
|
}
|
||||||
// we don't care if there isn't one
|
// we don't care if there isn't one
|
||||||
|
|
||||||
// there shouldn't be anything else on the line
|
// there shouldn't be anything else on the line
|
||||||
match = str + pos;
|
match = str + pos;
|
||||||
size_t uerr;// need a special type here
|
size_t uerr;// need a special type here
|
||||||
|
@ -154,7 +154,7 @@ ClientPattern::ClientPattern(const char *str):
|
||||||
m_terms.pop_back();
|
m_terms.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientPattern::~ClientPattern() {
|
ClientPattern::~ClientPattern() {
|
||||||
// delete all the terms
|
// delete all the terms
|
||||||
|
@ -165,7 +165,7 @@ ClientPattern::~ClientPattern() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// return a string representation of this pattern
|
// return a string representation of this pattern
|
||||||
std::string ClientPattern::toString() const {
|
string ClientPattern::toString() const {
|
||||||
string pat;
|
string pat;
|
||||||
Terms::const_iterator it = m_terms.begin();
|
Terms::const_iterator it = m_terms.begin();
|
||||||
Terms::const_iterator it_end = m_terms.end();
|
Terms::const_iterator it_end = m_terms.end();
|
||||||
|
@ -206,7 +206,7 @@ std::string ClientPattern::toString() const {
|
||||||
|
|
||||||
// does this client match this pattern?
|
// does this client match this pattern?
|
||||||
bool ClientPattern::match(const WinClient &win) const {
|
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())
|
m_terms.empty())
|
||||||
return false; // already matched out
|
return false; // already matched out
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ bool ClientPattern::match(const WinClient &win) const {
|
||||||
// add an expression to match against
|
// add an expression to match against
|
||||||
// The first argument is a regular expression, the second is the member
|
// The first argument is a regular expression, the second is the member
|
||||||
// function that we wish to match against.
|
// 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 *term = new Term(str, true);
|
||||||
term->orig = str;
|
term->orig = str;
|
||||||
|
@ -239,7 +239,7 @@ bool ClientPattern::addTerm(const std::string &str, WinProperty prop) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const {
|
string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case TITLE:
|
case TITLE:
|
||||||
return client.title();
|
return client.title();
|
||||||
|
|
|
@ -28,7 +28,10 @@
|
||||||
#include "I18n.hh"
|
#include "I18n.hh"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -56,9 +59,9 @@ Color::Color(const Color &col_copy):
|
||||||
}
|
}
|
||||||
|
|
||||||
Color::Color(unsigned short red, unsigned short green, unsigned short blue, int screen):
|
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_pixel(0), m_allocated(false),
|
||||||
m_screen(screen) {
|
m_screen(screen) {
|
||||||
allocate(red, green, blue, screen);
|
allocate(red, green, blue, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +98,7 @@ bool Color::setFromString(const char *color_string, int screen) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setPixel(color.pixel);
|
setPixel(color.pixel);
|
||||||
setRGB(maxValue(color.red),
|
setRGB(maxValue(color.red),
|
||||||
maxValue(color.green),
|
maxValue(color.green),
|
||||||
maxValue(color.blue));
|
maxValue(color.blue));
|
||||||
setAllocated(true);
|
setAllocated(true);
|
||||||
|
@ -107,7 +110,7 @@ bool Color::setFromString(const char *color_string, int screen) {
|
||||||
bool Color::validColorString(const char *color_string, int screen) {
|
bool Color::validColorString(const char *color_string, int screen) {
|
||||||
XColor color;
|
XColor color;
|
||||||
Display *disp = App::instance()->display();
|
Display *disp = App::instance()->display();
|
||||||
Colormap colm = DefaultColormap(disp, screen);
|
Colormap colm = DefaultColormap(disp, screen);
|
||||||
// trim white space
|
// trim white space
|
||||||
string color_string_tmp = color_string;
|
string color_string_tmp = color_string;
|
||||||
StringUtil::removeFirstWhitespace(color_string_tmp);
|
StringUtil::removeFirstWhitespace(color_string_tmp);
|
||||||
|
@ -120,7 +123,7 @@ Color &Color::operator = (const Color &col_copy) {
|
||||||
// check for aliasing
|
// check for aliasing
|
||||||
if (this == &col_copy)
|
if (this == &col_copy)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
copy(col_copy);
|
copy(col_copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +137,7 @@ void Color::free() {
|
||||||
setPixel(0);
|
setPixel(0);
|
||||||
setRGB(0, 0, 0);
|
setRGB(0, 0, 0);
|
||||||
setAllocated(false);
|
setAllocated(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Color::copy(const Color &col_copy) {
|
void Color::copy(const Color &col_copy) {
|
||||||
|
@ -144,12 +147,12 @@ void Color::copy(const Color &col_copy) {
|
||||||
setPixel(col_copy.pixel());
|
setPixel(col_copy.pixel());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocate(col_copy.red()*0xFF,
|
allocate(col_copy.red()*0xFF,
|
||||||
col_copy.green()*0xFF,
|
col_copy.green()*0xFF,
|
||||||
col_copy.blue()*0xFF,
|
col_copy.blue()*0xFF,
|
||||||
col_copy.m_screen);
|
col_copy.m_screen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, int screen) {
|
void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, int screen) {
|
||||||
|
@ -158,10 +161,10 @@ void Color::allocate(unsigned short red, unsigned short green, unsigned short bl
|
||||||
XColor color;
|
XColor color;
|
||||||
// fill xcolor structure
|
// fill xcolor structure
|
||||||
color.red = red;
|
color.red = red;
|
||||||
color.green = green;
|
color.green = green;
|
||||||
color.blue = blue;
|
color.blue = blue;
|
||||||
|
|
||||||
|
|
||||||
if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) {
|
if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl;
|
cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl;
|
||||||
|
@ -173,7 +176,7 @@ void Color::allocate(unsigned short red, unsigned short green, unsigned short bl
|
||||||
setPixel(color.pixel);
|
setPixel(color.pixel);
|
||||||
setAllocated(true);
|
setAllocated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_screen = screen;
|
m_screen = screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,13 @@
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
@ -54,7 +60,7 @@ static iconv_t *iconv_convs = 0;
|
||||||
static int iconv_convs[CONVSIZE];
|
static int iconv_convs[CONVSIZE];
|
||||||
#endif // HAVE_ICONV
|
#endif // HAVE_ICONV
|
||||||
|
|
||||||
static std::string locale_codeset;
|
static string locale_codeset;
|
||||||
|
|
||||||
/// Initialise all of the iconv conversion descriptors
|
/// Initialise all of the iconv conversion descriptors
|
||||||
void init() {
|
void init() {
|
||||||
|
@ -70,9 +76,9 @@ void init() {
|
||||||
locale_codeset = nl_langinfo(CODESET);
|
locale_codeset = nl_langinfo(CODESET);
|
||||||
#else // openbsd doesnt have this (yet?)
|
#else // openbsd doesnt have this (yet?)
|
||||||
locale_codeset = "";
|
locale_codeset = "";
|
||||||
std::string locale = setlocale(LC_CTYPE, NULL);
|
string locale = setlocale(LC_CTYPE, NULL);
|
||||||
size_t pos = locale.find('.');
|
size_t pos = locale.find('.');
|
||||||
if (pos != std::string::npos)
|
if (pos != string::npos)
|
||||||
locale_codeset = locale.substr(pos);
|
locale_codeset = locale.substr(pos);
|
||||||
#endif // CODESET
|
#endif // CODESET
|
||||||
|
|
||||||
|
@ -85,7 +91,7 @@ void init() {
|
||||||
iconv_convs[FB2LOCALE] = iconv_open(locale_codeset.c_str(), "UTF-8");
|
iconv_convs[FB2LOCALE] = iconv_open(locale_codeset.c_str(), "UTF-8");
|
||||||
iconv_convs[LOCALE2FB] = iconv_open("UTF-8", locale_codeset.c_str());
|
iconv_convs[LOCALE2FB] = iconv_open("UTF-8", locale_codeset.c_str());
|
||||||
#else
|
#else
|
||||||
for (int i=0; i < CONVSIZE; ++i)
|
for (int i=0; i < CONVSIZE; ++i)
|
||||||
iconv_convs[i] = 0;
|
iconv_convs[i] = 0;
|
||||||
#endif // HAVE_ICONV
|
#endif // HAVE_ICONV
|
||||||
|
|
||||||
|
@ -96,7 +102,7 @@ void shutdown() {
|
||||||
if (iconv_convs == 0)
|
if (iconv_convs == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i=0; i < CONVSIZE; ++i)
|
for (int i=0; i < CONVSIZE; ++i)
|
||||||
if (iconv_convs[i] != (iconv_t)(-1))
|
if (iconv_convs[i] != (iconv_t)(-1))
|
||||||
iconv_close(iconv_convs[i]);
|
iconv_close(iconv_convs[i]);
|
||||||
|
|
||||||
|
@ -118,18 +124,18 @@ void shutdown() {
|
||||||
@return the recoded string, or 0 on failure
|
@return the recoded string, or 0 on failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
--NOTE--
|
--NOTE--
|
||||||
In the "C" locale, this will strip any high-bit characters
|
In the "C" locale, this will strip any high-bit characters
|
||||||
because C means 7-bit ASCII charset. If you don't want this
|
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
|
then you need to set your locale to something UTF-8, OR something
|
||||||
ISO8859-1.
|
ISO8859-1.
|
||||||
*/
|
*/
|
||||||
std::string recode(iconv_t cd,
|
string recode(iconv_t cd,
|
||||||
const std::string &in) {
|
const string &in) {
|
||||||
|
|
||||||
// If empty message, yes this can happen, return
|
// If empty message, yes this can happen, return
|
||||||
if (in.empty())
|
if (in.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (cd == ((iconv_t)(-1)))
|
if (cd == ((iconv_t)(-1)))
|
||||||
|
@ -183,7 +189,7 @@ std::string recode(iconv_t cd,
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy to our return string
|
// copy to our return string
|
||||||
std::string ret;
|
string ret;
|
||||||
ret.append(out, outsize - outbytesleft);
|
ret.append(out, outsize - outbytesleft);
|
||||||
|
|
||||||
// reset the conversion descriptor
|
// reset the conversion descriptor
|
||||||
|
@ -195,27 +201,27 @@ std::string recode(iconv_t cd,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::string recode(int cd,
|
string recode(int cd,
|
||||||
const std::string &str) {
|
const string &str) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
#endif // HAVE_ICONV
|
#endif // HAVE_ICONV
|
||||||
|
|
||||||
FbString XStrToFb(const std::string &src) {
|
FbString XStrToFb(const string &src) {
|
||||||
return recode(iconv_convs[X2FB], src);
|
return recode(iconv_convs[X2FB], src);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FbStrToX(const FbString &src) {
|
string FbStrToX(const FbString &src) {
|
||||||
return recode(iconv_convs[FB2X], src);
|
return recode(iconv_convs[FB2X], src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Handle thislocale string encodings (strings coming from userspace)
|
/// 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);
|
return recode(iconv_convs[LOCALE2FB], src);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FbStrToLocale(const FbString &src) {
|
string FbStrToLocale(const FbString &src) {
|
||||||
return recode(iconv_convs[FB2LOCALE], src);
|
return recode(iconv_convs[FB2LOCALE], src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +237,7 @@ bool haveUTF8() {
|
||||||
|
|
||||||
}; // end namespace StringUtil
|
}; // end namespace StringUtil
|
||||||
|
|
||||||
StringConvertor::StringConvertor(EncodingTarget target):
|
StringConvertor::StringConvertor(EncodingTarget target):
|
||||||
#ifdef HAVE_ICONV
|
#ifdef HAVE_ICONV
|
||||||
m_iconv((iconv_t)(-1)) {
|
m_iconv((iconv_t)(-1)) {
|
||||||
if (target == ToLocaleStr)
|
if (target == ToLocaleStr)
|
||||||
|
@ -251,9 +257,9 @@ StringConvertor::~StringConvertor() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StringConvertor::setSource(const std::string &encoding) {
|
bool StringConvertor::setSource(const string &encoding) {
|
||||||
#ifdef HAVE_ICONV
|
#ifdef HAVE_ICONV
|
||||||
std::string tempenc = encoding;
|
string tempenc = encoding;
|
||||||
if (encoding == "")
|
if (encoding == "")
|
||||||
tempenc = FbStringUtil::locale_codeset;
|
tempenc = FbStringUtil::locale_codeset;
|
||||||
|
|
||||||
|
@ -270,8 +276,8 @@ bool StringConvertor::setSource(const std::string &encoding) {
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string StringConvertor::recode(const std::string &src) {
|
string StringConvertor::recode(const string &src) {
|
||||||
#ifdef HAVE_ICONV
|
#ifdef HAVE_ICONV
|
||||||
return FbStringUtil::recode(m_iconv, src);
|
return FbStringUtil::recode(m_iconv, src);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -39,7 +39,10 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
using namespace std;
|
|
||||||
|
using std::string;
|
||||||
|
using std::list;
|
||||||
|
using std::set;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
@ -60,9 +63,9 @@ void Image::init() {
|
||||||
|
|
||||||
void Image::shutdown() {
|
void Image::shutdown() {
|
||||||
|
|
||||||
std::set<ImageBase*> handlers;
|
set<ImageBase*> handlers;
|
||||||
|
|
||||||
// one imagehandler could be registered
|
// one imagehandler could be registered
|
||||||
// for more than one type
|
// for more than one type
|
||||||
ImageMap::iterator it = s_image_map.begin();
|
ImageMap::iterator it = s_image_map.begin();
|
||||||
ImageMap::iterator it_end = s_image_map.end();
|
ImageMap::iterator it_end = s_image_map.end();
|
||||||
|
@ -72,8 +75,8 @@ void Image::shutdown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// free the unique handlers
|
// free the unique handlers
|
||||||
std::set<ImageBase*>::iterator handler_it = handlers.begin();
|
set<ImageBase*>::iterator handler_it = handlers.begin();
|
||||||
std::set<ImageBase*>::iterator handler_it_end = handlers.end();
|
set<ImageBase*>::iterator handler_it_end = handlers.end();
|
||||||
for(; handler_it != handler_it_end; handler_it++) {
|
for(; handler_it != handler_it_end; handler_it++) {
|
||||||
delete (*handler_it);
|
delete (*handler_it);
|
||||||
}
|
}
|
||||||
|
@ -81,26 +84,26 @@ void Image::shutdown() {
|
||||||
s_image_map.clear();
|
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 == "")
|
if (filename == "")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// determine file ending
|
// determine file ending
|
||||||
std::string extension(StringUtil::toUpper(StringUtil::findExtension(filename)));
|
string extension(StringUtil::toUpper(StringUtil::findExtension(filename)));
|
||||||
|
|
||||||
// valid handle?
|
// valid handle?
|
||||||
if (s_image_map.find(extension) == s_image_map.end())
|
if (s_image_map.find(extension) == s_image_map.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// load file
|
// load file
|
||||||
PixmapWithMask *pm = s_image_map[extension]->load(filename, screen_num);
|
PixmapWithMask *pm = s_image_map[extension]->load(filename, screen_num);
|
||||||
// failed?, try different search paths
|
// failed?, try different search paths
|
||||||
if (pm == 0 && s_search_paths.size()) {
|
if (pm == 0 && s_search_paths.size()) {
|
||||||
// first we need to get basename of current filename
|
// first we need to get basename of current filename
|
||||||
std::string base_filename = StringUtil::basename(filename);
|
string base_filename = StringUtil::basename(filename);
|
||||||
std::string path = "";
|
string path = "";
|
||||||
// append each search path and try to load
|
// append each search path and try to load
|
||||||
StringList::iterator it = s_search_paths.begin();
|
StringList::iterator it = s_search_paths.begin();
|
||||||
StringList::iterator it_end = s_search_paths.end();
|
StringList::iterator it_end = s_search_paths.end();
|
||||||
|
@ -115,13 +118,13 @@ PixmapWithMask *Image::load(const std::string &filename, int screen_num) {
|
||||||
return pm;
|
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);
|
string ucase_type = StringUtil::toUpper(type);
|
||||||
|
|
||||||
// not empty and not this base?
|
// not empty and not this base?
|
||||||
if (s_image_map[ucase_type] != 0 &&
|
if (s_image_map[ucase_type] != 0 &&
|
||||||
s_image_map[ucase_type] != &base)
|
s_image_map[ucase_type] != &base)
|
||||||
return false;
|
return false;
|
||||||
// already registered?
|
// already registered?
|
||||||
if (s_image_map[ucase_type] == &base)
|
if (s_image_map[ucase_type] == &base)
|
||||||
|
@ -136,7 +139,7 @@ void Image::remove(ImageBase &base) {
|
||||||
// find and remove all referenses to base
|
// find and remove all referenses to base
|
||||||
ImageMap::iterator it = s_image_map.begin();
|
ImageMap::iterator it = s_image_map.begin();
|
||||||
ImageMap::iterator it_end = s_image_map.end();
|
ImageMap::iterator it_end = s_image_map.end();
|
||||||
std::list<std::string> remove_list;
|
list<string> remove_list;
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
if (it->second == &base)
|
if (it->second == &base)
|
||||||
remove_list.push_back(it->first);
|
remove_list.push_back(it->first);
|
||||||
|
@ -148,11 +151,11 @@ void Image::remove(ImageBase &base) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::addSearchPath(const std::string &search_path) {
|
void Image::addSearchPath(const string &search_path) {
|
||||||
s_search_paths.push_back(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);
|
s_search_paths.remove(search_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,13 @@
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
using namespace FbTk;
|
using namespace FbTk;
|
||||||
|
|
||||||
MultLayers::MultLayers(int numlayers) :
|
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));
|
m_layers.push_back(new XLayer(*this, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ MultLayers::~MultLayers() {
|
||||||
|
|
||||||
|
|
||||||
XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) {
|
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;
|
return 0;
|
||||||
|
|
||||||
layernum--; // next one up
|
layernum--; // next one up
|
||||||
|
@ -57,7 +56,7 @@ XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) {
|
||||||
layernum--;
|
layernum--;
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XLayerItem *MultLayers::getItemBelow(XLayerItem &item) {
|
XLayerItem *MultLayers::getItemBelow(XLayerItem &item) {
|
||||||
XLayer &curr_layer = item.getLayer();
|
XLayer &curr_layer = item.getLayer();
|
||||||
|
@ -74,24 +73,24 @@ XLayerItem *MultLayers::getItemBelow(XLayerItem &item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
XLayerItem *MultLayers::getItemAbove(XLayerItem &item) {
|
XLayerItem *MultLayers::getItemAbove(XLayerItem &item) {
|
||||||
XLayer &curr_layer = item.getLayer();
|
XLayer &curr_layer = item.getLayer();
|
||||||
|
|
||||||
// assume that the LayerItem does exist in a layer.
|
// assume that the LayerItem does exist in a layer.
|
||||||
XLayerItem *ret = curr_layer.getItemAbove(item);
|
XLayerItem *ret = curr_layer.getItemAbove(item);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = getLowestItemAboveLayer(curr_layer.getLayerNum());
|
ret = getLowestItemAboveLayer(curr_layer.getLayerNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultLayers::addToTop(XLayerItem &item, int layernum) {
|
void MultLayers::addToTop(XLayerItem &item, int layernum) {
|
||||||
if (layernum < 0)
|
if (layernum < 0)
|
||||||
layernum = 0;
|
layernum = 0;
|
||||||
else if (layernum >= static_cast<signed>(m_layers.size()))
|
else if (layernum >= static_cast<signed>(m_layers.size()))
|
||||||
layernum = m_layers.size()-1;
|
layernum = m_layers.size()-1;
|
||||||
|
|
||||||
|
@ -106,7 +105,7 @@ void MultLayers::raise(XLayer &layer) {
|
||||||
if (layernum >= static_cast<signed>(m_layers.size() - 1))
|
if (layernum >= static_cast<signed>(m_layers.size() - 1))
|
||||||
// already on top
|
// already on top
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// not yet implemented
|
// not yet implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +115,7 @@ void MultLayers::lower(XLayer &layer) {
|
||||||
if (layernum == 0)
|
if (layernum == 0)
|
||||||
// already on bottom
|
// already on bottom
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// not yet implemented
|
// not yet implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,16 +142,16 @@ void MultLayers::moveToLayer(XLayerItem &item, int layernum) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// clamp layer number
|
// clamp layer number
|
||||||
if (layernum < 0)
|
if (layernum < 0)
|
||||||
layernum = 0;
|
layernum = 0;
|
||||||
else if (layernum >= static_cast<signed>(m_layers.size()))
|
else if (layernum >= static_cast<signed>(m_layers.size()))
|
||||||
layernum = m_layers.size()-1;
|
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]);
|
item.setLayer(*m_layers[layernum]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultLayers::restack() {
|
void MultLayers::restack() {
|
||||||
if (!isUpdatable())
|
if (!isUpdatable())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int layernum=0, winnum=0, size = this->size();
|
int layernum=0, winnum=0, size = this->size();
|
||||||
|
@ -162,13 +161,13 @@ void MultLayers::restack() {
|
||||||
|
|
||||||
XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin();
|
XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin();
|
||||||
XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end();
|
XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end();
|
||||||
|
|
||||||
// add all windows from each layeritem in each layer
|
// add all windows from each layeritem in each layer
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
|
XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
|
||||||
XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
|
XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
|
||||||
for (; wit != wit_end; ++wit) {
|
for (; wit != wit_end; ++wit) {
|
||||||
if ((*wit)->window())
|
if ((*wit)->window())
|
||||||
winlist[winnum++] = (*wit)->window();
|
winlist[winnum++] = (*wit)->window();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,9 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
@ -55,7 +57,7 @@ ResourceManager::~ResourceManager() {
|
||||||
bool ResourceManager::m_init = false;
|
bool ResourceManager::m_init = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
reloads all resources from resourcefile
|
reloads all resources from resourcefile
|
||||||
@return true on success else false
|
@return true on success else false
|
||||||
*/
|
*/
|
||||||
bool ResourceManager::load(const char *filename) {
|
bool ResourceManager::load(const char *filename) {
|
||||||
|
@ -72,18 +74,18 @@ bool ResourceManager::load(const char *filename) {
|
||||||
unlock();
|
unlock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
XrmValue value;
|
XrmValue value;
|
||||||
char *value_type;
|
char *value_type;
|
||||||
|
|
||||||
//get list and go throu all the resources and load them
|
//get list and go throu all the resources and load them
|
||||||
ResourceList::iterator i = m_resourcelist.begin();
|
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) {
|
for (; i != i_end; ++i) {
|
||||||
|
|
||||||
Resource_base *resource = *i;
|
Resource_base *resource = *i;
|
||||||
if (XrmGetResource(**m_database, resource->name().c_str(),
|
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);
|
resource->setFromString(value.addr);
|
||||||
else {
|
else {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
@ -104,11 +106,11 @@ bool ResourceManager::load(const char *filename) {
|
||||||
*/
|
*/
|
||||||
bool ResourceManager::save(const char *filename, const char *mergefilename) {
|
bool ResourceManager::save(const char *filename, const char *mergefilename) {
|
||||||
assert(filename);
|
assert(filename);
|
||||||
|
|
||||||
// empty database
|
// empty database
|
||||||
XrmDatabaseHelper database;
|
XrmDatabaseHelper database;
|
||||||
|
|
||||||
string rc_string;
|
string rc_string;
|
||||||
ResourceList::iterator i = m_resourcelist.begin();
|
ResourceList::iterator i = m_resourcelist.begin();
|
||||||
ResourceList::iterator i_end = m_resourcelist.end();
|
ResourceList::iterator i_end = m_resourcelist.end();
|
||||||
//write all resources to database
|
//write all resources to database
|
||||||
|
@ -125,7 +127,7 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) {
|
||||||
if (mergefilename) {
|
if (mergefilename) {
|
||||||
// force reload of file
|
// force reload of file
|
||||||
m_filename = mergefilename;
|
m_filename = mergefilename;
|
||||||
if (m_database)
|
if (m_database)
|
||||||
delete m_database;
|
delete m_database;
|
||||||
m_database = 0;
|
m_database = 0;
|
||||||
|
|
||||||
|
@ -149,31 +151,31 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Resource_base *ResourceManager::findResource(const std::string &resname) {
|
Resource_base *ResourceManager::findResource(const string &resname) {
|
||||||
// find resource name
|
// find resource name
|
||||||
ResourceList::iterator i = m_resourcelist.begin();
|
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) {
|
for (; i != i_end; ++i) {
|
||||||
if ((*i)->name() == resname ||
|
if ((*i)->name() == resname ||
|
||||||
(*i)->altName() == resname)
|
(*i)->altName() == resname)
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Resource_base *ResourceManager::findResource(const std::string &resname) const {
|
const Resource_base *ResourceManager::findResource(const string &resname) const {
|
||||||
// find resource name
|
// find resource name
|
||||||
ResourceList::const_iterator i = m_resourcelist.begin();
|
ResourceList::const_iterator i = m_resourcelist.begin();
|
||||||
ResourceList::const_iterator i_end = m_resourcelist.end();
|
ResourceList::const_iterator i_end = m_resourcelist.end();
|
||||||
for (; i != i_end; ++i) {
|
for (; i != i_end; ++i) {
|
||||||
if ((*i)->name() == resname ||
|
if ((*i)->name() == resname ||
|
||||||
(*i)->altName() == resname)
|
(*i)->altName() == resname)
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ResourceManager::resourceValue(const std::string &resname) const {
|
string ResourceManager::resourceValue(const string &resname) const {
|
||||||
const Resource_base *res = findResource(resname);
|
const Resource_base *res = findResource(resname);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
return res->getString();
|
return res->getString();
|
||||||
|
@ -181,7 +183,7 @@ string ResourceManager::resourceValue(const std::string &resname) const {
|
||||||
return "";
|
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);
|
Resource_base *res = findResource(resname);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
res->setFromString(value.c_str());
|
res->setFromString(value.c_str());
|
||||||
|
|
|
@ -39,7 +39,9 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace std;
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
@ -49,8 +51,8 @@ struct LoadThemeHelper {
|
||||||
m_tm.loadTheme(*tm);
|
m_tm.loadTheme(*tm);
|
||||||
}
|
}
|
||||||
void operator ()(ThemeManager::ThemeList &tmlist) {
|
void operator ()(ThemeManager::ThemeList &tmlist) {
|
||||||
|
|
||||||
for_each(tmlist.begin(), tmlist.end(),
|
for_each(tmlist.begin(), tmlist.end(),
|
||||||
*this);
|
*this);
|
||||||
// send reconfiguration signal to theme and listeners
|
// send reconfiguration signal to theme and listeners
|
||||||
ThemeManager::ThemeList::iterator it = tmlist.begin();
|
ThemeManager::ThemeList::iterator it = tmlist.begin();
|
||||||
|
@ -61,7 +63,7 @@ struct LoadThemeHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeManager &m_tm;
|
ThemeManager &m_tm;
|
||||||
};
|
};
|
||||||
|
|
||||||
Theme::Theme(int screen_num):m_screen_num(screen_num) {
|
Theme::Theme(int screen_num):m_screen_num(screen_num) {
|
||||||
|
@ -78,9 +80,9 @@ ThemeManager &ThemeManager::instance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeManager::ThemeManager():
|
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
|
// without having a display connection
|
||||||
m_max_screens(-1),
|
m_max_screens(-1),
|
||||||
m_verbose(false),
|
m_verbose(false),
|
||||||
m_themelocation("") {
|
m_themelocation("") {
|
||||||
|
|
||||||
|
@ -96,7 +98,7 @@ bool ThemeManager::registerTheme(Theme &tm) {
|
||||||
if (m_max_screens < tm.screenNum() || tm.screenNum() < 0)
|
if (m_max_screens < tm.screenNum() || tm.screenNum() < 0)
|
||||||
return false;
|
return false;
|
||||||
// TODO: use find and return false if it's already there
|
// 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()].push_back(&tm);
|
||||||
m_themes[tm.screenNum()].unique();
|
m_themes[tm.screenNum()].unique();
|
||||||
|
@ -112,10 +114,10 @@ bool ThemeManager::unregisterTheme(Theme &tm) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeManager::load(const std::string &filename,
|
bool ThemeManager::load(const string &filename,
|
||||||
const std::string &overlay_filename, int screen_num) {
|
const string &overlay_filename, int screen_num) {
|
||||||
std::string location = FbTk::StringUtil::expandFilename(filename);
|
string location = FbTk::StringUtil::expandFilename(filename);
|
||||||
std::string prefix = "";
|
string prefix = "";
|
||||||
|
|
||||||
if (FileUtil::isDirectory(filename.c_str())) {
|
if (FileUtil::isDirectory(filename.c_str())) {
|
||||||
prefix = location;
|
prefix = location;
|
||||||
|
@ -139,7 +141,7 @@ bool ThemeManager::load(const std::string &filename,
|
||||||
|
|
||||||
|
|
||||||
if (!overlay_filename.empty()) {
|
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())) {
|
if (FileUtil::isRegularFile(overlay_location.c_str())) {
|
||||||
XrmDatabaseHelper overlay_db;
|
XrmDatabaseHelper overlay_db;
|
||||||
if (overlay_db.load(overlay_location.c_str())) {
|
if (overlay_db.load(overlay_location.c_str())) {
|
||||||
|
@ -204,7 +206,7 @@ bool ThemeManager::loadItem(ThemeItem_base &resource) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// handles resource item loading with specific name/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;
|
XrmValue value;
|
||||||
char *value_type;
|
char *value_type;
|
||||||
if (XrmGetResource(*m_database, name.c_str(),
|
if (XrmGetResource(*m_database, name.c_str(),
|
||||||
|
@ -217,7 +219,7 @@ bool ThemeManager::loadItem(ThemeItem_base &resource, const std::string &name, c
|
||||||
return true;
|
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;
|
XrmValue value;
|
||||||
char *value_type;
|
char *value_type;
|
||||||
if (*m_database != 0 && XrmGetResource(*m_database, name.c_str(),
|
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 = m_themelist.begin();
|
||||||
ThemeList::iterator it_end = m_themelist.end();
|
ThemeList::iterator it_end = m_themelist.end();
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
std::list<ThemeItem_base *>::iterator item = (*it)->itemList().begin();
|
list<ThemeItem_base *>::iterator item = (*it)->itemList().begin();
|
||||||
std::list<ThemeItem_base *>::iterator item_end = (*it)->itemList().end();
|
list<ThemeItem_base *>::iterator item_end = (*it)->itemList().end();
|
||||||
for (; item != item_end; ++item) {
|
for (; item != item_end; ++item) {
|
||||||
|
|
||||||
if (typeid(**item) == typeid(ThemeItem<Texture>)) {
|
if (typeid(**item) == typeid(ThemeItem<Texture>)) {
|
||||||
cerr<<(*item)->name()<<": <texture type>"<<endl;
|
cerr<<(*item)->name()<<": <texture type>"<<endl;
|
||||||
cerr<<(*item)->name()<<".pixmap: <filename>"<<endl;
|
cerr<<(*item)->name()<<".pixmap: <filename>"<<endl;
|
||||||
|
@ -249,7 +251,7 @@ void ThemeManager::listItems() {
|
||||||
cerr<<(*item)->name()<<": <boolean>"<<endl;
|
cerr<<(*item)->name()<<": <boolean>"<<endl;
|
||||||
} else if (typeid(**item) == typeid(ThemeItem<PixmapWithMask>)) {
|
} else if (typeid(**item) == typeid(ThemeItem<PixmapWithMask>)) {
|
||||||
cerr<<(*item)->name()<<": <filename>"<<endl;
|
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;
|
cerr<<(*item)->name()<<": <string>"<<endl;
|
||||||
} else if (typeid(**item) == typeid(ThemeItem<Font>)) {
|
} else if (typeid(**item) == typeid(ThemeItem<Font>)) {
|
||||||
cerr<<(*item)->name()<<": <font>"<<endl;
|
cerr<<(*item)->name()<<": <font>"<<endl;
|
||||||
|
@ -258,7 +260,7 @@ void ThemeManager::listItems() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}; // end namespace FbTk
|
}; // end namespace FbTk
|
||||||
|
|
|
@ -35,7 +35,13 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
#ifdef HAVE_XRENDER
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
#endif // HAVE_XRENDER
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef HAVE_XRENDER
|
#ifdef HAVE_XRENDER
|
||||||
|
@ -52,8 +58,8 @@ Picture createAlphaPic(Window drawable, unsigned char alpha) {
|
||||||
PictFormatDepth | PictFormatAlphaMask,
|
PictFormatDepth | PictFormatAlphaMask,
|
||||||
&pic_format, 0);
|
&pic_format, 0);
|
||||||
if (format == 0) {
|
if (format == 0) {
|
||||||
cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderFormat,
|
cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderFormat,
|
||||||
"Warning: Failed to find valid format for alpha.",
|
"Warning: Failed to find valid format for alpha.",
|
||||||
"transparency requires a pict format, can't get one...")<<endl;
|
"transparency requires a pict format, can't get one...")<<endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +69,7 @@ Picture createAlphaPic(Window drawable, unsigned char alpha) {
|
||||||
1, 1, 8);
|
1, 1, 8);
|
||||||
if (alpha_pm == 0) {
|
if (alpha_pm == 0) {
|
||||||
cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderPixmap,
|
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;
|
"XCreatePixmap failed for our transparency pixmap")<<endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -75,8 +81,8 @@ Picture createAlphaPic(Window drawable, unsigned char alpha) {
|
||||||
format, CPRepeat, &attr);
|
format, CPRepeat, &attr);
|
||||||
if (alpha_pic == 0) {
|
if (alpha_pic == 0) {
|
||||||
XFreePixmap(disp, alpha_pm);
|
XFreePixmap(disp, alpha_pm);
|
||||||
cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderPicture,
|
cerr<<"FbTk::Transparent: "<<_FBTK_CONSOLETEXT(Error, NoRenderPicture,
|
||||||
"Warning: Failed to create alpha picture.",
|
"Warning: Failed to create alpha picture.",
|
||||||
"XRenderCreatePicture failed")<<endl;
|
"XRenderCreatePicture failed")<<endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -234,15 +240,15 @@ void Transparent::setDest(Drawable dest, int screen_num) {
|
||||||
// create new dest pic if we have a valid dest drawable
|
// create new dest pic if we have a valid dest drawable
|
||||||
if (dest != 0) {
|
if (dest != 0) {
|
||||||
|
|
||||||
XRenderPictFormat *format =
|
XRenderPictFormat *format =
|
||||||
XRenderFindVisualFormat(disp,
|
XRenderFindVisualFormat(disp,
|
||||||
DefaultVisual(disp, screen_num));
|
DefaultVisual(disp, screen_num));
|
||||||
if (format == 0) {
|
if (format == 0) {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
cerr<<"FbTk::Transparent: ";
|
cerr<<"FbTk::Transparent: ";
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_FBTK_CONSOLETEXT(Error, NoRenderVisualFormat,
|
_FBTK_CONSOLETEXT(Error, NoRenderVisualFormat,
|
||||||
"Failed to find format for screen(%d)",
|
"Failed to find format for screen(%d)",
|
||||||
"XRenderFindVisualFormat failed... include %d for screen number").
|
"XRenderFindVisualFormat failed... include %d for screen number").
|
||||||
c_str(), screen_num);
|
c_str(), screen_num);
|
||||||
|
|
||||||
|
@ -284,8 +290,8 @@ void Transparent::setSource(Drawable source, int screen_num) {
|
||||||
if (format == 0) {
|
if (format == 0) {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
cerr<<"FbTk::Transparent: ";
|
cerr<<"FbTk::Transparent: ";
|
||||||
fprintf(stderr, _FBTK_CONSOLETEXT(Error, NoRenderVisualFormat,
|
fprintf(stderr, _FBTK_CONSOLETEXT(Error, NoRenderVisualFormat,
|
||||||
"Failed to find format for screen(%d)",
|
"Failed to find format for screen(%d)",
|
||||||
"XRenderFindVisualFormat failed... include %d for screen number").
|
"XRenderFindVisualFormat failed... include %d for screen number").
|
||||||
c_str(), screen_num);
|
c_str(), screen_num);
|
||||||
cerr<<endl;
|
cerr<<endl;
|
||||||
|
|
|
@ -27,9 +27,15 @@
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
|
using std::find;
|
||||||
using namespace FbTk;
|
using namespace FbTk;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
XLayer::XLayer(MultLayers &manager, int layernum):
|
XLayer::XLayer(MultLayers &manager, int layernum):
|
||||||
m_manager(manager), m_layernum(layernum) {
|
m_manager(manager), m_layernum(layernum) {
|
||||||
}
|
}
|
||||||
|
@ -51,7 +57,7 @@ void XLayer::restack() {
|
||||||
it_end = itemList().end();
|
it_end = itemList().end();
|
||||||
Window *winlist = new Window[num_windows];
|
Window *winlist = new Window[num_windows];
|
||||||
size_t j=0;
|
size_t j=0;
|
||||||
|
|
||||||
// add all the windows from each item
|
// add all the windows from each item
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
|
XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
|
||||||
|
@ -87,13 +93,13 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
|
||||||
Window *winlist;
|
Window *winlist;
|
||||||
size_t winnum, size, num = item->numWindows();
|
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
|
// then we must have to go right to the top of the stack
|
||||||
if (!above) { // must need to go right to top
|
if (!above) { // must need to go right to top
|
||||||
if (item->getWindows().front()->window())
|
if (item->getWindows().front()->window())
|
||||||
XRaiseWindow(FbTk::App::instance()->display(), 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
|
// 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.
|
// our size needs to be the number of windows in the group, since there isn't one above.
|
||||||
if (num > 1) {
|
if (num > 1) {
|
||||||
|
@ -120,7 +126,7 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
|
||||||
XLayerItem::Windows::iterator it = item->getWindows().begin();
|
XLayerItem::Windows::iterator it = item->getWindows().begin();
|
||||||
XLayerItem::Windows::iterator it_end = item->getWindows().end();
|
XLayerItem::Windows::iterator it_end = item->getWindows().end();
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
if ((*it)->window())
|
if ((*it)->window())
|
||||||
winlist[winnum++] = (*it)->window();
|
winlist[winnum++] = (*it)->window();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +134,7 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
|
||||||
XRestackWindows(FbTk::App::instance()->display(), winlist, winnum);
|
XRestackWindows(FbTk::App::instance()->display(), winlist, winnum);
|
||||||
|
|
||||||
delete [] winlist;
|
delete [] winlist;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can't just use Restack here, because it won't do anything if they're
|
// We can't just use Restack here, because it won't do anything if they're
|
||||||
|
@ -139,17 +145,17 @@ void XLayer::alignItem(XLayerItem &item) {
|
||||||
return;
|
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
|
// sorted from highest to lowest
|
||||||
// get our item
|
// get our item
|
||||||
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
|
iterator myit = find(itemList().begin(), itemList().end(), &item);
|
||||||
iterator it = myit;
|
iterator it = myit;
|
||||||
|
|
||||||
// go to the one above it in our layer (top is front, so we decrement)
|
// go to the one above it in our layer (top is front, so we decrement)
|
||||||
--it;
|
--it;
|
||||||
|
|
||||||
// keep going until we find one that is currently visible to the user
|
// 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;
|
--it;
|
||||||
|
|
||||||
if (it == itemList().begin() && !(*it)->visible())
|
if (it == itemList().begin() && !(*it)->visible())
|
||||||
|
@ -166,7 +172,7 @@ XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) {
|
||||||
if (pos != 0)
|
if (pos != 0)
|
||||||
cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in XLayer"<<endl;
|
cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in XLayer"<<endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
itemList().push_front(&item);
|
itemList().push_front(&item);
|
||||||
// restack below next window up
|
// restack below next window up
|
||||||
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
|
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
|
// need to find highest visible window, and move it to bottom
|
||||||
iterator it = itemList().begin();
|
iterator it = itemList().begin();
|
||||||
iterator it_end = itemList().end();
|
iterator it_end = itemList().end();
|
||||||
while (it != it_end && !(*it)->visible())
|
while (it != it_end && !(*it)->visible())
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
// if there is something to do
|
// if there is something to do
|
||||||
if (it != it_end)
|
if (it != it_end)
|
||||||
lower(**it);
|
lower(**it);
|
||||||
|
@ -202,34 +208,34 @@ void XLayer::cycleDown() {
|
||||||
// so use a reverse iterator, and the same logic as cycleUp()
|
// so use a reverse iterator, and the same logic as cycleUp()
|
||||||
reverse_iterator it = itemList().rbegin();
|
reverse_iterator it = itemList().rbegin();
|
||||||
reverse_iterator it_end = itemList().rend();
|
reverse_iterator it_end = itemList().rend();
|
||||||
while (it != it_end && !(*it)->visible())
|
while (it != it_end && !(*it)->visible())
|
||||||
++it;
|
++it;
|
||||||
|
|
||||||
// if there is something to do
|
// if there is something to do
|
||||||
if (it != it_end)
|
if (it != it_end)
|
||||||
raise(**it);
|
raise(**it);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XLayer::stepUp(XLayerItem &item) {
|
void XLayer::stepUp(XLayerItem &item) {
|
||||||
// need to find next visible window upwards, and put it above that
|
// need to find next visible window upwards, and put it above that
|
||||||
|
|
||||||
if (&item == itemList().front())
|
if (&item == itemList().front())
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
// TODO: is there a better way of doing this?
|
// TODO: is there a better way of doing this?
|
||||||
|
|
||||||
// get our item
|
// get our item
|
||||||
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
|
iterator myit = find(itemList().begin(), itemList().end(), &item);
|
||||||
iterator it = myit;
|
iterator it = myit;
|
||||||
|
|
||||||
// go to the one above it in our layer (top is front, so we decrement)
|
// go to the one above it in our layer (top is front, so we decrement)
|
||||||
--it;
|
--it;
|
||||||
|
|
||||||
// keep going until we find one that is currently visible to the user
|
// 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;
|
--it;
|
||||||
|
|
||||||
if (it == itemList().begin() && !(*it)->visible()) {
|
if (it == itemList().begin() && !(*it)->visible()) {
|
||||||
// reached front item, but it wasn't visible, therefore it was already raised
|
// reached front item, but it wasn't visible, therefore it was already raised
|
||||||
} else {
|
} else {
|
||||||
|
@ -243,7 +249,7 @@ void XLayer::stepUp(XLayerItem &item) {
|
||||||
if (it == itemList().begin()) {
|
if (it == itemList().begin()) {
|
||||||
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
|
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
|
||||||
} else {
|
} 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;
|
--it;
|
||||||
// and stack below that.
|
// and stack below that.
|
||||||
stackBelowItem(&item, *it);
|
stackBelowItem(&item, *it);
|
||||||
|
@ -255,11 +261,11 @@ void XLayer::stepDown(XLayerItem &item) {
|
||||||
// need to find next visible window down, and put it below that
|
// need to find next visible window down, and put it below that
|
||||||
|
|
||||||
// if we're already the bottom of the layer
|
// if we're already the bottom of the layer
|
||||||
if (&item == itemList().back())
|
if (&item == itemList().back())
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
// get our position
|
// get our position
|
||||||
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
|
iterator myit = find(itemList().begin(), itemList().end(), &item);
|
||||||
iterator it = myit;
|
iterator it = myit;
|
||||||
|
|
||||||
// go one below it (top is front, so we must increment)
|
// go one below it (top is front, so we must increment)
|
||||||
|
@ -267,7 +273,7 @@ void XLayer::stepDown(XLayerItem &item) {
|
||||||
iterator it_end = itemList().end();
|
iterator it_end = itemList().end();
|
||||||
|
|
||||||
// keep going down until we find a visible one
|
// keep going down until we find a visible one
|
||||||
while (it != it_end && !(*it)->visible())
|
while (it != it_end && !(*it)->visible())
|
||||||
it++;
|
it++;
|
||||||
|
|
||||||
// if we didn't reach the end, then stack below the
|
// if we didn't reach the end, then stack below the
|
||||||
|
@ -283,7 +289,7 @@ void XLayer::raise(XLayerItem &item) {
|
||||||
if (&item == itemList().front())
|
if (&item == itemList().front())
|
||||||
return; // nothing to do
|
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())
|
if (it != itemList().end())
|
||||||
itemList().erase(it);
|
itemList().erase(it);
|
||||||
else {
|
else {
|
||||||
|
@ -295,7 +301,7 @@ void XLayer::raise(XLayerItem &item) {
|
||||||
|
|
||||||
itemList().push_front(&item);
|
itemList().push_front(&item);
|
||||||
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
|
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XLayer::tempRaise(XLayerItem &item) {
|
void XLayer::tempRaise(XLayerItem &item) {
|
||||||
|
@ -304,7 +310,7 @@ void XLayer::tempRaise(XLayerItem &item) {
|
||||||
if (&item == itemList().front())
|
if (&item == itemList().front())
|
||||||
return; // nothing to do
|
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()) {
|
if (it == itemList().end()) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl;
|
cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl;
|
||||||
|
@ -314,17 +320,17 @@ void XLayer::tempRaise(XLayerItem &item) {
|
||||||
|
|
||||||
// don't add it back to the top
|
// don't add it back to the top
|
||||||
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
|
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XLayer::lower(XLayerItem &item) {
|
void XLayer::lower(XLayerItem &item) {
|
||||||
// assume already in this layer
|
// assume already in this layer
|
||||||
|
|
||||||
// is it already the lowest?
|
// is it already the lowest?
|
||||||
if (&item == itemList().back())
|
if (&item == itemList().back())
|
||||||
return; // nothing to do
|
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())
|
if (it != itemList().end())
|
||||||
// remove this item
|
// remove this item
|
||||||
itemList().erase(it);
|
itemList().erase(it);
|
||||||
|
@ -344,13 +350,13 @@ void XLayer::lower(XLayerItem &item) {
|
||||||
|
|
||||||
// go up one so we have an object (which must exist, since at least this item is in the layer)
|
// go up one so we have an object (which must exist, since at least this item is in the layer)
|
||||||
it--;
|
it--;
|
||||||
|
|
||||||
// go down another one
|
// go down another one
|
||||||
// must exist, otherwise our item must == itemList().back()
|
// must exist, otherwise our item must == itemList().back()
|
||||||
it--;
|
it--;
|
||||||
|
|
||||||
// and restack our window below that one.
|
// and restack our window below that one.
|
||||||
stackBelowItem(&item, *it);
|
stackBelowItem(&item, *it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XLayer::raiseLayer(XLayerItem &item) {
|
void XLayer::raiseLayer(XLayerItem &item) {
|
||||||
|
@ -367,15 +373,15 @@ void XLayer::moveToLayer(XLayerItem &item, int layernum) {
|
||||||
|
|
||||||
|
|
||||||
XLayerItem *XLayer::getLowestItem() {
|
XLayerItem *XLayer::getLowestItem() {
|
||||||
if (itemList().empty())
|
if (itemList().empty())
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return itemList().back();
|
return itemList().back();
|
||||||
}
|
}
|
||||||
|
|
||||||
XLayerItem *XLayer::getItemBelow(XLayerItem &item) {
|
XLayerItem *XLayer::getItemBelow(XLayerItem &item) {
|
||||||
// get our iterator
|
// get our iterator
|
||||||
iterator it = std::find(itemList().begin(), itemList().end(), &item);
|
iterator it = find(itemList().begin(), itemList().end(), &item);
|
||||||
|
|
||||||
// go one lower
|
// go one lower
|
||||||
it++;
|
it++;
|
||||||
|
@ -389,12 +395,12 @@ XLayerItem *XLayer::getItemBelow(XLayerItem &item) {
|
||||||
|
|
||||||
XLayerItem *XLayer::getItemAbove(XLayerItem &item) {
|
XLayerItem *XLayer::getItemAbove(XLayerItem &item) {
|
||||||
// get our iterator
|
// 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)
|
// the list (which must be there since we aren't the beginning)
|
||||||
if (it == itemList().begin())
|
if (it == itemList().begin())
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return *(--it);
|
return *(--it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,11 @@
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
|
|
||||||
#include <iostream>
|
#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,
|
FbTk::XLayer &layer,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height):
|
unsigned int width, unsigned int height):
|
||||||
|
@ -55,7 +57,7 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
|
||||||
m_window(theme.screenNum(), x, y, width, height, ButtonPressMask | ButtonReleaseMask |
|
m_window(theme.screenNum(), x, y, width, height, ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | EnterWindowMask, true),
|
ButtonMotionMask | EnterWindowMask, true),
|
||||||
m_layeritem(window(), layer),
|
m_layeritem(window(), layer),
|
||||||
m_titlebar(m_window, 0, 0, 100, 16,
|
m_titlebar(m_window, 0, 0, 100, 16,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
EnterWindowMask | LeaveWindowMask),
|
EnterWindowMask | LeaveWindowMask),
|
||||||
|
@ -78,8 +80,8 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
EnterWindowMask | LeaveWindowMask),
|
EnterWindowMask | LeaveWindowMask),
|
||||||
m_bevel(1),
|
m_bevel(1),
|
||||||
m_use_titlebar(true),
|
m_use_titlebar(true),
|
||||||
m_use_tabs(true),
|
m_use_tabs(true),
|
||||||
m_use_handle(true),
|
m_use_handle(true),
|
||||||
m_focused(false),
|
m_focused(false),
|
||||||
m_visible(false),
|
m_visible(false),
|
||||||
|
@ -104,7 +106,7 @@ FbWinFrame::~FbWinFrame() {
|
||||||
removeAllButtons();
|
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) {
|
bool double_click, bool pressed) {
|
||||||
// find mousebutton_num
|
// find mousebutton_num
|
||||||
if (mousebutton_num < 1 || mousebutton_num > 5)
|
if (mousebutton_num < 1 || mousebutton_num > 5)
|
||||||
|
@ -127,7 +129,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
// setting tabmode to notset forces it through when
|
// setting tabmode to notset forces it through when
|
||||||
// something is likely to change
|
// something is likely to change
|
||||||
if (tabmode == NOTSET)
|
if (tabmode == NOTSET)
|
||||||
tabmode = m_tabmode;
|
tabmode = m_tabmode;
|
||||||
|
@ -183,7 +185,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
|
||||||
|
|
||||||
m_tab_container.raise();
|
m_tab_container.raise();
|
||||||
m_tab_container.show();
|
m_tab_container.show();
|
||||||
|
|
||||||
if (!m_use_tabs)
|
if (!m_use_tabs)
|
||||||
ret = false;
|
ret = false;
|
||||||
|
|
||||||
|
@ -234,7 +236,7 @@ void FbWinFrame::shade() {
|
||||||
alignTabs();
|
alignTabs();
|
||||||
// need to update our shape
|
// need to update our shape
|
||||||
if ( m_shape.get() )
|
if ( m_shape.get() )
|
||||||
m_shape->update();
|
m_shape->update();
|
||||||
} else { // should be unshaded
|
} else { // should be unshaded
|
||||||
m_window.resize(m_width_before_shade, m_height_before_shade);
|
m_window.resize(m_width_before_shade, m_height_before_shade);
|
||||||
reconfigure();
|
reconfigure();
|
||||||
|
@ -251,10 +253,10 @@ void FbWinFrame::resize(unsigned int width, unsigned int height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// need an atomic moveresize where possible
|
// need an atomic moveresize where possible
|
||||||
void FbWinFrame::moveResizeForClient(int x, int y,
|
void FbWinFrame::moveResizeForClient(int x, int y,
|
||||||
unsigned int width, unsigned int height,
|
unsigned int width, unsigned int height,
|
||||||
int win_gravity,
|
int win_gravity,
|
||||||
unsigned int client_bw,
|
unsigned int client_bw,
|
||||||
bool move, bool resize) {
|
bool move, bool resize) {
|
||||||
// total height for frame
|
// total height for frame
|
||||||
|
|
||||||
|
@ -266,16 +268,16 @@ void FbWinFrame::moveResizeForClient(int x, int y,
|
||||||
moveResize(x, y, width, height, move, resize);
|
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) {
|
int win_gravity, unsigned int client_bw) {
|
||||||
moveResizeForClient(0, 0, width, height, win_gravity, client_bw, false, true);
|
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) {
|
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;
|
move = false;
|
||||||
|
|
||||||
if (resize && width == FbWinFrame::width() && height == FbWinFrame::height())
|
if (resize && width == FbWinFrame::width() && height == FbWinFrame::height())
|
||||||
resize = false;
|
resize = false;
|
||||||
|
|
||||||
if (!move && !resize)
|
if (!move && !resize)
|
||||||
|
@ -320,11 +322,11 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::quietMoveResize(int x, int y,
|
void FbWinFrame::quietMoveResize(int x, int y,
|
||||||
unsigned int width, unsigned int height) {
|
unsigned int width, unsigned int height) {
|
||||||
m_window.moveResize(x, y, width, height);
|
m_window.moveResize(x, y, width, height);
|
||||||
if (m_tabmode == EXTERNAL) {
|
if (m_tabmode == EXTERNAL) {
|
||||||
|
|
||||||
switch(m_screen.getTabPlacement()) {
|
switch(m_screen.getTabPlacement()) {
|
||||||
case LEFTTOP:
|
case LEFTTOP:
|
||||||
case RIGHTTOP:
|
case RIGHTTOP:
|
||||||
|
@ -444,7 +446,7 @@ void FbWinFrame::alignTabs() {
|
||||||
void FbWinFrame::notifyMoved(bool clear) {
|
void FbWinFrame::notifyMoved(bool clear) {
|
||||||
// not important if no alpha...
|
// not important if no alpha...
|
||||||
unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha());
|
unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha());
|
||||||
if (alpha == 255)
|
if (alpha == 255)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_tabmode == EXTERNAL && m_use_tabs || m_use_titlebar) {
|
if (m_tabmode == EXTERNAL && m_use_tabs || m_use_titlebar) {
|
||||||
|
@ -516,7 +518,7 @@ void FbWinFrame::setFocus(bool newvalue) {
|
||||||
|
|
||||||
if (currentLabel()) {
|
if (currentLabel()) {
|
||||||
if (newvalue) // focused
|
if (newvalue) // focused
|
||||||
applyFocusLabel(*m_current_label);
|
applyFocusLabel(*m_current_label);
|
||||||
else // unfocused
|
else // unfocused
|
||||||
applyActiveLabel(*m_current_label);
|
applyActiveLabel(*m_current_label);
|
||||||
}
|
}
|
||||||
|
@ -536,7 +538,7 @@ void FbWinFrame::addLeftButton(FbTk::Button *btn) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
applyButton(*btn); // setup theme and other stuff
|
applyButton(*btn); // setup theme and other stuff
|
||||||
|
|
||||||
m_buttons_left.push_back(btn);
|
m_buttons_left.push_back(btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +564,7 @@ void FbWinFrame::removeAllButtons() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FbWinFrame::ButtonId FbWinFrame::createTab(const std::string &title, FbTk::Command *command,
|
FbWinFrame::ButtonId FbWinFrame::createTab(const string &title, FbTk::Command *command,
|
||||||
int tabs_padding) {
|
int tabs_padding) {
|
||||||
FbTk::TextButton *button = new FbTk::TextButton(m_tab_container,
|
FbTk::TextButton *button = new FbTk::TextButton(m_tab_container,
|
||||||
theme().font(),
|
theme().font(),
|
||||||
|
@ -573,7 +575,7 @@ FbWinFrame::ButtonId FbWinFrame::createTab(const std::string &title, FbTk::Comma
|
||||||
ButtonReleaseMask | ButtonMotionMask |
|
ButtonReleaseMask | ButtonMotionMask |
|
||||||
EnterWindowMask);
|
EnterWindowMask);
|
||||||
FbTk::EventManager::instance()->add(*button, button->window());
|
FbTk::EventManager::instance()->add(*button, button->window());
|
||||||
|
|
||||||
FbTk::RefCount<FbTk::Command> refcmd(command);
|
FbTk::RefCount<FbTk::Command> refcmd(command);
|
||||||
button->setOnClick(refcmd);
|
button->setOnClick(refcmd);
|
||||||
|
|
||||||
|
@ -681,7 +683,7 @@ void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
|
||||||
win.setEventMask(NoEventMask);
|
win.setEventMask(NoEventMask);
|
||||||
win.reparent(m_window, 0, clientArea().y());
|
win.reparent(m_window, 0, clientArea().y());
|
||||||
// remask window so we get events
|
// remask window so we get events
|
||||||
win.setEventMask(PropertyChangeMask | StructureNotifyMask |
|
win.setEventMask(PropertyChangeMask | StructureNotifyMask |
|
||||||
FocusChangeMask);
|
FocusChangeMask);
|
||||||
|
|
||||||
m_window.setEventMask(ButtonPressMask | ButtonReleaseMask |
|
m_window.setEventMask(ButtonPressMask | ButtonReleaseMask |
|
||||||
|
@ -691,7 +693,7 @@ void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
|
||||||
|
|
||||||
XSetWindowAttributes attrib_set;
|
XSetWindowAttributes attrib_set;
|
||||||
attrib_set.event_mask = PropertyChangeMask | StructureNotifyMask | FocusChangeMask;
|
attrib_set.event_mask = PropertyChangeMask | StructureNotifyMask | FocusChangeMask;
|
||||||
attrib_set.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask |
|
attrib_set.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask;
|
ButtonMotionMask;
|
||||||
|
|
||||||
XChangeWindowAttributes(win.display(), win.window(), CWEventMask|CWDontPropagate, &attrib_set);
|
XChangeWindowAttributes(win.display(), win.window(), CWEventMask|CWDontPropagate, &attrib_set);
|
||||||
|
@ -852,7 +854,7 @@ void FbWinFrame::removeEventHandler() {
|
||||||
|
|
||||||
void FbWinFrame::buttonPressEvent(XButtonEvent &event) {
|
void FbWinFrame::buttonPressEvent(XButtonEvent &event) {
|
||||||
// we can ignore which window the event was generated for
|
// 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();
|
event.window = m_current_label->window();
|
||||||
|
|
||||||
m_tab_container.tryButtonPressEvent(event);
|
m_tab_container.tryButtonPressEvent(event);
|
||||||
|
@ -871,9 +873,9 @@ void FbWinFrame::buttonPressEvent(XButtonEvent &event) {
|
||||||
|
|
||||||
void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) {
|
void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) {
|
||||||
// we can ignore which window the event was generated for
|
// 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();
|
event.window = m_current_label->window();
|
||||||
|
|
||||||
// we continue even if a button got the event
|
// we continue even if a button got the event
|
||||||
m_tab_container.tryButtonReleaseEvent(event);
|
m_tab_container.tryButtonReleaseEvent(event);
|
||||||
|
|
||||||
|
@ -891,7 +893,7 @@ void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) {
|
||||||
bool double_click = (event.time - last_release_time <= m_double_click_time);
|
bool double_click = (event.time - last_release_time <= m_double_click_time);
|
||||||
last_release_time = event.time;
|
last_release_time = event.time;
|
||||||
int real_button = event.button - 1;
|
int real_button = event.button - 1;
|
||||||
|
|
||||||
if (double_click && *m_commands[real_button].double_click)
|
if (double_click && *m_commands[real_button].double_click)
|
||||||
m_commands[real_button].double_click->execute();
|
m_commands[real_button].double_click->execute();
|
||||||
else if (*m_commands[real_button].click)
|
else if (*m_commands[real_button].click)
|
||||||
|
@ -918,7 +920,7 @@ void FbWinFrame::exposeEvent(XExposeEvent &event) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// create compare function
|
// 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,
|
FbTk::CompareEqual_base<FbTk::FbWindow, Window> compare(&FbTk::FbWindow::window,
|
||||||
event.window);
|
event.window);
|
||||||
|
|
||||||
|
@ -966,18 +968,18 @@ void FbWinFrame::reconfigure() {
|
||||||
m_window.resize(m_window.width(), m_window.height() -
|
m_window.resize(m_window.width(), m_window.height() -
|
||||||
orig_handle_h + theme().handleWidth());
|
orig_handle_h + theme().handleWidth());
|
||||||
|
|
||||||
handle().resize(handle().width(),
|
handle().resize(handle().width(),
|
||||||
theme().handleWidth());
|
theme().handleWidth());
|
||||||
gripLeft().resize(buttonHeight(),
|
gripLeft().resize(buttonHeight(),
|
||||||
theme().handleWidth());
|
theme().handleWidth());
|
||||||
gripRight().resize(gripLeft().width(),
|
gripRight().resize(gripLeft().width(),
|
||||||
gripLeft().height());
|
gripLeft().height());
|
||||||
|
|
||||||
// align titlebar and render it
|
// align titlebar and render it
|
||||||
if (m_use_titlebar) {
|
if (m_use_titlebar) {
|
||||||
reconfigureTitlebar();
|
reconfigureTitlebar();
|
||||||
m_titlebar.raise();
|
m_titlebar.raise();
|
||||||
} else
|
} else
|
||||||
m_titlebar.lower();
|
m_titlebar.lower();
|
||||||
|
|
||||||
if (m_tabmode == EXTERNAL) {
|
if (m_tabmode == EXTERNAL) {
|
||||||
|
@ -1009,7 +1011,7 @@ void FbWinFrame::reconfigure() {
|
||||||
client_top += titlebar_height;
|
client_top += titlebar_height;
|
||||||
client_height -= titlebar_height;
|
client_height -= titlebar_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// align handle and grips
|
// align handle and grips
|
||||||
const int grip_height = m_handle.height();
|
const int grip_height = m_handle.height();
|
||||||
const int grip_width = 20; //TODO
|
const int grip_width = 20; //TODO
|
||||||
|
@ -1111,35 +1113,35 @@ void FbWinFrame::reconfigureTitlebar() {
|
||||||
|
|
||||||
int orig_height = m_titlebar.height();
|
int orig_height = m_titlebar.height();
|
||||||
// resize titlebar to window size with font 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;
|
m_theme.font().height() + m_bevel*2 + 2;
|
||||||
if (m_theme.titleHeight() != 0)
|
if (m_theme.titleHeight() != 0)
|
||||||
title_height = m_theme.titleHeight();
|
title_height = m_theme.titleHeight();
|
||||||
|
|
||||||
// if the titlebar grows in size, make sure the whole window does too
|
// 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_window.resize(m_window.width(), m_window.height()-orig_height+title_height);
|
||||||
m_titlebar.invalidateBackground();
|
m_titlebar.invalidateBackground();
|
||||||
m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(),
|
m_titlebar.moveResize(-m_titlebar.borderWidth(), -m_titlebar.borderWidth(),
|
||||||
m_window.width(), title_height);
|
m_window.width(), title_height);
|
||||||
|
|
||||||
// draw left buttons first
|
// draw left buttons first
|
||||||
unsigned int next_x = m_bevel;
|
unsigned int next_x = m_bevel;
|
||||||
unsigned int button_size = buttonHeight();
|
unsigned int button_size = buttonHeight();
|
||||||
m_button_size = button_size;
|
m_button_size = button_size;
|
||||||
for (size_t i=0; i < m_buttons_left.size(); i++, next_x += button_size + m_bevel) {
|
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
|
// probably on theme reconfigure, leave bg alone for now
|
||||||
m_buttons_left[i]->invalidateBackground();
|
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);
|
button_size, button_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
next_x += m_bevel;
|
next_x += m_bevel;
|
||||||
|
|
||||||
// space left on titlebar between left and right buttons
|
// space left on titlebar between left and right buttons
|
||||||
int space_left = m_titlebar.width() - next_x;
|
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_buttons_right.size() * (button_size + m_bevel);
|
||||||
|
|
||||||
space_left -= m_bevel;
|
space_left -= m_bevel;
|
||||||
|
@ -1167,7 +1169,7 @@ void FbWinFrame::reconfigureTitlebar() {
|
||||||
next_x += m_label.width() + m_bevel;
|
next_x += m_label.width() + m_bevel;
|
||||||
|
|
||||||
// finaly set new buttons to the right
|
// 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) {
|
++i, next_x += button_size + m_bevel) {
|
||||||
m_buttons_right[i]->invalidateBackground();
|
m_buttons_right[i]->invalidateBackground();
|
||||||
m_buttons_right[i]->moveResize(next_x, m_bevel,
|
m_buttons_right[i]->moveResize(next_x, m_bevel,
|
||||||
|
@ -1201,21 +1203,21 @@ void FbWinFrame::renderTitlebar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// render pixmaps
|
// render pixmaps
|
||||||
render(m_theme.titleFocusTexture(), m_title_focused_color,
|
render(m_theme.titleFocusTexture(), m_title_focused_color,
|
||||||
m_title_focused_pm,
|
m_title_focused_pm,
|
||||||
m_titlebar.width(), m_titlebar.height());
|
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_title_unfocused_pm,
|
||||||
m_titlebar.width(), m_titlebar.height());
|
m_titlebar.width(), m_titlebar.height());
|
||||||
|
|
||||||
//!! TODO: don't render label if internal tabs
|
//!! 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_focused_pm,
|
||||||
m_label.width(), m_label.height());
|
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_unfocused_pm,
|
||||||
m_label.width(), m_label.height());
|
m_label.width(), m_label.height());
|
||||||
|
|
||||||
|
@ -1235,23 +1237,23 @@ void FbWinFrame::renderTabContainer() {
|
||||||
if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE)
|
if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE)
|
||||||
tc_unfocused = &m_theme.titleUnfocusTexture();
|
tc_unfocused = &m_theme.titleUnfocusTexture();
|
||||||
|
|
||||||
render(*tc_focused, m_tabcontainer_focused_color,
|
render(*tc_focused, m_tabcontainer_focused_color,
|
||||||
m_tabcontainer_focused_pm,
|
m_tabcontainer_focused_pm,
|
||||||
m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
|
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_tabcontainer_unfocused_pm,
|
||||||
m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
|
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_labelbutton_focused_pm,
|
||||||
m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
|
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_labelbutton_unfocused_pm,
|
||||||
m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
|
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_labelbutton_active_pm,
|
||||||
m_tab_container.width(), m_tab_container.height(), m_tab_container.orientation());
|
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
|
// set up pixmaps for titlebar windows
|
||||||
Pixmap label_pm = None;
|
Pixmap label_pm = None;
|
||||||
Pixmap title_pm = None;
|
Pixmap title_pm = None;
|
||||||
FbTk::Color label_color;
|
FbTk::Color label_color;
|
||||||
FbTk::Color title_color;
|
FbTk::Color title_color;
|
||||||
getCurrentFocusPixmap(label_pm, title_pm,
|
getCurrentFocusPixmap(label_pm, title_pm,
|
||||||
|
@ -1301,18 +1303,18 @@ void FbWinFrame::renderHandles() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
render(m_theme.handleFocusTexture(), m_handle_focused_color,
|
render(m_theme.handleFocusTexture(), m_handle_focused_color,
|
||||||
m_handle_focused_pm,
|
m_handle_focused_pm,
|
||||||
m_handle.width(), m_handle.height());
|
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_unfocused_pm,
|
||||||
m_handle.width(), m_handle.height());
|
m_handle.width(), m_handle.height());
|
||||||
|
|
||||||
render(m_theme.gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm,
|
render(m_theme.gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm,
|
||||||
m_grip_left.width(), m_grip_left.height());
|
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_unfocused_pm,
|
||||||
m_grip_left.width(), m_grip_left.height());
|
m_grip_left.width(), m_grip_left.height());
|
||||||
|
|
||||||
|
@ -1339,7 +1341,7 @@ void FbWinFrame::applyHandles() {
|
||||||
} else {
|
} else {
|
||||||
m_grip_left.setBackgroundColor(m_grip_focused_color);
|
m_grip_left.setBackgroundColor(m_grip_focused_color);
|
||||||
m_grip_right.setBackgroundColor(m_grip_focused_color);
|
m_grip_right.setBackgroundColor(m_grip_focused_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1347,7 +1349,7 @@ void FbWinFrame::applyHandles() {
|
||||||
m_handle.setBackgroundPixmap(m_handle_unfocused_pm);
|
m_handle.setBackgroundPixmap(m_handle_unfocused_pm);
|
||||||
} else {
|
} else {
|
||||||
m_handle.setBackgroundColor(m_handle_unfocused_color);
|
m_handle.setBackgroundColor(m_handle_unfocused_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_grip_unfocused_pm) {
|
if (m_grip_unfocused_pm) {
|
||||||
m_grip_left.setBackgroundPixmap(m_grip_unfocused_pm);
|
m_grip_left.setBackgroundPixmap(m_grip_unfocused_pm);
|
||||||
|
@ -1355,7 +1357,7 @@ void FbWinFrame::applyHandles() {
|
||||||
} else {
|
} else {
|
||||||
m_grip_left.setBackgroundColor(m_grip_unfocused_color);
|
m_grip_left.setBackgroundColor(m_grip_unfocused_color);
|
||||||
m_grip_right.setBackgroundColor(m_grip_unfocused_color);
|
m_grip_right.setBackgroundColor(m_grip_unfocused_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1367,15 +1369,15 @@ void FbWinFrame::renderButtons() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
render(m_theme.buttonFocusTexture(), m_button_color,
|
render(m_theme.buttonFocusTexture(), m_button_color,
|
||||||
m_button_pm,
|
m_button_pm,
|
||||||
m_button_size, m_button_size);
|
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_unfocused_pm,
|
||||||
m_button_size, m_button_size);
|
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_pressed_pm,
|
||||||
m_button_size, m_button_size);
|
m_button_size, m_button_size);
|
||||||
}
|
}
|
||||||
|
@ -1477,7 +1479,7 @@ void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
|
||||||
pm = m_imagectrl.renderImage(w, h, tex, orient);
|
pm = m_imagectrl.renderImage(w, h, tex, orient);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp)
|
if (tmp)
|
||||||
m_imagectrl.removeImage(tmp);
|
m_imagectrl.removeImage(tmp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1489,7 +1491,7 @@ void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
|
||||||
label_pm = m_label_focused_pm;
|
label_pm = m_label_focused_pm;
|
||||||
else
|
else
|
||||||
label_color = m_label_focused_color;
|
label_color = m_label_focused_color;
|
||||||
|
|
||||||
if (m_title_focused_pm != 0)
|
if (m_title_focused_pm != 0)
|
||||||
title_pm = m_title_focused_pm;
|
title_pm = m_title_focused_pm;
|
||||||
else
|
else
|
||||||
|
@ -1499,12 +1501,12 @@ void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
|
||||||
label_pm = m_label_unfocused_pm;
|
label_pm = m_label_unfocused_pm;
|
||||||
else
|
else
|
||||||
label_color = m_label_unfocused_color;
|
label_color = m_label_unfocused_color;
|
||||||
|
|
||||||
if (m_title_unfocused_pm != 0)
|
if (m_title_unfocused_pm != 0)
|
||||||
title_pm = m_title_unfocused_pm;
|
title_pm = m_title_unfocused_pm;
|
||||||
else
|
else
|
||||||
title_color = m_title_unfocused_color;
|
title_color = m_title_unfocused_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbWinFrame::applyTabContainer() {
|
void FbWinFrame::applyTabContainer() {
|
||||||
|
@ -1553,11 +1555,11 @@ void FbWinFrame::setBorderWidth(unsigned int border_width) {
|
||||||
gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false);
|
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 the border width changes...
|
||||||
if (m_use_titlebar)
|
if (m_use_titlebar)
|
||||||
bw_changes += static_cast<signed>(border_width - titlebar().borderWidth());
|
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());
|
bw_changes += static_cast<signed>(border_width - handle().borderWidth());
|
||||||
|
|
||||||
window().setBorderWidth(border_width);
|
window().setBorderWidth(border_width);
|
||||||
|
@ -1662,7 +1664,7 @@ private:
|
||||||
// this function translates its arguments according to win_gravity
|
// this function translates its arguments according to win_gravity
|
||||||
// if win_gravity is negative, it does an inverse translation
|
// if win_gravity is negative, it does an inverse translation
|
||||||
// This function should be used when a window is mapped/unmapped/pos configured
|
// 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) {
|
int win_gravity, unsigned int client_bw, bool move_frame) {
|
||||||
bool invert = false;
|
bool invert = false;
|
||||||
if (win_gravity < 0) {
|
if (win_gravity < 0) {
|
||||||
|
@ -1670,18 +1672,18 @@ void FbWinFrame::gravityTranslate(int &x, int &y,
|
||||||
win_gravity = -win_gravity; // make +ve
|
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
|
* corresponding bit of window would have been
|
||||||
* Thus, x,y always refers to where top left of the WINDOW would be placed
|
* 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
|
* 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
|
* it so that the given reference point is in the same spot as the
|
||||||
* window's reference point would have been.
|
* 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
|
* frame is placed where the centre of the rhs of the window would
|
||||||
* have been if there was no frame.
|
* have been if there was no frame.
|
||||||
* Hope that makes enough sense.
|
* 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.
|
* window width/height.
|
||||||
*
|
*
|
||||||
* If you get confused with the calculations, draw a picture.
|
* If you get confused with the calculations, draw a picture.
|
||||||
|
@ -1753,7 +1755,7 @@ void FbWinFrame::gravityTranslate(int &x, int &y,
|
||||||
}
|
}
|
||||||
|
|
||||||
int FbWinFrame::widthOffset() const {
|
int FbWinFrame::widthOffset() const {
|
||||||
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// same height offset for top and bottom tabs
|
// same height offset for top and bottom tabs
|
||||||
|
@ -1771,7 +1773,7 @@ int FbWinFrame::widthOffset() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int FbWinFrame::heightOffset() const {
|
int FbWinFrame::heightOffset() const {
|
||||||
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (m_screen.getTabPlacement()) {
|
switch (m_screen.getTabPlacement()) {
|
||||||
|
@ -1788,7 +1790,7 @@ int FbWinFrame::heightOffset() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int FbWinFrame::xOffset() const {
|
int FbWinFrame::xOffset() const {
|
||||||
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (m_screen.getTabPlacement()) {
|
switch (m_screen.getTabPlacement()) {
|
||||||
|
@ -1803,7 +1805,7 @@ int FbWinFrame::xOffset() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int FbWinFrame::yOffset() const {
|
int FbWinFrame::yOffset() const {
|
||||||
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
if (m_tabmode != EXTERNAL || !m_use_tabs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (m_screen.getTabPlacement()) {
|
switch (m_screen.getTabPlacement()) {
|
||||||
|
|
24
src/Keys.cc
24
src/Keys.cc
|
@ -89,7 +89,11 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace std;
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
using std::string;
|
||||||
|
using std::vector;
|
||||||
|
using std::ifstream;
|
||||||
|
|
||||||
Keys::Keys():
|
Keys::Keys():
|
||||||
m_display(FbTk::App::instance()->display())
|
m_display(FbTk::App::instance()->display())
|
||||||
|
@ -171,7 +175,7 @@ bool Keys::save(const char *filename) const {
|
||||||
// return true;
|
// return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Keys::addBinding(const std::string &linebuffer) {
|
bool Keys::addBinding(const string &linebuffer) {
|
||||||
|
|
||||||
vector<string> val;
|
vector<string> val;
|
||||||
// Parse arguments
|
// Parse arguments
|
||||||
|
@ -187,7 +191,7 @@ bool Keys::addBinding(const std::string &linebuffer) {
|
||||||
unsigned int key = 0, mod = 0;
|
unsigned int key = 0, mod = 0;
|
||||||
t_key *current_key=0, *last_key=0;
|
t_key *current_key=0, *last_key=0;
|
||||||
size_t argc = 0;
|
size_t argc = 0;
|
||||||
std::string keyMode = "default:";
|
string keyMode = "default:";
|
||||||
|
|
||||||
if (val[0][val[0].length()-1] == ':') {
|
if (val[0][val[0].length()-1] == ':') {
|
||||||
argc++;
|
argc++;
|
||||||
|
@ -213,21 +217,21 @@ bool Keys::addBinding(const std::string &linebuffer) {
|
||||||
// +[1-9] - number between +1 and +9
|
// +[1-9] - number between +1 and +9
|
||||||
// numbers 10 and above
|
// numbers 10 and above
|
||||||
//
|
//
|
||||||
if (val[argc].size() > 1 && (isdigit(val[argc][0]) &&
|
if (val[argc].size() > 1 && (isdigit(val[argc][0]) &&
|
||||||
(isdigit(val[argc][1]) || val[argc][1] == 'x') ||
|
(isdigit(val[argc][1]) || val[argc][1] == 'x') ||
|
||||||
val[argc][0] == '+' && isdigit(val[argc][1])) ) {
|
val[argc][0] == '+' && isdigit(val[argc][1])) ) {
|
||||||
|
|
||||||
key = strtoul(val[argc].c_str(), NULL, 0);
|
key = strtoul(val[argc].c_str(), NULL, 0);
|
||||||
|
|
||||||
if (errno == EINVAL || errno == ERANGE)
|
if (errno == EINVAL || errno == ERANGE)
|
||||||
key = 0;
|
key = 0;
|
||||||
|
|
||||||
} else // convert from string symbol
|
} else // convert from string symbol
|
||||||
key = FbTk::KeyUtil::getKey(val[argc].c_str());
|
key = FbTk::KeyUtil::getKey(val[argc].c_str());
|
||||||
|
|
||||||
if (key == 0) {
|
if (key == 0) {
|
||||||
cerr<<_FB_CONSOLETEXT(Keys, InvalidKeyMod,
|
cerr<<_FB_CONSOLETEXT(Keys, InvalidKeyMod,
|
||||||
"Keys: Invalid key/modifier on line",
|
"Keys: Invalid key/modifier on line",
|
||||||
"A bad key/modifier string was found on line (number following)")<<" "<<
|
"A bad key/modifier string was found on line (number following)")<<" "<<
|
||||||
m_current_line<<"): "<<linebuffer<<endl;
|
m_current_line<<"): "<<linebuffer<<endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -391,7 +395,7 @@ bool Keys::mergeTree(t_key *newtree, t_key *basetree) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Keys::keyMode(std::string keyMode = "default") {
|
void Keys::keyMode(string keyMode = "default") {
|
||||||
keyspace_t::iterator it = m_map.find(keyMode + ":");
|
keyspace_t::iterator it = m_map.find(keyMode + ":");
|
||||||
if (it == m_map.end())
|
if (it == m_map.end())
|
||||||
m_keylist = m_map["default:"];
|
m_keylist = m_map["default:"];
|
||||||
|
|
|
@ -33,7 +33,12 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using std::string;
|
||||||
|
|
||||||
|
#ifdef USE_REGEXP
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
|
#endif // USE_REGEXP
|
||||||
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
@ -42,7 +47,7 @@ using namespace std;
|
||||||
|
|
||||||
// full_match is to say if we match on this regexp using the full string
|
// 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
|
// 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
|
#ifdef USE_REGEXP
|
||||||
m_regex(0) {
|
m_regex(0) {
|
||||||
string match;
|
string match;
|
||||||
|
@ -83,7 +88,7 @@ RegExp::~RegExp() {
|
||||||
#endif // USE_REGEXP
|
#endif // USE_REGEXP
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RegExp::match(const std::string &str) const {
|
bool RegExp::match(const string &str) const {
|
||||||
#ifdef USE_REGEXP
|
#ifdef USE_REGEXP
|
||||||
if (m_regex)
|
if (m_regex)
|
||||||
return regexec(m_regex, str.c_str(), 0, 0, 0) == 0;
|
return regexec(m_regex, str.c_str(), 0, 0, 0) == 0;
|
||||||
|
@ -97,7 +102,7 @@ bool RegExp::match(const std::string &str) const {
|
||||||
|
|
||||||
bool RegExp::error() const {
|
bool RegExp::error() const {
|
||||||
#ifdef USE_REGEXP
|
#ifdef USE_REGEXP
|
||||||
return m_regex == 0;
|
return m_regex == 0;
|
||||||
#else
|
#else
|
||||||
return m_str == "";
|
return m_str == "";
|
||||||
#endif // USE_REGEXP
|
#endif // USE_REGEXP
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
||||||
// and Simon Bowden (rathnor at users.sourceforge.net)
|
// and Simon Bowden (rathnor at users.sourceforge.net)
|
||||||
// Copyright (c) 2002 Xavier Brouckaert
|
// Copyright (c) 2002 Xavier Brouckaert
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
// to deal in the Software without restriction, including without limitation
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
@ -56,7 +56,17 @@
|
||||||
#include <set>
|
#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 {
|
namespace {
|
||||||
|
|
||||||
|
@ -254,7 +264,7 @@ Remember::~Remember() {
|
||||||
// the patterns free the "Application"s
|
// the patterns free the "Application"s
|
||||||
// the client mapping shouldn't need cleaning
|
// the client mapping shouldn't need cleaning
|
||||||
Patterns::iterator it;
|
Patterns::iterator it;
|
||||||
std::set<Application *> all_apps; // no duplicates
|
set<Application *> all_apps; // no duplicates
|
||||||
while (!m_pats->empty()) {
|
while (!m_pats->empty()) {
|
||||||
it = m_pats->begin();
|
it = m_pats->begin();
|
||||||
delete it->first; // ClientPattern
|
delete it->first; // ClientPattern
|
||||||
|
@ -262,7 +272,7 @@ Remember::~Remember() {
|
||||||
m_pats->erase(it);
|
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) {
|
for (; ait != all_apps.end(); ++ait) {
|
||||||
delete (*ait);
|
delete (*ait);
|
||||||
}
|
}
|
||||||
|
@ -300,7 +310,7 @@ Application * Remember::add(WinClient &winclient) {
|
||||||
return 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;
|
string line;
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
@ -346,13 +356,13 @@ int Remember::parseApp(std::ifstream &file, Application &app, std::string *first
|
||||||
continue; //read next line
|
continue; //read next line
|
||||||
if (strcasecmp(str_key.c_str(), "Workspace") == 0) {
|
if (strcasecmp(str_key.c_str(), "Workspace") == 0) {
|
||||||
unsigned int w;
|
unsigned int w;
|
||||||
if (getuint(str_label.c_str(), w))
|
if (getuint(str_label.c_str(), w))
|
||||||
app.rememberWorkspace(w);
|
app.rememberWorkspace(w);
|
||||||
else
|
else
|
||||||
had_error = true;
|
had_error = true;
|
||||||
} else if (strcasecmp(str_key.c_str(), "Head") == 0) {
|
} else if (strcasecmp(str_key.c_str(), "Head") == 0) {
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
if (getuint(str_label.c_str(), h))
|
if (getuint(str_label.c_str(), h))
|
||||||
app.rememberHead(h);
|
app.rememberHead(h);
|
||||||
else
|
else
|
||||||
had_error = true;
|
had_error = true;
|
||||||
|
@ -403,7 +413,7 @@ int Remember::parseApp(std::ifstream &file, Application &app, std::string *first
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
app.rememberPosition(x, y, r);
|
||||||
else
|
else
|
||||||
had_error = true;
|
had_error = true;
|
||||||
|
@ -476,8 +486,8 @@ int Remember::parseApp(std::ifstream &file, Application &app, std::string *first
|
||||||
This function is used to search for old instances of the same pattern
|
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
|
(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).
|
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
|
We REMOVE and delete any matching patterns from the old list, as they're
|
||||||
effectively moved into the new
|
effectively moved into the new
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Application *Remember::findMatchingPatterns(ClientPattern *pat, Patterns *patlist, bool is_group) {
|
Application *Remember::findMatchingPatterns(ClientPattern *pat, Patterns *patlist, bool is_group) {
|
||||||
|
@ -519,10 +529,11 @@ void Remember::reconfigure() {
|
||||||
time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(apps_string.c_str());
|
time_t timestamp = FbTk::FileUtil::getLastStatusChangeTimestamp(apps_string.c_str());
|
||||||
if (m_last_timestamp > 0 && m_last_timestamp == timestamp)
|
if (m_last_timestamp > 0 && m_last_timestamp == timestamp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<__FILE__<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl;
|
cerr<<__FILE__<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
ifstream apps_file(apps_string.c_str());
|
ifstream apps_file(apps_string.c_str());
|
||||||
|
|
||||||
// we merge the old patterns with new ones
|
// we merge the old patterns with new ones
|
||||||
|
@ -536,7 +547,7 @@ void Remember::reconfigure() {
|
||||||
string line;
|
string line;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
bool in_group = false;
|
bool in_group = false;
|
||||||
std::list<ClientPattern *> grouped_pats;
|
list<ClientPattern *> grouped_pats;
|
||||||
while (getline(apps_file, line) && ! apps_file.eof()) {
|
while (getline(apps_file, line) && ! apps_file.eof()) {
|
||||||
row++;
|
row++;
|
||||||
FbTk::StringUtil::removeFirstWhitespace(line);
|
FbTk::StringUtil::removeFirstWhitespace(line);
|
||||||
|
@ -554,7 +565,7 @@ void Remember::reconfigure() {
|
||||||
if (!in_group) {
|
if (!in_group) {
|
||||||
if ((err = pat->error()) == 0) {
|
if ((err = pat->error()) == 0) {
|
||||||
Application *app = findMatchingPatterns(pat, old_pats, false);
|
Application *app = findMatchingPatterns(pat, old_pats, false);
|
||||||
if (!app)
|
if (!app)
|
||||||
app = new Application(false);
|
app = new Application(false);
|
||||||
|
|
||||||
m_pats->push_back(make_pair(pat, app));
|
m_pats->push_back(make_pair(pat, app));
|
||||||
|
@ -578,8 +589,8 @@ void Remember::reconfigure() {
|
||||||
// otherwise assume that it is the start of the attributes
|
// otherwise assume that it is the start of the attributes
|
||||||
Application *app = 0;
|
Application *app = 0;
|
||||||
// search for a matching app
|
// search for a matching app
|
||||||
std::list<ClientPattern *>::iterator it = grouped_pats.begin();
|
list<ClientPattern *>::iterator it = grouped_pats.begin();
|
||||||
std::list<ClientPattern *>::iterator it_end = grouped_pats.end();
|
list<ClientPattern *>::iterator it_end = grouped_pats.end();
|
||||||
while (!app && it != it_end) {
|
while (!app && it != it_end) {
|
||||||
app = findMatchingPatterns(*it, old_pats, true);
|
app = findMatchingPatterns(*it, old_pats, true);
|
||||||
++it;
|
++it;
|
||||||
|
@ -617,9 +628,9 @@ void Remember::reconfigure() {
|
||||||
// Clean up old state
|
// Clean up old state
|
||||||
// can't just delete old patterns list. Need to delete the
|
// can't just delete old patterns list. Need to delete the
|
||||||
// patterns themselves, plus the applications!
|
// patterns themselves, plus the applications!
|
||||||
|
|
||||||
Patterns::iterator it;
|
Patterns::iterator it;
|
||||||
std::set<Application *> old_apps; // no duplicates
|
set<Application *> old_apps; // no duplicates
|
||||||
while (!old_pats->empty()) {
|
while (!old_pats->empty()) {
|
||||||
it = old_pats->begin();
|
it = old_pats->begin();
|
||||||
delete it->first; // ClientPattern
|
delete it->first; // ClientPattern
|
||||||
|
@ -640,7 +651,7 @@ void Remember::reconfigure() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
for (; ait != old_apps.end(); ++ait) {
|
||||||
delete (*ait);
|
delete (*ait);
|
||||||
}
|
}
|
||||||
|
@ -667,7 +678,7 @@ void Remember::save() {
|
||||||
Patterns::iterator it = m_pats->begin();
|
Patterns::iterator it = m_pats->begin();
|
||||||
Patterns::iterator it_end = m_pats->end();
|
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) {
|
for (; it != it_end; ++it) {
|
||||||
Application &a = *it->second;
|
Application &a = *it->second;
|
||||||
|
|
269
src/Screen.cc
269
src/Screen.cc
|
@ -135,19 +135,32 @@ extern "C" {
|
||||||
#endif // XINERAMA
|
#endif // XINERAMA
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <stack>
|
#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;
|
static bool running = true;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
int anotherWMRunning(Display *display, XErrorEvent *) {
|
int anotherWMRunning(Display *display, XErrorEvent *) {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
cerr<<_FB_CONSOLETEXT(Screen, AnotherWMRunning,
|
cerr<<_FB_CONSOLETEXT(Screen, AnotherWMRunning,
|
||||||
"BScreen::BScreen: an error occured while querying the X server.\n"
|
"BScreen::BScreen: an error occured while querying the X server.\n"
|
||||||
" another window manager already running on display ",
|
" another window manager already running on display ",
|
||||||
"Message when another WM is found already active on all screens")
|
"Message when another WM is found already active on all screens")
|
||||||
|
@ -161,8 +174,8 @@ int anotherWMRunning(Display *display, XErrorEvent *) {
|
||||||
|
|
||||||
class TabPlacementMenuItem: public FbTk::MenuItem {
|
class TabPlacementMenuItem: public FbTk::MenuItem {
|
||||||
public:
|
public:
|
||||||
TabPlacementMenuItem(FbTk::FbString & label, BScreen &screen,
|
TabPlacementMenuItem(FbTk::FbString & label, BScreen &screen,
|
||||||
FbWinFrame::TabPlacement place,
|
FbWinFrame::TabPlacement place,
|
||||||
FbTk::RefCount<FbTk::Command> &cmd):
|
FbTk::RefCount<FbTk::Command> &cmd):
|
||||||
FbTk::MenuItem(label, cmd),
|
FbTk::MenuItem(label, cmd),
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
|
@ -244,9 +257,9 @@ getString() const {
|
||||||
} // end namespace FbTk
|
} // end namespace FbTk
|
||||||
|
|
||||||
|
|
||||||
BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
|
BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
|
||||||
const std::string &scrname,
|
const string &scrname,
|
||||||
const std::string &altscrname):
|
const string &altscrname):
|
||||||
image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"),
|
image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"),
|
||||||
opaque_move(rm, false, scrname + ".opaqueMove", altscrname+".OpaqueMove"),
|
opaque_move(rm, false, scrname + ".opaqueMove", altscrname+".OpaqueMove"),
|
||||||
full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"),
|
full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"),
|
||||||
|
@ -274,9 +287,9 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
|
||||||
menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"),
|
menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"),
|
||||||
|
|
||||||
gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"),
|
gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"),
|
||||||
gc_line_style(rm,
|
gc_line_style(rm,
|
||||||
FbTk::GContext::LINESOLID,
|
FbTk::GContext::LINESOLID,
|
||||||
scrname+".overlay.lineStyle",
|
scrname+".overlay.lineStyle",
|
||||||
altscrname+".Overlay.LineStyle"),
|
altscrname+".Overlay.LineStyle"),
|
||||||
gc_join_style(rm,
|
gc_join_style(rm,
|
||||||
FbTk::GContext::JOINMITER,
|
FbTk::GContext::JOINMITER,
|
||||||
|
@ -290,24 +303,24 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
|
||||||
scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"),
|
scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"),
|
||||||
max_over_tabs(rm, false, scrname+".tabs.maxOver", altscrname+".Tabs.MaxOver"),
|
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") {
|
default_internal_tabs(rm, false /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BScreen::BScreen(FbTk::ResourceManager &rm,
|
BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
const std::string &screenname,
|
const string &screenname,
|
||||||
const std::string &altscreenname,
|
const string &altscreenname,
|
||||||
int scrn, int num_layers) :
|
int scrn, int num_layers) :
|
||||||
m_clientlist_sig(*this), // client signal
|
m_clientlist_sig(*this), // client signal
|
||||||
m_iconlist_sig(*this), // icon list signal
|
m_iconlist_sig(*this), // icon list signal
|
||||||
m_workspacecount_sig(*this), // workspace count 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_workspace_area_sig(*this), // workspace area signal
|
||||||
m_currentworkspace_sig(*this), // current workspace signal
|
m_currentworkspace_sig(*this), // current workspace signal
|
||||||
m_reconfigure_sig(*this), // reconfigure signal
|
m_reconfigure_sig(*this), // reconfigure signal
|
||||||
m_resize_sig(*this),
|
m_resize_sig(*this),
|
||||||
m_layermanager(num_layers),
|
m_layermanager(num_layers),
|
||||||
m_windowtheme(new FbWinFrameTheme(scrn)),
|
m_windowtheme(new FbWinFrameTheme(scrn)),
|
||||||
// the order of windowtheme and winbutton theme is important
|
// the order of windowtheme and winbutton theme is important
|
||||||
// because winbutton need to rescale the pixmaps in winbutton theme
|
// because winbutton need to rescale the pixmaps in winbutton theme
|
||||||
// after fbwinframe have resized them
|
// after fbwinframe have resized them
|
||||||
|
@ -315,7 +328,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
m_menutheme(new MenuTheme(scrn)),
|
m_menutheme(new MenuTheme(scrn)),
|
||||||
m_root_window(scrn),
|
m_root_window(scrn),
|
||||||
m_geom_window(m_root_window,
|
m_geom_window(m_root_window,
|
||||||
0, 0, 10, 10,
|
0, 0, 10, 10,
|
||||||
false, // override redirect
|
false, // override redirect
|
||||||
true), // save under
|
true), // save under
|
||||||
m_pos_window(m_root_window,
|
m_pos_window(m_root_window,
|
||||||
|
@ -370,17 +383,17 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
|
|
||||||
// TODO fluxgen: check if this is the right place
|
// TODO fluxgen: check if this is the right place
|
||||||
m_head_areas = new HeadArea[numHeads() ? numHeads() : 1];
|
m_head_areas = new HeadArea[numHeads() ? numHeads() : 1];
|
||||||
|
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
|
||||||
fprintf(stderr, _FB_CONSOLETEXT(Screen, ManagingScreen,
|
fprintf(stderr, _FB_CONSOLETEXT(Screen, ManagingScreen,
|
||||||
"BScreen::BScreen: managing screen %d "
|
"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(),
|
"informational message saying screen number (%d), visual (%lx), and colour depth (%d)").c_str(),
|
||||||
screenNumber(), XVisualIDFromVisual(rootWindow().visual()),
|
screenNumber(), XVisualIDFromVisual(rootWindow().visual()),
|
||||||
rootWindow().depth());
|
rootWindow().depth());
|
||||||
|
|
||||||
|
|
||||||
rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
|
rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
|
||||||
|
|
||||||
// load this screens resources
|
// load this screens resources
|
||||||
|
@ -388,7 +401,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
fluxbox->load_rc(*this);
|
fluxbox->load_rc(*this);
|
||||||
|
|
||||||
// setup image cache engine
|
// 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->colorsPerChannel(),
|
||||||
fluxbox->getCacheLife(), fluxbox->getCacheMax()));
|
fluxbox->getCacheLife(), fluxbox->getCacheMax()));
|
||||||
imageControl().installRootColormap();
|
imageControl().installRootColormap();
|
||||||
|
@ -435,13 +448,13 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
}
|
}
|
||||||
|
|
||||||
m_current_workspace = m_workspaces_list.front();
|
m_current_workspace = m_workspaces_list.front();
|
||||||
|
|
||||||
|
|
||||||
//!! TODO: we shouldn't do this more than once, but since slit handles their
|
//!! TODO: we shouldn't do this more than once, but since slit handles their
|
||||||
// own resources we must do this.
|
// own resources we must do this.
|
||||||
fluxbox->load_rc(*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")));
|
"Configuration", "Title of configuration menu")));
|
||||||
setupConfigmenu(*m_configmenu.get());
|
setupConfigmenu(*m_configmenu.get());
|
||||||
m_configmenu->setInternalMenu();
|
m_configmenu->setInternalMenu();
|
||||||
|
@ -472,21 +485,21 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
rm.unlock();
|
rm.unlock();
|
||||||
|
|
||||||
XFlush(disp);
|
XFlush(disp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BScreen::~BScreen() {
|
BScreen::~BScreen() {
|
||||||
|
|
||||||
|
|
||||||
if (! managed)
|
if (! managed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_rootmenu.get() != 0)
|
if (m_rootmenu.get() != 0)
|
||||||
m_rootmenu->removeAll();
|
m_rootmenu->removeAll();
|
||||||
|
|
||||||
// Since workspacemenu holds client list menus (from workspace)
|
// Since workspacemenu holds client list menus (from workspace)
|
||||||
// we need to destroy it before we destroy workspaces
|
// we need to destroy it before we destroy workspaces
|
||||||
m_workspacemenu.reset(0);
|
m_workspacemenu.reset(0);
|
||||||
|
@ -508,7 +521,7 @@ BScreen::~BScreen() {
|
||||||
mit->second->setInternalMenu(false);
|
mit->second->setInternalMenu(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geom_pixmap != None)
|
if (geom_pixmap != None)
|
||||||
imageControl().removeImage(geom_pixmap);
|
imageControl().removeImage(geom_pixmap);
|
||||||
|
|
||||||
|
@ -521,7 +534,7 @@ BScreen::~BScreen() {
|
||||||
destroyAndClear(m_netizen_list);
|
destroyAndClear(m_netizen_list);
|
||||||
destroyAndClear(m_managed_resources);
|
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()
|
//problem with that: a delete FluxboxWindow* calls m_diesig.notify()
|
||||||
//which leads to screen.removeWindow() which leads to removeIcon(win)
|
//which leads to screen.removeWindow() which leads to removeIcon(win)
|
||||||
//which would modify the m_icon_list anyways...
|
//which would modify the m_icon_list anyways...
|
||||||
|
@ -533,7 +546,7 @@ BScreen::~BScreen() {
|
||||||
delete (tmp.back());
|
delete (tmp.back());
|
||||||
tmp.pop_back();
|
tmp.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasXinerama() && m_xinerama_headinfo) {
|
if (hasXinerama() && m_xinerama_headinfo) {
|
||||||
delete [] m_xinerama_headinfo;
|
delete [] m_xinerama_headinfo;
|
||||||
}
|
}
|
||||||
|
@ -654,8 +667,8 @@ void BScreen::initWindows() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BScreen::currentWorkspaceID() const {
|
unsigned int BScreen::currentWorkspaceID() const {
|
||||||
return m_current_workspace->workspaceID();
|
return m_current_workspace->workspaceID();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Strut* BScreen::availableWorkspaceArea(int head) const {
|
const Strut* BScreen::availableWorkspaceArea(int head) const {
|
||||||
|
@ -663,10 +676,10 @@ const Strut* BScreen::availableWorkspaceArea(int head) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BScreen::maxLeft(int head) const {
|
unsigned int BScreen::maxLeft(int head) const {
|
||||||
|
|
||||||
// we ignore strut if we're doing full maximization
|
// we ignore strut if we're doing full maximization
|
||||||
if (hasXinerama())
|
if (hasXinerama())
|
||||||
return doFullMax() ? getHeadX(head) :
|
return doFullMax() ? getHeadX(head) :
|
||||||
getHeadX(head) + availableWorkspaceArea(head)->left();
|
getHeadX(head) + availableWorkspaceArea(head)->left();
|
||||||
else
|
else
|
||||||
return doFullMax() ? 0 : availableWorkspaceArea(head)->left();
|
return doFullMax() ? 0 : availableWorkspaceArea(head)->left();
|
||||||
|
@ -675,7 +688,7 @@ unsigned int BScreen::maxLeft(int head) const {
|
||||||
unsigned int BScreen::maxRight(int head) const {
|
unsigned int BScreen::maxRight(int head) const {
|
||||||
// we ignore strut if we're doing full maximization
|
// we ignore strut if we're doing full maximization
|
||||||
if (hasXinerama())
|
if (hasXinerama())
|
||||||
return doFullMax() ? getHeadX(head) + getHeadWidth(head) :
|
return doFullMax() ? getHeadX(head) + getHeadWidth(head) :
|
||||||
getHeadX(head) + getHeadWidth(head) - availableWorkspaceArea(head)->right();
|
getHeadX(head) + getHeadWidth(head) - availableWorkspaceArea(head)->right();
|
||||||
else
|
else
|
||||||
return doFullMax() ? width() : width() - availableWorkspaceArea(head)->right();
|
return doFullMax() ? width() : width() - availableWorkspaceArea(head)->right();
|
||||||
|
@ -723,21 +736,21 @@ void BScreen::update(FbTk::Subject *subj) {
|
||||||
const Icons::iterator it_end = iconList().end();
|
const Icons::iterator it_end = iconList().end();
|
||||||
for (; it != it_end; ++it)
|
for (; it != it_end; ++it)
|
||||||
fluxbox->updateFrameExtents(**it);
|
fluxbox->updateFrameExtents(**it);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::Menu *BScreen::createMenu(const std::string &label) {
|
FbTk::Menu *BScreen::createMenu(const string &label) {
|
||||||
FbTk::Menu *menu = new FbMenu(menuTheme(),
|
FbTk::Menu *menu = new FbMenu(menuTheme(),
|
||||||
imageControl(),
|
imageControl(),
|
||||||
*layerManager().getLayer(Layer::MENU));
|
*layerManager().getLayer(Layer::MENU));
|
||||||
if (!label.empty())
|
if (!label.empty())
|
||||||
menu->setLabel(label);
|
menu->setLabel(label);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
FbTk::Menu *BScreen::createToggleMenu(const std::string &label) {
|
FbTk::Menu *BScreen::createToggleMenu(const string &label) {
|
||||||
FbTk::Menu *menu = new ToggleMenu(menuTheme(),
|
FbTk::Menu *menu = new ToggleMenu(menuTheme(),
|
||||||
imageControl(),
|
imageControl(),
|
||||||
*layerManager().getLayer(Layer::MENU));
|
*layerManager().getLayer(Layer::MENU));
|
||||||
if (!label.empty())
|
if (!label.empty())
|
||||||
menu->setLabel(label);
|
menu->setLabel(label);
|
||||||
|
@ -748,7 +761,7 @@ FbTk::Menu *BScreen::createToggleMenu(const std::string &label) {
|
||||||
void BScreen::addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu) {
|
void BScreen::addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu) {
|
||||||
menu->setInternalMenu();
|
menu->setInternalMenu();
|
||||||
menu->disableTitle();
|
menu->disableTitle();
|
||||||
m_extramenus.push_back(std::make_pair(label, menu));
|
m_extramenus.push_back(make_pair(label, menu));
|
||||||
// recreate window menu
|
// recreate window menu
|
||||||
m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
|
m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
|
||||||
m_windowmenu->setInternalMenu();
|
m_windowmenu->setInternalMenu();
|
||||||
|
@ -772,7 +785,7 @@ void BScreen::hideMenus() {
|
||||||
(*it)->menu().hide();
|
(*it)->menu().hide();
|
||||||
}
|
}
|
||||||
// hide all client menus
|
// hide all client menus
|
||||||
hideWindowMenus();
|
hideWindowMenus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,7 +856,7 @@ void BScreen::reconfigure() {
|
||||||
m_windowmenu->setInternalMenu();
|
m_windowmenu->setInternalMenu();
|
||||||
|
|
||||||
// We need to check to see if the timestamps
|
// 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
|
// in the same way, since we can't really say if
|
||||||
// any submenu is in the same place as before if the
|
// any submenu is in the same place as before if the
|
||||||
// menu changed.
|
// menu changed.
|
||||||
|
@ -873,7 +886,7 @@ void BScreen::reconfigure() {
|
||||||
FbTk::Menu *menu = m_rootmenu.get();
|
FbTk::Menu *menu = m_rootmenu.get();
|
||||||
for (size_t i = 0; i < remember_sub.size(); i++ ) {
|
for (size_t i = 0; i < remember_sub.size(); i++ ) {
|
||||||
int sub = remember_sub[i];
|
int sub = remember_sub[i];
|
||||||
if (!menu || sub < 0)
|
if (!menu || sub < 0)
|
||||||
break;
|
break;
|
||||||
FbTk::MenuItem *item = menu->find(sub);
|
FbTk::MenuItem *item = menu->find(sub);
|
||||||
if (item != 0) {
|
if (item != 0) {
|
||||||
|
@ -889,12 +902,12 @@ void BScreen::reconfigure() {
|
||||||
for_each(m_workspaces_list.begin(),
|
for_each(m_workspaces_list.begin(),
|
||||||
m_workspaces_list.end(),
|
m_workspaces_list.end(),
|
||||||
mem_fun(&Workspace::reconfigure));
|
mem_fun(&Workspace::reconfigure));
|
||||||
|
|
||||||
// reconfigure Icons
|
// reconfigure Icons
|
||||||
for_each(m_icon_list.begin(),
|
for_each(m_icon_list.begin(),
|
||||||
m_icon_list.end(),
|
m_icon_list.end(),
|
||||||
mem_fun(&FluxboxWindow::reconfigure));
|
mem_fun(&FluxboxWindow::reconfigure));
|
||||||
|
|
||||||
imageControl().cleanCache();
|
imageControl().cleanCache();
|
||||||
// notify objects that the screen is reconfigured
|
// notify objects that the screen is reconfigured
|
||||||
m_reconfigure_sig.notify();
|
m_reconfigure_sig.notify();
|
||||||
|
@ -952,7 +965,7 @@ void BScreen::updateWorkspaceNamesAtom() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BScreen::addIcon(FluxboxWindow *w) {
|
void BScreen::addIcon(FluxboxWindow *w) {
|
||||||
if (w == 0)
|
if (w == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// make sure we have a unique list
|
// make sure we have a unique list
|
||||||
|
@ -973,7 +986,7 @@ void BScreen::removeIcon(FluxboxWindow *w) {
|
||||||
Icons::iterator erase_it = remove_if(iconList().begin(),
|
Icons::iterator erase_it = remove_if(iconList().begin(),
|
||||||
iconList().end(),
|
iconList().end(),
|
||||||
bind2nd(equal_to<FluxboxWindow *>(), w));
|
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
|
// change the iconlist
|
||||||
if (erase_it != m_icon_list.end()) {
|
if (erase_it != m_icon_list.end()) {
|
||||||
iconList().erase(erase_it);
|
iconList().erase(erase_it);
|
||||||
|
@ -985,7 +998,7 @@ void BScreen::removeWindow(FluxboxWindow *win) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<"BScreen::removeWindow("<<win<<")"<<endl;
|
cerr<<"BScreen::removeWindow("<<win<<")"<<endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
// extra precaution, if for some reason, the
|
// extra precaution, if for some reason, the
|
||||||
// icon list should be out of sync
|
// icon list should be out of sync
|
||||||
removeIcon(win);
|
removeIcon(win);
|
||||||
// remove from workspace
|
// remove from workspace
|
||||||
|
@ -1022,20 +1035,20 @@ void BScreen::removeClient(WinClient &client) {
|
||||||
int BScreen::addWorkspace() {
|
int BScreen::addWorkspace() {
|
||||||
|
|
||||||
bool save_name = getNameOfWorkspace(m_workspaces_list.size()) != "" ? false : true;
|
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()),
|
getNameOfWorkspace(m_workspaces_list.size()),
|
||||||
m_workspaces_list.size());
|
m_workspaces_list.size());
|
||||||
m_workspaces_list.push_back(wkspc);
|
m_workspaces_list.push_back(wkspc);
|
||||||
|
|
||||||
if (save_name)
|
if (save_name)
|
||||||
addWorkspaceName(wkspc->name().c_str()); //update names
|
addWorkspaceName(wkspc->name().c_str()); //update names
|
||||||
|
|
||||||
saveWorkspaces(m_workspaces_list.size());
|
saveWorkspaces(m_workspaces_list.size());
|
||||||
|
|
||||||
updateNetizenWorkspaceCount();
|
updateNetizenWorkspaceCount();
|
||||||
|
|
||||||
return m_workspaces_list.size();
|
return m_workspaces_list.size();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// removes last workspace
|
/// removes last workspace
|
||||||
|
@ -1059,7 +1072,7 @@ int BScreen::removeLastWorkspace() {
|
||||||
m_clientlist_sig.notify();
|
m_clientlist_sig.notify();
|
||||||
|
|
||||||
//remove last workspace
|
//remove last workspace
|
||||||
m_workspaces_list.pop_back();
|
m_workspaces_list.pop_back();
|
||||||
|
|
||||||
updateNetizenWorkspaceCount();
|
updateNetizenWorkspaceCount();
|
||||||
saveWorkspaces(m_workspaces_list.size());
|
saveWorkspaces(m_workspaces_list.size());
|
||||||
|
@ -1104,10 +1117,10 @@ void BScreen::changeWorkspaceID(unsigned int id) {
|
||||||
// set new workspace
|
// set new workspace
|
||||||
m_current_workspace = getWorkspace(id);
|
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
|
// this way we can set focus pixmap on frame before we show it
|
||||||
// and using ExposeEvent to redraw without flicker
|
// and using ExposeEvent to redraw without flicker
|
||||||
/*
|
/*
|
||||||
WinClient *win = getLastFocusedWindow(currentWorkspaceID());
|
WinClient *win = getLastFocusedWindow(currentWorkspaceID());
|
||||||
if (win && win->fbwindow())
|
if (win && win->fbwindow())
|
||||||
win->fbwindow()->setFocusFlag(true);
|
win->fbwindow()->setFocusFlag(true);
|
||||||
|
@ -1146,7 +1159,7 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
|
||||||
win->deiconify();
|
win->deiconify();
|
||||||
|
|
||||||
// if the window isn't on current workspace, hide it
|
// if the window isn't on current workspace, hide it
|
||||||
if (id != currentWorkspace()->workspaceID())
|
if (id != currentWorkspace()->workspaceID())
|
||||||
win->withdraw(true);
|
win->withdraw(true);
|
||||||
|
|
||||||
windowMenu().hide();
|
windowMenu().hide();
|
||||||
|
@ -1182,7 +1195,7 @@ void BScreen::addNetizen(Window win) {
|
||||||
Workspace::Windows::iterator win_it = (*it)->windowList().begin();
|
Workspace::Windows::iterator win_it = (*it)->windowList().begin();
|
||||||
Workspace::Windows::iterator win_it_end = (*it)->windowList().end();
|
Workspace::Windows::iterator win_it_end = (*it)->windowList().end();
|
||||||
for (; win_it != win_it_end; ++win_it) {
|
for (; win_it != win_it_end; ++win_it) {
|
||||||
net->sendWindowAdd((*win_it)->clientWindow(),
|
net->sendWindowAdd((*win_it)->clientWindow(),
|
||||||
(*it)->workspaceID());
|
(*it)->workspaceID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1199,7 +1212,7 @@ void BScreen::removeNetizen(Window w) {
|
||||||
if ((*it)->window() == w) {
|
if ((*it)->window() == w) {
|
||||||
Netizen *n = *it;
|
Netizen *n = *it;
|
||||||
delete n;
|
delete n;
|
||||||
m_netizen_list.erase(it);
|
m_netizen_list.erase(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1218,7 +1231,7 @@ void BScreen::updateNetizenWorkspaceCount() {
|
||||||
for_each(m_netizen_list.begin(),
|
for_each(m_netizen_list.begin(),
|
||||||
m_netizen_list.end(),
|
m_netizen_list.end(),
|
||||||
mem_fun(&Netizen::sendWorkspaceCount));
|
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
|
// update the list of clients
|
||||||
m_clientlist_sig.notify();
|
m_clientlist_sig.notify();
|
||||||
|
|
||||||
// and then send the signal to listeners
|
// and then send the signal to listeners
|
||||||
Netizens::iterator it = m_netizen_list.begin();
|
Netizens::iterator it = m_netizen_list.begin();
|
||||||
Netizens::iterator it_end = m_netizen_list.end();
|
Netizens::iterator it_end = m_netizen_list.end();
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
(*it)->sendWindowAdd(w, p);
|
(*it)->sendWindowAdd(w, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1250,7 +1263,7 @@ void BScreen::updateNetizenWindowDel(Window w) {
|
||||||
for_each(m_netizen_list.begin(),
|
for_each(m_netizen_list.begin(),
|
||||||
m_netizen_list.end(),
|
m_netizen_list.end(),
|
||||||
bind2nd(mem_fun(&Netizen::sendWindowDel), w));
|
bind2nd(mem_fun(&Netizen::sendWindowDel), w));
|
||||||
|
|
||||||
m_clientlist_sig.notify();
|
m_clientlist_sig.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1285,12 +1298,12 @@ bool BScreen::isKdeDockapp(Window client) const {
|
||||||
Display *disp = FbTk::App::instance()->display();
|
Display *disp = FbTk::App::instance()->display();
|
||||||
// Check if KDE v2.x dock applet
|
// Check if KDE v2.x dock applet
|
||||||
if (XGetWindowProperty(disp, client,
|
if (XGetWindowProperty(disp, client,
|
||||||
XInternAtom(FbTk::App::instance()->display(),
|
XInternAtom(FbTk::App::instance()->display(),
|
||||||
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False),
|
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False),
|
||||||
0l, 1l, False,
|
0l, 1l, False,
|
||||||
XA_WINDOW, &ajunk, &ijunk, &uljunk,
|
XA_WINDOW, &ajunk, &ijunk, &uljunk,
|
||||||
&uljunk, (unsigned char **) &data) == Success) {
|
&uljunk, (unsigned char **) &data) == Success) {
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
iskdedockapp = true;
|
iskdedockapp = true;
|
||||||
XFree((void *) data);
|
XFree((void *) data);
|
||||||
|
@ -1299,7 +1312,7 @@ bool BScreen::isKdeDockapp(Window client) const {
|
||||||
|
|
||||||
// Check if KDE v1.x dock applet
|
// Check if KDE v1.x dock applet
|
||||||
if (!iskdedockapp) {
|
if (!iskdedockapp) {
|
||||||
Atom kwm1 = XInternAtom(FbTk::App::instance()->display(),
|
Atom kwm1 = XInternAtom(FbTk::App::instance()->display(),
|
||||||
"KWM_DOCKWINDOW", False);
|
"KWM_DOCKWINDOW", False);
|
||||||
if (XGetWindowProperty(disp, client,
|
if (XGetWindowProperty(disp, client,
|
||||||
kwm1, 0l, 1l, False,
|
kwm1, 0l, 1l, False,
|
||||||
|
@ -1309,7 +1322,7 @@ bool BScreen::isKdeDockapp(Window client) const {
|
||||||
XFree((void *) data);
|
XFree((void *) data);
|
||||||
data = 0;
|
data = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return iskdedockapp;
|
return iskdedockapp;
|
||||||
}
|
}
|
||||||
|
@ -1317,9 +1330,9 @@ bool BScreen::isKdeDockapp(Window client) const {
|
||||||
bool BScreen::addKdeDockapp(Window client) {
|
bool BScreen::addKdeDockapp(Window client) {
|
||||||
|
|
||||||
XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask);
|
XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask);
|
||||||
char intbuff[16];
|
char intbuff[16];
|
||||||
sprintf(intbuff, "%d", screenNumber());
|
sprintf(intbuff, "%d", screenNumber());
|
||||||
std::string atom_name("_NET_SYSTEM_TRAY_S");
|
string atom_name("_NET_SYSTEM_TRAY_S");
|
||||||
atom_name += intbuff; // append number
|
atom_name += intbuff; // append number
|
||||||
// find the right atomhandler that has the name: _NET_SYSTEM_TRAY_S<num>
|
// find the right atomhandler that has the name: _NET_SYSTEM_TRAY_S<num>
|
||||||
AtomHandler *handler = Fluxbox::instance()->getAtomHandler(atom_name);
|
AtomHandler *handler = Fluxbox::instance()->getAtomHandler(atom_name);
|
||||||
|
@ -1333,7 +1346,7 @@ bool BScreen::addKdeDockapp(Window client) {
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// this handler is a special case
|
// this handler is a special case
|
||||||
// so we call setupClient in it
|
// so we call setupClient in it
|
||||||
WinClient winclient(client, *this);
|
WinClient winclient(client, *this);
|
||||||
handler->setupClient(winclient);
|
handler->setupClient(winclient);
|
||||||
|
@ -1381,14 +1394,14 @@ FluxboxWindow *BScreen::createWindow(Window client) {
|
||||||
win = new FluxboxWindow(*winclient,
|
win = new FluxboxWindow(*winclient,
|
||||||
winFrameTheme(),
|
winFrameTheme(),
|
||||||
*layerManager().getLayer(Layer::NORMAL));
|
*layerManager().getLayer(Layer::NORMAL));
|
||||||
|
|
||||||
if (!win->isManaged()) {
|
if (!win->isManaged()) {
|
||||||
delete win;
|
delete win;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// always put on end of focused list, if it gets focused it'll get pushed up
|
// 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
|
// there is only the one win client at this stage
|
||||||
focusControl().addFocusBack(*winclient);
|
focusControl().addFocusBack(*winclient);
|
||||||
|
@ -1422,7 +1435,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
|
||||||
slit()->addClient(win->clientWindow());
|
slit()->addClient(win->clientWindow());
|
||||||
}
|
}
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
|
|
||||||
if (!win->isManaged()) {
|
if (!win->isManaged()) {
|
||||||
delete win;
|
delete win;
|
||||||
|
@ -1440,7 +1453,7 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
|
||||||
|
|
||||||
Strut *BScreen::requestStrut(int head, int left, int right, int top, int bottom) {
|
Strut *BScreen::requestStrut(int head, int left, int right, int top, int bottom) {
|
||||||
if (head > numHeads() && head != 1) {
|
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
|
// which means no xinerama, but there's a head after all
|
||||||
head = numHeads();
|
head = numHeads();
|
||||||
}
|
}
|
||||||
|
@ -1462,7 +1475,7 @@ Strut *BScreen::requestStrut(int head, int left, int right, int top, int bottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
void BScreen::clearStrut(Strut *str) {
|
void BScreen::clearStrut(Strut *str) {
|
||||||
if (str->next())
|
if (str->next())
|
||||||
clearStrut(str->next());
|
clearStrut(str->next());
|
||||||
int head = str->head() ? str->head() - 1 : 0;
|
int head = str->head() ? str->head() - 1 : 0;
|
||||||
m_head_areas[head].clearStrut(str);
|
m_head_areas[head].clearStrut(str);
|
||||||
|
@ -1493,7 +1506,7 @@ string BScreen::getNameOfWorkspace(unsigned int workspace) const {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
|
void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
|
||||||
bool ignore_sticky) {
|
bool ignore_sticky) {
|
||||||
if (w == 0)
|
if (w == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1510,10 +1523,10 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
|
||||||
getWorkspace(wkspc_id)->addWindow(*w);
|
getWorkspace(wkspc_id)->addWindow(*w);
|
||||||
// client list need to notify now even though
|
// client list need to notify now even though
|
||||||
// we didn't remove/add any window,
|
// 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
|
// show whats on current/other workspace
|
||||||
// gets updated
|
// gets updated
|
||||||
m_clientlist_sig.notify();
|
m_clientlist_sig.notify();
|
||||||
} else if (ignore_sticky || ! w->isStuck()) {
|
} else if (ignore_sticky || ! w->isStuck()) {
|
||||||
// fresh windows have workspaceNumber == -1, which leads to
|
// fresh windows have workspaceNumber == -1, which leads to
|
||||||
// an invalid workspace (unsigned int)
|
// an invalid workspace (unsigned int)
|
||||||
|
@ -1534,12 +1547,12 @@ void BScreen::initMenus() {
|
||||||
|
|
||||||
|
|
||||||
void BScreen::initMenu() {
|
void BScreen::initMenu() {
|
||||||
|
|
||||||
if (m_rootmenu.get()) {
|
if (m_rootmenu.get()) {
|
||||||
// since all menus in root is submenus in m_rootmenu
|
// since all menus in root is submenus in m_rootmenu
|
||||||
// just remove every item in m_rootmenu and then clear m_rootmenu_list
|
// just remove every item in m_rootmenu and then clear m_rootmenu_list
|
||||||
while (m_rootmenu->numberOfItems())
|
while (m_rootmenu->numberOfItems())
|
||||||
m_rootmenu->remove(0);
|
m_rootmenu->remove(0);
|
||||||
m_rootmenu_list.clear();
|
m_rootmenu_list.clear();
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
@ -1571,7 +1584,7 @@ void BScreen::initMenu() {
|
||||||
|
|
||||||
|
|
||||||
void BScreen::addConfigMenu(const FbTk::FbString &label, FbTk::Menu &menu) {
|
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());
|
setupConfigmenu(*m_configmenu.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1585,7 +1598,7 @@ void BScreen::removeConfigMenu(FbTk::Menu &menu) {
|
||||||
|
|
||||||
setupConfigmenu(*m_configmenu.get());
|
setupConfigmenu(*m_configmenu.get());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BScreen::addManagedResource(FbTk::Resource_base *resource) {
|
void BScreen::addManagedResource(FbTk::Resource_base *resource) {
|
||||||
|
@ -1600,12 +1613,12 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand();
|
FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand();
|
||||||
FbTk::MacroCommand *s_a_reconftabs_macro = new FbTk::MacroCommand();
|
FbTk::MacroCommand *s_a_reconftabs_macro = new FbTk::MacroCommand();
|
||||||
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(
|
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(
|
||||||
*Fluxbox::instance(),
|
*Fluxbox::instance(),
|
||||||
&Fluxbox::save_rc));
|
&Fluxbox::save_rc));
|
||||||
FbTk::RefCount<FbTk::Command> reconf_cmd(CommandParser::instance().parseLine("reconfigure"));
|
FbTk::RefCount<FbTk::Command> reconf_cmd(CommandParser::instance().parseLine("reconfigure"));
|
||||||
|
|
||||||
FbTk::RefCount<FbTk::Command> reconftabs_cmd(new FbTk::SimpleCommand<BScreen>(
|
FbTk::RefCount<FbTk::Command> reconftabs_cmd(new FbTk::SimpleCommand<BScreen>(
|
||||||
*this,
|
*this,
|
||||||
&BScreen::reconfigureTabs));
|
&BScreen::reconfigureTabs));
|
||||||
s_a_reconf_macro->add(saverc_cmd);
|
s_a_reconf_macro->add(saverc_cmd);
|
||||||
s_a_reconf_macro->add(reconf_cmd);
|
s_a_reconf_macro->add(reconf_cmd);
|
||||||
|
@ -1614,15 +1627,15 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro);
|
FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro);
|
||||||
FbTk::RefCount<FbTk::Command> save_and_reconftabs(s_a_reconftabs_macro);
|
FbTk::RefCount<FbTk::Command> save_and_reconftabs(s_a_reconftabs_macro);
|
||||||
// create focus menu
|
// 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
|
// be deleted toghether with the parent
|
||||||
FbTk::FbString focusmenu_label = _FB_XTEXT(Configmenu, FocusModel,
|
FbTk::FbString focusmenu_label = _FB_XTEXT(Configmenu, FocusModel,
|
||||||
"Focus Model",
|
"Focus Model",
|
||||||
"Method used to give focus to windows");
|
"Method used to give focus to windows");
|
||||||
FbTk::Menu *focus_menu = createMenu(focusmenu_label);
|
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 _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) \
|
#define _FOCUSITEM(a, b, c, d, e) \
|
||||||
focus_menu->insert(new FocusModelMenuItem(_FB_XTEXT(a, b, c, d), focusControl(), \
|
focus_menu->insert(new FocusModelMenuItem(_FB_XTEXT(a, b, c, d), focusControl(), \
|
||||||
|
@ -1641,9 +1654,9 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
focusControl(), FocusControl::CLICKTABFOCUS, save_and_reconfigure));
|
focusControl(), FocusControl::CLICKTABFOCUS, save_and_reconfigure));
|
||||||
focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
|
focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
|
||||||
MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"),
|
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,
|
AutoRaise,
|
||||||
"Auto Raise",
|
"Auto Raise",
|
||||||
"Auto Raise windows on sloppy"),
|
"Auto Raise windows on sloppy"),
|
||||||
|
@ -1659,7 +1672,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
// BEGIN tab menu
|
// BEGIN tab menu
|
||||||
|
|
||||||
FbTk::FbString tabmenu_label = _FB_XTEXT(Configmenu, TabMenu,
|
FbTk::FbString tabmenu_label = _FB_XTEXT(Configmenu, TabMenu,
|
||||||
"Tab Options",
|
"Tab Options",
|
||||||
"heading for tab-related options");
|
"heading for tab-related options");
|
||||||
FbTk::Menu *tab_menu = createMenu(tabmenu_label);
|
FbTk::Menu *tab_menu = createMenu(tabmenu_label);
|
||||||
FbTk::FbString tabplacement_label = _FB_XTEXT(Menu, Placement, "Placement", "Title of Placement menu");
|
FbTk::FbString tabplacement_label = _FB_XTEXT(Menu, Placement, "Placement", "Title of Placement menu");
|
||||||
|
@ -1675,7 +1688,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
*resource.max_over_tabs, save_and_reconfigure));
|
*resource.max_over_tabs, save_and_reconfigure));
|
||||||
|
|
||||||
FbTk::MenuItem *tab_width_item =
|
FbTk::MenuItem *tab_width_item =
|
||||||
new IntResMenuItem(_FB_XTEXT(Configmenu, ExternalTabWidth,
|
new IntResMenuItem(_FB_XTEXT(Configmenu, ExternalTabWidth,
|
||||||
"External Tab Width",
|
"External Tab Width",
|
||||||
"Width of external-style tabs"),
|
"Width of external-style tabs"),
|
||||||
resource.tab_width, 10, 3000, /* silly number */
|
resource.tab_width, 10, 3000, /* silly number */
|
||||||
|
@ -1722,7 +1735,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
"Image Dithering", "Image Dithering",
|
"Image Dithering", "Image Dithering",
|
||||||
*resource.image_dither, save_and_reconfigure);
|
*resource.image_dither, save_and_reconfigure);
|
||||||
_BOOLITEM(menu, Configmenu, OpaqueMove,
|
_BOOLITEM(menu, Configmenu, OpaqueMove,
|
||||||
"Opaque Window Moving",
|
"Opaque Window Moving",
|
||||||
"Window Moving with whole window visible (as opposed to outline moving)",
|
"Window Moving with whole window visible (as opposed to outline moving)",
|
||||||
*resource.opaque_move, saverc_cmd);
|
*resource.opaque_move, saverc_cmd);
|
||||||
_BOOLITEM(menu, Configmenu, FullMax,
|
_BOOLITEM(menu, Configmenu, FullMax,
|
||||||
|
@ -1747,7 +1760,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_BOOLITEM(menu, Configmenu, WorkspaceWarping,
|
_BOOLITEM(menu, Configmenu, WorkspaceWarping,
|
||||||
"Workspace Warping",
|
"Workspace Warping",
|
||||||
"Workspace Warping - dragging windows to the edge and onto the next workspace",
|
"Workspace Warping - dragging windows to the edge and onto the next workspace",
|
||||||
*resource.workspace_warping, saverc_cmd);
|
*resource.workspace_warping, saverc_cmd);
|
||||||
_BOOLITEM(menu, Configmenu, DesktopWheeling,
|
_BOOLITEM(menu, Configmenu, DesktopWheeling,
|
||||||
|
@ -1757,7 +1770,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
"Decorate Transient Windows", "Decorate Transient Windows",
|
"Decorate Transient Windows", "Decorate Transient Windows",
|
||||||
*resource.decorate_transient, saverc_cmd);
|
*resource.decorate_transient, saverc_cmd);
|
||||||
_BOOLITEM(menu, Configmenu, ClickRaises,
|
_BOOLITEM(menu, Configmenu, ClickRaises,
|
||||||
"Click Raises", "Click Raises",
|
"Click Raises", "Click Raises",
|
||||||
*resource.click_raises, saverc_cmd);
|
*resource.click_raises, saverc_cmd);
|
||||||
|
|
||||||
#ifdef HAVE_XRENDER
|
#ifdef HAVE_XRENDER
|
||||||
|
@ -1765,37 +1778,37 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
FbTk::Transparent::haveComposite()) {
|
FbTk::Transparent::haveComposite()) {
|
||||||
|
|
||||||
FbTk::FbString alphamenu_label = _FB_XTEXT(Configmenu, Transparency,
|
FbTk::FbString alphamenu_label = _FB_XTEXT(Configmenu, Transparency,
|
||||||
"Transparency",
|
"Transparency",
|
||||||
"Menu containing various transparency options");
|
"Menu containing various transparency options");
|
||||||
FbTk::Menu *alpha_menu = createMenu(alphamenu_label);
|
FbTk::Menu *alpha_menu = createMenu(alphamenu_label);
|
||||||
|
|
||||||
if (FbTk::Transparent::haveComposite(true)) {
|
if (FbTk::Transparent::haveComposite(true)) {
|
||||||
alpha_menu->insert(new BoolMenuItem(_FB_XTEXT(Configmenu, ForcePseudoTrans,
|
alpha_menu->insert(new BoolMenuItem(_FB_XTEXT(Configmenu, ForcePseudoTrans,
|
||||||
"Force Pseudo-Transparency",
|
"Force Pseudo-Transparency",
|
||||||
"When composite is available, still use old pseudo-transparency"),
|
"When composite is available, still use old pseudo-transparency"),
|
||||||
Fluxbox::instance()->getPseudoTrans(), save_and_reconfigure));
|
Fluxbox::instance()->getPseudoTrans(), save_and_reconfigure));
|
||||||
}
|
}
|
||||||
|
|
||||||
FbTk::MenuItem *focused_alpha_item =
|
FbTk::MenuItem *focused_alpha_item =
|
||||||
new IntResMenuItem(_FB_XTEXT(Configmenu, FocusedAlpha,
|
new IntResMenuItem(_FB_XTEXT(Configmenu, FocusedAlpha,
|
||||||
"Focused Window Alpha",
|
"Focused Window Alpha",
|
||||||
"Transparency level of the focused window"),
|
"Transparency level of the focused window"),
|
||||||
resource.focused_alpha, 0, 255, *alpha_menu);
|
resource.focused_alpha, 0, 255, *alpha_menu);
|
||||||
focused_alpha_item->setCommand(saverc_cmd);
|
focused_alpha_item->setCommand(saverc_cmd);
|
||||||
alpha_menu->insert(focused_alpha_item);
|
alpha_menu->insert(focused_alpha_item);
|
||||||
|
|
||||||
FbTk::MenuItem *unfocused_alpha_item =
|
FbTk::MenuItem *unfocused_alpha_item =
|
||||||
new IntResMenuItem(_FB_XTEXT(Configmenu,
|
new IntResMenuItem(_FB_XTEXT(Configmenu,
|
||||||
UnfocusedAlpha,
|
UnfocusedAlpha,
|
||||||
"Unfocused Window Alpha",
|
"Unfocused Window Alpha",
|
||||||
"Transparency level of unfocused windows"),
|
"Transparency level of unfocused windows"),
|
||||||
|
|
||||||
resource.unfocused_alpha, 0, 255, *alpha_menu);
|
resource.unfocused_alpha, 0, 255, *alpha_menu);
|
||||||
unfocused_alpha_item->setCommand(saverc_cmd);
|
unfocused_alpha_item->setCommand(saverc_cmd);
|
||||||
alpha_menu->insert(unfocused_alpha_item);
|
alpha_menu->insert(unfocused_alpha_item);
|
||||||
|
|
||||||
FbTk::MenuItem *menu_alpha_item =
|
FbTk::MenuItem *menu_alpha_item =
|
||||||
new IntResMenuItem(_FB_XTEXT(Configmenu, MenuAlpha,
|
new IntResMenuItem(_FB_XTEXT(Configmenu, MenuAlpha,
|
||||||
"Menu Alpha", "Transparency level of menu"),
|
"Menu Alpha", "Transparency level of menu"),
|
||||||
resource.menu_alpha, 0, 255, *alpha_menu);
|
resource.menu_alpha, 0, 255, *alpha_menu);
|
||||||
menu_alpha_item->setCommand(saverc_cmd);
|
menu_alpha_item->setCommand(saverc_cmd);
|
||||||
|
@ -1807,7 +1820,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
||||||
#endif // HAVE_XRENDER
|
#endif // HAVE_XRENDER
|
||||||
#undef _BOOLITEM
|
#undef _BOOLITEM
|
||||||
|
|
||||||
// finaly update menu
|
// finaly update menu
|
||||||
menu.updateMenu();
|
menu.updateMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1833,9 +1846,9 @@ void BScreen::showPosition(int x, int y) {
|
||||||
|
|
||||||
m_pos_window.move(getHeadX(head) + (getHeadWidth(head) - m_pos_window.width()) / 2,
|
m_pos_window.move(getHeadX(head) + (getHeadWidth(head) - m_pos_window.width()) / 2,
|
||||||
getHeadY(head) + (getHeadHeight(head) - m_pos_window.height()) / 2);
|
getHeadY(head) + (getHeadHeight(head) - m_pos_window.height()) / 2);
|
||||||
|
|
||||||
} else {
|
} 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);
|
(height() - m_pos_window.height()) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1854,10 +1867,10 @@ void BScreen::showPosition(int x, int y) {
|
||||||
screenNumber(),
|
screenNumber(),
|
||||||
winFrameTheme().labelTextFocusGC(),
|
winFrameTheme().labelTextFocusGC(),
|
||||||
label, strlen(label),
|
label, strlen(label),
|
||||||
winFrameTheme().bevelWidth(),
|
winFrameTheme().bevelWidth(),
|
||||||
winFrameTheme().bevelWidth() +
|
winFrameTheme().bevelWidth() +
|
||||||
winFrameTheme().font().ascent());
|
winFrameTheme().font().ascent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1880,7 +1893,7 @@ void BScreen::showGeometry(int gx, int gy) {
|
||||||
m_geom_window.move(getHeadX(head) + (getHeadWidth(head) - m_geom_window.width()) / 2,
|
m_geom_window.move(getHeadX(head) + (getHeadWidth(head) - m_geom_window.width()) / 2,
|
||||||
getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2);
|
getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2);
|
||||||
} else {
|
} 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);
|
(height() - m_geom_window.height()) / 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1889,7 +1902,7 @@ void BScreen::showGeometry(int gx, int gy) {
|
||||||
|
|
||||||
geom_visible = true;
|
geom_visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char label[256];
|
char label[256];
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
|
||||||
|
@ -1906,9 +1919,9 @@ void BScreen::showGeometry(int gx, int gy) {
|
||||||
screenNumber(),
|
screenNumber(),
|
||||||
winFrameTheme().labelTextFocusGC(),
|
winFrameTheme().labelTextFocusGC(),
|
||||||
label, strlen(label),
|
label, strlen(label),
|
||||||
winFrameTheme().bevelWidth(),
|
winFrameTheme().bevelWidth(),
|
||||||
winFrameTheme().bevelWidth() +
|
winFrameTheme().bevelWidth() +
|
||||||
winFrameTheme().font().ascent());
|
winFrameTheme().font().ascent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2106,7 +2119,7 @@ void BScreen::initXinerama() {
|
||||||
if (!XineramaIsActive(display)) {
|
if (!XineramaIsActive(display)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<"BScreen::initXinerama(): dont have Xinerama"<<endl;
|
cerr<<"BScreen::initXinerama(): dont have Xinerama"<<endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
m_xinerama_avail = false;
|
m_xinerama_avail = false;
|
||||||
m_xinerama_headinfo = 0;
|
m_xinerama_headinfo = 0;
|
||||||
m_xinerama_num_heads = 0;
|
m_xinerama_num_heads = 0;
|
||||||
|
@ -2114,7 +2127,7 @@ void BScreen::initXinerama() {
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<"BScreen::initXinerama(): have Xinerama"<<endl;
|
cerr<<"BScreen::initXinerama(): have Xinerama"<<endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
m_xinerama_avail = true;
|
m_xinerama_avail = true;
|
||||||
|
|
||||||
XineramaScreenInfo *screen_info;
|
XineramaScreenInfo *screen_info;
|
||||||
|
@ -2161,7 +2174,7 @@ int BScreen::getHead(int x, int y) const {
|
||||||
int BScreen::getHead(FbTk::FbWindow &win) const {
|
int BScreen::getHead(FbTk::FbWindow &win) const {
|
||||||
if (hasXinerama())
|
if (hasXinerama())
|
||||||
return getHead(win.x() + win.width()/2, win.y() + win.height()/2);
|
return getHead(win.x() + win.width()/2, win.y() + win.height()/2);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2176,7 +2189,7 @@ int BScreen::getCurrHead() const {
|
||||||
Window ignore_w;
|
Window ignore_w;
|
||||||
|
|
||||||
XQueryPointer(FbTk::App::instance()->display(),
|
XQueryPointer(FbTk::App::instance()->display(),
|
||||||
rootWindow().window(), &ignore_w,
|
rootWindow().window(), &ignore_w,
|
||||||
&ignore_w, &root_x, &root_y,
|
&ignore_w, &root_x, &root_y,
|
||||||
&ignore_i, &ignore_i, &ignore_ui);
|
&ignore_i, &ignore_i, &ignore_ui);
|
||||||
#endif // XINERAMA
|
#endif // XINERAMA
|
||||||
|
@ -2225,17 +2238,17 @@ pair<int,int> BScreen::clampToHead(int head, int x, int y, int w, int h) const {
|
||||||
// a better way would be to search the closest head
|
// a better way would be to search the closest head
|
||||||
if (head == 0 && numHeads() != 0)
|
if (head == 0 && numHeads() != 0)
|
||||||
head = 1;
|
head = 1;
|
||||||
|
|
||||||
int hx = getHeadX(head);
|
int hx = getHeadX(head);
|
||||||
int hy = getHeadY(head);
|
int hy = getHeadY(head);
|
||||||
int hw = getHeadWidth(head);
|
int hw = getHeadWidth(head);
|
||||||
int hh = getHeadHeight(head);
|
int hh = getHeadHeight(head);
|
||||||
|
|
||||||
if (x + w > hx + hw)
|
if (x + w > hx + hw)
|
||||||
x = hx + hw - w;
|
x = hx + hw - w;
|
||||||
if (y + h > hy + hh)
|
if (y + h > hy + hh)
|
||||||
y = hy + hh - h;
|
y = hy + hh - h;
|
||||||
|
|
||||||
if (x < hx)
|
if (x < hx)
|
||||||
x = hx;
|
x = hx;
|
||||||
if (y < hy)
|
if (y < hy)
|
||||||
|
|
36
src/Shape.cc
36
src/Shape.cc
|
@ -1,6 +1,6 @@
|
||||||
// Shape.cc
|
// Shape.cc
|
||||||
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
// to deal in the Software without restriction, including without limitation
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
@ -28,6 +28,10 @@
|
||||||
#include "FbTk/GContext.hh"
|
#include "FbTk/GContext.hh"
|
||||||
#include "FbTk/FbPixmap.hh"
|
#include "FbTk/FbPixmap.hh"
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#ifdef HAVE_CSTRING
|
#ifdef HAVE_CSTRING
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#else
|
#else
|
||||||
|
@ -35,9 +39,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif // HAVE_CONFIG_H
|
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
|
@ -45,15 +46,16 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace std;
|
|
||||||
|
using std::min;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
|
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)
|
win.width() < 3 || win.height() < 3)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
static char left_bits[] = { 0xc0, 0xf8, 0xfc, 0xfe, 0xfe, 0xfe, 0xff, 0xff };
|
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 right_bits[] = { 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff};
|
||||||
static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 };
|
static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 };
|
||||||
|
@ -74,7 +76,7 @@ FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memset(data, 0xFF, data_size);
|
memset(data, 0xFF, data_size);
|
||||||
|
|
||||||
XImage *ximage = XCreateImage(disp,
|
XImage *ximage = XCreateImage(disp,
|
||||||
DefaultVisual(disp, win.screenNumber()),
|
DefaultVisual(disp, win.screenNumber()),
|
||||||
1,
|
1,
|
||||||
|
@ -96,20 +98,20 @@ FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (place & Shape::TOPRIGHT) {
|
if (place & Shape::TOPRIGHT) {
|
||||||
for (int y=0; y<pixmap_height; y++) {
|
for (int y=0; y<pixmap_height; y++) {
|
||||||
for (int x=0; x<pixmap_width; x++) {
|
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);
|
(right_bits[y] & (0x01 << x)) ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (place & Shape::BOTTOMLEFT) {
|
if (place & Shape::BOTTOMLEFT) {
|
||||||
for (int y=0; y<pixmap_height; y++) {
|
for (int y=0; y<pixmap_height; y++) {
|
||||||
for (int x=0; x<pixmap_width; x++) {
|
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);
|
(bottom_left_bits[y] & (0x01 << x)) ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +130,7 @@ FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
|
||||||
|
|
||||||
|
|
||||||
FbTk::GContext gc(*pm);
|
FbTk::GContext gc(*pm);
|
||||||
|
|
||||||
XPutImage(disp, pm->drawable(), gc.gc(), ximage, 0, 0, 0, 0,
|
XPutImage(disp, pm->drawable(), gc.gc(), ximage, 0, 0, 0, 0,
|
||||||
win_width, win_height);
|
win_width, win_height);
|
||||||
|
|
||||||
|
@ -177,7 +179,7 @@ void Shape::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// the m_shape can be = 0 which will just reset the shape mask
|
// 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(),
|
XShapeCombineMask(FbTk::App::instance()->display(),
|
||||||
m_win->window(),
|
m_win->window(),
|
||||||
ShapeBounding,
|
ShapeBounding,
|
||||||
|
@ -197,7 +199,7 @@ void Shape::setWindow(FbTk::FbWindow &win) {
|
||||||
|
|
||||||
void Shape::setShapeNotify(const FbTk::FbWindow &win) {
|
void Shape::setShapeNotify(const FbTk::FbWindow &win) {
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
XShapeSelectInput(FbTk::App::instance()->display(),
|
XShapeSelectInput(FbTk::App::instance()->display(),
|
||||||
win.window(), ShapeNotifyMask);
|
win.window(), ShapeNotifyMask);
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
}
|
}
|
||||||
|
@ -209,7 +211,7 @@ bool Shape::isShaped(const FbTk::FbWindow &win) {
|
||||||
int not_used;
|
int not_used;
|
||||||
unsigned int not_used2;
|
unsigned int not_used2;
|
||||||
XShapeQueryExtents(FbTk::App::instance()->display(),
|
XShapeQueryExtents(FbTk::App::instance()->display(),
|
||||||
win.window(),
|
win.window(),
|
||||||
&shaped, /// bShaped
|
&shaped, /// bShaped
|
||||||
¬_used, ¬_used, // xbs, ybs
|
¬_used, ¬_used, // xbs, ybs
|
||||||
¬_used2, ¬_used2, // wbs, hbs
|
¬_used2, ¬_used2, // wbs, hbs
|
||||||
|
|
172
src/Slit.cc
172
src/Slit.cc
|
@ -78,7 +78,19 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#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 {
|
namespace FbTk {
|
||||||
|
|
||||||
|
@ -108,9 +120,9 @@ void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void FbTk::Resource<Slit::Direction>::setFromString(const char *strval) {
|
void FbTk::Resource<Slit::Direction>::setFromString(const char *strval) {
|
||||||
if (strcasecmp(strval, "Vertical") == 0)
|
if (strcasecmp(strval, "Vertical") == 0)
|
||||||
m_value = Slit::VERTICAL;
|
m_value = Slit::VERTICAL;
|
||||||
else if (strcasecmp(strval, "Horizontal") == 0)
|
else if (strcasecmp(strval, "Horizontal") == 0)
|
||||||
m_value = Slit::HORIZONTAL;
|
m_value = Slit::HORIZONTAL;
|
||||||
else
|
else
|
||||||
setDefaultValue();
|
setDefaultValue();
|
||||||
|
@ -130,7 +142,7 @@ string FbTk::Resource<Slit::Placement>::getString() const {
|
||||||
break;
|
break;
|
||||||
case Slit::TOPCENTER:
|
case Slit::TOPCENTER:
|
||||||
return string("TopCenter");
|
return string("TopCenter");
|
||||||
break;
|
break;
|
||||||
case Slit::BOTTOMCENTER:
|
case Slit::BOTTOMCENTER:
|
||||||
return string("BottomCenter");
|
return string("BottomCenter");
|
||||||
break;
|
break;
|
||||||
|
@ -162,7 +174,7 @@ string FbTk::Resource<Slit::Direction>::getString() const {
|
||||||
return string("Vertical");
|
return string("Vertical");
|
||||||
}
|
}
|
||||||
} // end namespace FbTk
|
} // end namespace FbTk
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class SlitClientMenuItem: public FbTk::MenuItem{
|
class SlitClientMenuItem: public FbTk::MenuItem{
|
||||||
public:
|
public:
|
||||||
|
@ -172,7 +184,7 @@ public:
|
||||||
FbTk::MenuItem::setSelected(client.visible());
|
FbTk::MenuItem::setSelected(client.visible());
|
||||||
setToggleItem(true);
|
setToggleItem(true);
|
||||||
}
|
}
|
||||||
const std::string &label() const {
|
const string &label() const {
|
||||||
return m_client.matchName();
|
return m_client.matchName();
|
||||||
}
|
}
|
||||||
bool isSelected() const {
|
bool isSelected() const {
|
||||||
|
@ -197,9 +209,9 @@ private:
|
||||||
class SlitDirMenuItem: public FbTk::MenuItem {
|
class SlitDirMenuItem: public FbTk::MenuItem {
|
||||||
public:
|
public:
|
||||||
SlitDirMenuItem(const FbTk::FbString &label, Slit &slit, FbTk::RefCount<FbTk::Command> &cmd)
|
SlitDirMenuItem(const FbTk::FbString &label, Slit &slit, FbTk::RefCount<FbTk::Command> &cmd)
|
||||||
:FbTk::MenuItem(label,cmd),
|
:FbTk::MenuItem(label,cmd),
|
||||||
m_slit(slit),
|
m_slit(slit),
|
||||||
m_label(label) {
|
m_label(label) {
|
||||||
setLabel(m_label); // update label
|
setLabel(m_label); // update label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,23 +228,23 @@ public:
|
||||||
void setLabel(const FbTk::FbString &label) {
|
void setLabel(const FbTk::FbString &label) {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
m_label = (label);
|
m_label = (label);
|
||||||
std::string reallabel = m_label + " " +
|
string reallabel = m_label + " " +
|
||||||
( m_slit.direction() == Slit::HORIZONTAL ?
|
( m_slit.direction() == Slit::HORIZONTAL ?
|
||||||
|
|
||||||
_FB_XTEXT(Align, Horizontal, "Horizontal", "Horizontal"):
|
_FB_XTEXT(Align, Horizontal, "Horizontal", "Horizontal"):
|
||||||
_FB_XTEXT(Align, Vertical, "Vertical", "Vertical"));
|
_FB_XTEXT(Align, Vertical, "Vertical", "Vertical"));
|
||||||
FbTk::MenuItem::setLabel(reallabel);
|
FbTk::MenuItem::setLabel(reallabel);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Slit &m_slit;
|
Slit &m_slit;
|
||||||
std::string m_label;
|
string m_label;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlaceSlitMenuItem: public FbTk::MenuItem {
|
class PlaceSlitMenuItem: public FbTk::MenuItem {
|
||||||
public:
|
public:
|
||||||
PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command> &cmd):
|
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) {
|
FbTk::MenuItem(label, cmd), m_slit(slit), m_place(place) {
|
||||||
|
|
||||||
}
|
}
|
||||||
bool isEnabled() const { return m_slit.placement() != m_place; }
|
bool isEnabled() const { return m_slit.placement() != m_place; }
|
||||||
void click(int button, int time) {
|
void click(int button, int time) {
|
||||||
|
@ -246,13 +258,13 @@ private:
|
||||||
|
|
||||||
}; // End anonymous namespace
|
}; // End anonymous namespace
|
||||||
|
|
||||||
unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask |
|
unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask |
|
||||||
EnterWindowMask | LeaveWindowMask | ExposureMask;
|
EnterWindowMask | LeaveWindowMask | ExposureMask;
|
||||||
|
|
||||||
Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
||||||
: m_hidden(false),
|
: m_hidden(false),
|
||||||
m_screen(scr),
|
m_screen(scr),
|
||||||
m_slitmenu(scr.menuTheme(),
|
m_slitmenu(scr.menuTheme(),
|
||||||
scr.imageControl(),
|
scr.imageControl(),
|
||||||
*scr.layerManager().getLayer(Layer::MENU)),
|
*scr.layerManager().getLayer(Layer::MENU)),
|
||||||
m_clientlist_menu(scr.menuTheme(),
|
m_clientlist_menu(scr.menuTheme(),
|
||||||
|
@ -260,9 +272,9 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
||||||
*scr.layerManager().getLayer(Layer::MENU)),
|
*scr.layerManager().getLayer(Layer::MENU)),
|
||||||
frame(scr.rootWindow()),
|
frame(scr.rootWindow()),
|
||||||
//For KDE dock applets
|
//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
|
"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
|
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False)), //KDE v2.x
|
||||||
|
|
||||||
m_layeritem(0),
|
m_layeritem(0),
|
||||||
|
@ -271,20 +283,20 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
||||||
m_strut(0),
|
m_strut(0),
|
||||||
// resources
|
// resources
|
||||||
// lock in first resource
|
// 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"),
|
scr.name() + ".slit.autoHide", scr.altName() + ".Slit.AutoHide"),
|
||||||
// TODO: this resource name must change
|
// TODO: this resource name must change
|
||||||
m_rc_maximize_over(scr.resourceManager(), false,
|
m_rc_maximize_over(scr.resourceManager(), false,
|
||||||
scr.name() + ".slit.maxOver", scr.altName() + ".Slit.MaxOver"),
|
scr.name() + ".slit.maxOver", scr.altName() + ".Slit.MaxOver"),
|
||||||
m_rc_placement(scr.resourceManager(), BOTTOMRIGHT,
|
m_rc_placement(scr.resourceManager(), BOTTOMRIGHT,
|
||||||
scr.name() + ".slit.placement", scr.altName() + ".Slit.Placement"),
|
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"),
|
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"),
|
scr.name() + ".slit.alpha", scr.altName() + ".Slit.Alpha"),
|
||||||
m_rc_on_head(scr.resourceManager(), 0,
|
m_rc_on_head(scr.resourceManager(), 0,
|
||||||
scr.name() + ".slit.onhead", scr.altName() + ".Slit.onHead"),
|
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") {
|
scr.name() + ".slit.layer", scr.altName() + ".Slit.Layer") {
|
||||||
|
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
@ -307,7 +319,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
||||||
|
|
||||||
|
|
||||||
FbTk::EventManager::instance()->add(*this, frame.window);
|
FbTk::EventManager::instance()->add(*this, frame.window);
|
||||||
|
|
||||||
if (FbTk::Transparent::haveComposite()) {
|
if (FbTk::Transparent::haveComposite()) {
|
||||||
frame.window.setOpaque(*m_rc_alpha);
|
frame.window.setOpaque(*m_rc_alpha);
|
||||||
} else {
|
} else {
|
||||||
|
@ -319,7 +331,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
||||||
m_layermenu.reset(new LayerMenu(scr.menuTheme(),
|
m_layermenu.reset(new LayerMenu(scr.menuTheme(),
|
||||||
scr.imageControl(),
|
scr.imageControl(),
|
||||||
*scr.layerManager().
|
*scr.layerManager().
|
||||||
getLayer(Layer::MENU),
|
getLayer(Layer::MENU),
|
||||||
this,
|
this,
|
||||||
true));
|
true));
|
||||||
m_layermenu->setLabel(_FB_XTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu"));
|
m_layermenu->setLabel(_FB_XTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu"));
|
||||||
|
@ -343,7 +355,7 @@ Slit::~Slit() {
|
||||||
screen().imageControl().removeImage(frame.pixmap);
|
screen().imageControl().removeImage(frame.pixmap);
|
||||||
|
|
||||||
// otherwise it will try to access it on deletion
|
// otherwise it will try to access it on deletion
|
||||||
screen().removeConfigMenu(m_slitmenu);
|
screen().removeConfigMenu(m_slitmenu);
|
||||||
|
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
@ -429,7 +441,7 @@ void Slit::addClient(Window w) {
|
||||||
|
|
||||||
// Look for slot in client list by name
|
// Look for slot in client list by name
|
||||||
SlitClient *client = 0;
|
SlitClient *client = 0;
|
||||||
std::string match_name;
|
string match_name;
|
||||||
match_name = Xutil::getWMClassName(w);
|
match_name = Xutil::getWMClassName(w);
|
||||||
SlitClients::iterator it = m_client_list.begin();
|
SlitClients::iterator it = m_client_list.begin();
|
||||||
SlitClients::iterator it_end = m_client_list.end();
|
SlitClients::iterator it_end = m_client_list.end();
|
||||||
|
@ -445,7 +457,7 @@ void Slit::addClient(Window w) {
|
||||||
}
|
}
|
||||||
// Otherwise keep looking for an unused match or a non-match
|
// Otherwise keep looking for an unused match or a non-match
|
||||||
found_match = true; // Possibly redundant
|
found_match = true; // Possibly redundant
|
||||||
|
|
||||||
} else if (found_match) {
|
} else if (found_match) {
|
||||||
// Insert before first non-match after a previously found match?
|
// Insert before first non-match after a previously found match?
|
||||||
client = new SlitClient(&screen(), w);
|
client = new SlitClient(&screen(), w);
|
||||||
|
@ -466,7 +478,7 @@ void Slit::addClient(Window w) {
|
||||||
if ((wmhints->flags & IconWindowHint) &&
|
if ((wmhints->flags & IconWindowHint) &&
|
||||||
(wmhints->icon_window != None)) {
|
(wmhints->icon_window != None)) {
|
||||||
XMoveWindow(disp, client->clientWindow(), screen().width() + 10,
|
XMoveWindow(disp, client->clientWindow(), screen().width() + 10,
|
||||||
screen().height() + 10);
|
screen().height() + 10);
|
||||||
XMapWindow(disp, client->clientWindow());
|
XMapWindow(disp, client->clientWindow());
|
||||||
client->setIconWindow(wmhints->icon_window);
|
client->setIconWindow(wmhints->icon_window);
|
||||||
client->setWindow(client->iconWindow());
|
client->setWindow(client->iconWindow());
|
||||||
|
@ -486,12 +498,12 @@ void Slit::addClient(Window w) {
|
||||||
FbAtoms *fbatoms = FbAtoms::instance();
|
FbAtoms *fbatoms = FbAtoms::instance();
|
||||||
|
|
||||||
if (XGetWMProtocols(disp, w, &proto, &num_return)) {
|
if (XGetWMProtocols(disp, w, &proto, &num_return)) {
|
||||||
|
|
||||||
for (int i = 0; i < num_return; ++i) {
|
for (int i = 0; i < num_return; ++i) {
|
||||||
if (proto[i] == fbatoms->getFluxboxStructureMessagesAtom())
|
if (proto[i] == fbatoms->getFluxboxStructureMessagesAtom())
|
||||||
screen().addNetizen(w);
|
screen().addNetizen(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree((void *) proto);
|
XFree((void *) proto);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
} else {
|
} else {
|
||||||
|
@ -500,13 +512,13 @@ void Slit::addClient(Window w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
XWindowAttributes attrib;
|
XWindowAttributes attrib;
|
||||||
|
|
||||||
#ifdef KDE
|
#ifdef KDE
|
||||||
if (screen().isKdeDockapp(w))
|
if (screen().isKdeDockapp(w))
|
||||||
client->resize(24, 24);
|
client->resize(24, 24);
|
||||||
else
|
else
|
||||||
#endif // KDE
|
#endif // KDE
|
||||||
|
|
||||||
{
|
{
|
||||||
if (XGetWindowAttributes(disp, client->window(), &attrib)) {
|
if (XGetWindowAttributes(disp, client->window(), &attrib)) {
|
||||||
client->resize(attrib.width, attrib.height);
|
client->resize(attrib.width, attrib.height);
|
||||||
|
@ -521,7 +533,7 @@ void Slit::addClient(Window w) {
|
||||||
// disable events to frame.window
|
// disable events to frame.window
|
||||||
frame.window.setEventMask(NoEventMask);
|
frame.window.setEventMask(NoEventMask);
|
||||||
client->disableEvents();
|
client->disableEvents();
|
||||||
|
|
||||||
|
|
||||||
XReparentWindow(disp, client->window(), frame.window.window(), 0, 0);
|
XReparentWindow(disp, client->window(), frame.window.window(), 0, 0);
|
||||||
XMapRaised(disp, client->window());
|
XMapRaised(disp, client->window());
|
||||||
|
@ -530,7 +542,7 @@ void Slit::addClient(Window w) {
|
||||||
frame.window.setEventMask(s_eventmask);
|
frame.window.setEventMask(s_eventmask);
|
||||||
// setup event for slit client window
|
// setup event for slit client window
|
||||||
client->enableEvents();
|
client->enableEvents();
|
||||||
|
|
||||||
// flush events
|
// flush events
|
||||||
// XFlush(disp);
|
// XFlush(disp);
|
||||||
|
|
||||||
|
@ -651,9 +663,9 @@ void Slit::reconfigure() {
|
||||||
num_windows++;
|
num_windows++;
|
||||||
if (height_inc) {
|
if (height_inc) {
|
||||||
// increase height of slit for each client (VERTICAL mode)
|
// 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
|
// 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();
|
frame.width = (*client_it)->width();
|
||||||
} else {
|
} else {
|
||||||
// increase width of slit for each client (HORIZONTAL mode)
|
// increase width of slit for each client (HORIZONTAL mode)
|
||||||
|
@ -695,7 +707,7 @@ void Slit::reconfigure() {
|
||||||
frame.window.setBackgroundPixmap(frame.pixmap);
|
frame.window.setBackgroundPixmap(frame.pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp)
|
if (tmp)
|
||||||
image_ctrl.removeImage(tmp);
|
image_ctrl.removeImage(tmp);
|
||||||
|
|
||||||
if (FbTk::Transparent::haveComposite()) {
|
if (FbTk::Transparent::haveComposite()) {
|
||||||
|
@ -733,7 +745,7 @@ void Slit::reconfigure() {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//client created window?
|
//client created window?
|
||||||
if ((*client_it)->visible())
|
if ((*client_it)->visible())
|
||||||
(*client_it)->show();
|
(*client_it)->show();
|
||||||
else {
|
else {
|
||||||
(*client_it)->disableEvents();
|
(*client_it)->disableEvents();
|
||||||
|
@ -776,7 +788,7 @@ void Slit::reconfigure() {
|
||||||
x += (*client_it)->width() + bevel_width;
|
x += (*client_it)->width() + bevel_width;
|
||||||
} // end for
|
} // end for
|
||||||
|
|
||||||
if (doAutoHide() && !isHidden() && !m_timer.isTiming())
|
if (doAutoHide() && !isHidden() && !m_timer.isTiming())
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
else if (!doAutoHide() && isHidden())
|
else if (!doAutoHide() && isHidden())
|
||||||
toggleHidden(); // restore visible
|
toggleHidden(); // restore visible
|
||||||
|
@ -891,12 +903,12 @@ void Slit::reposition() {
|
||||||
frame.x = head_x + head_w - frame.width - border_width*2;
|
frame.x = head_x + head_w - frame.width - border_width*2;
|
||||||
frame.y = head_y + head_h - frame.height - border_width*2;
|
frame.y = head_y + head_h - frame.height - border_width*2;
|
||||||
if (direction() == VERTICAL) {
|
if (direction() == VERTICAL) {
|
||||||
frame.x_hidden = head_x + head_w -
|
frame.x_hidden = head_x + head_w -
|
||||||
bevel_width - border_width;
|
bevel_width - border_width;
|
||||||
frame.y_hidden = frame.y;
|
frame.y_hidden = frame.y;
|
||||||
} else {
|
} else {
|
||||||
frame.x_hidden = frame.x;
|
frame.x_hidden = frame.x;
|
||||||
frame.y_hidden = head_y + head_h -
|
frame.y_hidden = head_y + head_h -
|
||||||
bevel_width - border_width;
|
bevel_width - border_width;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -924,12 +936,12 @@ void Slit::shutdown() {
|
||||||
void Slit::clientUp(SlitClient* client) {
|
void Slit::clientUp(SlitClient* client) {
|
||||||
if (!client || m_client_list.size() < 2)
|
if (!client || m_client_list.size() < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (client == m_client_list.front()) {
|
if (client == m_client_list.front()) {
|
||||||
cycleClientsUp();
|
cycleClientsUp();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SlitClients::iterator it = m_client_list.begin();
|
SlitClients::iterator it = m_client_list.begin();
|
||||||
for(it++; it != m_client_list.end(); it++) {
|
for(it++; it != m_client_list.end(); it++) {
|
||||||
if ((*it) == client) {
|
if ((*it) == client) {
|
||||||
|
@ -945,12 +957,12 @@ void Slit::clientUp(SlitClient* client) {
|
||||||
void Slit::clientDown(SlitClient* client) {
|
void Slit::clientDown(SlitClient* client) {
|
||||||
if (!client || m_client_list.size() < 2)
|
if (!client || m_client_list.size() < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (client == m_client_list.back()) {
|
if (client == m_client_list.back()) {
|
||||||
cycleClientsDown();
|
cycleClientsDown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SlitClients::reverse_iterator it = m_client_list.rbegin();
|
SlitClients::reverse_iterator it = m_client_list.rbegin();
|
||||||
for(it++; it != m_client_list.rend(); it++) {
|
for(it++; it != m_client_list.rend(); it++) {
|
||||||
if ((*it) == client) {
|
if ((*it) == client) {
|
||||||
|
@ -1000,13 +1012,13 @@ void Slit::handleEvent(XEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slit::buttonPressEvent(XButtonEvent &e) {
|
void Slit::buttonPressEvent(XButtonEvent &e) {
|
||||||
if (e.window != frame.window.window())
|
if (e.window != frame.window.window())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (e.button == Button3) {
|
if (e.button == Button3) {
|
||||||
if (! m_slitmenu.isVisible()) {
|
if (! m_slitmenu.isVisible()) {
|
||||||
int x = e.x_root - (m_slitmenu.width() / 2),
|
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)
|
if (x < 0)
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -1032,10 +1044,10 @@ void Slit::enterNotifyEvent(XCrossingEvent &) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isHidden()) {
|
if (isHidden()) {
|
||||||
if (! m_timer.isTiming())
|
if (! m_timer.isTiming())
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
} else {
|
} else {
|
||||||
if (m_timer.isTiming())
|
if (m_timer.isTiming())
|
||||||
m_timer.stop();
|
m_timer.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1046,12 +1058,12 @@ void Slit::leaveNotifyEvent(XCrossingEvent &ev) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isHidden()) {
|
if (isHidden()) {
|
||||||
if (m_timer.isTiming())
|
if (m_timer.isTiming())
|
||||||
m_timer.stop();
|
m_timer.stop();
|
||||||
} else {
|
} else {
|
||||||
if (! m_timer.isTiming()) {
|
if (! m_timer.isTiming()) {
|
||||||
// the menu is open, keep it firing until it closes
|
// the menu is open, keep it firing until it closes
|
||||||
if (m_slitmenu.isVisible())
|
if (m_slitmenu.isVisible())
|
||||||
m_timer.fireOnce(false);
|
m_timer.fireOnce(false);
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
}
|
}
|
||||||
|
@ -1072,7 +1084,7 @@ void Slit::configureRequestEvent(XConfigureRequestEvent &event) {
|
||||||
xwc.sibling = event.above;
|
xwc.sibling = event.above;
|
||||||
xwc.stack_mode = event.detail;
|
xwc.stack_mode = event.detail;
|
||||||
|
|
||||||
XConfigureWindow(FbTk::App::instance()->display(),
|
XConfigureWindow(FbTk::App::instance()->display(),
|
||||||
event.window, event.value_mask, &xwc);
|
event.window, event.value_mask, &xwc);
|
||||||
|
|
||||||
SlitClients::iterator it = m_client_list.begin();
|
SlitClients::iterator it = m_client_list.begin();
|
||||||
|
@ -1090,12 +1102,12 @@ void Slit::configureRequestEvent(XConfigureRequestEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reconf)
|
if (reconf)
|
||||||
reconfigure();
|
reconfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slit::exposeEvent(XExposeEvent &ev) {
|
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
|
// just the are that gets exposed
|
||||||
frame.window.clearArea(ev.x, ev.y, ev.width, ev.height);
|
frame.window.clearArea(ev.x, ev.y, ev.width, ev.height);
|
||||||
}
|
}
|
||||||
|
@ -1112,11 +1124,11 @@ void Slit::toggleHidden() {
|
||||||
if (doAutoHide()) {
|
if (doAutoHide()) {
|
||||||
if (!m_slitmenu.isVisible()) {
|
if (!m_slitmenu.isVisible()) {
|
||||||
m_timer.fireOnce(true);
|
m_timer.fireOnce(true);
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
if (!isHidden()) return;
|
if (!isHidden()) return;
|
||||||
|
|
||||||
m_hidden = ! m_hidden; // toggle hidden state
|
m_hidden = ! m_hidden; // toggle hidden state
|
||||||
if (isHidden())
|
if (isHidden())
|
||||||
frame.window.move(frame.x_hidden, frame.y_hidden);
|
frame.window.move(frame.x_hidden, frame.y_hidden);
|
||||||
|
@ -1130,18 +1142,18 @@ void Slit::loadClientList(const char *filename) {
|
||||||
|
|
||||||
// save filename so we can save client list later
|
// save filename so we can save client list later
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
std::string real_filename= FbTk::StringUtil::expandFilename(filename);
|
string real_filename= FbTk::StringUtil::expandFilename(filename);
|
||||||
|
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
if (stat(real_filename.c_str(), &buf) == 0) {
|
if (stat(real_filename.c_str(), &buf) == 0) {
|
||||||
std::ifstream file(real_filename.c_str());
|
ifstream file(real_filename.c_str());
|
||||||
std::string name;
|
string name;
|
||||||
while (! file.eof()) {
|
while (! file.eof()) {
|
||||||
name = "";
|
name = "";
|
||||||
std::getline(file, name); // get the entire line
|
getline(file, name); // get the entire line
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// remove whitespaces from start and end
|
// remove whitespaces from start and end
|
||||||
FbTk::StringUtil::removeFirstWhitespace(name);
|
FbTk::StringUtil::removeFirstWhitespace(name);
|
||||||
|
|
||||||
|
@ -1159,7 +1171,7 @@ void Slit::loadClientList(const char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slit::updateClientmenu() {
|
void Slit::updateClientmenu() {
|
||||||
if (screen().isShuttingdown())
|
if (screen().isShuttingdown())
|
||||||
return;
|
return;
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
|
||||||
|
@ -1183,9 +1195,9 @@ void Slit::updateClientmenu() {
|
||||||
|
|
||||||
m_clientlist_menu.insert(new FbTk::MenuSeparator());
|
m_clientlist_menu.insert(new FbTk::MenuSeparator());
|
||||||
FbTk::RefCount<FbTk::Command> savecmd(new FbTk::SimpleCommand<Slit>(*this, &Slit::saveClientList));
|
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,
|
SaveSlitList,
|
||||||
"Save SlitList", "Saves the current order in the slit"),
|
"Save SlitList", "Saves the current order in the slit"),
|
||||||
savecmd);
|
savecmd);
|
||||||
|
|
||||||
m_clientlist_menu.updateMenu();
|
m_clientlist_menu.updateMenu();
|
||||||
|
@ -1193,15 +1205,15 @@ void Slit::updateClientmenu() {
|
||||||
|
|
||||||
void Slit::saveClientList() {
|
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 = m_client_list.begin();
|
||||||
SlitClients::iterator it_end = m_client_list.end();
|
SlitClients::iterator it_end = m_client_list.end();
|
||||||
std::string prevName;
|
string prevName;
|
||||||
std::string name;
|
string name;
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
name = (*it)->matchName();
|
name = (*it)->matchName();
|
||||||
if (name != prevName)
|
if (name != prevName)
|
||||||
file << name.c_str() << std::endl;
|
file << name.c_str() << endl;
|
||||||
|
|
||||||
prevName = name;
|
prevName = name;
|
||||||
}
|
}
|
||||||
|
@ -1231,7 +1243,7 @@ void Slit::setupMenu() {
|
||||||
FbMenu *placement_menu = new FbMenu(m_screen.menuTheme(),
|
FbMenu *placement_menu = new FbMenu(m_screen.menuTheme(),
|
||||||
m_screen.imageControl(),
|
m_screen.imageControl(),
|
||||||
*m_screen.layerManager().getLayer(::Layer::MENU));
|
*m_screen.layerManager().getLayer(::Layer::MENU));
|
||||||
|
|
||||||
|
|
||||||
// setup base menu
|
// setup base menu
|
||||||
m_slitmenu.setLabel(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"));
|
m_slitmenu.setLabel(_FB_XTEXT(Slit, Slit, "Slit", "The Slit"));
|
||||||
|
@ -1258,17 +1270,17 @@ void Slit::setupMenu() {
|
||||||
*m_rc_auto_hide,
|
*m_rc_auto_hide,
|
||||||
save_and_reconfigure_slit));
|
save_and_reconfigure_slit));
|
||||||
|
|
||||||
m_slitmenu.insert(new BoolMenuItem(_FB_XTEXT(Common, MaximizeOver,"Maximize Over", "Maximize over this thing when maximizing"),
|
m_slitmenu.insert(new BoolMenuItem(_FB_XTEXT(Common, MaximizeOver,"Maximize Over", "Maximize over this thing when maximizing"),
|
||||||
*m_rc_maximize_over,
|
*m_rc_maximize_over,
|
||||||
save_and_reconfigure_slit));
|
save_and_reconfigure_slit));
|
||||||
|
|
||||||
// this saves resources and clears the slit window to update alpha value
|
// 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"),
|
new IntResMenuItem(_FB_XTEXT(Common, Alpha, "Alpha", "Transparency level"),
|
||||||
m_rc_alpha,
|
m_rc_alpha,
|
||||||
0, 255, m_slitmenu);
|
0, 255, m_slitmenu);
|
||||||
// setup command for alpha value
|
// 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));
|
RefCount<Command> alpha_cmd(new SimpleCommand<Slit>(*this, &Slit::updateAlpha));
|
||||||
alpha_macrocmd->add(saverc_cmd);
|
alpha_macrocmd->add(saverc_cmd);
|
||||||
alpha_macrocmd->add(alpha_cmd);
|
alpha_macrocmd->add(alpha_cmd);
|
||||||
|
@ -1277,7 +1289,7 @@ void Slit::setupMenu() {
|
||||||
|
|
||||||
m_slitmenu.insert(alpha_menuitem);
|
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,
|
*this,
|
||||||
save_and_reconfigure));
|
save_and_reconfigure));
|
||||||
m_slitmenu.insert(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"), &m_clientlist_menu);
|
m_slitmenu.insert(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"), &m_clientlist_menu);
|
||||||
|
@ -1289,7 +1301,7 @@ void Slit::setupMenu() {
|
||||||
m_layermenu->setInternalMenu();
|
m_layermenu->setInternalMenu();
|
||||||
m_clientlist_menu.setInternalMenu();
|
m_clientlist_menu.setInternalMenu();
|
||||||
m_slitmenu.setInternalMenu();
|
m_slitmenu.setInternalMenu();
|
||||||
|
|
||||||
typedef pair<FbTk::FbString, Slit::Placement> PlacementP;
|
typedef pair<FbTk::FbString, Slit::Placement> PlacementP;
|
||||||
typedef list<PlacementP> Placements;
|
typedef list<PlacementP> Placements;
|
||||||
Placements place_menu;
|
Placements place_menu;
|
||||||
|
@ -1304,7 +1316,7 @@ void Slit::setupMenu() {
|
||||||
place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Slit::TOPRIGHT));
|
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, RightCenter, "Right Center", "Right Center"), Slit::RIGHTCENTER));
|
||||||
place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Slit::BOTTOMRIGHT));
|
place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Slit::BOTTOMRIGHT));
|
||||||
|
|
||||||
|
|
||||||
// create items in sub menu
|
// create items in sub menu
|
||||||
for (size_t i=0; i<9; ++i) {
|
for (size_t i=0; i<9; ++i) {
|
||||||
|
@ -1316,9 +1328,9 @@ void Slit::setupMenu() {
|
||||||
placement_menu->setItemEnabled(i, false);
|
placement_menu->setItemEnabled(i, false);
|
||||||
} else {
|
} else {
|
||||||
placement_menu->insert(new PlaceSlitMenuItem(str, *this,
|
placement_menu->insert(new PlaceSlitMenuItem(str, *this,
|
||||||
placement,
|
placement,
|
||||||
save_and_reconfigure));
|
save_and_reconfigure));
|
||||||
|
|
||||||
}
|
}
|
||||||
place_menu.pop_front();
|
place_menu.pop_front();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,14 +26,16 @@
|
||||||
#include "FbTk/App.hh"
|
#include "FbTk/App.hh"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
#include <string>
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
ToolbarTheme::ToolbarTheme(int screen_num):
|
ToolbarTheme::ToolbarTheme(int screen_num):
|
||||||
FbTk::Theme(screen_num),
|
FbTk::Theme(screen_num),
|
||||||
m_toolbar(*this, "toolbar", "Toolbar"),
|
m_toolbar(*this, "toolbar", "Toolbar"),
|
||||||
m_border(*this, "toolbar", "Toolbar"),
|
m_border(*this, "toolbar", "Toolbar"),
|
||||||
m_bevel_width(*this, "toolbar.bevelWidth", "Toolbar.BevelWidth"),
|
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_height(*this, "toolbar.height", "Toolbar.Height"),
|
||||||
m_button_size(*this, "toolbar.button.size", "Toolbar.Button.Size") {
|
m_button_size(*this, "toolbar.button.size", "Toolbar.Button.Size") {
|
||||||
// set default value
|
// set default value
|
||||||
|
@ -48,9 +50,9 @@ ToolbarTheme::~ToolbarTheme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToolbarTheme::fallback(FbTk::ThemeItem_base &item) {
|
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");
|
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");
|
return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor");
|
||||||
} else if (item.name() == "toolbar.bevelWidth") {
|
} else if (item.name() == "toolbar.bevelWidth") {
|
||||||
return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "BevelWidth");
|
return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "BevelWidth");
|
||||||
|
|
|
@ -44,8 +44,16 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#endif
|
#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;
|
WinClient::TransientWaitMap WinClient::s_transient_wait;
|
||||||
|
|
||||||
|
@ -75,7 +83,7 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin):FbTk::Fb
|
||||||
m_mwm_hint(0),
|
m_mwm_hint(0),
|
||||||
m_focus_mode(F_PASSIVE),
|
m_focus_mode(F_PASSIVE),
|
||||||
m_diesig(*this), m_focussig(*this),
|
m_diesig(*this), m_focussig(*this),
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_strut(0) {
|
m_strut(0) {
|
||||||
updateWMProtocols();
|
updateWMProtocols();
|
||||||
updateBlackboxHints();
|
updateBlackboxHints();
|
||||||
|
@ -86,7 +94,7 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin):FbTk::Fb
|
||||||
updateTitle();
|
updateTitle();
|
||||||
updateIconTitle();
|
updateIconTitle();
|
||||||
Fluxbox::instance()->saveWindowSearch(win, this);
|
Fluxbox::instance()->saveWindowSearch(win, this);
|
||||||
if (window_group != None)
|
if (window_group != None)
|
||||||
Fluxbox::instance()->saveGroupSearch(window_group, this);
|
Fluxbox::instance()->saveGroupSearch(window_group, this);
|
||||||
|
|
||||||
// search for this in transient waiting list
|
// search for this in transient waiting list
|
||||||
|
@ -127,7 +135,7 @@ WinClient::~WinClient() {
|
||||||
transient_for->transientList().remove(this);
|
transient_for->transientList().remove(this);
|
||||||
transient_for = 0;
|
transient_for = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!transients.empty()) {
|
while (!transients.empty()) {
|
||||||
transients.back()->transient_for = 0;
|
transients.back()->transient_for = 0;
|
||||||
transients.pop_back();
|
transients.pop_back();
|
||||||
|
@ -158,8 +166,8 @@ WinClient::~WinClient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinClient::acceptsFocus() const {
|
bool WinClient::acceptsFocus() const {
|
||||||
return (m_focus_mode == F_LOCALLYACTIVE ||
|
return (m_focus_mode == F_LOCALLYACTIVE ||
|
||||||
m_focus_mode == F_PASSIVE ||
|
m_focus_mode == F_PASSIVE ||
|
||||||
m_focus_mode == F_GLOBALLYACTIVE && send_focus_message);
|
m_focus_mode == F_GLOBALLYACTIVE && send_focus_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,11 +230,11 @@ bool WinClient::getWMIconName(XTextProperty &textprop) const {
|
||||||
return XGetWMName(display(), window(), &textprop);
|
return XGetWMName(display(), window(), &textprop);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &WinClient::getWMClassName() const {
|
const string &WinClient::getWMClassName() const {
|
||||||
return m_instance_name;
|
return m_instance_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &WinClient::getWMClassClass() const {
|
const string &WinClient::getWMClassClass() const {
|
||||||
return m_class_name;
|
return m_class_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,15 +244,15 @@ void WinClient::updateWMClassHint() {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<"WinClient: Failed to read class hint!"<<endl;
|
cerr<<"WinClient: Failed to read class hint!"<<endl;
|
||||||
#endif //DEBUG
|
#endif //DEBUG
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (ch.res_name != 0) {
|
if (ch.res_name != 0) {
|
||||||
m_instance_name = const_cast<char *>(ch.res_name);
|
m_instance_name = const_cast<char *>(ch.res_name);
|
||||||
XFree(ch.res_name);
|
XFree(ch.res_name);
|
||||||
ch.res_name = 0;
|
ch.res_name = 0;
|
||||||
} else
|
} else
|
||||||
m_instance_name = "";
|
m_instance_name = "";
|
||||||
|
|
||||||
if (ch.res_class != 0) {
|
if (ch.res_class != 0) {
|
||||||
m_class_name = const_cast<char *>(ch.res_class);
|
m_class_name = const_cast<char *>(ch.res_class);
|
||||||
XFree(ch.res_class);
|
XFree(ch.res_class);
|
||||||
|
@ -266,7 +274,7 @@ void WinClient::updateTransientInfo() {
|
||||||
if (transientFor() != 0) {
|
if (transientFor() != 0) {
|
||||||
transientFor()->transientList().remove(this);
|
transientFor()->transientList().remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
transient_for = 0;
|
transient_for = 0;
|
||||||
// determine if this is a transient window
|
// determine if this is a transient window
|
||||||
Window win = 0;
|
Window win = 0;
|
||||||
|
@ -284,24 +292,24 @@ void WinClient::updateTransientInfo() {
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win != None && m_win->screen().rootWindow() == win) {
|
if (win != None && m_win->screen().rootWindow() == win) {
|
||||||
// transient for root window... = transient for group
|
// transient for root window... = transient for group
|
||||||
// I don't think we are group-aware yet
|
// I don't think we are group-aware yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
transient_for = Fluxbox::instance()->searchWindow(win);
|
transient_for = Fluxbox::instance()->searchWindow(win);
|
||||||
// if we did not find a transient WinClient but still
|
// 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
|
// X transient_for window in a waiting list and update this clients transient
|
||||||
// list later when the transient_for has a Winclient
|
// list later when the transient_for has a Winclient
|
||||||
if (!transient_for) {
|
if (!transient_for) {
|
||||||
// We might also already waiting for an old transient_for;
|
// We might also already waiting for an old transient_for;
|
||||||
//
|
//
|
||||||
// this call fixes issue 2:
|
// 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)
|
// (see comment in WinClient.hh)
|
||||||
//
|
//
|
||||||
removeTransientFromWaitingList();
|
removeTransientFromWaitingList();
|
||||||
|
@ -335,11 +343,11 @@ void WinClient::updateTransientInfo() {
|
||||||
|
|
||||||
|
|
||||||
void WinClient::updateTitle() {
|
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
|
// 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
|
// 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
|
// TODO: - find out why this mostly happens when using xft-fonts
|
||||||
// - why other windowmanagers (pekwm/pwm3/openbox etc) are
|
// - why other windowmanagers (pekwm/pwm3/openbox etc) are
|
||||||
// also influenced
|
// also influenced
|
||||||
|
@ -492,7 +500,7 @@ void WinClient::updateWMHints() {
|
||||||
m_focus_mode = F_NOINPUT;
|
m_focus_mode = F_NOINPUT;
|
||||||
}
|
}
|
||||||
} else // InputHint not present: ignoring send_focus_message and assuming F_PASSIVE
|
} 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)
|
if (wmhint->flags & StateHint)
|
||||||
initial_state = wmhint->initial_state;
|
initial_state = wmhint->initial_state;
|
||||||
|
@ -626,7 +634,7 @@ void WinClient::setGroupLeftWindow(Window win) {
|
||||||
if (m_screen.isShuttingdown())
|
if (m_screen.isShuttingdown())
|
||||||
return;
|
return;
|
||||||
Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False);
|
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);
|
PropModeReplace, (unsigned char *) &win, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +680,7 @@ bool WinClient::validateClient() const {
|
||||||
|
|
||||||
XEvent e;
|
XEvent e;
|
||||||
if (( XCheckTypedWindowEvent(display(), window(), DestroyNotify, &e) ||
|
if (( XCheckTypedWindowEvent(display(), window(), DestroyNotify, &e) ||
|
||||||
XCheckTypedWindowEvent(display(), window(), UnmapNotify, &e))
|
XCheckTypedWindowEvent(display(), window(), UnmapNotify, &e))
|
||||||
&& XPutBackEvent(display(), &e)) {
|
&& XPutBackEvent(display(), &e)) {
|
||||||
Fluxbox::instance()->ungrab();
|
Fluxbox::instance()->ungrab();
|
||||||
return false;
|
return false;
|
||||||
|
@ -681,7 +689,7 @@ bool WinClient::validateClient() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinClient::setStrut(Strut *strut) {
|
void WinClient::setStrut(Strut *strut) {
|
||||||
clearStrut();
|
clearStrut();
|
||||||
m_strut = strut;
|
m_strut = strut;
|
||||||
}
|
}
|
||||||
|
@ -736,14 +744,14 @@ void WinClient::updateWMProtocols() {
|
||||||
Note that its slightly simplified in that only the
|
Note that its slightly simplified in that only the
|
||||||
line gradient is given - this is because for aspect
|
line gradient is given - this is because for aspect
|
||||||
ratios, we always have the line going through the origin
|
ratios, we always have the line going through the origin
|
||||||
|
|
||||||
* Based on this formula:
|
* Based on this formula:
|
||||||
http://astronomy.swin.edu.au/~pbourke/geometry/pointline/
|
http://astronomy.swin.edu.au/~pbourke/geometry/pointline/
|
||||||
|
|
||||||
Note that a gradient from origin goes through ( grad , 1 )
|
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 point_x, double point_y,
|
||||||
double gradient) {
|
double gradient) {
|
||||||
double u = (point_x * gradient + point_y) /
|
double u = (point_x * gradient + point_y) /
|
||||||
|
@ -763,13 +771,13 @@ void closestPointToLine(double &ret_x, double &ret_y,
|
||||||
*
|
*
|
||||||
* See ICCCM section 4.1.2.3
|
* 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 *display_width, int *display_height) {
|
||||||
|
|
||||||
int i = width, j = height;
|
int i = width, j = height;
|
||||||
|
|
||||||
// Check minimum size
|
// Check minimum size
|
||||||
if (width < 0 || width < static_cast<signed>(min_width))
|
if (width < 0 || width < static_cast<signed>(min_width))
|
||||||
width = min_width;
|
width = min_width;
|
||||||
|
|
||||||
if (height < 0 || height < static_cast<signed>(min_height))
|
if (height < 0 || height < static_cast<signed>(min_height))
|
||||||
|
@ -783,8 +791,8 @@ void WinClient::applySizeHints(int &width, int &height,
|
||||||
height = max_height;
|
height = max_height;
|
||||||
|
|
||||||
// we apply aspect ratios before incrementals
|
// we apply aspect ratios before incrementals
|
||||||
// Too difficult to exactly satisfy both incremental+aspect
|
// Too difficult to exactly satisfy both incremental+aspect
|
||||||
// in most situations
|
// in most situations
|
||||||
// (they really shouldn't happen at the same time anyway).
|
// (they really shouldn't happen at the same time anyway).
|
||||||
|
|
||||||
/* aspect ratios are applied exclusive to the base_width
|
/* aspect ratios are applied exclusive to the base_width
|
||||||
|
@ -809,11 +817,11 @@ void WinClient::applySizeHints(int &width, int &height,
|
||||||
double widthd = static_cast<double>(width - base_width);
|
double widthd = static_cast<double>(width - base_width);
|
||||||
double heightd = static_cast<double>(height - base_height);
|
double heightd = static_cast<double>(height - base_height);
|
||||||
|
|
||||||
double min = static_cast<double>(min_aspect_x) /
|
double min = static_cast<double>(min_aspect_x) /
|
||||||
static_cast<double>(min_aspect_y);
|
static_cast<double>(min_aspect_y);
|
||||||
|
|
||||||
double max = static_cast<double>(max_aspect_x) /
|
double max = static_cast<double>(max_aspect_x) /
|
||||||
static_cast<double>(max_aspect_y);
|
static_cast<double>(max_aspect_y);
|
||||||
|
|
||||||
double actual = widthd / heightd;
|
double actual = widthd / heightd;
|
||||||
|
|
||||||
|
@ -836,7 +844,7 @@ void WinClient::applySizeHints(int &width, int &height,
|
||||||
|
|
||||||
// enforce incremental size limits, wrt base size
|
// enforce incremental size limits, wrt base size
|
||||||
// only calculate this if we really need to
|
// 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);
|
static_cast<signed>(width_inc);
|
||||||
width = i*static_cast<signed>(width_inc) +
|
width = i*static_cast<signed>(width_inc) +
|
||||||
static_cast<signed>(base_width);
|
static_cast<signed>(base_width);
|
||||||
|
@ -857,9 +865,9 @@ void WinClient::removeTransientFromWaitingList() {
|
||||||
|
|
||||||
// holds the windows that dont have empty
|
// holds the windows that dont have empty
|
||||||
// transient waiting list
|
// 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
|
// have a large transient waiting list the time spent here is neglectable
|
||||||
TransientWaitMap::iterator t_it = s_transient_wait.begin();
|
TransientWaitMap::iterator t_it = s_transient_wait.begin();
|
||||||
TransientWaitMap::iterator t_it_end = s_transient_wait.end();
|
TransientWaitMap::iterator t_it_end = s_transient_wait.end();
|
||||||
|
@ -872,8 +880,8 @@ void WinClient::removeTransientFromWaitingList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// erase empty waiting lists
|
// erase empty waiting lists
|
||||||
std::list<Window>::iterator it = remove_list.begin();
|
list<Window>::iterator it = remove_list.begin();
|
||||||
std::list<Window>::iterator it_end = remove_list.end();
|
list<Window>::iterator it_end = remove_list.end();
|
||||||
for (; it != it_end; ++it)
|
for (; it != it_end; ++it)
|
||||||
s_transient_wait.erase(*it);
|
s_transient_wait.erase(*it);
|
||||||
}
|
}
|
||||||
|
|
51
src/main.cc
51
src/main.cc
|
@ -59,8 +59,21 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
using namespace std;
|
using std::cout;
|
||||||
void showInfo(ostream &ostr) {
|
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;
|
_FB_USES_NLS;
|
||||||
ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl;
|
ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl;
|
||||||
|
|
||||||
|
@ -73,7 +86,7 @@ void showInfo(ostream &ostr) {
|
||||||
ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl;
|
ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl;
|
||||||
#endif // __fluxbox_compiler
|
#endif // __fluxbox_compiler
|
||||||
#ifdef __fluxbox_compiler_version
|
#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
|
#endif // __fluxbox_compiler_version
|
||||||
|
|
||||||
ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl;
|
ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl;
|
||||||
|
@ -177,9 +190,9 @@ void showInfo(ostream &ostr) {
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
std::string session_display = "";
|
string session_display = "";
|
||||||
std::string rc_file;
|
string rc_file;
|
||||||
std::string log_filename;
|
string log_filename;
|
||||||
|
|
||||||
FbTk::NLSInit("fluxbox.cat");
|
FbTk::NLSInit("fluxbox.cat");
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
@ -191,7 +204,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if ((++i) >= argc) {
|
if ((++i) >= argc) {
|
||||||
cerr<<_FB_CONSOLETEXT(main, RCRequiresArg,
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +221,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
session_display = argv[i];
|
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()))) {
|
if (putenv(const_cast<char *>(display_env.c_str()))) {
|
||||||
cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv,
|
cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv,
|
||||||
"warning: couldn't set environment variable 'DISPLAY'",
|
"warning: couldn't set environment variable 'DISPLAY'",
|
||||||
|
@ -252,7 +265,7 @@ int main(int argc, char **argv) {
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
_chdir2(getenv("X11ROOT"));
|
_chdir2(getenv("X11ROOT"));
|
||||||
#endif // __EMX__
|
#endif // __EMX__
|
||||||
std::auto_ptr<Fluxbox> fluxbox;
|
auto_ptr<Fluxbox> fluxbox;
|
||||||
int exitcode=EXIT_FAILURE;
|
int exitcode=EXIT_FAILURE;
|
||||||
|
|
||||||
streambuf *outbuf = 0;
|
streambuf *outbuf = 0;
|
||||||
|
@ -279,17 +292,17 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
exitcode = EXIT_SUCCESS;
|
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;
|
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;
|
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl;
|
||||||
} catch (std::bad_cast &bc) {
|
} catch (bad_cast &bc) {
|
||||||
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl;
|
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl;
|
||||||
} catch (std::bad_alloc &ba) {
|
} catch (bad_alloc &ba) {
|
||||||
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl;
|
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;
|
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;
|
cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl;
|
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl;
|
||||||
|
@ -297,11 +310,11 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool restarting = false;
|
bool restarting = false;
|
||||||
std::string restart_argument;
|
string restart_argument;
|
||||||
|
|
||||||
if (fluxbox.get()) {
|
if (fluxbox.get()) {
|
||||||
restarting = fluxbox->isRestarting();
|
restarting = fluxbox->isRestarting();
|
||||||
restart_argument = fluxbox->getRestartArgument();
|
restart_argument = fluxbox->getRestartArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy fluxbox
|
// destroy fluxbox
|
||||||
|
|
Loading…
Reference in a new issue