gnome-desktop r5352 - trunk/libgnome-desktop
- From: halfline svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-desktop r5352 - trunk/libgnome-desktop
- Date: Mon, 19 Jan 2009 22:57:38 +0000 (UTC)
Author: halfline
Date: Mon Jan 19 22:57:38 2009
New Revision: 5352
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5352&view=rev
Log:
Move part of set_pixmap_as_root to set_root_pixmap_id
The meatiest part of set_pixmap_as_root takes the passed
in pixmap and stores it on the root window in the
ESETROOT_PMAP_ID and _XROOTPMAP_ID properties. That
functionality stands on its own, and should be factored
out so it can get reused later when adding crossfade
transitions on background changes.
Modified:
trunk/libgnome-desktop/ChangeLog
trunk/libgnome-desktop/gnome-bg.c
Modified: trunk/libgnome-desktop/gnome-bg.c
==============================================================================
--- trunk/libgnome-desktop/gnome-bg.c (original)
+++ trunk/libgnome-desktop/gnome-bg.c Mon Jan 19 22:57:38 2009
@@ -1046,15 +1046,9 @@
return result;
}
-
-/* Set the root pixmap, and properties pointing to it. We
- * do this atomically with a server grab to make sure that
- * we won't leak the pixmap if somebody else it setting
- * it at the same time. (This assumes that they follow the
- * same conventions we do)
- */
-void
-gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
+static void
+gnome_bg_set_root_pixmap_id (GdkScreen *screen,
+ GdkPixmap *pixmap)
{
int result;
gint format;
@@ -1065,24 +1059,20 @@
Atom type;
Display *display;
int screen_num;
-
- g_return_if_fail (screen != NULL);
- g_return_if_fail (pixmap != NULL);
-
+
screen_num = gdk_screen_get_number (screen);
-
data_esetroot = NULL;
+
display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
-
- gdk_x11_display_grab (gdk_screen_get_display (screen));
-
- result = XGetWindowProperty (
- display, RootWindow (display, screen_num),
- gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
- 0L, 1L, False, XA_PIXMAP,
- &type, &format, &nitems, &bytes_after,
- &data_esetroot);
-
+
+ result = XGetWindowProperty (display,
+ RootWindow (display, screen_num),
+ gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
+ 0L, 1L, False, XA_PIXMAP,
+ &type, &format, &nitems,
+ &bytes_after,
+ &data_esetroot);
+
if (data_esetroot != NULL) {
if (result == Success && type == XA_PIXMAP &&
format == 32 &&
@@ -1105,9 +1095,33 @@
gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"), XA_PIXMAP,
32, PropModeReplace,
(guchar *) &pixmap_id, 1);
-
+}
+
+/* Set the root pixmap, and properties pointing to it. We
+ * do this atomically with a server grab to make sure that
+ * we won't leak the pixmap if somebody else it setting
+ * it at the same time. (This assumes that they follow the
+ * same conventions we do)
+ */
+void
+gnome_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *pixmap)
+{
+ Display *display;
+ int screen_num;
+
+ g_return_if_fail (screen != NULL);
+ g_return_if_fail (pixmap != NULL);
+
+ screen_num = gdk_screen_get_number (screen);
+
+ display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+
+ gdk_x11_display_grab (gdk_screen_get_display (screen));
+
+ gnome_bg_set_root_pixmap_id (screen, pixmap);
+
XSetWindowBackgroundPixmap (display, RootWindow (display, screen_num),
- pixmap_id);
+ GDK_PIXMAP_XID (pixmap));
XClearWindow (display, RootWindow (display, screen_num));
gdk_display_flush (gdk_screen_get_display (screen));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]