Do not abort if the Aurorae theme could not be loaded. So a missing theme will result in a translucent decoration and not in a crashing kwin.
svn path=/trunk/KDE/kdebase/workspace/; revision=1068533
This commit is contained in:
parent
82093ae630
commit
c92e314c9f
2 changed files with 16 additions and 4 deletions
|
@ -36,6 +36,7 @@ namespace Aurorae
|
||||||
AuroraeFactory::AuroraeFactory()
|
AuroraeFactory::AuroraeFactory()
|
||||||
: QObject()
|
: QObject()
|
||||||
, KDecorationFactoryUnstable()
|
, KDecorationFactoryUnstable()
|
||||||
|
, m_valid(false)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -55,7 +56,7 @@ void AuroraeFactory::init()
|
||||||
}
|
}
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
kDebug(1216) << "Could not find decoration svg: aborting";
|
kDebug(1216) << "Could not find decoration svg: aborting";
|
||||||
abort();
|
return;
|
||||||
}
|
}
|
||||||
m_frame.setImagePath(path);
|
m_frame.setImagePath(path);
|
||||||
m_frame.setCacheAllRenderedFrames(true);
|
m_frame.setCacheAllRenderedFrames(true);
|
||||||
|
@ -73,6 +74,7 @@ void AuroraeFactory::init()
|
||||||
initButtonFrame("help");
|
initButtonFrame("help");
|
||||||
|
|
||||||
readThemeConfig();
|
readThemeConfig();
|
||||||
|
m_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuroraeFactory::readThemeConfig()
|
void AuroraeFactory::readThemeConfig()
|
||||||
|
@ -263,7 +265,7 @@ void AuroraeButton::animationFinished(int id)
|
||||||
void AuroraeButton::paintEvent(QPaintEvent *event)
|
void AuroraeButton::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
if (decoration()->isPreview()) {
|
if (decoration()->isPreview() || !AuroraeFactory::instance()->isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,6 +559,9 @@ bool AuroraeClient::decorationBehaviour(DecorationBehaviour behavior) const
|
||||||
int AuroraeClient::layoutMetric(LayoutMetric lm, bool respectWindowState,
|
int AuroraeClient::layoutMetric(LayoutMetric lm, bool respectWindowState,
|
||||||
const KCommonDecorationButton *button) const
|
const KCommonDecorationButton *button) const
|
||||||
{
|
{
|
||||||
|
if (!AuroraeFactory::instance()->isValid()) {
|
||||||
|
return KCommonDecoration::layoutMetric(lm, respectWindowState, button);
|
||||||
|
}
|
||||||
bool maximized = maximizeMode() == MaximizeFull &&
|
bool maximized = maximizeMode() == MaximizeFull &&
|
||||||
!options()->moveResizeMaximizedWindows();
|
!options()->moveResizeMaximizedWindows();
|
||||||
const ThemeConfig &conf = AuroraeFactory::instance()->themeConfig();
|
const ThemeConfig &conf = AuroraeFactory::instance()->themeConfig();
|
||||||
|
@ -725,7 +730,7 @@ KCommonDecorationButton *AuroraeClient::createButton(ButtonType type)
|
||||||
void AuroraeClient::paintEvent(QPaintEvent *event)
|
void AuroraeClient::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
if (isPreview()) {
|
if (isPreview() || !AuroraeFactory::instance()->isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool maximized = maximizeMode() == MaximizeFull &&
|
bool maximized = maximizeMode() == MaximizeFull &&
|
||||||
|
@ -843,6 +848,9 @@ void AuroraeClient::generateTextPixmap(QPixmap& pixmap, bool active)
|
||||||
{
|
{
|
||||||
QPainter painter(&pixmap);
|
QPainter painter(&pixmap);
|
||||||
pixmap.fill(Qt::transparent);
|
pixmap.fill(Qt::transparent);
|
||||||
|
if (!AuroraeFactory::instance()->isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const ThemeConfig &conf = AuroraeFactory::instance()->themeConfig();
|
const ThemeConfig &conf = AuroraeFactory::instance()->themeConfig();
|
||||||
painter.setFont(options()->font(active));
|
painter.setFont(options()->font(active));
|
||||||
if (conf.useTextShadow()) {
|
if (conf.useTextShadow()) {
|
||||||
|
@ -900,7 +908,7 @@ void AuroraeClient::updateWindowShape()
|
||||||
int w=widget()->width();
|
int w=widget()->width();
|
||||||
int h=widget()->height();
|
int h=widget()->height();
|
||||||
|
|
||||||
if (maximized || compositingActive()) {
|
if (maximized || compositingActive() || !AuroraeFactory::instance()->isValid()) {
|
||||||
QRegion mask(0,0,w,h);
|
QRegion mask(0,0,w,h);
|
||||||
setMask(mask);
|
setMask(mask);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
ThemeConfig &themeConfig() {
|
ThemeConfig &themeConfig() {
|
||||||
return m_themeConfig;
|
return m_themeConfig;
|
||||||
}
|
}
|
||||||
|
bool isValid() const {
|
||||||
|
return m_valid;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AuroraeFactory();
|
AuroraeFactory();
|
||||||
|
@ -68,6 +71,7 @@ private:
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
QHash< QString, Plasma::FrameSvg* > m_buttons;
|
QHash< QString, Plasma::FrameSvg* > m_buttons;
|
||||||
|
bool m_valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AuroraeButton : public KCommonDecorationButton
|
class AuroraeButton : public KCommonDecorationButton
|
||||||
|
|
Loading…
Reference in a new issue