Merge r632199 from kwin_composite.

svn path=/trunk/KDE/kdebase/workspace/; revision=632843
This commit is contained in:
Luboš Luňák 2007-02-12 13:29:36 +00:00
parent 559f90a06a
commit 36afaf2efc
6 changed files with 90 additions and 92 deletions

View file

@ -9,7 +9,7 @@
* Thin frame in fixed size windows, titlebar gradient support, accessibility
* improvements, customizable menu double click action and button hover
* effects are
* Copyright (c) 2003,2004 Luciano Montanaro <mikelima@cirulla.net>
* Copyright (c) 2003, 2004, 2006 Luciano Montanaro <mikelima@cirulla.net>
*/
#include "b2client.h"
@ -144,10 +144,10 @@ static void read_config(B2ClientFactory *f)
thickness = 8;
break;
case KDecoration::BorderHuge:
thickness = 12;
break;
case KDecoration::BorderVeryHuge:
case KDecoration::BorderOversized:
thickness = 12;
break;
case KDecoration::BorderNormal:
default:
thickness = 4;
@ -199,37 +199,37 @@ static void create_pixmaps()
for (i = 0; i < NUM_PIXMAPS; i++) {
switch (i / NumStates) {
case P_MAX: // will be initialized by copying P_CLOSE
case P_RESIZE:
pixmap[i] = new QPixmap();
break;
case P_ICONIFY:
pixmap[i] = new QPixmap(10, 10);
break;
case P_SHADE:
case P_CLOSE:
pixmap[i] = new QPixmap(bsize, bsize);
break;
default:
pixmap[i] = new QPixmap(16, 16);
break;
case P_MAX: // will be initialized by copying P_CLOSE
case P_RESIZE:
pixmap[i] = new QPixmap();
break;
case P_ICONIFY:
pixmap[i] = new QPixmap(10, 10);
break;
case P_SHADE:
case P_CLOSE:
pixmap[i] = new QPixmap(bsize, bsize);
break;
default:
pixmap[i] = new QPixmap(16, 16);
break;
}
}
// there seems to be no way to load X bitmaps from data properly, so
// we need to create new ones for each mask :P
QBitmap pinupMask = QBitmap::fromData(QSize( 16, 16 ), pinup_mask_bits);
QBitmap pinupMask = QBitmap::fromData(QSize(16, 16), pinup_mask_bits);
PIXMAP_A(P_PINUP)->setMask(pinupMask);
PIXMAP_I(P_PINUP)->setMask(pinupMask);
QBitmap pindownMask = QBitmap::fromData(QSize( 16, 16 ), pindown_mask_bits);
QBitmap pindownMask = QBitmap::fromData(QSize(16, 16), pindown_mask_bits);
PIXMAP_AD(P_PINUP)->setMask(pindownMask);
PIXMAP_ID(P_PINUP)->setMask(pindownMask);
QBitmap menuMask = QBitmap::fromData(QSize( 16, 16 ), menu_mask_bits);
QBitmap menuMask = QBitmap::fromData(QSize(16, 16), menu_mask_bits);
for (i = 0; i < NumStates; i++)
pixmap[P_MENU * NumStates + i]->setMask(menuMask);
QBitmap helpMask = QBitmap::fromData(QSize( 16, 16 ), help_mask_bits);
QBitmap helpMask = QBitmap::fromData(QSize(16, 16), help_mask_bits);
for (i = 0; i < NumStates; i++)
pixmap[P_HELP * NumStates + i]->setMask(helpMask);
@ -309,10 +309,9 @@ bool B2ClientFactory::reset(unsigned long changed)
return needsReset;
}
bool B2ClientFactory::supports( Ability ability )
bool B2ClientFactory::supports(Ability ability)
{
switch( ability )
{
switch (ability) {
case AbilityAnnounceButtons:
case AbilityButtonMenu:
case AbilityButtonOnAllDesktops:
@ -416,7 +415,7 @@ void B2Client::init()
}
// titlebar
g->addItem( new QSpacerItem( 0, buttonSize + 4 ), 0, 0 );
g->addItem( new QSpacerItem(0, buttonSize + 4), 0, 0 );
titlebar = new B2Titlebar(this);
titlebar->setMinimumWidth(buttonSize + 4);
@ -650,7 +649,7 @@ void B2Client::paintEvent(QPaintEvent* e)
qDrawShadePanel(&p, 1, t.bottom() - thickness + 2,
width() - 2, fHeight - 2 - bb + thickness, fillColor, false);
if (thickness == 4) {
p.setPen(fillColor.color( QPalette::Background ) );
p.setPen(fillColor.color(QPalette::Background));
p.drawRect(thickness - 2, t.bottom() - 1,
width() - 2 * (thickness - 2), fHeight + 4 - bDepth);
} else if (thickness > 4) {
@ -686,12 +685,12 @@ void B2Client::paintEvent(QPaintEvent* e)
p.fillRect(hx + 1, height() - thickness - 3,
hw - 2, thickness + 2, fillBrush);
p.setPen(fillColor.color( QPalette::Dark ));
p.setPen(fillColor.color(QPalette::Dark));
p.drawLine(width() - 2, height() - thickness - 4,
width() - 2, height() - 2);
p.drawLine(hx + 1, height() - 2, width() - 2, height() - 2);
p.setPen(fillColor.color( QPalette::Light ));
p.setPen(fillColor.color(QPalette::Light));
p.drawLine(hx + 1, height() - thickness - 2,
hx + 1, height() - 3);
p.drawLine(hx + 1, height() - thickness - 3,
@ -729,7 +728,7 @@ void B2Client::doShape()
}
if (t.right() < width() - 1) {
mask -= QRect(width() - 1,
t.height() - thickness, 1, 1); //top right point
t.height() - thickness, 1, 1); // top right point
mask -= QRect(t.right() + 1, 0,
width() - t.right() - 1, t.height() - thickness);
}
@ -856,7 +855,7 @@ void B2Client::activeChange()
titlebar->repaint();
QColor c = options()->palette(
KDecoration::ColorTitleBar, isActive()).color(QPalette::Active, QPalette::Button);
KDecoration::ColorTitleBar, isActive()).color(QPalette::Active, QPalette::Button);
for (int i = 0; i < BtnCount; i++)
if (button[i]) {
@ -872,7 +871,7 @@ void B2Client::shadeChange()
g->activate();
doShape();
if (B2Button *b = button[BtnShade]) {
b->setToolTip( isSetShade() ? i18n("Unshade") : i18n("Shade"));
b->setToolTip(isSetShade() ? i18n("Unshade") : i18n("Shade"));
}
}
@ -940,7 +939,7 @@ void B2Client::unobscureTitlebar()
return;
}
in_unobs = 1;
QRegion reg(QRect(0,0,width(), buttonSize + 4));
QRegion reg(QRect(0, 0, width(), buttonSize + 4));
reg = unobscuredRegion(reg);
if (!reg.isEmpty()) {
// there is at least _one_ pixel from our title area, which is not
@ -955,8 +954,8 @@ void B2Client::unobscureTitlebar()
static void redraw_pixmaps()
{
int i;
QPalette aGrp = options()->palette(KDecoration::ColorButtonBg, true);
QPalette iGrp = options()->palette(KDecoration::ColorButtonBg, false);
QPalette aGrp = options()->palette(KDecoration::ColorButtonBg, true);
QPalette iGrp = options()->palette(KDecoration::ColorButtonBg, false);
// close
drawB2Rect(PIXMAP_A(P_CLOSE), aGrp.color( QPalette::Button ), false);
@ -1137,10 +1136,10 @@ bool B2Client::drawbound(const QRect& geom, bool clear)
if (barRight > geom.right()) barRight = geom.right();
// line width is 5 pixels, so compensate for the 2 outer pixels (#88657)
QRect g = geom;
g.setLeft( g.left() + 2 );
g.setTop( g.top() + 2 );
g.setRight( g.right() - 2 );
g.setBottom( g.bottom() - 2 );
g.setLeft(g.left() + 2);
g.setTop(g.top() + 2);
g.setRight(g.right() - 2);
g.setBottom(g.bottom() - 2);
frameTop += 2;
barLeft += 2;
barRight -= 2;
@ -1209,7 +1208,7 @@ B2Button::B2Button(B2Client *_client, QWidget *parent,
client = _client;
useMiniIcon = false;
setFixedSize(buttonSize, buttonSize);
this->setToolTip( tip);
this->setToolTip(tip);
}
@ -1232,7 +1231,8 @@ void B2Button::drawButton(QPainter *p)
p->fillRect(rect(), bg);
}
if (useMiniIcon) {
QPixmap miniIcon = client->icon().pixmap(style()->pixelMetric( QStyle::PM_SmallIconSize ),
QPixmap miniIcon = client->icon().pixmap(
style()->pixelMetric(QStyle::PM_SmallIconSize),
client->isActive() ? QIcon::Normal : QIcon::Disabled);
p->drawPixmap((width() - miniIcon.width()) / 2,
(height() - miniIcon.height()) / 2, miniIcon);
@ -1386,7 +1386,7 @@ void B2Titlebar::resizeEvent(QResizeEvent *)
void B2Titlebar::paintEvent(QPaintEvent *)
{
if(client->isActive())
if (client->isActive())
bitBlt(this, 0, 0, &titleBuffer, 0, 0, titleBuffer.width(),
titleBuffer.height());
else {
@ -1436,6 +1436,6 @@ void B2Titlebar::mouseMoveEvent(QMouseEvent * e)
#include "b2client.moc"
// vim: sw=4
// vim: sw=4 ts=8
#endif // CLIENTS/B2/B2CLIENT.CPP

View file

@ -32,7 +32,6 @@
#include <kglobal.h>
#include "config.h"
#include "configdialog.h"
PlastikConfig::PlastikConfig(KConfig* config, QWidget* parent)
: QObject(parent), m_config(0), m_dialog(0)
@ -63,8 +62,8 @@ PlastikConfig::PlastikConfig(KConfig* config, QWidget* parent)
PlastikConfig::~PlastikConfig()
{
if (m_dialog) delete m_dialog;
if (m_config) delete m_config;
delete m_dialog;
delete m_config;
}
void PlastikConfig::load(KConfig*)

View file

@ -530,8 +530,11 @@ void KWinDecorationModule::save()
emit pluginSave( &kwinConfig );
kwinConfig.sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}

View file

@ -39,6 +39,7 @@
#include <QVBoxLayout>
#include <kmessagebox.h>
#include <qlabel.h>
#include <klocale.h>
#include <kcolorbutton.h>
#include <kconfig.h>
@ -56,7 +57,6 @@
#include "windows.h"
// kwin config keywords
#define KWIN_FOCUS "FocusPolicy"
#define KWIN_PLACEMENT "Placement"
@ -496,8 +496,10 @@ void KFocusConfig::save( void )
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -688,7 +690,7 @@ void KAdvancedConfig::load( void )
setShadeHover(config->readEntry(KWIN_SHADEHOVER, false));
setShadeHoverInterval(config->readEntry(KWIN_SHADEHOVER_INTERVAL, 250));
setElectricBorders(config->readEntry(KWM_ELECTRIC_BORDER, false));
setElectricBorders(config->readEntry(KWM_ELECTRIC_BORDER, 0));
setElectricBorderDelay(config->readEntry(KWM_ELECTRIC_BORDER_DELAY, 150));
// setFocusStealing( config->readEntry(KWIN_FOCUS_STEALING, 2 ));
@ -723,8 +725,11 @@ void KAdvancedConfig::save( void )
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -1187,8 +1192,10 @@ void KMovingConfig::save( void )
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -1254,6 +1261,8 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, co
"And if your GPU provides hardware-accelerated Xrender support (mainly nVidia cards):<br><br>"
"<i>Option \"RenderAccel\" \"true\"</i><br>"
"In <i>Section \"Device\"</i></qt>"), this);
label->setOpenExternalLinks(true);
label->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
lay->addWidget(label);
}
else
@ -1474,16 +1483,18 @@ void KTranslucencyConfig::load( void )
if (!kompmgrAvailable_)
return;
config->setGroup( "Translucency" );
config->setGroup( "Notification Messages" );
useTranslucency->setChecked(config->readEntry("UseTranslucency", false));
activeWindowTransparency->setChecked(config->readEntry("TranslucentActiveWindows", false));
inactiveWindowTransparency->setChecked(config->readEntry("TranslucentInactiveWindows", true));
movingWindowTransparency->setChecked(config->readEntry("TranslucentMovingWindows", false));
removeShadowsOnMove->setChecked(config->readEntry("RemoveShadowsOnMove", false));
removeShadowsOnResize->setChecked(config->readEntry("RemoveShadowsOnResize", false));
dockWindowTransparency->setChecked(config->readEntry("TranslucentDocks", true));
keepAboveAsActive->setChecked(config->readEntry("TreatKeepAboveAsActive", true));
onlyDecoTranslucent->setChecked(config->readEntry("OnlyDecoTranslucent", false));
config->setGroup( "Translucency" );
activeWindowTransparency->setChecked(config->readEntry("TranslucentActiveWindows", false);
inactiveWindowTransparency->setChecked(config->readEntry("TranslucentInactiveWindows", true);
movingWindowTransparency->setChecked(config->readEntry("TranslucentMovingWindows", false);
removeShadowsOnMove->setChecked(config->readEntry("RemoveShadowsOnMove", false);
removeShadowsOnResize->setChecked(config->readEntry("RemoveShadowsOnResize", false);
dockWindowTransparency->setChecked(config->readEntry("TranslucentDocks", true);
keepAboveAsActive->setChecked(config->readEntry("TreatKeepAboveAsActive", true);
onlyDecoTranslucent->setChecked(config->readEntry("OnlyDecoTranslucent", false);
activeWindowOpacity->setValue(config->readEntry("ActiveWindowOpacity",100));
inactiveWindowOpacity->setValue(config->readEntry("InactiveWindowOpacity",75));
@ -1535,8 +1546,10 @@ void KTranslucencyConfig::save( void )
{
if (!kompmgrAvailable_)
return;
config->setGroup( "Translucency" );
config->setGroup( "Notification Messages" );
config->writeEntry("UseTranslucency",useTranslucency->isChecked());
config->setGroup( "Translucency" );
config->writeEntry("TranslucentActiveWindows",activeWindowTransparency->isChecked());
config->writeEntry("TranslucentInactiveWindows",inactiveWindowTransparency->isChecked());
config->writeEntry("TranslucentMovingWindows",movingWindowTransparency->isChecked());
@ -1586,8 +1599,11 @@ void KTranslucencyConfig::save( void )
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}

View file

@ -145,15 +145,15 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
QFont old_activeFontSmall = activeFontSmall;
QFont old_inactiveFontSmall = inactiveFontSmall;
QFont activeFontGuess = KGlobalSettings::generalFont();
activeFontGuess.setBold(true);
activeFontGuess.setPixelSize(12);
QFont activeFontGuess = KGlobalSettings::windowTitleFont();
activeFont = config->readEntry("activeFont", activeFontGuess);
inactiveFont = config->readEntry("inactiveFont", activeFont);
activeFontSmall = activeFont;
#ifdef __GNUC__
#warning KDE4 : is it useful ? ( temporary hack )
#endif
// activeFontSmall.setPointSize(activeFont.pointSize() - 2 > 0 ? activeFont.pointSize() - 2 : activeFont.pointSize()+1 );
activeFontSmall = config->readEntry("activeFontSmall", activeFontSmall);
inactiveFontSmall = config->readEntry("inactiveFontSmall", activeFontSmall);

View file

@ -174,8 +174,9 @@ unsigned long Options::updateSettings()
CmdAllWheel = mouseWheelCommand(config->readEntry("CommandAllWheel","Nothing"));
//translucency settings - TODO
config->setGroup( "Notification Messages" );
useTranslucency = config->readEntry("UseTranslucency", false);
config->setGroup( "Translucency");
useTranslucency = config->readEntry("UseTranslucency", true);
translucentActiveWindows = config->readEntry("TranslucentActiveWindows", false);
activeWindowOpacity = uint((config->readEntry("ActiveWindowOpacity", 100)/100.0)*0xFFFFFFFF);
translucentInactiveWindows = config->readEntry("TranslucentInactiveWindows", false);
@ -194,27 +195,6 @@ unsigned long Options::updateSettings()
removeShadowsOnResize = config->readEntry("RemoveShadowsOnResize", true);
onlyDecoTranslucent = config->readEntry("OnlyDecoTranslucent", false);
refreshRate = config->readEntry( "RefreshRate", 0 );
smoothScale = qBound( -1, config->readEntry( "SmoothScale", -1 ), 2 );
QString glmode = config->readEntry("GLMode", "TFP" ).upper();
if( glmode == "TFP" )
glMode = GLTFP;
else if( glmode == "SHM" )
glMode = GLSHM;
else
glMode = GLFallback;
glAlwaysRebind = config->readEntry("GLAlwaysRebind", false );
glDirect = config->readEntry("GLDirect", true );
glVSync = config->readEntry("GLVSync", true );
config->setGroup( "Effects" );
defaultEffects = config->readEntry( "Load", QStringList() << "ShowFps" << "FadeOut" );
config->setGroup( "EffectShowFps" );
effectShowFpsAlpha = config->readEntry( "Alpha", 0.5 );
effectShowFpsX = config->readEntry( "X", -10000 );
effectShowFpsY = config->readEntry( "Y", 0 );
// Read button tooltip animation effect from kdeglobals
// Since we want to allow users to enable window decoration tooltips
// and not kstyle tooltips and vise-versa, we don't read the