kdebase4-workspace/kde-workspace-4.11.6-dbus-wallpaper.patch

84 lines
3.7 KiB
Diff

diff -urN kde-workspace-4.11.6/plasma/desktop/shell/dbus/org.kde.plasma.App.xml kde-workspace-4.11.6-patched/plasma/desktop/shell/dbus/org.kde.plasma.App.xml
--- kde-workspace-4.11.6/plasma/desktop/shell/dbus/org.kde.plasma.App.xml 2014-01-31 06:25:09.000000000 +1100
+++ kde-workspace-4.11.6-patched/plasma/desktop/shell/dbus/org.kde.plasma.App.xml 2014-02-18 15:04:27.716403119 +1100
@@ -6,6 +6,11 @@
<method name="showDashboard">
<arg name="show" type="b" direction="in"/>
</method>
+ <method name="setWallpaperImage">
+ <arg name="screenId" type="i" direction="in"/>
+ <arg name="resizeHint" type="i" direction="in"/>
+ <arg name="url" type="s" direction="in"/>
+ </method>
<method name="showInteractiveConsole">
</method>
<method name="loadScriptInInteractiveConsole">
diff -urN kde-workspace-4.11.6/plasma/desktop/shell/plasmaapp.cpp kde-workspace-4.11.6-patched/plasma/desktop/shell/plasmaapp.cpp
--- kde-workspace-4.11.6/plasma/desktop/shell/plasmaapp.cpp 2014-01-31 06:25:09.000000000 +1100
+++ kde-workspace-4.11.6-patched/plasma/desktop/shell/plasmaapp.cpp 2014-02-18 16:27:22.000000000 +1100
@@ -396,6 +396,53 @@
KGlobal::config()->sync();
}
+void PlasmaApp::setWallpaperImage(int screenId, int resizeHint, const QString &url)
+{
+ int currentDesktop;
+
+ if (AppSettings::perVirtualDesktopViews()) {
+ currentDesktop = KWindowSystem::currentDesktop() - 1;
+ } else {
+ currentDesktop = -1;
+ }
+
+ // Use current screen if -1 is passed
+ if (screenId < 0) {
+ screenId = m_corona->screenId(QCursor::pos());
+ }
+
+ Plasma::Containment *currentContainment = PlasmaApp::self()->corona()->containmentForScreen(screenId, currentDesktop);
+
+ if (currentContainment && !url.isEmpty()) {
+ if (currentContainment->wallpaper() && currentContainment->wallpaper()->supportsMimetype(KMimeType::findByUrl(KUrl(url)).data()->name())) {
+ currentContainment->wallpaper()->setUrls(KUrl(url));
+ } else {
+ KPluginInfo::List wallpaperList = currentContainment->wallpaper()->listWallpaperInfoForMimetype(KMimeType::findByUrl(KUrl(url)).data()->name());
+ bool image = false;
+ foreach (const KPluginInfo &wallpaper, wallpaperList) {
+ if (wallpaper.pluginName() == "image") {
+ image = true;
+ break;
+ }
+ }
+
+ if (image) {
+ currentContainment->setWallpaper("image");
+ } else if (!wallpaperList.isEmpty()) {
+ currentContainment->setWallpaper(wallpaperList.at(0).name());
+ }
+
+ if (currentContainment->wallpaper()) {
+ currentContainment->wallpaper()->setUrls(KUrl(url));
+ }
+ }
+ // Don't change current resize method hint if -1 is passed
+ if (resizeHint >= 0) {
+ currentContainment->wallpaper()->setResizeMethodHint((Plasma::Wallpaper::ResizeMethod)resizeHint);
+ }
+ }
+}
+
void PlasmaApp::toggleDashboard()
{
// we don't want to listen to dashboard closure signals when toggling
diff -urN kde-workspace-4.11.6/plasma/desktop/shell/plasmaapp.h kde-workspace-4.11.6-patched/plasma/desktop/shell/plasmaapp.h
--- kde-workspace-4.11.6/plasma/desktop/shell/plasmaapp.h 2014-01-31 06:25:09.000000000 +1100
+++ kde-workspace-4.11.6-patched/plasma/desktop/shell/plasmaapp.h 2014-02-18 15:05:21.850434230 +1100
@@ -110,6 +110,8 @@
void toggleDashboard();
void showDashboard(bool show);
+ void setWallpaperImage(int screenId, int resizeHint, const QString &url);
+
void showInteractiveConsole();
void loadScriptInInteractiveConsole(const QString &script);
void showInteractiveKWinConsole();