From 6919b4dc94db05df3b260c4662341ecd69905523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 27 Apr 2012 11:03:26 +0200 Subject: [PATCH] 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 --- composite.cpp | 16 +++++++++++++ kcmkwin/kwincompositing/CMakeLists.txt | 33 -------------------------- kcmkwin/kwincompositing/main.cpp | 16 +++++++------ kcmkwin/kwincompositing/main.h | 4 +--- org.kde.KWin.xml | 11 ++++++++- workspace.h | 3 +++ 6 files changed, 39 insertions(+), 44 deletions(-) diff --git a/composite.cpp b/composite.cpp index abf0e9dbbb..28e00b5278 100644 --- a/composite.cpp +++ b/composite.cpp @@ -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 //**************************************** diff --git a/kcmkwin/kwincompositing/CMakeLists.txt b/kcmkwin/kwincompositing/CMakeLists.txt index decc6b71f6..17fcbb4976 100644 --- a/kcmkwin/kwincompositing/CMakeLists.txt +++ b/kcmkwin/kwincompositing/CMakeLists.txt @@ -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 ############### diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 19a2469ea3..34ecae139d 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -21,6 +21,7 @@ along with this program. If not, see . #include "main.h" #include "kwin_interface.h" +#include "kwinglobals.h" #include #include @@ -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 += "
"; - 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 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"); diff --git a/kcmkwin/kwincompositing/main.h b/kcmkwin/kwincompositing/main.h index 8e2f3bb65a..94c62deea7 100644 --- a/kcmkwin/kwincompositing/main.h +++ b/kcmkwin/kwincompositing/main.h @@ -29,7 +29,6 @@ along with this program. If not, see . #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 mPreviousConfig; KTemporaryFile mTmpConfigFile; diff --git a/org.kde.KWin.xml b/org.kde.KWin.xml index a0b3a29e30..b893bec24b 100644 --- a/org.kde.KWin.xml +++ b/org.kde.KWin.xml @@ -85,6 +85,15 @@ - + + + + + + + + + + diff --git a/workspace.h b/workspace.h index 0447f45118..703ab012be 100644 --- a/workspace.h +++ b/workspace.h @@ -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);