summaryrefslogtreecommitdiffstats
path: root/twin
diff options
context:
space:
mode:
Diffstat (limited to 'twin')
-rw-r--r--twin/KWinInterface.h3
-rw-r--r--twin/kcmtwin/twinoptions/windows.cpp105
-rw-r--r--twin/kcmtwin/twinoptions/windows.h4
-rw-r--r--twin/kompmgr/kompmgr.c54
-rw-r--r--twin/options.cpp12
-rw-r--r--twin/workspace.cpp10
-rw-r--r--twin/workspace.h3
7 files changed, 136 insertions, 55 deletions
diff --git a/twin/KWinInterface.h b/twin/KWinInterface.h
index ec1d9f1f8..445e42fe9 100644
--- a/twin/KWinInterface.h
+++ b/twin/KWinInterface.h
@@ -32,12 +32,13 @@ class KWinInterface : virtual public DCOPObject
virtual void startKompmgr() = 0;
virtual void stopKompmgr() = 0;
virtual bool kompmgrIsRunning() = 0;
+ virtual void kompmgrReloadSettings() = 0;
virtual void setOpacity(unsigned long winId, unsigned int opacityPercent) = 0;
virtual void setShadowSize(unsigned long winId, unsigned int shadowSizePercent) = 0;
virtual void setUnshadowed(unsigned long winId) = 0;
k_dcop_signals:
-
+
virtual void kompmgrStarted() = 0;
virtual void kompmgrStopped() = 0;
diff --git a/twin/kcmtwin/twinoptions/windows.cpp b/twin/kcmtwin/twinoptions/windows.cpp
index 567121a1a..a6c2645c5 100644
--- a/twin/kcmtwin/twinoptions/windows.cpp
+++ b/twin/kcmtwin/twinoptions/windows.cpp
@@ -1357,56 +1357,65 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, TQ
TQGridLayout *gLay2 = new TQGridLayout(vLay2,6,2);
gLay2->setColStretch(1,1);
- TQLabel *label2 = new TQLabel(i18n("Base shadow size:"),sGroup);
+ TQLabel *label2 = new TQLabel(i18n("Base shadow radius:"),sGroup);
gLay2->addWidget(label2,0,0);
+ baseShadowSize = new KIntNumInput(6,sGroup);
+ baseShadowSize->setRange(0,32);
+// inactiveWindowShadowSize->setSuffix("px");
+ gLay2->addWidget(baseShadowSize,0,1);
+
+ TQLabel *label2a = new TQLabel(i18n("Inactive window shadow size:"),sGroup);
+ gLay2->addWidget(label2a,1,0);
inactiveWindowShadowSize = new KIntNumInput(6,sGroup);
inactiveWindowShadowSize->setRange(0,32);
// inactiveWindowShadowSize->setSuffix("px");
- gLay2->addWidget(inactiveWindowShadowSize,0,1);
+ gLay2->addWidget(inactiveWindowShadowSize,1,1);
- TQLabel *label1 = new TQLabel(i18n("Active window shadow size multiplier:"),sGroup);
- gLay2->addWidget(label1,1,0);
+ TQLabel *label1 = new TQLabel(i18n("Active window shadow size:"),sGroup);
+ gLay2->addWidget(label1,2,0);
activeWindowShadowSize = new KIntNumInput(12,sGroup);
activeWindowShadowSize->setRange(0,32);
// activeWindowShadowSize->setSuffix("px");
- gLay2->addWidget(activeWindowShadowSize,1,1);
+ gLay2->addWidget(activeWindowShadowSize,2,1);
- TQLabel *label3 = new TQLabel(i18n("Dock shadow size multiplier:"),sGroup);
- gLay2->addWidget(label3,2,0);
+ TQLabel *label3 = new TQLabel(i18n("Dock shadow size:"),sGroup);
+ gLay2->addWidget(label3,3,0);
dockWindowShadowSize = new KIntNumInput(6,sGroup);
dockWindowShadowSize->setRange(0,32);
// dockWindowShadowSize->setSuffix("px");
- gLay2->addWidget(dockWindowShadowSize,2,1);
+ gLay2->addWidget(dockWindowShadowSize,3,1);
- TQLabel *label3a = new TQLabel(i18n("Menu shadow size multiplier:"),sGroup);
- gLay2->addWidget(label3a,3,0);
+ TQLabel *label3a = new TQLabel(i18n("Menu shadow size:"),sGroup);
+ gLay2->addWidget(label3a,4,0);
menuWindowShadowSize = new KIntNumInput(6,sGroup);
menuWindowShadowSize->setRange(0,32);
// menuWindowShadowSize->setSuffix("px");
- gLay2->addWidget(menuWindowShadowSize,3,1);
+ gLay2->addWidget(menuWindowShadowSize,4,1);
- // Menu shadow settings don't work
+ // FIXME
+ // Menu control does not work!
+ // Menus appear to be controlled by the base shadow radius ONLY
label3a->hide();
menuWindowShadowSize->hide();
TQLabel *label4 = new TQLabel(i18n("Vertical offset:"),sGroup);
- gLay2->addWidget(label4,4,0);
+ gLay2->addWidget(label4,5,0);
shadowTopOffset = new KIntNumInput(80,sGroup);
shadowTopOffset->setSuffix("%");
shadowTopOffset->setRange(-200,200);
- gLay2->addWidget(shadowTopOffset,4,1);
+ gLay2->addWidget(shadowTopOffset,5,1);
TQLabel *label5 = new TQLabel(i18n("Horizontal offset:"),sGroup);
- gLay2->addWidget(label5,5,0);
+ gLay2->addWidget(label5,6,0);
shadowLeftOffset = new KIntNumInput(0,sGroup);
shadowLeftOffset->setSuffix("%");
shadowLeftOffset->setRange(-200,200);
- gLay2->addWidget(shadowLeftOffset,5,1);
+ gLay2->addWidget(shadowLeftOffset,6,1);
TQLabel *label6 = new TQLabel(i18n("Shadow color:"),sGroup);
- gLay2->addWidget(label6,5,0);
+ gLay2->addWidget(label6,7,0);
shadowColor = new KColorButton(Qt::black,sGroup);
- gLay2->addWidget(shadowColor,6,1);
+ gLay2->addWidget(shadowColor,7,1);
gLay2->setColStretch(1,1);
vLay2->addSpacing(11);
removeShadowsOnMove = new TQCheckBox(i18n("Remove shadows on move"),sGroup);
@@ -1468,6 +1477,7 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, TQ
connect(menuWindowShadowSize, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed()));
connect(activeWindowShadowSize, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed()));
connect(inactiveWindowShadowSize, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed()));
+ connect(baseShadowSize, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed()));
connect(shadowTopOffset, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed()));
connect(shadowLeftOffset, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(changed()));
connect(shadowColor, TQT_SIGNAL(changed(const TQColor&)), TQT_SLOT(changed()));
@@ -1481,6 +1491,7 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, TQ
connect(useShadows, TQT_SIGNAL(toggled(bool)), menuWindowShadowSize, TQT_SLOT(setEnabled(bool)));
connect(useShadows, TQT_SIGNAL(toggled(bool)), activeWindowShadowSize, TQT_SLOT(setEnabled(bool)));
connect(useShadows, TQT_SIGNAL(toggled(bool)), inactiveWindowShadowSize, TQT_SLOT(setEnabled(bool)));
+ connect(useShadows, TQT_SIGNAL(toggled(bool)), baseShadowSize, TQT_SLOT(setEnabled(bool)));
connect(useShadows, TQT_SIGNAL(toggled(bool)), shadowTopOffset, TQT_SLOT(setEnabled(bool)));
connect(useShadows, TQT_SIGNAL(toggled(bool)), shadowLeftOffset, TQT_SLOT(setEnabled(bool)));
connect(useShadows, TQT_SIGNAL(toggled(bool)), shadowColor, TQT_SLOT(setEnabled(bool)));
@@ -1496,6 +1507,7 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, TQ
connect(disableARGB, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
connect(useShadows, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
connect(inactiveWindowShadowSize, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(resetKompmgr()));
+ connect(baseShadowSize, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(resetKompmgr()));
connect(shadowTopOffset, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(resetKompmgr()));
connect(shadowLeftOffset, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(resetKompmgr()));
connect(shadowColor, TQT_SIGNAL(changed(const TQColor&)), TQT_SLOT(resetKompmgr()));
@@ -1536,10 +1548,10 @@ void KTranslucencyConfig::load( void )
dockWindowOpacity->setValue(config->readNumEntry("DockOpacity",80));
int ass, iss, dss, mss;
- dss = config->readNumEntry("DockShadowSize", 33);
- mss = config->readNumEntry("MenuShadowSize", 33);
- ass = config->readNumEntry("ActiveWindowShadowSize", 133);
- iss = config->readNumEntry("InactiveWindowShadowSize", 67);
+ dss = config->readNumEntry("DockShadowSize", 0*100);
+ mss = config->readNumEntry("MenuShadowSize", 1*100);
+ ass = config->readNumEntry("ActiveWindowShadowSize", 2*100);
+ iss = config->readNumEntry("InactiveWindowShadowSize", 1*100);
activeWindowOpacity->setEnabled(activeWindowTransparency->isChecked());
inactiveWindowOpacity->setEnabled(inactiveWindowTransparency->isChecked());
@@ -1552,14 +1564,15 @@ void KTranslucencyConfig::load( void )
disableARGB->setChecked(conf_.readBoolEntry("DisableARGB",FALSE));
useShadows->setChecked(conf_.readEntry("Compmode","").compare("CompClientShadows") == 0);
- shadowTopOffset->setValue(-1*(conf_.readNumEntry("ShadowOffsetY",-80)));
- shadowLeftOffset->setValue(-1*(conf_.readNumEntry("ShadowOffsetX",0)));
+ shadowTopOffset->setValue(-1*(conf_.readNumEntry("ShadowOffsetY",200)));
+ shadowLeftOffset->setValue(-1*(conf_.readNumEntry("ShadowOffsetX",200)));
int ss = conf_.readNumEntry("ShadowRadius",6);
- dockWindowShadowSize->setValue((int)(dss*ss/100.0));
- menuWindowShadowSize->setValue((int)(mss*ss/100.0));
- activeWindowShadowSize->setValue((int)(ass*ss/100.0));
- inactiveWindowShadowSize->setValue((int)(iss*ss/100.0));
+ dockWindowShadowSize->setValue((int)(dss/100.0));
+ menuWindowShadowSize->setValue((int)(mss/100.0));
+ activeWindowShadowSize->setValue((int)(ass/100.0));
+ inactiveWindowShadowSize->setValue((int)(iss/100.0));
+ baseShadowSize->setValue((int)(ss));
TQString hex = conf_.readEntry("ShadowColor","#000000");
uint r, g, b;
@@ -1602,10 +1615,10 @@ void KTranslucencyConfig::save( void )
// 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
// 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("MenuShadowSize",(int)(200.0 * menuWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
- config->writeEntry("ActiveWindowShadowSize",(int)(200.0 * activeWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
- config->writeEntry("InactiveWindowShadowSize",(int)(200.0 * inactiveWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
+ config->writeEntry("DockShadowSize",(int)(100.0 * dockWindowShadowSize->value()));
+ config->writeEntry("MenuShadowSize",(int)(100.0 * menuWindowShadowSize->value()));
+ config->writeEntry("ActiveWindowShadowSize",(int)(100.0 * activeWindowShadowSize->value()));
+ config->writeEntry("InactiveWindowShadowSize",(int)(100.0 * inactiveWindowShadowSize->value()));
config->writeEntry("RemoveShadowsOnMove",removeShadowsOnMove->isChecked());
config->writeEntry("RemoveShadowsOnResize",removeShadowsOnResize->isChecked());
@@ -1626,7 +1639,7 @@ void KTranslucencyConfig::save( void )
TQString hex;
hex.sprintf("0x%02X%02X%02X", r,g,b);
conf_->writeEntry("ShadowColor",hex);
- conf_->writeEntry("ShadowRadius",(activeWindowShadowSize->value() + inactiveWindowShadowSize->value()) / 2);
+ conf_->writeEntry("ShadowRadius",baseShadowSize->value());
conf_->writeEntry("FadeWindows",fadeInWindows->isChecked());
conf_->writeEntry("FadeMenuWindows",fadeInMenuWindows->isChecked());
conf_->writeEntry("FadeTrans",fadeOnOpacityChange->isChecked());
@@ -1644,6 +1657,8 @@ void KTranslucencyConfig::save( void )
}
if (useTranslucency->isChecked())
startKompmgr();
+ else
+ stopKompmgr();
emit KCModule::changed(false);
}
@@ -1665,12 +1680,13 @@ void KTranslucencyConfig::defaults()
movingWindowOpacity->setValue(25);
dockWindowOpacity->setValue(80);
- dockWindowShadowSize->setValue(6);
- menuWindowShadowSize->setValue(6);
- activeWindowShadowSize->setValue(12);
- inactiveWindowShadowSize->setValue(6);
- shadowTopOffset->setValue(80);
- shadowLeftOffset->setValue(0);
+ dockWindowShadowSize->setValue(0);
+ menuWindowShadowSize->setValue(1);
+ activeWindowShadowSize->setValue(2);
+ inactiveWindowShadowSize->setValue(1);
+ baseShadowSize->setValue(1);
+ shadowTopOffset->setValue(200);
+ shadowLeftOffset->setValue(200);
activeWindowOpacity->setEnabled(false);
inactiveWindowOpacity->setEnabled(false);
@@ -1701,10 +1717,13 @@ bool KTranslucencyConfig::kompmgrAvailable()
void KTranslucencyConfig::startKompmgr()
{
- bool ret;
- KProcess proc;
- proc << "kompmgr";
- ret = proc.start(KProcess::DontCare);
+ kapp->dcopClient()->send("twin*", "", "startKompmgr()", TQString(""));
+ kapp->dcopClient()->send("twin*", "", "kompmgrReloadSettings()", TQString(""));
+}
+
+void KTranslucencyConfig::stopKompmgr()
+{
+ kapp->dcopClient()->send("twin*", "", "stopKompmgr()", TQString(""));
}
void KTranslucencyConfig::showWarning(bool alphaActivated)
diff --git a/twin/kcmtwin/twinoptions/windows.h b/twin/kcmtwin/twinoptions/windows.h
index 0b371d054..cbce12676 100644
--- a/twin/kcmtwin/twinoptions/windows.h
+++ b/twin/kcmtwin/twinoptions/windows.h
@@ -275,6 +275,7 @@ private:
KIntNumInput *menuWindowShadowSize;
KIntNumInput *activeWindowShadowSize;
KIntNumInput *inactiveWindowShadowSize;
+ KIntNumInput *baseShadowSize;
KIntNumInput *shadowTopOffset;
KIntNumInput *shadowLeftOffset;
KIntNumInput *fadeInSpeed;
@@ -286,9 +287,10 @@ private:
bool resetKompmgr_;
bool kompmgrAvailable();
void startKompmgr();
+ void stopKompmgr();
bool kompmgrAvailable_;
KProcess *kompmgr;
-
+
private slots:
void resetKompmgr();
void showWarning(bool alphaActivated);
diff --git a/twin/kompmgr/kompmgr.c b/twin/kompmgr/kompmgr.c
index 82166766e..f203c32d0 100644
--- a/twin/kompmgr/kompmgr.c
+++ b/twin/kompmgr/kompmgr.c
@@ -277,6 +277,15 @@ get_opacity_percent(Display *dpy, win *w);
static XserverRegion
win_extents (Display *dpy, win *w);
+static void
+presum_gaussian (conv *map);
+
+static conv *
+make_gaussian_map (Display *dpy, double r);
+
+Picture
+solid_picture (Display *dpy, Bool argb, double a, double r, double g, double b);
+
CompMode compMode = CompSimple;
int shadowRadius = 12;
@@ -403,6 +412,27 @@ void delete_pid_file()
#endif
}
+void clear_shadow_cache()
+{
+ win *w;
+
+ for (w = list; w; w = w->next) {
+ if (w->shadow)
+ {
+ XRenderFreePicture (dpy, w->shadow);
+ w->shadow = None;
+ if (w->opacity != OPAQUE && !w->alphaPict)
+ w->alphaPict = solid_picture (dpy, False,
+ (double) w->opacity / OPAQUE, shadowColor.red, shadowColor.green, shadowColor.blue);
+ if( w->extents != None ) {
+ XFixesDestroyRegion( dpy, w->extents );
+ }
+ w->extents = win_extents (dpy, w);
+ w->damaged = 1; /* redraw */
+ }
+ }
+}
+
void handle_siguser (int sig)
{
int uidnum;
@@ -456,6 +486,19 @@ void handle_siguser (int sig)
loadConfig(filename); /* reload the configuration file */
+ /* set background/shadow picture using the new settings */
+ blackPicture = solid_picture (dpy, True, 1, (double)(shadowColor.red)/0xff, (double)(shadowColor.green)/0xff, (double)(shadowColor.blue)/0xff);
+ if (compMode == CompServerShadows)
+ transBlackPicture = solid_picture (dpy, True, 0.3, 0, 0, 0);
+
+ /* regenerate shadows using the new settings */
+ if (compMode == CompClientShadows)
+ {
+ gaussianMap = make_gaussian_map(dpy, shadowRadius);
+ presum_gaussian (gaussianMap);
+ }
+ clear_shadow_cache();
+
free(filename);
filename = NULL;
}
@@ -1419,7 +1462,6 @@ paint_all (Display *dpy, XserverRegion region)
{
w->borderClip = XFixesCreateRegion (dpy, 0, 0);
XFixesCopyRegion (dpy, w->borderClip, region);
- XFixesIntersectRegion(dpy, w->borderClip, w->borderClip, w->borderSize);
}
w->prev_trans = t;
t = w;
@@ -2892,6 +2934,8 @@ options[NUMBEROFOPTIONS] = {
void
setValue(Option option, char *value ){
+ int i;
+
switch(option){ /*please keep that upside-down, because this way adding a new option is easier (all in one view)*/
case FadeDelta:
@@ -2920,7 +2964,7 @@ setValue(Option option, char *value ){
break;
case ShadowRadius:
shadowRadius = atoi(value);
- break;
+ break;
case ShadowColor:
setShadowColor(value);
break;
@@ -2955,12 +2999,18 @@ setValue(Option option, char *value ){
case Compmode:
if( strcasecmp(value, "CompClientShadows") == 0 ){
compMode = CompClientShadows;
+ for (i = 0; i < NUM_WINTYPES; ++i)
+ winTypeShadow[i] = True;
}
else if( strcasecmp(value, "CompServerShadows") == 0 ){
compMode = CompServerShadows;
+ for (i = 0; i < NUM_WINTYPES; ++i)
+ winTypeShadow[i] = True;
}
else{
compMode = CompSimple; /*default*/
+ for (i = 0; i < NUM_WINTYPES; ++i)
+ winTypeShadow[i] = False;
}
break;
case Display_:
diff --git a/twin/options.cpp b/twin/options.cpp
index 07f4d88fd..ea9efd01e 100644
--- a/twin/options.cpp
+++ b/twin/options.cpp
@@ -183,12 +183,12 @@ unsigned long Options::updateSettings()
keepAboveAsActive = config->readBoolEntry("TreatKeepAboveAsActive", true);
//TODO: remove this variable
useTitleMenuSlider = true;
- activeWindowShadowSize = config->readNumEntry("ActiveWindowShadowSize", 200);
- inactiveWindowShadowSize = config->readNumEntry("InactiveWindowShadowSize", 100);
- dockShadowSize = config->readNumEntry("DockShadowSize", 80);
- menuShadowSize = config->readNumEntry("MenuShadowSize", 80);
- removeShadowsOnMove = config->readBoolEntry("RemoveShadowsOnMove", true);
- removeShadowsOnResize = config->readBoolEntry("RemoveShadowsOnResize", true);
+ activeWindowShadowSize = config->readNumEntry("ActiveWindowShadowSize", 2*100);
+ inactiveWindowShadowSize = config->readNumEntry("InactiveWindowShadowSize", 1*100);
+ dockShadowSize = config->readNumEntry("DockShadowSize", 0*100);
+ menuShadowSize = config->readNumEntry("MenuShadowSize", 1*100);
+ removeShadowsOnMove = config->readBoolEntry("RemoveShadowsOnMove", false);
+ removeShadowsOnResize = config->readBoolEntry("RemoveShadowsOnResize", false);
onlyDecoTranslucent = config->readBoolEntry("OnlyDecoTranslucent",false);
resetKompmgr = config->readBoolEntry("ResetKompmgr", false);
if (resetKompmgr)
diff --git a/twin/workspace.cpp b/twin/workspace.cpp
index 923e8775a..6df4d1198 100644
--- a/twin/workspace.cpp
+++ b/twin/workspace.cpp
@@ -2806,13 +2806,21 @@ void Workspace::stopKompmgr()
kompmgr->disconnect(this, TQT_SLOT(restartKompmgr(KProcess*)));
options->useTranslucency = FALSE;
if (popup){ delete popup; popup = 0L; } // to add/remove opacity slider
- kompmgr->kill();
+ kompmgr->kill(SIGKILL);
TQByteArray ba;
TQDataStream arg(ba, IO_WriteOnly);
arg << "";
kapp->dcopClient()->emitDCOPSignal("default", "kompmgrStopped()", ba);
}
+void Workspace::kompmgrReloadSettings()
+{
+ if (!kompmgr || !kompmgr->isRunning()) {
+ return;
+ }
+ kompmgr->kill(SIGUSR2);
+}
+
bool Workspace::kompmgrIsRunning()
{
return kompmgr && kompmgr->isRunning();
diff --git a/twin/workspace.h b/twin/workspace.h
index 7cb2c3a6a..f1f7dc97e 100644
--- a/twin/workspace.h
+++ b/twin/workspace.h
@@ -413,7 +413,8 @@ class Workspace : public TQObject, public KWinInterface, public KDecorationDefin
void restartKompmgr( KProcess *proc );
void handleKompmgrOutput( KProcess *proc, char *buffer, int buflen);
void stopKompmgr();
- // end
+ void kompmgrReloadSettings();
+ // end
protected:
bool keyPressMouseEmulation( XKeyEvent& ev );