Drop CompositingPrefs from Compositing KCM

Instead of getting the information from CompositingPrefs
the running KWin instance is queried through D-Bus.
In general the running KWin should have more information
about whether Compositing will work or not.

This means the kcm no longer has to link OpenGL.

REVIEW: 104753
This commit is contained in:
Martin Gräßlin 2012-04-27 11:03:26 +02:00
parent 704902720b
commit 6919b4dc94
6 changed files with 39 additions and 44 deletions

View file

@ -536,6 +536,22 @@ void Workspace::delayedCheckUnredirect()
scene->overlayWindow()->setShape(reg);
}
bool Workspace::compositingPossible() const
{
return CompositingPrefs::compositingPossible();
}
QString Workspace::compositingNotPossibleReason() const
{
return CompositingPrefs::compositingNotPossibleReason();
}
bool Workspace::openGLIsBroken() const
{
return CompositingPrefs::openGlIsBroken();
}
//****************************************
// Toplevel
//****************************************

View file

@ -5,9 +5,6 @@ include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin )
set(kcm_kwincompositing_PART_SRCS
main.cpp
ktimerdialog.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/compositingprefs.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/libkwineffects/kwinglobals.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/libkwineffects/kwinglplatform.cpp
)
kde4_add_ui_files(kcm_kwincompositing_PART_SRCS main.ui)
set(kwin_xml ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/org.kde.KWin.xml)
@ -17,36 +14,6 @@ kde4_add_plugin(kcm_kwincompositing ${kcm_kwincompositing_PART_SRCS})
target_link_libraries(kcm_kwincompositing ${KDE4_KCMUTILS_LIBS} ${KDE4_KDEUI_LIBS} ${X11_LIBRARIES})
install(TARGETS kcm_kwincompositing DESTINATION ${PLUGIN_INSTALL_DIR} )
# CompositingPrefs uses OpenGL
if(OPENGL_FOUND)
target_link_libraries(kcm_kwincompositing kwinglutils ${OPENGL_gl_LIBRARY})
set_target_properties(kcm_kwincompositing PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL)
# -ldl used by OpenGL code
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
target_link_libraries(kcm_kwincompositing ${DL_LIBRARY})
endif(DL_LIBRARY)
endif(OPENGL_FOUND)
if(OPENGLES_FOUND)
target_link_libraries(kcm_kwincompositing kwinglesutils ${OPENGLES_LIBRARIES})
set_target_properties(kcm_kwincompositing PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGL -DKWIN_HAVE_OPENGLES")
endif(OPENGLES_FOUND)
if (X11_Xrender_FOUND)
target_link_libraries(kcm_kwincompositing ${X11_Xrender_LIB})
endif (X11_Xrender_FOUND)
if (X11_Xrandr_FOUND)
target_link_libraries(kcm_kwincompositing ${X11_Xrandr_LIB})
endif (X11_Xrandr_FOUND)
if (X11_Xcomposite_FOUND)
target_link_libraries(kcm_kwincompositing ${X11_Xcomposite_LIB})
endif (X11_Xcomposite_FOUND)
if (X11_Xdamage_FOUND)
target_link_libraries(kcm_kwincompositing ${X11_Xdamage_LIB})
endif (X11_Xdamage_FOUND)
if (X11_Xfixes_FOUND)
target_link_libraries(kcm_kwincompositing ${X11_Xfixes_LIB})
endif (X11_Xfixes_FOUND)
########### install files ###############

View file

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "main.h"
#include "kwin_interface.h"
#include "kwinglobals.h"
#include <kaboutdata.h>
#include <kaction.h>
@ -385,19 +386,18 @@ void KWinCompositingConfig::updateStatusUI(bool compositingIsPossible)
ui.compositingOptionsContainer->show();
ui.statusTitleWidget->hide();
ui.rearmGlSupport->hide();
// Driver-specific config detection
mDefaultPrefs.detect();
}
else {
OrgKdeKWinInterface kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
ui.compositingOptionsContainer->hide();
QString text = i18n("Desktop effects are not available on this system due to the following technical issues:");
text += "<hr>";
text += CompositingPrefs::compositingNotPossibleReason();
text += kwin.isValid() ? kwin.compositingNotPossibleReason() : i18nc("Reason shown when trying to activate desktop effects and KWin (most likely) crashes",
"Window Manager seems not to be running");
ui.statusTitleWidget->setText(text);
ui.statusTitleWidget->setPixmap(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft);
ui.statusTitleWidget->show();
ui.rearmGlSupport->setVisible(CompositingPrefs::openGlIsBroken());
ui.rearmGlSupport->setVisible(kwin.isValid() ? kwin.openGLIsBroken() : true);
}
}
@ -405,7 +405,8 @@ void KWinCompositingConfig::load()
{
initEffectSelector();
mKWinConfig->reparseConfiguration();
updateStatusUI(CompositingPrefs::compositingPossible());
QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kwin", "/KWin", "org.kde.KWin", "compositingPossible");
QDBusConnection::sessionBus().callWithCallback(msg, this, SLOT(updateStatusUI(bool)));
// Copy Plugins group to temp config file
QMap<QString, QString> entries = mKWinConfig->entryMap("Plugins");
@ -515,8 +516,9 @@ bool KWinCompositingConfig::saveAdvancedTab()
void KWinCompositingConfig::save()
{
OrgKdeKWinInterface kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
if (ui.compositingType->currentIndex() == OPENGL_INDEX &&
CompositingPrefs::openGlIsBroken() && !ui.rearmGlSupport->isVisible())
kwin.openGLIsBroken() && !ui.rearmGlSupport->isVisible())
{
KConfigGroup config(mKWinConfig, "Compositing");
QString oldBackend = config.readEntry("Backend", "OpenGL");

View file

@ -29,7 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwin_interface.h"
#include "ui_main.h"
#include "compositingprefs.h"
#include "ktimerdialog.h"
class KPluginSelector;
@ -80,14 +79,13 @@ private slots:
void suggestGraphicsSystem();
void toogleSmoothScaleUi(int compositingType);
void toggleEffectShortcutChanged(const QKeySequence &seq);
void updateStatusUI(bool compositingIsPossible);
private:
bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const;
void updateStatusUI(bool compositingIsPossible);
KSharedConfigPtr mKWinConfig;
Ui::KWinCompositingConfig ui;
CompositingPrefs mDefaultPrefs;
QMap<QString, QString> mPreviousConfig;
KTemporaryFile mTmpConfigFile;

View file

@ -85,6 +85,15 @@
</method>
<method name="supportInformation">
<arg type="s" direction="out"/>
</medthod>
</method>
<method name="compositingPossible">
<arg type="b" direction="out"/>
</method>
<method name="compositingNotPossibleReason">
<arg type="s" direction="out"/>
</method>
<method name="openGLIsBroken">
<arg type="b" direction="out"/>
</method>
</interface>
</node>

View file

@ -447,6 +447,9 @@ public:
bool startActivity(const QString &id);
QStringList activeEffects() const;
QString supportInformation() const;
bool compositingPossible() const;
QString compositingNotPossibleReason() const;
bool openGLIsBroken() const;
void setCurrentScreen(int new_screen);