Re: New from Iain's hack factory
- From: Todd Kulesza <todd dropline net>
- To: iain <iain prettypeople org>
- Cc: desktop-devel-list gnome org
- Subject: Re: New from Iain's hack factory
- Date: Mon, 17 Feb 2003 14:57:58 -0500
Iain, you are rocking out. Thanks :]
Todd
iain wrote:
Its amazing what you can do with 10 minutes and a desire not to write YA
iTunes Clone...
Apply to gnome-session, don't think it matters if the previous
gnome-session patch has been applied.
Log out,
log back in
and log out again...
Log out times are slightly slower, but still faster than winXP on my
laptop.
Although an arthritic snail would be faster than winXP on my laptop.
Oh yeah, should tell the viewers
listening in on radio what it does
Instead of the black lines filling the screen
It gradually fades your desktop to greyscale
iain
------------------------------------------------------------------------
Index: logout.c
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/logout.c,v
retrieving revision 1.44
diff -u -p -r1.44 logout.c
--- logout.c 15 Oct 2002 06:05:01 -0000 1.44
+++ logout.c 17 Feb 2003 19:03:53 -0000
@@ -54,63 +54,53 @@ static enum
action = LOGOUT;
typedef struct {
- GdkScreen *screen;
- int monitor;
- GdkRectangle iris_rect;
- GdkWindow *root_window;
- int iris_block;
- GdkGC *iris_gc;
+ GdkScreen *screen;
+ int monitor;
+ GdkRectangle iris_rect;
+ GdkWindow *root_window;
+ GdkPixbuf *back_pb, *dest;
+ int iris_block;
+ int percent;
+ GdkGC *iris_gc;
} IrisData;
static int num_iris_timeouts = 0;
-static gint
-iris_callback (IrisData *data)
+static gboolean
+iris_callback (gpointer data)
{
- gint i;
- gint width_step;
- gint height_step;
- gint width;
- gint height;
-
- width_step = MIN (data->iris_rect.width / 2, data->iris_block);
- height_step = MIN (data->iris_rect.width / 2, data->iris_block);
-
- for (i = 0; i < MIN (width_step, height_step); i++)
- {
- width = (gint)data->iris_rect.width - 2 * i;
- height = (gint)data->iris_rect.height - 2 * i;
+ IrisData *iris = data;
- if (width < 0 || height < 0)
- break;
-
- gdk_draw_rectangle (data->root_window, data->iris_gc, FALSE,
- data->iris_rect.x + i,
- data->iris_rect.y + i,
- width, height);
+ if (iris->percent < 0) {
+
+ g_object_unref (iris->iris_gc);
+ g_object_unref (iris->back_pb);
+ g_object_unref (iris->dest);
+
+ g_free (iris);
+
+ if (!--num_iris_timeouts) {
+ gtk_main_quit ();
}
+
+ return FALSE;
+ }
+
+ gdk_pixbuf_saturate_and_pixelate (iris->back_pb, iris->dest,
+ ((float) iris->percent) / 100.0, FALSE);
+
+ gdk_draw_pixbuf (iris->root_window, iris->iris_gc, iris->dest,
+ 0, 0, iris->iris_rect.x, iris->iris_rect.y,
+ iris->iris_rect.width, iris->iris_rect.height,
+ GDK_RGB_DITHER_NONE, 0, 0);
gdk_flush ();
-
- data->iris_rect.x += width_step;
- data->iris_rect.y += height_step;
- data->iris_rect.width -= MIN (data->iris_rect.width, data->iris_block * 2);
- data->iris_rect.height -= MIN (data->iris_rect.height, data->iris_block * 2);
-
- if (data->iris_rect.width == 0 || data->iris_rect.height == 0)
- {
- g_object_unref (data->iris_gc);
- g_free (data);
-
- if (!--num_iris_timeouts)
- gtk_main_quit ();
-
- return FALSE;
- }
- else
- return TRUE;
+
+ iris->percent -= 30;
+
+ return TRUE;
}
-
+
static void
iris_on_screen (GdkScreen *screen,
int monitor)
@@ -128,21 +118,23 @@ iris_on_screen (GdkScreen *screen,
data->iris_rect.y = gsm_screen_get_y (screen, monitor);
data->iris_rect.width = gsm_screen_get_width (screen, monitor);
data->iris_rect.height = gsm_screen_get_height (screen, monitor);
-
+ data->percent = 90;
+
data->root_window = gdk_screen_get_root_window (screen);
-
- values.line_style = GDK_LINE_ON_OFF_DASH;
+ data->back_pb = gdk_pixbuf_get_from_drawable (NULL, data->root_window,
+ NULL, data->iris_rect.x,
+ data->iris_rect.y,
+ 0, 0, data->iris_rect.width,
+ data->iris_rect.height);
+ data->dest = gdk_pixbuf_copy (data->back_pb);
+
+/* values.line_style = GDK_LINE_ON_OFF_DASH; */
values.subwindow_mode = GDK_INCLUDE_INFERIORS;
data->iris_gc = gdk_gc_new_with_values (data->root_window,
&values,
- GDK_GC_LINE_STYLE | GDK_GC_SUBWINDOW);
- gdk_gc_set_dashes (data->iris_gc, 0, dash_list, 2);
-
- /* Plan for a time of 0.5 seconds for effect */
- data->iris_block = data->iris_rect.height / (500 / 20);
- if (data->iris_block < 8)
- data->iris_block = 8;
+ GDK_GC_SUBWINDOW);
+/* gdk_gc_set_dashes (data->iris_gc, 0, dash_list, 2); */
g_timeout_add (20, (GSourceFunc) iris_callback, data);
num_iris_timeouts++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]