gnome-screensaver r1434 - in trunk: . src
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-screensaver r1434 - in trunk: . src
- Date: Wed, 30 Apr 2008 05:30:51 +0100 (BST)
Author: mccann
Date: Wed Apr 30 04:30:50 2008
New Revision: 1434
URL: http://svn.gnome.org/viewvc/gnome-screensaver?rev=1434&view=rev
Log:
2008-04-30 William Jon McCann <jmccann redhat com>
* configure.ac:
* src/Makefile.am:
* src/debug-screensaver.sh:
* src/gs-manager.c (gs_manager_init),
(apply_background_prefs_to_window), (manager_show_window):
* src/gs-window-x11.c (gs_window_set_background_pixmap),
(gs_window_clear_to_background_pixmap), (gs_window_clear),
(spawn_on_window), (popup_dialog_idle), (gs_window_init):
* src/gs-window.h:
Add support for showing the desktop background behind the
unlock dialog. Add dep on gnome-desktop and
pull in libbackground as an svn:external.
Still to-do:
1. add bg_preferences_load_defaults to pull from
system defaults instead of user settings
2. process bg changes
3. fix clearing child windows to the pixmap
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/src/ (props changed)
trunk/src/Makefile.am
trunk/src/debug-screensaver.sh
trunk/src/gs-manager.c
trunk/src/gs-window-x11.c
trunk/src/gs-window.h
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Wed Apr 30 04:30:50 2008
@@ -41,6 +41,7 @@
GDK_REQUIRED_VERSION=2.7.0
GTK_REQUIRED_VERSION=2.11.5
LIBGNOME_MENU_REQUIRED_VERSION=2.11.1
+GNOME_DESKTOP_REQUIRED_VERSION=2.21.4
GLADE_REQUIRED_VERSION=2.5.0
LIBGNOMEKBDUI_REQUIRED_VERSION=0.1
@@ -57,6 +58,7 @@
gtk+-2.0 >= $GTK_REQUIRED_VERSION
dbus-glib-1 >= $DBUS_REQUIRED_VERSION
gconf-2.0 >= $GCONF_REQUIRED_VERSION
+ gnome-desktop-2.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
libgnome-menu >= $LIBGNOME_MENU_REQUIRED_VERSION)
AC_SUBST(GNOME_SCREENSAVER_CFLAGS)
AC_SUBST(GNOME_SCREENSAVER_LIBS)
@@ -84,6 +86,8 @@
AC_SUBST(GNOME_SCREENSAVER_COMMAND_CFLAGS)
AC_SUBST(GNOME_SCREENSAVER_COMMAND_LIBS)
+PKG_CHECK_MODULES(LIBBACKGROUND, glib-2.0 gobject-2.0 gdk-2.0 gconf-2.0)
+
AC_PATH_XTRA
ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
@@ -1109,6 +1113,7 @@
Makefile
po/Makefile.in
src/Makefile
+src/libbackground/Makefile
data/Makefile
data/gnome-screensavers.menu
data/gnome-screensaver.pc
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Apr 30 04:30:50 2008
@@ -3,12 +3,17 @@
NULL =
+SUBDIRS = \
+ libbackground \
+ $(NULL)
+
saverdir = $(libexecdir)/gnome-screensaver
themesdir = $(pkgdatadir)/themes
INCLUDES = \
-I. \
-I$(srcdir) \
+ -I$(top_srcdir)/src/libbackground \
-DGMENU_I_KNOW_THIS_IS_UNSTABLE \
$(GNOME_SCREENSAVER_CFLAGS) \
$(GNOME_SCREENSAVER_DIALOG_CFLAGS) \
@@ -52,10 +57,12 @@
$(NULL)
gnome_screensaver_command_SOURCES = \
- gnome-screensaver-command.c
+ gnome-screensaver-command.c \
+ $(NULL)
gnome_screensaver_command_LDADD = \
- $(GNOME_SCREENSAVER_COMMAND_LIBS)
+ $(GNOME_SCREENSAVER_COMMAND_LIBS) \
+ $(NULL)
AUTH_SOURCES = \
gs-auth.h \
@@ -206,6 +213,7 @@
gnome_screensaver_LDADD = \
$(GNOME_SCREENSAVER_LIBS) \
$(SAVER_LIBS) \
+ $(top_builddir)/src/libbackground/libbackground.la \
$(NULL)
gnome_screensaver_LDFLAGS = -export-dynamic
Modified: trunk/src/debug-screensaver.sh
==============================================================================
--- trunk/src/debug-screensaver.sh (original)
+++ trunk/src/debug-screensaver.sh Wed Apr 30 04:30:50 2008
@@ -27,6 +27,8 @@
exit 1
fi
+export G_DEBUG=fatal_criticals
+
# kill the existing daemon
gnome-screensaver-command --exit
Modified: trunk/src/gs-manager.c
==============================================================================
--- trunk/src/gs-manager.c (original)
+++ trunk/src/gs-manager.c Wed Apr 30 04:30:50 2008
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
- * Copyright (C) 2004-2006 William Jon McCann <mccann jhu edu>
+ * Copyright (C) 2004-2008 William Jon McCann <mccann jhu edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,6 +25,10 @@
#include <time.h>
#include <gdk/gdk.h>
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnomeui/gnome-bg.h>
+#include "preferences.h"
+
#include "gs-prefs.h" /* for GSSaverMode */
#include "gs-manager.h"
@@ -47,6 +51,8 @@
GHashTable *jobs;
GSThemeManager *theme_manager;
+ BGPreferences *prefs;
+ GnomeBG *bg;
/* Policy */
glong lock_timeout;
@@ -940,6 +946,19 @@
manager->priv->fade = gs_fade_new ();
manager->priv->grab = gs_grab_new ();
manager->priv->theme_manager = gs_theme_manager_new ();
+
+ manager->priv->prefs = BG_PREFERENCES (bg_preferences_new ());
+ manager->priv->bg = gnome_bg_new ();
+
+#if 0
+ g_signal_connect (manager->priv->bg,
+ "changed",
+ G_CALLBACK (on_bg_changed),
+ manager);
+#endif
+
+ /* FIXME: should only load from defaults */
+ bg_preferences_load (manager->priv->prefs);
}
static void
@@ -1217,11 +1236,86 @@
}
static void
+apply_background_prefs_to_window (GSManager *manager,
+ GSWindow *window)
+{
+ GnomeBGPlacement placement;
+ GnomeBGColorType color;
+ const char *uri;
+ GdkPixmap *pixmap;
+ GdkScreen *screen;
+ int width;
+ int height;
+
+ uri = manager->priv->prefs->wallpaper_filename;
+
+ placement = GNOME_BG_PLACEMENT_TILED;
+
+ switch (manager->priv->prefs->wallpaper_type) {
+ case WPTYPE_TILED:
+ placement = GNOME_BG_PLACEMENT_TILED;
+ break;
+ case WPTYPE_CENTERED:
+ placement = GNOME_BG_PLACEMENT_CENTERED;
+ break;
+ case WPTYPE_SCALED:
+ placement = GNOME_BG_PLACEMENT_SCALED;
+ break;
+ case WPTYPE_STRETCHED:
+ placement = GNOME_BG_PLACEMENT_FILL_SCREEN;
+ break;
+ case WPTYPE_ZOOM:
+ placement = GNOME_BG_PLACEMENT_ZOOMED;
+ break;
+ case WPTYPE_NONE:
+ case WPTYPE_UNSET:
+ uri = NULL;
+ break;
+ }
+
+ switch (manager->priv->prefs->orientation) {
+ case ORIENTATION_SOLID:
+ color = GNOME_BG_COLOR_SOLID;
+ break;
+ case ORIENTATION_HORIZ:
+ color = GNOME_BG_COLOR_H_GRADIENT;
+ break;
+ case ORIENTATION_VERT:
+ color = GNOME_BG_COLOR_V_GRADIENT;
+ break;
+ default:
+ color = GNOME_BG_COLOR_SOLID;
+ break;
+ }
+
+ gnome_bg_set_uri (manager->priv->bg, uri);
+ gnome_bg_set_placement (manager->priv->bg, placement);
+ gnome_bg_set_color (manager->priv->bg,
+ color,
+ manager->priv->prefs->color1,
+ manager->priv->prefs->color2);
+
+ screen = gs_window_get_screen (window);
+ width = gdk_screen_get_width (screen);
+ height = gdk_screen_get_height (screen);
+ gs_debug ("Creating pixmap background w:%d h:%d", width, height);
+ pixmap = gnome_bg_create_pixmap (manager->priv->bg,
+ gs_window_get_gdk_window (window),
+ width,
+ height,
+ TRUE);
+ gs_window_set_background_pixmap (window, pixmap);
+ g_object_unref (pixmap);
+}
+
+static void
manager_show_window (GSManager *manager,
GSWindow *window)
{
GSJob *job;
+ apply_background_prefs_to_window (manager, window);
+
job = gs_job_new_for_widget (GTK_WIDGET (window));
manager_select_theme_for_job (manager, job);
Modified: trunk/src/gs-window-x11.c
==============================================================================
--- trunk/src/gs-window-x11.c (original)
+++ trunk/src/gs-window-x11.c Wed Apr 30 04:30:50 2008
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
- * Copyright (C) 2004-2006 William Jon McCann <mccann jhu edu>
+ * Copyright (C) 2004-2008 William Jon McCann <mccann jhu edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -77,6 +77,8 @@
GtkWidget *lock_socket;
GtkWidget *keyboard_socket;
+ GdkPixmap *background_pixmap;
+
guint popup_dialog_idle_id;
guint dialog_map_signal_id;
@@ -261,11 +263,79 @@
}
void
+gs_window_set_background_pixmap (GSWindow *window,
+ GdkPixmap *pixmap)
+{
+ g_return_if_fail (GS_IS_WINDOW (window));
+
+ if (window->priv->background_pixmap != NULL) {
+ g_object_unref (window->priv->background_pixmap);
+ }
+
+ if (pixmap != NULL) {
+ window->priv->background_pixmap = g_object_ref (pixmap);
+ gdk_window_set_back_pixmap (GTK_WIDGET (window)->window,
+ pixmap,
+ FALSE);
+ }
+}
+
+void
+gs_window_clear_to_background_pixmap (GSWindow *window)
+{
+ GtkStateType state;
+ GtkStyle *style;
+
+ g_return_if_fail (GS_IS_WINDOW (window));
+
+ if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (window))) {
+ return;
+ }
+
+ if (window->priv->background_pixmap == NULL) {
+ /* don't allow null pixmaps */
+ return;
+ }
+
+ gs_debug ("Clearing window to background pixmap");
+
+ style = gtk_style_copy (GTK_WIDGET (window)->style);
+
+ state = (GtkStateType) 0;
+ while (state < (GtkStateType) G_N_ELEMENTS (GTK_WIDGET (window)->style->bg_pixmap)) {
+
+ if (style->bg_pixmap[state] != NULL) {
+ g_object_unref (style->bg_pixmap[state]);
+ }
+
+ style->bg_pixmap[state] = g_object_ref (window->priv->background_pixmap);
+ state++;
+ }
+
+ gtk_widget_set_style (GTK_WIDGET (window), style);
+ g_object_unref (style);
+
+ if (window->priv->background_pixmap != NULL) {
+ gdk_window_set_back_pixmap (GTK_WIDGET (window)->window,
+ window->priv->background_pixmap,
+ FALSE);
+ }
+
+ gdk_window_clear (GTK_WIDGET (window)->window);
+
+ /* If a screensaver theme adds child windows we need to clear them too */
+ clear_all_children (window);
+
+ gdk_flush ();
+}
+
+void
gs_window_clear (GSWindow *window)
{
GdkColor color = { 0, 0x0000, 0x0000, 0x0000 };
GdkColormap *colormap;
GtkStateType state;
+ GtkStyle *style;
g_return_if_fail (GS_IS_WINDOW (window));
@@ -281,9 +351,26 @@
state++;
}
+ style = gtk_style_copy (GTK_WIDGET (window)->style);
+
+ state = (GtkStateType) 0;
+ while (state < (GtkStateType) G_N_ELEMENTS (GTK_WIDGET (window)->style->bg_pixmap)) {
+
+ if (style->bg_pixmap[state] != NULL) {
+ g_object_unref (style->bg_pixmap[state]);
+ }
+
+ style->bg_pixmap[state] = NULL;
+ state++;
+ }
+
colormap = gdk_drawable_get_colormap (GTK_WIDGET (window)->window);
gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);
gdk_window_set_background (GTK_WIDGET (window)->window, &color);
+
+ gtk_widget_set_style (GTK_WIDGET (window), style);
+ g_object_unref (style);
+
gdk_window_clear (GTK_WIDGET (window)->window);
/* If a screensaver theme adds child windows we need to clear them too */
@@ -882,7 +969,6 @@
int standard_error;
int child_pid;
int id;
- int i;
error = NULL;
if (! g_shell_parse_argv (command, &argc, &argv, &error)) {
@@ -1438,7 +1524,8 @@
command = g_string_append (command, " --verbose");
}
- gs_window_clear (window);
+ gs_window_clear_to_background_pixmap (window);
+
set_invisible_cursor (GTK_WIDGET (window)->window, FALSE);
result = spawn_on_window (window,
@@ -2121,7 +2208,7 @@
| GDK_VISIBILITY_NOTIFY_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK);
- force_no_pixmap_background (GTK_WIDGET (window));
+ /*force_no_pixmap_background (GTK_WIDGET (window));*/
window->priv->vbox = gtk_vbox_new (FALSE, 12);
gtk_widget_show (window->priv->vbox);
Modified: trunk/src/gs-window.h
==============================================================================
--- trunk/src/gs-window.h (original)
+++ trunk/src/gs-window.h Wed Apr 30 04:30:50 2008
@@ -65,6 +65,8 @@
int monitor);
int gs_window_get_monitor (GSWindow *window);
+void gs_window_set_background_pixmap (GSWindow *window,
+ GdkPixmap *pixmap);
void gs_window_set_lock_enabled (GSWindow *window,
gboolean lock_enabled);
void gs_window_set_logout_enabled (GSWindow *window,
@@ -92,6 +94,7 @@
void gs_window_destroy (GSWindow *window);
GdkWindow * gs_window_get_gdk_window (GSWindow *window);
void gs_window_clear (GSWindow *window);
+void gs_window_clear_to_background_pixmap (GSWindow *window);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]