updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / libgksu-ubuntu / patches / 17_composited_fade.patch
blobaea07bb75812c50703f47d8359962bf2c9369b9a
1 diff -Nur -x '*.orig' -x '*~' libgksu-2.0.7/libgksu/libgksu.c libgksu-2.0.7.new/libgksu/libgksu.c
2 --- libgksu-2.0.7/libgksu/libgksu.c 2008-06-12 18:33:47.000000000 +0200
3 +++ libgksu-2.0.7.new/libgksu/libgksu.c 2008-06-12 18:34:26.000000000 +0200
4 @@ -171,13 +171,14 @@
5 guchar *start_p, *end_p, *frame_p;
6 GTimeVal start_time;
7 GdkGC *gc;
8 + gboolean composited;
9 } FadeoutData;
11 FadeoutData *fade_data = NULL;
12 static GList *fade_data_l = NULL;
13 static GList *fadeout_windows = NULL;
15 -#define FADE_DURATION 500.0
16 +#define FADE_DURATION 300.0
18 int
19 gsm_screen_get_width (GdkScreen *screen,
20 @@ -314,33 +315,47 @@
21 elapsed = G_MAXDOUBLE;
24 - if (elapsed > FADE_DURATION)
25 + if (elapsed > FADE_DURATION )
27 - gdk_draw_pixbuf (fadeout->draw_window,
28 - fadeout->gc,
29 - fadeout->end_pb,
30 - 0, 0,
31 - 0, 0,
32 - fadeout->area.width,
33 - fadeout->area.height,
34 - GDK_RGB_DITHER_NONE,
35 - 0, 0);
36 + if (fadeout->composited)
37 + {
38 + gdk_window_set_opacity (fadeout->draw_window, 0.5);
39 + }
40 + else
41 + {
42 + gdk_draw_pixbuf (fadeout->draw_window,
43 + fadeout->gc,
44 + fadeout->end_pb,
45 + 0, 0,
46 + 0, 0,
47 + fadeout->area.width,
48 + fadeout->area.height,
49 + GDK_RGB_DITHER_NONE,
50 + 0, 0);
51 + }
53 return FALSE;
56 percent = elapsed / FADE_DURATION;
58 - get_current_frame (fadeout, 1.0 - percent);
59 - gdk_draw_pixbuf (fadeout->draw_window,
60 - fadeout->gc,
61 - fadeout->frame,
62 - 0, 0,
63 - 0, 0,
64 - fadeout->area.width,
65 - fadeout->area.height,
66 - GDK_RGB_DITHER_NONE,
67 - 0, 0);
68 + if (fadeout->composited)
69 + {
70 + gdk_window_set_opacity (fadeout->draw_window, percent/2);
71 + }
72 + else
73 + {
74 + get_current_frame (fadeout, 1.0 - percent);
75 + gdk_draw_pixbuf (fadeout->draw_window,
76 + fadeout->gc,
77 + fadeout->frame,
78 + 0, 0,
79 + 0, 0,
80 + fadeout->area.width,
81 + fadeout->area.height,
82 + GDK_RGB_DITHER_NONE,
83 + 0, 0);
84 + }
86 gdk_flush ();
88 @@ -380,15 +395,23 @@
90 if (elapsed > FADE_DURATION)
92 - gdk_draw_pixbuf (fadeout->draw_window,
93 - fadeout->gc,
94 - fadeout->end_pb,
95 - 0, 0,
96 - 0, 0,
97 - fadeout->area.width,
98 - fadeout->area.height,
99 - GDK_RGB_DITHER_NONE,
100 - 0, 0);
101 + if (fadeout->composited)
103 + gdk_window_set_opacity (fadeout->draw_window, 0.0);
104 + gdk_window_resize (fadeout->draw_window, 4, 4);
106 + else
108 + gdk_draw_pixbuf (fadeout->draw_window,
109 + fadeout->gc,
110 + fadeout->end_pb,
111 + 0, 0,
112 + 0, 0,
113 + fadeout->area.width,
114 + fadeout->area.height,
115 + GDK_RGB_DITHER_NONE,
116 + 0, 0);
119 g_object_unref (fadeout->gc);
120 g_object_unref (fadeout->start_pb);
121 @@ -404,16 +427,23 @@
123 percent = elapsed / FADE_DURATION;
125 - get_current_frame (fadeout, percent);
126 - gdk_draw_pixbuf (fadeout->draw_window,
127 - fadeout->gc,
128 - fadeout->frame,
129 - 0, 0,
130 - 0, 0,
131 - fadeout->area.width,
132 - fadeout->area.height,
133 - GDK_RGB_DITHER_NONE,
134 - 0, 0);
135 + if (fadeout->composited)
137 + gdk_window_set_opacity (fadeout->draw_window, 0.5 - percent/2);
139 + else
141 + get_current_frame (fadeout, percent);
142 + gdk_draw_pixbuf (fadeout->draw_window,
143 + fadeout->gc,
144 + fadeout->frame,
145 + 0, 0,
146 + 0, 0,
147 + fadeout->area.width,
148 + fadeout->area.height,
149 + GDK_RGB_DITHER_NONE,
150 + 0, 0);
153 gdk_flush ();
155 @@ -433,6 +463,7 @@
157 fadeout->screen = screen;
158 fadeout->monitor = monitor;
159 + fadeout->composited = gdk_screen_is_composited (screen);
161 fadeout->area.x = gsm_screen_get_x (screen, monitor);
162 fadeout->area.y = gsm_screen_get_y (screen, monitor);
163 @@ -440,11 +471,11 @@
164 fadeout->area.height = gsm_screen_get_height (screen, monitor);
166 fadeout->root_window = gdk_screen_get_root_window (screen);
167 - attr.window_type = GDK_WINDOW_CHILD;
168 + attr.window_type = GDK_WINDOW_TOPLEVEL;
169 attr.x = fadeout->area.x;
170 attr.y = fadeout->area.y;
171 - attr.width = fadeout->area.width;
172 - attr.height = fadeout->area.height;
173 + attr.width = 4;
174 + attr.height = 4;
175 attr.wclass = GDK_INPUT_OUTPUT;
176 attr.visual = gdk_screen_get_system_visual (fadeout->screen);
177 attr.colormap = gdk_screen_get_default_colormap (fadeout->screen);
178 @@ -477,17 +508,29 @@
180 fadeout->gc = gdk_gc_new_with_values (fadeout->root_window, &values, GDK_GC_SUBWINDOW);
182 - gdk_window_set_back_pixmap (fadeout->draw_window, NULL, FALSE);
183 + if (fadeout->composited)
185 + gdk_window_set_opacity (fadeout->draw_window, 0.0);
187 + else
189 + gdk_window_set_back_pixmap (fadeout->draw_window, NULL, FALSE);
190 + gdk_draw_pixbuf (fadeout->draw_window,
191 + fadeout->gc,
192 + fadeout->frame,
193 + 0, 0,
194 + 0, 0,
195 + fadeout->area.width,
196 + fadeout->area.height,
197 + GDK_RGB_DITHER_NONE,
198 + 0, 0);
201 gdk_window_show (fadeout->draw_window);
202 - gdk_draw_pixbuf (fadeout->draw_window,
203 - fadeout->gc,
204 - fadeout->frame,
205 - 0, 0,
206 - 0, 0,
207 - fadeout->area.width,
208 - fadeout->area.height,
209 - GDK_RGB_DITHER_NONE,
210 - 0, 0);
211 + gdk_window_clear (fadeout->draw_window);
212 + gdk_window_resize (fadeout->draw_window,
213 + fadeout->area.width,
214 + fadeout->area.height);
216 g_get_current_time (&fadeout->start_time);
217 g_idle_add ((GSourceFunc) fadeout_callback, fadeout);