gdm/gdm-2.23.92-save-root-window.patch
2008-09-16 20:54:52 +00:00

118 lines
4.4 KiB
Diff

diff -up gdm-2.23.92/daemon/gdm-simple-slave.c.save-root-window gdm-2.23.92/daemon/gdm-simple-slave.c
--- gdm-2.23.92/daemon/gdm-simple-slave.c.save-root-window 2008-09-03 16:52:53.000000000 -0400
+++ gdm-2.23.92/daemon/gdm-simple-slave.c 2008-09-16 15:29:15.000000000 -0400
@@ -825,6 +825,15 @@ setup_server (GdmSimpleSlave *slave)
{
/* Set the busy cursor */
gdm_slave_set_busy_cursor (GDM_SLAVE (slave));
+
+ /* The root window has a background that may be useful
+ * to cross fade or transition from when setting the
+ * login screen background. We read it here, and stuff
+ * it into the standard _XROOTPMAP_ID root window property,
+ * so gnome-settings-daemon can get at it.
+ */
+ gdm_slave_save_root_windows (GDM_SLAVE (slave));
+
}
static void
diff -up gdm-2.23.92/daemon/gdm-slave.c.save-root-window gdm-2.23.92/daemon/gdm-slave.c
--- gdm-2.23.92/daemon/gdm-slave.c.save-root-window 2008-08-26 15:04:00.000000000 -0400
+++ gdm-2.23.92/daemon/gdm-slave.c 2008-09-16 15:39:18.000000000 -0400
@@ -42,6 +42,7 @@
#include <dbus/dbus-glib-lowlevel.h>
#include <X11/Xlib.h> /* for Display */
+#include <X11/Xatom.h> /* for XA_PIXMAP */
#include <X11/cursorfont.h> /* for watch cursor */
#include "gdm-common.h"
@@ -341,6 +342,75 @@ gdm_slave_run_script (GdmSlave *slave,
return ret;
}
+static void
+gdm_slave_save_root_window_of_screen (GdmSlave *slave,
+ Atom id_atom,
+ int screen_number)
+{
+ Window root_window;
+ GC gc;
+ XGCValues values;
+ Pixmap pixmap;
+ int width, height, depth;
+
+ root_window = RootWindow (slave->priv->server_display,
+ screen_number);
+
+ width = DisplayWidth (slave->priv->server_display, screen_number);
+ height = DisplayHeight (slave->priv->server_display, screen_number);
+ depth = DefaultDepth (slave->priv->server_display, screen_number);
+ pixmap = XCreatePixmap (slave->priv->server_display,
+ root_window,
+ width, height, depth);
+
+ values.function = GXcopy;
+ values.plane_mask = AllPlanes;
+ values.fill_style = FillSolid;
+ values.subwindow_mode = IncludeInferiors;
+
+ gc = XCreateGC (slave->priv->server_display,
+ root_window,
+ GCFunction | GCPlaneMask | GCFillStyle | GCSubwindowMode,
+ &values);
+
+ if (XCopyArea (slave->priv->server_display,
+ root_window, pixmap, gc, 0, 0,
+ width, height, 0, 0)) {
+
+ long pixmap_as_long;
+
+ pixmap_as_long = (long) pixmap;
+
+ XChangeProperty (slave->priv->server_display,
+ root_window, id_atom, XA_PIXMAP,
+ 32, PropModeReplace, (guchar *) &pixmap_as_long,
+ 1);
+
+ }
+
+ XFreeGC (slave->priv->server_display, gc);
+}
+
+void
+gdm_slave_save_root_windows (GdmSlave *slave)
+{
+ int i, number_of_screens;
+ Atom atom;
+
+ number_of_screens = ScreenCount (slave->priv->server_display);
+
+ atom = XInternAtom (slave->priv->server_display,
+ "_XROOTPMAP_ID", False);
+
+ if (atom == 0) {
+ return;
+ }
+
+ for (i = 0; i < number_of_screens; i++) {
+ gdm_slave_save_root_window_of_screen (slave, atom, i);
+ }
+}
+
void
gdm_slave_set_busy_cursor (GdmSlave *slave)
{
diff -up gdm-2.23.92/daemon/gdm-slave.h.save-root-window gdm-2.23.92/daemon/gdm-slave.h
--- gdm-2.23.92/daemon/gdm-slave.h.save-root-window 2008-08-26 15:04:00.000000000 -0400
+++ gdm-2.23.92/daemon/gdm-slave.h 2008-09-16 15:29:15.000000000 -0400
@@ -69,6 +69,7 @@ gboolean gdm_slave_switch_to_
gboolean gdm_slave_connect_to_x11_display (GdmSlave *slave);
void gdm_slave_set_busy_cursor (GdmSlave *slave);
+void gdm_slave_save_root_windows (GdmSlave *slave);
gboolean gdm_slave_run_script (GdmSlave *slave,
const char *dir,
const char *username);