redesigned partial opacity (moved from kompmgr to kwin, allowing to be set e.g. from decos) and (hopefully) fixed CPU hunger (if using fades)

svn path=/trunk/KDE/kdebase/kwin/; revision=430562
This commit is contained in:
Thomas Lübking 2005-07-01 19:55:06 +00:00
parent 229690ab71
commit d6b4366c51
9 changed files with 185 additions and 172 deletions

View file

@ -79,8 +79,8 @@ Atoms::Atoms()
atoms[n] = &net_wm_window_shapable;
names[n++] = (char*) "_KDE_WM_WINDOW_SHAPABLE";
atoms[n] = &net_wm_window_titleheight;
names[n++] = (char*) "_KDE_WM_WINDOW_TITLEHEIGHT";
atoms[n] = &net_wm_window_decohash;
names[n++] = (char*) "_KDE_WM_WINDOW_DECOHASH";
Atom fake;
atoms[n] = &fake;

View file

@ -41,7 +41,7 @@ class Atoms
Atom net_wm_window_shadow;
Atom net_wm_window_shade;
Atom net_wm_window_shapable;
Atom net_wm_window_titleheight;
Atom net_wm_window_decohash;
Atom xdnd_aware;
Atom xdnd_position;
Atom net_frame_extents;

View file

@ -277,7 +277,9 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
XReparentWindow( qt_xdisplay(), decoration->widget()->winId(), frameId(), 0, 0 );
decoration->widget()->lower();
decoration->borders( border_left, border_right, border_top, border_bottom );
setXTitleHeightProperty(border_top);
options->onlyDecoTranslucent ?
setDecoHashProperty(border_top, border_right, border_bottom, border_left):
unsetDecoHashProperty();
int save_workarea_diff_x = workarea_diff_x;
int save_workarea_diff_y = workarea_diff_y;
move( calculateGravitation( false ));
@ -327,10 +329,15 @@ void Client::checkBorderSizes()
move( calculateGravitation( true ));
border_left = new_left;
border_right = new_right;
if (border_top != new_top)
setXTitleHeightProperty(new_top);
border_top = new_top;
border_bottom = new_bottom;
if (border_left != new_left ||
border_right != new_right ||
border_top != new_top ||
border_bottom != new_bottom)
options->onlyDecoTranslucent ?
setDecoHashProperty(new_top, new_right, new_bottom, new_left):
unsetDecoHashProperty();
move( calculateGravitation( false ));
plainResize( sizeForClientSize( clientSize()), ForceGeometrySet );
checkWorkspacePosition();
@ -2043,10 +2050,18 @@ bool Client::touches(const Client* c)
return FALSE;
}
void Client::setXTitleHeightProperty(int titleHeight)
void Client::setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth)
{
long data = titleHeight;
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_titleheight, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
long data = (topHeight < 255 ? topHeight : 255) << 24 |
(rightWidth < 255 ? rightWidth : 255) << 16 |
(bottomHeight < 255 ? bottomHeight : 255) << 8 |
(leftWidth < 255 ? leftWidth : 255);
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_decohash, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
void Client::unsetDecoHashProperty()
{
XDeleteProperty( qt_xdisplay(), frameId(), atoms->net_wm_window_decohash);
}
#ifndef NDEBUG

View file

@ -395,7 +395,8 @@ class Client : public QObject, public KDecorationDefines
void ungrabButton( int mod );
void resetMaximize();
void resizeDecoration( const QSize& s );
void setXTitleHeightProperty(int titleHeight);
void setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHeight, uint leftWidth);
void unsetDecoHashProperty();
void pingWindow();
void killProcess( bool ask, Time timestamp = CurrentTime );

View file

@ -1216,15 +1216,8 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, QW
QVBoxLayout *vLay = new QVBoxLayout (tGroup,KDialog::marginHint(), KDialog::spacingHint());
vLay->addSpacing(11); // to get the proper gb top offset
QHBoxLayout *hLay = new QHBoxLayout(vLay);
QLabel *label0 = new QLabel(i18n("Apply translucency on"),tGroup);
hLay->addWidget(label0);
transMode = new QComboBox(tGroup);
transMode->insertItem (i18n("The whole window"));
transMode->insertItem (i18n("The titlebar only"));
transMode->insertItem (i18n("The content only"));
hLay->addWidget(transMode);
hLay->addStretch();
onlyDecoTranslucent = new QCheckBox(i18n("Apply translucency only to decoration"),tGroup);
vLay->addWidget(onlyDecoTranslucent);
vLay->addSpacing(11);
@ -1361,7 +1354,7 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, QW
connect(dockWindowTransparency, SIGNAL(toggled(bool)), dockWindowOpacity, SLOT(setEnabled(bool)));
connect(useTranslucency, SIGNAL(toggled(bool)), SLOT(changed()));
connect(transMode, SIGNAL(activated(int)), SLOT(changed()));
connect(onlyDecoTranslucent, SIGNAL(toggled(bool)), SLOT(changed()));
connect(activeWindowTransparency, SIGNAL(toggled(bool)), SLOT(changed()));
connect(inactiveWindowTransparency, SIGNAL(toggled(bool)), SLOT(changed()));
connect(movingWindowTransparency, SIGNAL(toggled(bool)), SLOT(changed()));
@ -1402,7 +1395,6 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, QW
// handle kompmgr restarts if necessary
connect(useTranslucency, SIGNAL(toggled(bool)), SLOT(resetKompmgr()));
connect(transMode, SIGNAL(activated(int)), SLOT(resetKompmgr()));
connect(disableARGB, SIGNAL(toggled(bool)), SLOT(resetKompmgr()));
connect(useShadows, SIGNAL(toggled(bool)), SLOT(resetKompmgr()));
connect(inactiveWindowShadowSize, SIGNAL(valueChanged(int)), SLOT(resetKompmgr()));
@ -1433,10 +1425,11 @@ void KTranslucencyConfig::load( void )
activeWindowTransparency->setChecked(config->readBoolEntry("TranslucentActiveWindows",false));
inactiveWindowTransparency->setChecked(config->readBoolEntry("TranslucentInactiveWindows",true));
movingWindowTransparency->setChecked(config->readBoolEntry("TranslucentMovingWindows",false));
removeShadowsOnMove->setChecked(config->readBoolEntry("RemoveShadowsOnMove",FALSE));
removeShadowsOnResize->setChecked(config->readBoolEntry("RemoveShadowsOnResize",FALSE));
removeShadowsOnMove->setChecked(config->readBoolEntry("RemoveShadowsOnMove",false));
removeShadowsOnResize->setChecked(config->readBoolEntry("RemoveShadowsOnResize",false));
dockWindowTransparency->setChecked(config->readBoolEntry("TranslucentDocks",true));
keepAboveAsActive->setChecked(config->readBoolEntry("TreatKeepAboveAsActive",true));
onlyDecoTranslucent->setChecked(config->readBoolEntry("OnlyDecoTranslucent",false));
activeWindowOpacity->setValue(config->readNumEntry("ActiveWindowOpacity",100));
inactiveWindowOpacity->setValue(config->readNumEntry("InactiveWindowOpacity",75));
@ -1444,9 +1437,9 @@ void KTranslucencyConfig::load( void )
dockWindowOpacity->setValue(config->readNumEntry("DockOpacity",80));
int ass, iss, dss;
dss = config->readNumEntry("DockShadowSize", 50);
ass = config->readNumEntry("ActiveWindowShadowSize", 200);
iss = config->readNumEntry("InactiveWindowShadowSize", 100);
dss = config->readNumEntry("DockShadowSize", 33);
ass = config->readNumEntry("ActiveWindowShadowSize", 133);
iss = config->readNumEntry("InactiveWindowShadowSize", 67);
activeWindowOpacity->setEnabled(activeWindowTransparency->isChecked());
inactiveWindowOpacity->setEnabled(inactiveWindowTransparency->isChecked());
@ -1456,9 +1449,6 @@ void KTranslucencyConfig::load( void )
KConfig conf_(QDir::homeDirPath() + "/.xcompmgrrc");
conf_.setGroup("xcompmgr");
QString modeString = conf_.readEntry("TransMode","All");
transMode->setCurrentItem(!modeString.compare("Content")?2:!modeString.compare("Title")?1:0);
disableARGB->setChecked(conf_.readBoolEntry("DisableARGB",FALSE));
useShadows->setChecked(conf_.readEntry("Compmode","CompClientShadows").compare("CompClientShadows") == 0);
@ -1509,11 +1499,14 @@ void KTranslucencyConfig::save( void )
// (speed reasons, so the shadow matrix hasn't to be recreated for every window)
// we set inactive windows to 100%, the radius to the inactive window value and adjust the multiplicators for docks and active windows
// this way the user can set the three values without caring about the radius/multiplicator stuff
config->writeEntry("DockShadowSize",(int)(100.0*dockWindowShadowSize->value()/inactiveWindowShadowSize->value()));
config->writeEntry("ActiveWindowShadowSize",(int)(100.0*activeWindowShadowSize->value()/inactiveWindowShadowSize->value()));
config->writeEntry("InctiveWindowShadowSize",100);
// additionally we find a value between big and small values to have a more smooth appereance
config->writeEntry("DockShadowSize",(int)(200.0 * dockWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
config->writeEntry("ActiveWindowShadowSize",(int)(200.0 * activeWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
config->writeEntry("InctiveWindowShadowSize",(int)(200.0 * inactiveWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
config->writeEntry("RemoveShadowsOnMove",removeShadowsOnMove->isChecked());
config->writeEntry("RemoveShadowsOnResize",removeShadowsOnResize->isChecked());
config->writeEntry("OnlyDecoTranslucent", onlyDecoTranslucent->isChecked());
config->writeEntry("ResetKompmgr",resetKompmgr_);
KConfig *conf_ = new KConfig(QDir::homeDirPath() + "/.xcompmgrrc");
@ -1523,7 +1516,6 @@ void KTranslucencyConfig::save( void )
conf_->writeEntry("DisableARGB",disableARGB->isChecked());
conf_->writeEntry("ShadowOffsetY",-1*shadowTopOffset->value());
conf_->writeEntry("ShadowOffsetX",-1*shadowLeftOffset->value());
conf_->writeEntry("TransMode",transMode->currentItem()==0?"All":transMode->currentItem()==1?"Title":"Content");
int r, g, b;
@ -1531,7 +1523,7 @@ void KTranslucencyConfig::save( void )
QString hex;
hex.sprintf("0x%02X%02X%02X", r,g,b);
conf_->writeEntry("ShadowColor",hex);
conf_->writeEntry("ShadowRadius",inactiveWindowShadowSize->value());
conf_->writeEntry("ShadowRadius",(activeWindowShadowSize->value() + inactiveWindowShadowSize->value()) / 2);
conf_->writeEntry("FadeWindows",fadeInWindows->isChecked());
conf_->writeEntry("FadeTrans",fadeOnOpacityChange->isChecked());
conf_->writeEntry("FadeInStep",fadeInSpeed->value()/1000.0);
@ -1554,7 +1546,7 @@ void KTranslucencyConfig::defaults()
if (!kompmgrAvailable_)
return;
useTranslucency->setChecked(false);
transMode->setCurrentItem(0);
onlyDecoTranslucent->setChecked(false);
activeWindowTransparency->setChecked(false);
inactiveWindowTransparency->setChecked(true);
movingWindowTransparency->setChecked(false);

View file

@ -255,7 +255,7 @@ private:
QCheckBox *removeShadowsOnResize;
QCheckBox *removeShadowsOnMove;
QGroupBox *sGroup;
QComboBox *transMode;
QCheckBox *onlyDecoTranslucent;
// QPushButton *xcompmgrButton;
KIntNumInput *activeWindowOpacity;
KIntNumInput *inactiveWindowOpacity;

View file

@ -56,6 +56,11 @@ check baghira.sf.net for more infos
#define CAN_DO_USABLE 0
#define _TOPHEIGHT_(x) ((x >> 24) & 0xff)
#define _RIGHTWIDTH_(x) ((x >> 16) & 0xff)
#define _BOTTOMHEIGHT_(x) ((x >> 8) & 0xff)
#define _LEFTWIDTH_(x) (x & 0xff)
typedef struct _ignore {
struct _ignore *next;
unsigned long sequence;
@ -80,11 +85,12 @@ typedef struct _win {
Picture alphaPict;
Picture shadowPict;
XserverRegion borderSize;
XserverRegion titleSize;
XserverRegion contentSize;
XserverRegion decoRegion;
XserverRegion contentRegion;
XserverRegion extents;
unsigned int preShadeOpacity;
Picture shadow;
/*Picture alpha;*/
int shadow_dx;
int shadow_dy;
int shadow_width;
@ -94,7 +100,7 @@ typedef struct _win {
Atom windowType;
unsigned long damage_sequence; /* sequence when damage was created */
Bool shapable; /* this will allow window managers to exclude windows if just the deco is shaped*/
int titleHeight;
unsigned int decoHash;
Picture dimPicture;
/* for drawing translucent windows */
@ -115,7 +121,7 @@ typedef struct _fade {
double step;
void (*callback) (Display *dpy, win *w, Bool gone);
Display *dpy;
int titleHeight;
unsigned int decoHash;
Bool gone;
} fade;
@ -152,7 +158,7 @@ Atom opacityAtom;
Atom shadowAtom;
Atom shadeAtom;
Atom shapableAtom;
Atom titleHeightAtom;
Atom decoHashAtom;
Atom dimAtom;
Atom deskChangeAtom;
Atom winTypeAtom;
@ -170,7 +176,7 @@ Atom winNormalAtom;
#define SHADOW_PROP "_KDE_WM_WINDOW_SHADOW"
#define SHADE_PROP "_KDE_WM_WINDOW_SHADE"
#define SHAPABLE_PROP "_KDE_WM_WINDOW_SHAPABLE"
#define TITLEHEIGHT_PROP "_KDE_WM_WINDOW_TITLEHEIGHT"
#define DECOHASH_PROP "_KDE_WM_WINDOW_DECOHASH"
#define DIM_PROP "_KDE_WM_WINDOW_DIM"
#define DESKCHANGE_PROP "_KDE_WM_DESKTOP_CHANGE"
@ -198,12 +204,6 @@ typedef enum _compMode {
CompClientShadows, /* use window extents for shadow, blurred */
} CompMode;
typedef enum _transMode {
Title, /*only the titlebar is drawn translucent*/
Content, /*only the content is drawn translucent*/
All /*all window is drawn translucent*/
} TransMode;
static void
determine_mode(Display *dpy, win *w);
@ -214,7 +214,6 @@ static XserverRegion
win_extents (Display *dpy, win *w);
CompMode compMode = CompSimple;
TransMode transMode = All;
int shadowRadius = 12;
int shadowOffsetX = 0;
@ -268,12 +267,11 @@ find_fade (win *w)
return 0;
}
void
dequeue_fade (Display *dpy, fade *f)
void dequeue_fade (Display *dpy, fade *f)
{
fade **prev;
f->w->isInFade = False;
f->w->titleHeight = f->titleHeight;
f->w->decoHash = f->decoHash;
for (prev = &fades; *prev; prev = &(*prev)->next)
if (*prev == f)
@ -318,20 +316,24 @@ set_fade (Display *dpy, win *w, double start, double finish, double step,
f = find_fade (w);
if (!f)
{
if (start == finish)
return;
f = malloc (sizeof (fade));
f->next = 0;
f->w = w;
f->titleHeight = w->titleHeight;
f->decoHash = w->decoHash;
f->cur = start;
enqueue_fade (dpy, f);
}
else if(!override)
return;
else
else if (start == finish)
{
if (exec_callback && f->callback)
(*f->callback)(dpy, f->w, f->gone);
dequeue_fade(dpy,f);
return;
}
else if (exec_callback && f->callback)
(*f->callback)(dpy, f->w, f->gone);
if (finish < 0)
finish = 0;
@ -346,7 +348,7 @@ set_fade (Display *dpy, win *w, double start, double finish, double step,
f->callback = callback;
w->opacity = f->cur * OPAQUE;
if (wholeWin)
w->titleHeight = 0;
w->decoHash = 0;
#if 0
printf ("set_fade start %g step %g\n", f->cur, f->step);
#endif
@ -393,7 +395,7 @@ run_fades (Display *dpy)
win *w = f->w;
next = f->next;
f->cur += f->step * steps;
if (f->cur >= 1)
if (f->cur > 1)
f->cur = 1;
else if (f->cur < 0)
f->cur = 0;
@ -408,7 +410,6 @@ run_fades (Display *dpy)
{
w->opacity = f->finish*OPAQUE;
need_dequeue = True;
/*dequeue_fade (dpy, f);*/
}
}
else
@ -417,7 +418,6 @@ run_fades (Display *dpy)
{
w->opacity = f->finish*OPAQUE;
need_dequeue = True;
/*dequeue_fade (dpy, f);*/
}
}
if (w->shadow)
@ -917,13 +917,18 @@ win_extents (Display *dpy, win *w)
{
double opacity = shadowOpacity;
if (w->shadowSize > 100)
opacity = opacity/(w->shadowSize*0.01);
opacity = opacity/(w->shadowSize*0.015);
if (w->mode == WINDOW_TRANS)
opacity = opacity * ((double)w->opacity)/((double)OPAQUE);
w->shadow = shadow_picture (dpy, opacity, w->alphaPict,
w->a.width + w->a.border_width * 2 - 2*(shadowRadius - (w->shadowSize*shadowRadius/100)) ,
w->a.height + w->a.border_width * 2 - 2*(shadowRadius - (w->shadowSize*shadowRadius/100)),
&w->shadow_width, &w->shadow_height);
/*int kill;
w->alpha = shadow_picture (dpy, 0.9, w->alphaPict,
w->a.width + w->a.border_width * 2,
w->a.height + w->a.border_width * 2,
&kill, &kill);*/
}
}
sr.x = w->a.x + w->shadow_dx;
@ -971,7 +976,7 @@ border_size (Display *dpy, win *w)
}
static XserverRegion
title_size (Display *dpy, win *w)
deco_region (Display *dpy, win *w)
{
XserverRegion title;
XRectangle r; /*titlebounding rect*/
@ -982,21 +987,21 @@ title_size (Display *dpy, win *w)
* of creates, that way you'd just end up with an empty region
* instead of an invalid XID.
*/
r.x = w->a.x - w->a.border_width;
r.y = w->a.y - w->a.border_width;
r.width = w->a.width + w->a.border_width * 2;
r.height = w->titleHeight + w->a.border_width;
r.x = w->a.x - w->a.border_width + _LEFTWIDTH_(w->decoHash);
r.y = w->a.y - w->a.border_width + _TOPHEIGHT_(w->decoHash);
r.width = w->a.width + w->a.border_width * 2 - _LEFTWIDTH_(w->decoHash) - _RIGHTWIDTH_(w->decoHash);
r.height = w->a.height + w->a.border_width - _TOPHEIGHT_(w->decoHash) - _BOTTOMHEIGHT_(w->decoHash);
set_ignore (dpy, NextRequest (dpy));
title = XFixesCreateRegion (dpy, &r, 1);
if (!w->borderSize)
w->borderSize = border_size (dpy, w);
set_ignore (dpy, NextRequest (dpy));
XFixesIntersectRegion(dpy, title, w->borderSize, title);
XFixesSubtractRegion(dpy, title, w->borderSize, title);
return title;
}
static XserverRegion
content_size (Display *dpy, win *w)
content_region (Display *dpy, win *w)
{
XserverRegion content;
XRectangle r; /*contentbounding rect*/
@ -1007,10 +1012,10 @@ content_size (Display *dpy, win *w)
* of creates, that way you'd just end up with an empty region
* instead of an invalid XID.
*/
r.x = w->a.x - w->a.border_width;
r.y = w->a.y - w->a.border_width + w->titleHeight;
r.width = w->a.width + w->a.border_width * 2;
r.height = w->a.height + w->a.border_width - w->titleHeight;
r.x = w->a.x - w->a.border_width + _LEFTWIDTH_(w->decoHash);
r.y = w->a.y - w->a.border_width + _TOPHEIGHT_(w->decoHash);
r.width = w->a.width + w->a.border_width * 2 - _LEFTWIDTH_(w->decoHash) - _RIGHTWIDTH_(w->decoHash);
r.height = w->a.height + w->a.border_width - _TOPHEIGHT_(w->decoHash) - _BOTTOMHEIGHT_(w->decoHash);
set_ignore (dpy, NextRequest (dpy));
content = XFixesCreateRegion (dpy, &r, 1);
if (!w->borderSize)
@ -1101,17 +1106,17 @@ paint_all (Display *dpy, XserverRegion region)
XFixesDestroyRegion (dpy, w->borderSize);
w->borderSize = None;
}
if (w->titleSize)
if (w->decoRegion)
{
set_ignore (dpy, NextRequest (dpy));
XFixesDestroyRegion (dpy, w->titleSize);
w->titleSize = None;
XFixesDestroyRegion (dpy, w->decoRegion);
w->decoRegion = None;
}
if (w->contentSize)
if (w->contentRegion)
{
set_ignore (dpy, NextRequest (dpy));
XFixesDestroyRegion (dpy, w->contentSize);
w->contentSize = None;
XFixesDestroyRegion (dpy, w->contentRegion);
w->contentRegion = None;
}
if (w->extents)
{
@ -1128,7 +1133,7 @@ paint_all (Display *dpy, XserverRegion region)
w->borderSize = border_size (dpy, w);
if (!w->extents)
w->extents = win_extents (dpy, w);
if ((w->mode == WINDOW_SOLID) || ((w->mode == WINDOW_TRANS) && (transMode < All) && w->titleHeight))
if ((w->mode == WINDOW_SOLID) || ((w->mode == WINDOW_TRANS) && w->decoHash))
{
int x, y, wid, hei;
#if HAS_NAME_WINDOW_PIXMAP
@ -1156,31 +1161,18 @@ paint_all (Display *dpy, XserverRegion region)
XRenderComposite (dpy, PictOpOver, w->dimPicture, None, rootBuffer, 0, 0, 0, 0, x, y, wid, hei);
}
else
switch (transMode) {
case Title:
{
if (!w->contentSize)
w->contentSize = content_size (dpy, w);
XFixesSubtractRegion (dpy, region, region, w->contentSize);
if (!w->contentRegion)
w->contentRegion = content_region (dpy, w);
XFixesSubtractRegion (dpy, region, region, w->contentRegion);
set_ignore (dpy, NextRequest (dpy));
/*solid part*/
XRenderComposite (dpy, PictOpSrc, w->picture, None, rootBuffer,
0, w->titleHeight, 0, 0, x, y+w->titleHeight, wid, hei - w->titleHeight);
break;
}
case Content:
{
if (!w->titleSize)
w->titleSize = title_size (dpy, w);
XFixesSubtractRegion (dpy, region, region, w->titleSize);
set_ignore (dpy, NextRequest (dpy));
/*solid part*/
XRenderComposite (dpy, PictOpSrc, w->picture, None, rootBuffer,
0, 0, 0, 0, x, y, wid, w->titleHeight);
break;
}
default:
break;
_LEFTWIDTH_(w->decoHash), _TOPHEIGHT_(w->decoHash), 0, 0,
x + _LEFTWIDTH_(w->decoHash),
y + _TOPHEIGHT_(w->decoHash),
wid - _LEFTWIDTH_(w->decoHash) - _RIGHTWIDTH_(w->decoHash),
hei - _TOPHEIGHT_(w->decoHash) - _BOTTOMHEIGHT_(w->decoHash));
}
}
if (!w->borderClip)
@ -1255,24 +1247,45 @@ paint_all (Display *dpy, XserverRegion region)
hei = w->a.height;
#endif
set_ignore (dpy, NextRequest (dpy));
if (!w->titleHeight)
if (!w->decoHash)
{
XRenderComposite (dpy, PictOpOver, w->picture, w->alphaPict, rootBuffer,
0, 0, 0, 0, x, y, wid, hei);
}
else
switch (transMode) {
case All:
XRenderComposite (dpy, PictOpOver, w->picture, w->alphaPict, rootBuffer,
0, 0, 0, 0, x, y, wid, hei);
break;
{
/*trans part*/
case Title:
/* PICTURE ;)
|-----------------------------|
| top |
|-----------------------------|
|l | | r|
|e | | i|
|f | | g|
|t | | h|
|--------------------------| t|
| bottom | |
|--------------------------|--|*/
/*top*/
XRenderComposite (dpy, PictOpOver, w->picture, w->alphaPict, rootBuffer,
0, 0, 0, 0, x, y, wid, w->titleHeight);
break;
case Content:
0, 0, 0, 0, x, y, wid, _TOPHEIGHT_(w->decoHash));
/*right*/
XRenderComposite (dpy, PictOpOver, w->picture, w->alphaPict, rootBuffer,
0, w->titleHeight, 0, 0, x, y+w->titleHeight, wid, hei - w->titleHeight);
break;
wid - _RIGHTWIDTH_(w->decoHash), _TOPHEIGHT_(w->decoHash),
0, 0,
x + wid - _RIGHTWIDTH_(w->decoHash),
y + _TOPHEIGHT_(w->decoHash), _RIGHTWIDTH_(w->decoHash),
hei - _TOPHEIGHT_(w->decoHash));
/*bottom*/
XRenderComposite (dpy, PictOpOver, w->picture, w->alphaPict, rootBuffer,
0, hei - _BOTTOMHEIGHT_(w->decoHash), 0, 0,
x, y + hei - _BOTTOMHEIGHT_(w->decoHash),
wid - _RIGHTWIDTH_(w->decoHash), _BOTTOMHEIGHT_(w->decoHash));
/*left*/
XRenderComposite (dpy, PictOpOver, w->picture, w->alphaPict, rootBuffer,
0, _TOPHEIGHT_(w->decoHash), 0, 0,
x, y + _TOPHEIGHT_(w->decoHash),
_LEFTWIDTH_(w->decoHash), hei - _TOPHEIGHT_(w->decoHash) - _BOTTOMHEIGHT_(w->decoHash));
}
}
else if (w->mode == WINDOW_ARGB)
@ -1434,18 +1447,18 @@ finish_unmap_win (Display *dpy, win *w)
w->borderSize = None;
}
if (w->titleSize)
if (w->decoRegion)
{
set_ignore (dpy, NextRequest (dpy));
XFixesDestroyRegion (dpy, w->titleSize);
w->titleSize = None;
XFixesDestroyRegion (dpy, w->decoRegion);
w->decoRegion = None;
}
if (w->contentSize)
if (w->contentRegion)
{
set_ignore (dpy, NextRequest (dpy));
XFixesDestroyRegion (dpy, w->contentSize);
w->contentSize = None;
XFixesDestroyRegion (dpy, w->contentRegion);
w->contentRegion = None;
}
if (w->shadow)
@ -1578,14 +1591,14 @@ get_shapable_prop(Display *dpy, win *w)
}
static unsigned int
get_titleHeight_prop(Display *dpy, win *w)
get_decoHash_prop(Display *dpy, win *w)
{
Atom actual;
int format;
unsigned long n, left;
unsigned char *data = NULL;
int result = XGetWindowProperty(dpy, w->id, titleHeightAtom, 0L, 1L, False,
int result = XGetWindowProperty(dpy, w->id, decoHashAtom, 0L, 1L, False,
XA_CARDINAL, &actual, &format,
&n, &left, &data);
if (result == Success && data != NULL && format == 32 )
@ -1857,7 +1870,7 @@ add_win (Display *dpy, Window id, Window prev)
new->shadow_height = 0;
new->opacity = OPAQUE;
new->shadowSize = 100;
new->titleHeight = 0;
new->decoHash = 0;
new->borderClip = None;
new->prev_trans = 0;
@ -1868,7 +1881,7 @@ add_win (Display *dpy, Window id, Window prev)
new->opacity = get_opacity_prop (dpy, new, OPAQUE);
new->shadowSize = get_shadow_prop (dpy, new);
new->shapable = get_shapable_prop(dpy, new);
new->titleHeight = get_titleHeight_prop(dpy, new);
new->decoHash = get_decoHash_prop(dpy, new);
unsigned int tmp = get_dim_prop(dpy, new);
new->dimPicture = (tmp < OPAQUE) ? solid_picture (dpy, True, (double)tmp/OPAQUE, 0.1, 0.1, 0.1) : None;
new->windowType = determine_wintype (dpy, new->id);
@ -2275,7 +2288,6 @@ typedef enum _option{
FadeInStep,
FadeDelta,
DisableARGB,
TransMode_,
NUMBEROFOPTIONS
} Option;
@ -2297,7 +2309,6 @@ options[NUMBEROFOPTIONS] = {
"FadeInStep", /*13*/
"FadeDelta", /*14*/
"DisableARGB", /*15*/
"TransMode", /*16*/
/*put your thingy in here...*/
};
@ -2361,17 +2372,6 @@ setValue(Option option, char *value ){
compMode = CompSimple; /*default*/
}
break;
case TransMode_:
if( strcasecmp(value, "Title") == 0 ){
transMode = Title;
}
else if( strcasecmp(value, "Content") == 0 ){
transMode = Content;
}
else{
transMode = All; /*default*/
}
break;
case Display_:
break;
display = strdup(value);
@ -2413,7 +2413,9 @@ loadConfig(char *filename){
const char *home = getenv("HOME");
const char *configfile = "/.xcompmgrrc";
wasNull = True;
filename = (char*)malloc((strlen(home)+strlen(configfile)+1)*sizeof(char));
int n = strlen(home)+strlen(configfile)+1;
filename = (char*)malloc(n*sizeof(char));
memset(filename,0,n);
strcat(filename, home);
strcat(filename, configfile);
@ -2630,7 +2632,7 @@ main (int argc, char **argv)
opacityAtom = XInternAtom (dpy, OPACITY_PROP, False);
shadeAtom = XInternAtom (dpy, SHADE_PROP, False);
shapableAtom = XInternAtom (dpy, SHAPABLE_PROP, False);
titleHeightAtom = XInternAtom (dpy, TITLEHEIGHT_PROP, False);
decoHashAtom = XInternAtom (dpy, DECOHASH_PROP, False);
dimAtom = XInternAtom (dpy, DIM_PROP, False);
deskChangeAtom = XInternAtom (dpy, DESKCHANGE_PROP, False);
winTypeAtom = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE", False);
@ -2817,12 +2819,12 @@ main (int argc, char **argv)
else
printf("arrrg, window not found\n");
}
else if (ev.xproperty.atom == titleHeightAtom)
else if (ev.xproperty.atom == decoHashAtom)
{
win * w = find_win(dpy, ev.xproperty.window);
if (w)
{
w->titleHeight = get_titleHeight_prop(dpy, w);
w->decoHash = get_decoHash_prop(dpy, w);
}
else
printf("arrrg, window not found\n");
@ -2856,8 +2858,9 @@ main (int argc, char **argv)
if (ev.xproperty.atom == opacityAtom)
{
tmp = get_opacity_prop(dpy, w, OPAQUE);
if (tmp == w->opacity)
break; /*skip if opacity does not change*/
/*THis will most probably happen if window is in fade - resulting in that the fade process isn't updated or broken -> we may have a wrong opacity in the future*/
/*if (tmp == w->opacity)
break;*/ /*skip if opacity does not change*/
if (fadeTrans)
{
set_fade (dpy, w, w->opacity*1.0/OPAQUE, (tmp*1.0)/OPAQUE, fade_out_step, 0, False, True, True, False);

View file

@ -191,6 +191,7 @@ unsigned long Options::updateSettings()
dockShadowSize = config->readNumEntry("DockShadowSize", 80);
removeShadowsOnMove = config->readBoolEntry("RemoveShadowsOnMove", true);
removeShadowsOnResize = config->readBoolEntry("RemoveShadowsOnResize", true);
onlyDecoTranslucent = config->readBoolEntry("OnlyDecoTranslucent",false);
if (resetKompmgr = config->readBoolEntry("ResetKompmgr", false))
config->writeEntry("ResetKompmgr",FALSE);

View file

@ -297,6 +297,7 @@ class Options : public KDecorationOptions
uint activeWindowShadowSize;
uint inactiveWindowShadowSize;
uint dockShadowSize;
bool onlyDecoTranslucent;
bool resetKompmgr;
private: