Branch: master

0ae6c2ce 2014-11-25 14:22:07 Timothy Pearson
Fix blur option not being written correctly
Add ability to set desaturated backgrounds from the control center
M twin/compton-tde/compton.c
M twin/kcmtwin/twinoptions/windows.cpp
M twin/kcmtwin/twinoptions/windows.h
diff --git a/twin/compton-tde/compton.c b/twin/compton-tde/compton.c
index d209512..4a78f7f 100644
--- a/twin/compton-tde/compton.c
+++ b/twin/compton-tde/compton.c
@@ -2512,10 +2512,10 @@
 
   /* This needs to be here since we don't get PropertyNotify when unmapped */
   w->opacity = wid_get_opacity_prop(ps, w->id, OPAQUE);
-  w->greyscale_background = determine_window_transparency_filter_greyscale(ps, id);
   w->greyscale_blended_background = determine_window_transparency_filter_greyscale_blended(ps, id);
   w->show_root_tile = determine_window_transparent_to_desktop(ps, id);
   w->show_black_background = determine_window_transparent_to_black(ps, id);
+  win_determine_greyscale_background(ps, w);
 
   // Update window mode here to check for ARGB windows
   win_determine_mode(ps, w);
diff --git a/twin/kcmtwin/twinoptions/windows.cpp b/twin/kcmtwin/twinoptions/windows.cpp
index 30d48d1..3e27575 100644
--- a/twin/kcmtwin/twinoptions/windows.cpp
+++ b/twin/kcmtwin/twinoptions/windows.cpp
@@ -1349,9 +1349,12 @@
   vLay->addWidget(useOpenGL);
   blurBackground = new TQCheckBox(i18n("Blur the background of transparent windows"),tGroup);
   vLay->addWidget(blurBackground);
+  greyscaleBackground = new TQCheckBox(i18n("Desaturate the background of transparent windows"),tGroup);
+  vLay->addWidget(greyscaleBackground);
   if (TDECompositor != "compton-tde") {
       useOpenGL->hide();
       blurBackground->hide();
+      greyscaleBackground->hide();
   }
 
   vLay->addStretch();
@@ -1490,6 +1493,8 @@
   connect(useOpenGL, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
   connect(useOpenGL, TQT_SIGNAL(toggled(bool)), blurBackground, TQT_SLOT(setEnabled(bool)));
   connect(blurBackground, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
+  connect(useOpenGL, TQT_SIGNAL(toggled(bool)), greyscaleBackground, TQT_SLOT(setEnabled(bool)));
+  connect(greyscaleBackground, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
   connect(useShadows, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
   connect(useShadowsOnMenuWindows, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
   connect(useShadowsOnToolTipWindows, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()));
@@ -1530,6 +1535,7 @@
   connect(disableARGB, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
   connect(useOpenGL, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
   connect(blurBackground, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
+  connect(greyscaleBackground, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
   connect(useShadows, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
   connect(useShadowsOnMenuWindows, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
   connect(useShadowsOnToolTipWindows, TQT_SIGNAL(toggled(bool)), TQT_SLOT(resetKompmgr()));
@@ -1607,6 +1613,8 @@
   useOpenGL->setChecked(conf_.readBoolEntry("useOpenGL",FALSE));
   blurBackground->setChecked(conf_.readBoolEntry("blurBackground",FALSE));
   blurBackground->setEnabled(useOpenGL->isChecked());
+  greyscaleBackground->setChecked(conf_.readBoolEntry("greyscaleBackground",FALSE));
+  greyscaleBackground->setEnabled(useOpenGL->isChecked());
 
   useShadows->setChecked(conf_.readEntry("Compmode","").compare("CompClientShadows") == 0);
   useShadowsOnMenuWindows->setChecked(conf_.readBoolEntry("ShadowsOnMenuWindows",TRUE));
@@ -1683,6 +1691,7 @@
   conf_->writeEntry("DisableARGB",disableARGB->isChecked());
   conf_->writeEntry("useOpenGL",useOpenGL->isChecked());
   conf_->writeEntry("blurBackground",blurBackground->isChecked());
+  conf_->writeEntry("greyscaleBackground",greyscaleBackground->isChecked());
   conf_->writeEntry("ShadowOffsetY",-1*shadowTopOffset->value());
   conf_->writeEntry("ShadowOffsetX",-1*shadowLeftOffset->value());
 
@@ -1759,13 +1768,15 @@
       stream << "backend = \"" << (useOpenGL->isChecked()?"glx":"xrender") << "\";\n";
       stream << "vsync = \"" << (useOpenGL->isChecked()?"opengl":"none") << "\";\n";
 
-      stream << "blur-background = \"" << ((blurBackground->isChecked() && useOpenGL->isChecked())?"true":"false") << "\";\n";
+      stream << "blur-background = " << ((blurBackground->isChecked() && useOpenGL->isChecked())?"true":"false") << ";\n";
       stream << "blur-background-fixed = true;\n";
       stream << "blur-background-exclude = [\n";
       stream << "  \"window_type = 'dock'\",\n";
       stream << "  \"window_type = 'desktop'\"\n";
       stream << "];\n";
 
+      stream << "greyscale-background = " << ((greyscaleBackground->isChecked() && useOpenGL->isChecked())?"true":"false") << ";\n";
+
       // Global settings
       stream << "no-dock-shadow = true;\n";
       stream << "no-dnd-shadow = true;\n";
diff --git a/twin/kcmtwin/twinoptions/windows.h b/twin/kcmtwin/twinoptions/windows.h
index facde41..52596ad 100644
--- a/twin/kcmtwin/twinoptions/windows.h
+++ b/twin/kcmtwin/twinoptions/windows.h
@@ -261,6 +261,7 @@
   TQCheckBox *disableARGB;
   TQCheckBox *useOpenGL;
   TQCheckBox *blurBackground;
+  TQCheckBox *greyscaleBackground;
   TQCheckBox *fadeInWindows;
   TQCheckBox *fadeInMenuWindows;
   TQCheckBox *fadeInToolTipWindows;