Browse Source

Fix save root window pixmap id when setting background (#3353)

Patch provided by sl4mmy. Thank you.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Nobuhiro Iwamatsu 11 years ago
parent
commit
ea681f0116
2 changed files with 8 additions and 1 deletions
  1. 6 1
      app.cpp
  2. 2 0
      app.h

+ 6 - 1
app.cpp

@@ -16,12 +16,12 @@
 #include <stdint.h>
 #include <cstring>
 #include <cstdio>
-
 #include <iostream>
 #include <fstream>
 #include <sstream>
 #include <vector>
 #include <algorithm>
+
 #include "app.h"
 #include "numlock.h"
 #include "util.h"
@@ -299,6 +299,9 @@ void App::Run() {
 	Scr = DefaultScreen(Dpy);
 	Root = RootWindow(Dpy, Scr);
 
+	// Intern _XROOTPMAP_ID property
+	BackgroundPixmapId = XInternAtom(Dpy, "_XROOTPMAP_ID", False);
+
 	/* for tests we use a standard window */
 	if (testing) {
 		Window RealRoot = RootWindow(Dpy, Scr);
@@ -1075,6 +1078,8 @@ void App::setBackground(const string& themedir) {
 		}
 		Pixmap p = image->createPixmap(Dpy, Scr, Root);
 		XSetWindowBackgroundPixmap(Dpy, Root, p);
+		XChangeProperty(Dpy, Root, BackgroundPixmapId, XA_PIXMAP, 32,
+			PropModeReplace, (unsigned char *)&p, 1);
 	}
 	XClearWindow(Dpy, Root);
 

+ 2 - 0
app.h

@@ -13,6 +13,7 @@
 #define _APP_H_
 
 #include <X11/Xlib.h>
+#include <X11/Xatom.h>
 #include <signal.h>
 #include <unistd.h>
 #include <sys/wait.h>
@@ -99,6 +100,7 @@ private:
 
 	void blankScreen();
 	Image *image;
+	Atom BackgroundPixmapId;
 	void setBackground(const std::string &themedir);
 
 	bool firstlogin;