Merge lp:~kalgasnik/lightdm-gtk-greeter/background-transition into lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/trunk
- background-transition
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 316 |
Proposed branch: | lp:~kalgasnik/lightdm-gtk-greeter/background-transition |
Merge into: | lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/trunk |
Diff against target: |
1452 lines (+646/-224) 5 files modified
src/Makefile.am (+3/-2) src/greeterbackground.c (+543/-167) src/greeterbackground.h (+5/-5) src/lightdm-gtk-greeter.c (+95/-44) src/lightdm-gtk-greeter.glade (+0/-6) |
To merge this branch: | bzr merge lp:~kalgasnik/lightdm-gtk-greeter/background-transition |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Simon Steinbeiß | Approve | ||
Review via email: mp+241082@code.launchpad.net |
Commit message
Description of the change
Add transition to backgrounds change.
1. Transition function: easy-in-out
2. Animation: drawing new background with different alpha over old background
3. Duration: 500ms
4. Delay before changing to user's background: 250ms
At first I thought to make all these things configurable, but someone can say that it is too much.
"transition-
Enabled by default, I'm not sure that it is good idea.
Andrew P. (kalgasnik) wrote : | # |
Sean Davis (bluesabre) wrote : | # |
Can you provide some examples for the configuration in this case?
Andrew P. (kalgasnik) wrote : | # |
[greeter]
# 500 by default, 0 to disable transition effect
transition-duration = <duration-in-ms>
# Transition function, "none" to disable transition effect
# "easy-in-out" by default
transition-type = easy-in-
Sean Davis (bluesabre) wrote : | # |
When I try this on my laptop, there does not seem to be a transition...
transition-
transition-
Andrew P. (kalgasnik) wrote : | # |
Maybe you have user-background = false or identical default and user's backgrounds.
It must looks like http://
Oh, "easy" -> "ease", my inglish is not so well. But it isn't the source of the problem.
Simon Steinbeiß (ochosi) wrote : | # |
I've checked out your branch (mostly testing, not code review) and it works just fine! Nice work on that and sorry it took so long.
Preview Diff
1 | === modified file 'src/Makefile.am' | |||
2 | --- src/Makefile.am 2014-08-20 23:23:59 +0000 | |||
3 | +++ src/Makefile.am 2014-12-10 07:59:47 +0000 | |||
4 | @@ -41,7 +41,8 @@ | |||
5 | 41 | $(LIBX11_LIBS) \ | 41 | $(LIBX11_LIBS) \ |
6 | 42 | $(LIBINDICATOR_LIBS) \ | 42 | $(LIBINDICATOR_LIBS) \ |
7 | 43 | $(LIBIDO_LIBS) \ | 43 | $(LIBIDO_LIBS) \ |
9 | 44 | $(LIBXKLAVIER_LIBS) | 44 | $(LIBXKLAVIER_LIBS)\ |
10 | 45 | -lm | ||
11 | 45 | 46 | ||
12 | 46 | if MAINTAINER_MODE | 47 | if MAINTAINER_MODE |
13 | 47 | 48 | ||
14 | @@ -65,4 +66,4 @@ | |||
15 | 65 | EXTRA_DIST = \ | 66 | EXTRA_DIST = \ |
16 | 66 | lightdm-gtk-greeter.glade \ | 67 | lightdm-gtk-greeter.glade \ |
17 | 67 | lightdm-gtk-greeter-fallback.css \ | 68 | lightdm-gtk-greeter-fallback.css \ |
18 | 68 | lightdm-gtk-greeter-application.css | ||
19 | 69 | \ No newline at end of file | 69 | \ No newline at end of file |
20 | 70 | lightdm-gtk-greeter-application.css | ||
21 | 70 | 71 | ||
22 | === modified file 'src/greeterbackground.c' | |||
23 | --- src/greeterbackground.c 2014-08-31 17:45:52 +0000 | |||
24 | +++ src/greeterbackground.c 2014-12-10 07:59:47 +0000 | |||
25 | @@ -1,4 +1,5 @@ | |||
26 | 1 | 1 | ||
27 | 2 | #include <math.h> | ||
28 | 2 | #include <cairo-xlib.h> | 3 | #include <cairo-xlib.h> |
29 | 3 | #include <gtk/gtk.h> | 4 | #include <gtk/gtk.h> |
30 | 4 | #include <gdk/gdkx.h> | 5 | #include <gdk/gdkx.h> |
31 | @@ -14,6 +15,8 @@ | |||
32 | 14 | BACKGROUND_TYPE_INVALID, | 15 | BACKGROUND_TYPE_INVALID, |
33 | 15 | /* Do not use this monitor */ | 16 | /* Do not use this monitor */ |
34 | 16 | BACKGROUND_TYPE_SKIP, | 17 | BACKGROUND_TYPE_SKIP, |
35 | 18 | /* Do not override window background */ | ||
36 | 19 | BACKGROUND_TYPE_DEFAULT, | ||
37 | 17 | /* Solid color */ | 20 | /* Solid color */ |
38 | 18 | BACKGROUND_TYPE_COLOR, | 21 | BACKGROUND_TYPE_COLOR, |
39 | 19 | /* Path to image and scaling mode */ | 22 | /* Path to image and scaling mode */ |
40 | @@ -22,6 +25,7 @@ | |||
41 | 22 | } BackgroundType; | 25 | } BackgroundType; |
42 | 23 | 26 | ||
43 | 24 | static const gchar* BACKGROUND_TYPE_SKIP_VALUE = "#skip"; | 27 | static const gchar* BACKGROUND_TYPE_SKIP_VALUE = "#skip"; |
44 | 28 | static const gchar* BACKGROUND_TYPE_DEFAULT_VALUE = "#default"; | ||
45 | 25 | 29 | ||
46 | 26 | typedef enum | 30 | typedef enum |
47 | 27 | { | 31 | { |
48 | @@ -34,6 +38,9 @@ | |||
49 | 34 | 38 | ||
50 | 35 | static const gchar* SCALING_MODE_PREFIXES[] = {"#source:", "#zoomed:", "#stretched:", NULL}; | 39 | static const gchar* SCALING_MODE_PREFIXES[] = {"#source:", "#zoomed:", "#stretched:", NULL}; |
51 | 36 | 40 | ||
52 | 41 | typedef gdouble (*TransitionFunction)(gdouble x); | ||
53 | 42 | typedef void (*TransitionDraw)(gconstpointer monitor, cairo_t* cr); | ||
54 | 43 | |||
55 | 37 | /* Background configuration (parsed from background=... option). | 44 | /* Background configuration (parsed from background=... option). |
56 | 38 | Used to fill <Background> */ | 45 | Used to fill <Background> */ |
57 | 39 | typedef struct | 46 | typedef struct |
58 | @@ -50,18 +57,32 @@ | |||
59 | 50 | } options; | 57 | } options; |
60 | 51 | } BackgroundConfig; | 58 | } BackgroundConfig; |
61 | 52 | 59 | ||
62 | 60 | /* Transition configuration | ||
63 | 61 | Used to as part of <MonitorConfig> and <Monitor> */ | ||
64 | 62 | typedef struct | ||
65 | 63 | { | ||
66 | 64 | /* Transition duration, in ms */ | ||
67 | 65 | glong duration; | ||
68 | 66 | TransitionFunction func; | ||
69 | 67 | /* Function to draw monitor background */ | ||
70 | 68 | TransitionDraw draw; | ||
71 | 69 | } TransitionConfig; | ||
72 | 70 | |||
73 | 53 | /* Store monitor configuration */ | 71 | /* Store monitor configuration */ |
74 | 54 | typedef struct | 72 | typedef struct |
75 | 55 | { | 73 | { |
76 | 56 | BackgroundConfig bg; | 74 | BackgroundConfig bg; |
77 | 57 | gboolean user_bg; | 75 | gboolean user_bg; |
78 | 58 | gboolean laptop; | 76 | gboolean laptop; |
79 | 77 | |||
80 | 78 | TransitionConfig transition; | ||
81 | 59 | } MonitorConfig; | 79 | } MonitorConfig; |
82 | 60 | 80 | ||
83 | 61 | /* Actual drawing information attached to monitor. | 81 | /* Actual drawing information attached to monitor. |
84 | 62 | * Used to separate configured monitor background and user background. */ | 82 | * Used to separate configured monitor background and user background. */ |
85 | 63 | typedef struct | 83 | typedef struct |
86 | 64 | { | 84 | { |
87 | 85 | gint ref_count; | ||
88 | 65 | BackgroundType type; | 86 | BackgroundType type; |
89 | 66 | union | 87 | union |
90 | 67 | { | 88 | { |
91 | @@ -80,14 +101,29 @@ | |||
92 | 80 | gulong window_draw_handler_id; | 101 | gulong window_draw_handler_id; |
93 | 81 | 102 | ||
94 | 82 | /* Configured background */ | 103 | /* Configured background */ |
98 | 83 | Background background_configured; | 104 | Background* background_configured; |
96 | 84 | /* Background used to display user-background */ | ||
97 | 85 | Background background_custom; | ||
99 | 86 | /* Current monitor background: &background_configured or &background_custom | 105 | /* Current monitor background: &background_configured or &background_custom |
100 | 87 | * Monitors with type = BACKGROUND_TYPE_SKIP have background = NULL */ | 106 | * Monitors with type = BACKGROUND_TYPE_SKIP have background = NULL */ |
102 | 88 | const Background* background; | 107 | Background* background; |
103 | 108 | |||
104 | 109 | struct | ||
105 | 110 | { | ||
106 | 111 | TransitionConfig config; | ||
107 | 112 | |||
108 | 113 | /* Old background, stage == 0.0 */ | ||
109 | 114 | Background* from; | ||
110 | 115 | /* New background, stage == 1.0 */ | ||
111 | 116 | Background* to; | ||
112 | 117 | |||
113 | 118 | guint timer_id; | ||
114 | 119 | gint64 started; | ||
115 | 120 | /* Current stage */ | ||
116 | 121 | gdouble stage; | ||
117 | 122 | } transition; | ||
118 | 89 | } Monitor; | 123 | } Monitor; |
119 | 90 | 124 | ||
120 | 125 | static const Monitor INVALID_MONITOR_STRUCT = {0}; | ||
121 | 126 | |||
122 | 91 | struct _GreeterBackground | 127 | struct _GreeterBackground |
123 | 92 | { | 128 | { |
124 | 93 | GObject parent_instance; | 129 | GObject parent_instance; |
125 | @@ -141,6 +177,9 @@ | |||
126 | 141 | gboolean follow_cursor; | 177 | gboolean follow_cursor; |
127 | 142 | /* Use cursor position to determinate initial active monitor */ | 178 | /* Use cursor position to determinate initial active monitor */ |
128 | 143 | gboolean follow_cursor_to_init; | 179 | gboolean follow_cursor_to_init; |
129 | 180 | |||
130 | 181 | /* Name => transition function, inited in set_monitor_config() */ | ||
131 | 182 | GHashTable* transition_types; | ||
132 | 144 | }; | 183 | }; |
133 | 145 | 184 | ||
134 | 146 | enum | 185 | enum |
135 | @@ -151,20 +190,6 @@ | |||
136 | 151 | 190 | ||
137 | 152 | static guint background_signals[BACKGROUND_SIGNAL_LAST] = {0}; | 191 | static guint background_signals[BACKGROUND_SIGNAL_LAST] = {0}; |
138 | 153 | 192 | ||
139 | 154 | static const MonitorConfig DEFAULT_MONITOR_CONFIG = | ||
140 | 155 | { | ||
141 | 156 | .bg = | ||
142 | 157 | { | ||
143 | 158 | .type = BACKGROUND_TYPE_COLOR, | ||
144 | 159 | .options = | ||
145 | 160 | { | ||
146 | 161 | .color = {.red = 0.0, .green = 0.0, .blue = 0.0, .alpha = 1.0} | ||
147 | 162 | } | ||
148 | 163 | }, | ||
149 | 164 | .user_bg = TRUE, | ||
150 | 165 | .laptop = FALSE | ||
151 | 166 | }; | ||
152 | 167 | |||
153 | 168 | static const gchar* DBUS_UPOWER_NAME = "org.freedesktop.UPower"; | 193 | static const gchar* DBUS_UPOWER_NAME = "org.freedesktop.UPower"; |
154 | 169 | static const gchar* DBUS_UPOWER_PATH = "/org/freedesktop/UPower"; | 194 | static const gchar* DBUS_UPOWER_PATH = "/org/freedesktop/UPower"; |
155 | 170 | static const gchar* DBUS_UPOWER_INTERFACE = "org.freedesktop.UPower"; | 195 | static const gchar* DBUS_UPOWER_INTERFACE = "org.freedesktop.UPower"; |
156 | @@ -177,15 +202,13 @@ | |||
157 | 177 | 202 | ||
158 | 178 | void greeter_background_set_active_monitor_config (GreeterBackground* background, | 203 | void greeter_background_set_active_monitor_config (GreeterBackground* background, |
159 | 179 | const gchar* value); | 204 | const gchar* value); |
160 | 180 | void greeter_background_set_default_config (GreeterBackground* background, | ||
161 | 181 | const gchar* bg, | ||
162 | 182 | gboolean user_bg, | ||
163 | 183 | gboolean laptop); | ||
164 | 184 | void greeter_background_set_monitor_config (GreeterBackground* background, | 205 | void greeter_background_set_monitor_config (GreeterBackground* background, |
165 | 185 | const gchar* name, | 206 | const gchar* name, |
167 | 186 | const gchar* bg, | 207 | const gchar* bg, /* NULL to use fallback value */ |
168 | 187 | gboolean user_bg, gboolean user_bg_used, | 208 | gboolean user_bg, gboolean user_bg_used, |
170 | 188 | gboolean laptop, gboolean laptop_used); | 209 | gboolean laptop, gboolean laptop_used, |
171 | 210 | gint transition_duration, /* -1 to use fallback value */ | ||
172 | 211 | const gchar* transition_type); /* NULL to use fallback value */ | ||
173 | 189 | void greeter_background_remove_monitor_config (GreeterBackground* background, | 212 | void greeter_background_remove_monitor_config (GreeterBackground* background, |
174 | 190 | const gchar* name); | 213 | const gchar* name); |
175 | 191 | gchar** greeter_background_get_configured_monitors (GreeterBackground* background); | 214 | gchar** greeter_background_get_configured_monitors (GreeterBackground* background); |
176 | @@ -212,6 +235,8 @@ | |||
177 | 212 | GreeterBackground* background); | 235 | GreeterBackground* background); |
178 | 213 | static void greeter_background_monitors_changed_cb (GdkScreen* screen, | 236 | static void greeter_background_monitors_changed_cb (GdkScreen* screen, |
179 | 214 | GreeterBackground* background); | 237 | GreeterBackground* background); |
180 | 238 | static void greeter_background_child_destroyed_cb (GtkWidget* child, | ||
181 | 239 | GreeterBackground* background); | ||
182 | 215 | 240 | ||
183 | 216 | /* struct BackgroundConfig */ | 241 | /* struct BackgroundConfig */ |
184 | 217 | static gboolean background_config_initialize (BackgroundConfig* config, | 242 | static gboolean background_config_initialize (BackgroundConfig* config, |
185 | @@ -227,17 +252,28 @@ | |||
186 | 227 | MonitorConfig* dest); | 252 | MonitorConfig* dest); |
187 | 228 | 253 | ||
188 | 229 | /* struct Background */ | 254 | /* struct Background */ |
191 | 230 | static gboolean background_initialize (Background* bg, | 255 | static Background* background_new (const BackgroundConfig* config, |
190 | 231 | const BackgroundConfig* config, | ||
192 | 232 | const Monitor* monitor, | 256 | const Monitor* monitor, |
193 | 233 | GHashTable* images_cache); | 257 | GHashTable* images_cache); |
194 | 258 | static Background* background_ref (Background* bg); | ||
195 | 259 | static void background_unref (Background** bg); | ||
196 | 234 | static void background_finalize (Background* bg); | 260 | static void background_finalize (Background* bg); |
197 | 235 | 261 | ||
198 | 236 | /* struct Monitor */ | 262 | /* struct Monitor */ |
199 | 237 | static void monitor_finalize (Monitor* info); | 263 | static void monitor_finalize (Monitor* info); |
200 | 238 | static void monitor_set_background (Monitor* monitor, | 264 | static void monitor_set_background (Monitor* monitor, |
202 | 239 | const Background* background); | 265 | Background* background); |
203 | 266 | static void monitor_start_transition (Monitor* monitor, | ||
204 | 267 | Background* from, | ||
205 | 268 | Background* to); | ||
206 | 269 | static void monitor_stop_transition (Monitor* monitor); | ||
207 | 270 | static gboolean monitor_transition_cb (GtkWidget *widget, | ||
208 | 271 | GdkFrameClock* frame_clock, | ||
209 | 272 | Monitor* monitor); | ||
210 | 273 | static void monitor_transition_draw_alpha (const Monitor* monitor, | ||
211 | 274 | cairo_t* cr); | ||
212 | 240 | static void monitor_draw_background (const Monitor* monitor, | 275 | static void monitor_draw_background (const Monitor* monitor, |
213 | 276 | const Background* background, | ||
214 | 241 | cairo_t* cr); | 277 | cairo_t* cr); |
215 | 242 | static gboolean monitor_window_draw_cb (GtkWidget* widget, | 278 | static gboolean monitor_window_draw_cb (GtkWidget* widget, |
216 | 243 | cairo_t* cr, | 279 | cairo_t* cr, |
217 | @@ -259,7 +295,32 @@ | |||
218 | 259 | Pixmap xpixmap); | 295 | Pixmap xpixmap); |
219 | 260 | static void set_surface_as_root (GdkScreen* screen, | 296 | static void set_surface_as_root (GdkScreen* screen, |
220 | 261 | cairo_surface_t* surface); | 297 | cairo_surface_t* surface); |
222 | 262 | 298 | static gdouble transition_func_linear (gdouble x); | |
223 | 299 | static gdouble transition_func_easy_in_out (gdouble x); | ||
224 | 300 | |||
225 | 301 | /* Implemented in lightdm-gtk-greeter.c */ | ||
226 | 302 | gpointer greeter_save_focus(GtkWidget* widget); | ||
227 | 303 | void greeter_restore_focus(const gpointer saved_data); | ||
228 | 304 | |||
229 | 305 | static const MonitorConfig DEFAULT_MONITOR_CONFIG = | ||
230 | 306 | { | ||
231 | 307 | .bg = | ||
232 | 308 | { | ||
233 | 309 | .type = BACKGROUND_TYPE_COLOR, | ||
234 | 310 | .options = | ||
235 | 311 | { | ||
236 | 312 | .color = {.red = 0.0, .green = 0.0, .blue = 0.0, .alpha = 1.0} | ||
237 | 313 | } | ||
238 | 314 | }, | ||
239 | 315 | .user_bg = TRUE, | ||
240 | 316 | .laptop = FALSE, | ||
241 | 317 | .transition = | ||
242 | 318 | { | ||
243 | 319 | .duration = 500, | ||
244 | 320 | .func = transition_func_easy_in_out, | ||
245 | 321 | .draw = (TransitionDraw)monitor_transition_draw_alpha | ||
246 | 322 | } | ||
247 | 323 | }; | ||
248 | 263 | 324 | ||
249 | 264 | /* Implementation */ | 325 | /* Implementation */ |
250 | 265 | 326 | ||
251 | @@ -302,11 +363,14 @@ | |||
252 | 302 | self->priv->laptop_lid_closed = FALSE; | 363 | self->priv->laptop_lid_closed = FALSE; |
253 | 303 | } | 364 | } |
254 | 304 | 365 | ||
256 | 305 | GreeterBackground* | 366 | GreeterBackground* |
257 | 306 | greeter_background_new(GtkWidget* child) | 367 | greeter_background_new(GtkWidget* child) |
258 | 307 | { | 368 | { |
259 | 369 | g_return_val_if_fail(child != NULL, NULL); | ||
260 | 370 | |||
261 | 308 | GreeterBackground* background = GREETER_BACKGROUND(g_object_new(greeter_background_get_type(), NULL)); | 371 | GreeterBackground* background = GREETER_BACKGROUND(g_object_new(greeter_background_get_type(), NULL)); |
262 | 309 | background->priv->child = child; | 372 | background->priv->child = child; |
263 | 373 | g_signal_connect(background->priv->child, "destroy", G_CALLBACK(greeter_background_child_destroyed_cb), background); | ||
264 | 310 | return background; | 374 | return background; |
265 | 311 | } | 375 | } |
266 | 312 | 376 | ||
267 | @@ -346,42 +410,55 @@ | |||
268 | 346 | } | 410 | } |
269 | 347 | 411 | ||
270 | 348 | void | 412 | void |
271 | 349 | greeter_background_set_default_config(GreeterBackground* background, | ||
272 | 350 | const gchar* bg, | ||
273 | 351 | gboolean user_bg, | ||
274 | 352 | gboolean laptop) | ||
275 | 353 | { | ||
276 | 354 | g_return_if_fail(GREETER_IS_BACKGROUND(background)); | ||
277 | 355 | GreeterBackgroundPrivate* priv = background->priv; | ||
278 | 356 | |||
279 | 357 | if(priv->default_config) | ||
280 | 358 | monitor_config_free(priv->default_config); | ||
281 | 359 | |||
282 | 360 | priv->default_config = g_new0(MonitorConfig, 1); | ||
283 | 361 | if(!background_config_initialize(&priv->default_config->bg, bg)) | ||
284 | 362 | background_config_copy(&DEFAULT_MONITOR_CONFIG.bg, &priv->default_config->bg); | ||
285 | 363 | priv->default_config->user_bg = user_bg; | ||
286 | 364 | priv->default_config->laptop = laptop; | ||
287 | 365 | } | ||
288 | 366 | |||
289 | 367 | void | ||
290 | 368 | greeter_background_set_monitor_config(GreeterBackground* background, | 413 | greeter_background_set_monitor_config(GreeterBackground* background, |
291 | 369 | const gchar* name, | 414 | const gchar* name, |
292 | 370 | const gchar* bg, | 415 | const gchar* bg, |
293 | 371 | gboolean user_bg, gboolean user_bg_used, | 416 | gboolean user_bg, gboolean user_bg_used, |
295 | 372 | gboolean laptop, gboolean laptop_used) | 417 | gboolean laptop, gboolean laptop_used, |
296 | 418 | gint transition_duration, | ||
297 | 419 | const gchar* transition_type) | ||
298 | 373 | { | 420 | { |
299 | 374 | g_return_if_fail(GREETER_IS_BACKGROUND(background)); | 421 | g_return_if_fail(GREETER_IS_BACKGROUND(background)); |
300 | 375 | GreeterBackgroundPrivate* priv = background->priv; | 422 | GreeterBackgroundPrivate* priv = background->priv; |
301 | 376 | 423 | ||
302 | 377 | MonitorConfig* config = g_new0(MonitorConfig, 1); | 424 | MonitorConfig* config = g_new0(MonitorConfig, 1); |
303 | 378 | 425 | ||
304 | 426 | const MonitorConfig* FALLBACK = (g_strcmp0(name, GREETER_BACKGROUND_DEFAULT) == 0) ? &DEFAULT_MONITOR_CONFIG : priv->default_config; | ||
305 | 427 | |||
306 | 379 | if(!background_config_initialize(&config->bg, bg)) | 428 | if(!background_config_initialize(&config->bg, bg)) |
312 | 380 | background_config_copy(&priv->default_config->bg, &config->bg); | 429 | background_config_copy(&FALLBACK->bg, &config->bg); |
313 | 381 | config->user_bg = user_bg_used ? user_bg : priv->default_config->user_bg; | 430 | config->user_bg = user_bg_used ? user_bg : FALLBACK->user_bg; |
314 | 382 | config->laptop = laptop_used ? laptop : priv->default_config->laptop; | 431 | config->laptop = laptop_used ? laptop : FALLBACK->laptop; |
315 | 383 | 432 | config->transition.duration = transition_duration >= 0 ? transition_duration : FALLBACK->transition.duration; | |
316 | 384 | g_hash_table_insert(priv->configs, g_strdup(name), config); | 433 | config->transition.draw = FALLBACK->transition.draw; |
317 | 434 | |||
318 | 435 | if(transition_type) | ||
319 | 436 | { | ||
320 | 437 | if(!priv->transition_types) | ||
321 | 438 | { | ||
322 | 439 | priv->transition_types = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); | ||
323 | 440 | g_hash_table_insert(priv->transition_types, g_strdup("none"), NULL); | ||
324 | 441 | g_hash_table_insert(priv->transition_types, g_strdup("linear"), transition_func_linear); | ||
325 | 442 | g_hash_table_insert(priv->transition_types, g_strdup("easy-in-out"), transition_func_easy_in_out); | ||
326 | 443 | } | ||
327 | 444 | if(!g_hash_table_lookup_extended(priv->transition_types, transition_type, NULL, (gpointer*)&config->transition.func)) | ||
328 | 445 | { | ||
329 | 446 | g_warning("[Background] Invalid transition type for '%s' monitor: '%s'. Using fallback value.", | ||
330 | 447 | name, transition_type); | ||
331 | 448 | config->transition.func = FALLBACK->transition.func; | ||
332 | 449 | } | ||
333 | 450 | } | ||
334 | 451 | else | ||
335 | 452 | config->transition.func = FALLBACK->transition.func; | ||
336 | 453 | |||
337 | 454 | if(FALLBACK == priv->default_config) | ||
338 | 455 | g_hash_table_insert(priv->configs, g_strdup(name), config); | ||
339 | 456 | else | ||
340 | 457 | { | ||
341 | 458 | if(priv->default_config) | ||
342 | 459 | monitor_config_free(priv->default_config); | ||
343 | 460 | priv->default_config = config; | ||
344 | 461 | } | ||
345 | 385 | } | 462 | } |
346 | 386 | 463 | ||
347 | 387 | void | 464 | void |
348 | @@ -418,12 +495,9 @@ | |||
349 | 418 | g_return_if_fail(GREETER_IS_BACKGROUND(background)); | 495 | g_return_if_fail(GREETER_IS_BACKGROUND(background)); |
350 | 419 | g_return_if_fail(GDK_IS_SCREEN(screen)); | 496 | g_return_if_fail(GDK_IS_SCREEN(screen)); |
351 | 420 | 497 | ||
353 | 421 | g_debug("Connecting to screen"); | 498 | g_debug("[Background] Connecting to screen: %p", screen); |
354 | 422 | 499 | ||
355 | 423 | GreeterBackgroundPrivate* priv = background->priv; | 500 | GreeterBackgroundPrivate* priv = background->priv; |
356 | 424 | gulong screen_monitors_changed_handler_id = (priv->screen == screen) ? priv->screen_monitors_changed_handler_id : 0; | ||
357 | 425 | if(screen_monitors_changed_handler_id) | ||
358 | 426 | priv->screen_monitors_changed_handler_id = 0; | ||
359 | 427 | 501 | ||
360 | 428 | if(priv->screen) | 502 | if(priv->screen) |
361 | 429 | greeter_background_disconnect(background); | 503 | greeter_background_disconnect(background); |
362 | @@ -433,6 +507,8 @@ | |||
363 | 433 | priv->monitors = g_new0(Monitor, priv->monitors_size); | 507 | priv->monitors = g_new0(Monitor, priv->monitors_size); |
364 | 434 | priv->monitors_map = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); | 508 | priv->monitors_map = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); |
365 | 435 | 509 | ||
366 | 510 | g_debug("[Background] Monitors found: %" G_GSIZE_FORMAT, priv->monitors_size); | ||
367 | 511 | |||
368 | 436 | /* Used to track situation when all monitors marked as "#skip" */ | 512 | /* Used to track situation when all monitors marked as "#skip" */ |
369 | 437 | Monitor* first_not_skipped_monitor = NULL; | 513 | Monitor* first_not_skipped_monitor = NULL; |
370 | 438 | 514 | ||
371 | @@ -449,25 +525,28 @@ | |||
372 | 449 | 525 | ||
373 | 450 | const gchar* printable_name = monitor->name ? monitor->name : "<unknown>"; | 526 | const gchar* printable_name = monitor->name ? monitor->name : "<unknown>"; |
374 | 451 | 527 | ||
375 | 452 | if(!greeter_background_find_monitor_data(background, priv->configs, monitor, (gpointer*)&config)) | ||
376 | 453 | { | ||
377 | 454 | g_debug("No configuration options for monitor %s #%d, using default", printable_name, i); | ||
378 | 455 | config = priv->default_config; | ||
379 | 456 | } | ||
380 | 457 | |||
381 | 458 | gdk_screen_get_monitor_geometry(screen, i, &monitor->geometry); | 528 | gdk_screen_get_monitor_geometry(screen, i, &monitor->geometry); |
382 | 459 | 529 | ||
384 | 460 | g_debug("Monitor: %s #%d (%dx%d at %dx%d)%s", printable_name, i, | 530 | g_debug("[Background] Monitor: %s #%d (%dx%d at %dx%d)%s", printable_name, i, |
385 | 461 | monitor->geometry.width, monitor->geometry.height, | 531 | monitor->geometry.width, monitor->geometry.height, |
386 | 462 | monitor->geometry.x, monitor->geometry.y, | 532 | monitor->geometry.x, monitor->geometry.y, |
387 | 463 | (i == gdk_screen_get_primary_monitor(screen)) ? " primary" : ""); | 533 | (i == gdk_screen_get_primary_monitor(screen)) ? " primary" : ""); |
388 | 464 | 534 | ||
389 | 535 | if(!greeter_background_find_monitor_data(background, priv->configs, monitor, (gpointer*)&config)) | ||
390 | 536 | { | ||
391 | 537 | g_debug("[Background] No configuration options for monitor %s #%d, using default", printable_name, i); | ||
392 | 538 | config = priv->default_config; | ||
393 | 539 | } | ||
394 | 540 | |||
395 | 465 | /* Force last skipped monitor to be active monitor, if there is no other choice */ | 541 | /* Force last skipped monitor to be active monitor, if there is no other choice */ |
396 | 466 | if(config->bg.type == BACKGROUND_TYPE_SKIP) | 542 | if(config->bg.type == BACKGROUND_TYPE_SKIP) |
397 | 467 | { | 543 | { |
398 | 468 | if(i < priv->monitors_size - 1 || first_not_skipped_monitor) | 544 | if(i < priv->monitors_size - 1 || first_not_skipped_monitor) |
399 | 545 | { | ||
400 | 546 | g_debug("[Background] Skipping monitor %s #%d", printable_name, i); | ||
401 | 469 | continue; | 547 | continue; |
403 | 470 | g_debug("Monitor %s #%d can not be skipped, using default configuration for it", printable_name, i); | 548 | } |
404 | 549 | g_debug("[Background] Monitor %s #%d can not be skipped, using default configuration for it", printable_name, i); | ||
405 | 471 | if(priv->default_config->bg.type != BACKGROUND_TYPE_SKIP) | 550 | if(priv->default_config->bg.type != BACKGROUND_TYPE_SKIP) |
406 | 472 | config = priv->default_config; | 551 | config = priv->default_config; |
407 | 473 | else | 552 | else |
408 | @@ -489,6 +568,12 @@ | |||
409 | 489 | monitor->window_draw_handler_id = g_signal_connect(G_OBJECT(monitor->window), "draw", | 568 | monitor->window_draw_handler_id = g_signal_connect(G_OBJECT(monitor->window), "draw", |
410 | 490 | G_CALLBACK(monitor_window_draw_cb), | 569 | G_CALLBACK(monitor_window_draw_cb), |
411 | 491 | monitor); | 570 | monitor); |
412 | 571 | |||
413 | 572 | gchar* window_name = monitor->name ? g_strdup_printf("monitor-%s", monitor->name) : g_strdup_printf("monitor-%d", i); | ||
414 | 573 | gtk_widget_set_name(GTK_WIDGET(monitor->window), window_name); | ||
415 | 574 | gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(monitor->window)), "lightdm-gtk-greeter"); | ||
416 | 575 | g_free(window_name); | ||
417 | 576 | |||
418 | 492 | GSList* item; | 577 | GSList* item; |
419 | 493 | for(item = priv->accel_groups; item != NULL; item = g_slist_next(item)) | 578 | for(item = priv->accel_groups; item != NULL; item = g_slist_next(item)) |
420 | 494 | gtk_window_add_accel_group(monitor->window, item->data); | 579 | gtk_window_add_accel_group(monitor->window, item->data); |
421 | @@ -503,9 +588,13 @@ | |||
422 | 503 | if(config->laptop) | 588 | if(config->laptop) |
423 | 504 | priv->laptop_monitors = g_slist_prepend(priv->laptop_monitors, monitor); | 589 | priv->laptop_monitors = g_slist_prepend(priv->laptop_monitors, monitor); |
424 | 505 | 590 | ||
428 | 506 | if(!background_initialize(&monitor->background_configured, &config->bg, monitor, images_cache)) | 591 | monitor->background_configured = background_new(&config->bg, monitor, images_cache); |
429 | 507 | background_initialize(&monitor->background_configured, &DEFAULT_MONITOR_CONFIG.bg, monitor, images_cache); | 592 | if(!monitor->background_configured) |
430 | 508 | monitor_set_background(monitor, &monitor->background_configured); | 593 | monitor->background_configured = background_new(&DEFAULT_MONITOR_CONFIG.bg, monitor, images_cache); |
431 | 594 | monitor_set_background(monitor, monitor->background_configured); | ||
432 | 595 | |||
433 | 596 | if(config->transition.duration && config->transition.func) | ||
434 | 597 | monitor->transition.config = config->transition; | ||
435 | 509 | 598 | ||
436 | 510 | if(monitor->name) | 599 | if(monitor->name) |
437 | 511 | g_hash_table_insert(priv->monitors_map, g_strdup(monitor->name), monitor); | 600 | g_hash_table_insert(priv->monitors_map, g_strdup(monitor->name), monitor); |
438 | @@ -528,18 +617,19 @@ | |||
439 | 528 | if(greeter_background_monitor_enabled(background, monitor) && | 617 | if(greeter_background_monitor_enabled(background, monitor) && |
440 | 529 | x >= monitor->geometry.x && x < monitor->geometry.x + monitor->geometry.width && | 618 | x >= monitor->geometry.x && x < monitor->geometry.x + monitor->geometry.width && |
441 | 530 | y >= monitor->geometry.y && y < monitor->geometry.y + monitor->geometry.height) | 619 | y >= monitor->geometry.y && y < monitor->geometry.y + monitor->geometry.height) |
442 | 620 | { | ||
443 | 621 | g_debug("[Background] Pointer position will be used to set active monitor: %dx%d", x, y); | ||
444 | 531 | greeter_background_set_active_monitor(background, monitor); | 622 | greeter_background_set_active_monitor(background, monitor); |
445 | 623 | break; | ||
446 | 624 | } | ||
447 | 532 | } | 625 | } |
448 | 533 | } | 626 | } |
449 | 534 | if(!priv->active_monitor) | 627 | if(!priv->active_monitor) |
450 | 535 | greeter_background_set_active_monitor(background, NULL); | 628 | greeter_background_set_active_monitor(background, NULL); |
451 | 536 | 629 | ||
458 | 537 | if(screen_monitors_changed_handler_id) | 630 | priv->screen_monitors_changed_handler_id = g_signal_connect(G_OBJECT(screen), "monitors-changed", |
459 | 538 | priv->screen_monitors_changed_handler_id = screen_monitors_changed_handler_id; | 631 | G_CALLBACK(greeter_background_monitors_changed_cb), |
460 | 539 | else | 632 | background); |
455 | 540 | priv->screen_monitors_changed_handler_id = g_signal_connect(G_OBJECT(screen), "monitors-changed", | ||
456 | 541 | G_CALLBACK(greeter_background_monitors_changed_cb), | ||
457 | 542 | background); | ||
461 | 543 | } | 633 | } |
462 | 544 | 634 | ||
463 | 545 | void | 635 | void |
464 | @@ -548,12 +638,11 @@ | |||
465 | 548 | g_return_if_fail(GREETER_IS_BACKGROUND(background)); | 638 | g_return_if_fail(GREETER_IS_BACKGROUND(background)); |
466 | 549 | GreeterBackgroundPrivate* priv = background->priv; | 639 | GreeterBackgroundPrivate* priv = background->priv; |
467 | 550 | 640 | ||
468 | 551 | priv->screen = NULL; | ||
469 | 552 | priv->active_monitor = NULL; | ||
470 | 553 | |||
471 | 554 | if(priv->screen_monitors_changed_handler_id) | 641 | if(priv->screen_monitors_changed_handler_id) |
472 | 555 | g_signal_handler_disconnect(priv->screen, priv->screen_monitors_changed_handler_id); | 642 | g_signal_handler_disconnect(priv->screen, priv->screen_monitors_changed_handler_id); |
473 | 556 | priv->screen_monitors_changed_handler_id = 0; | 643 | priv->screen_monitors_changed_handler_id = 0; |
474 | 644 | priv->screen = NULL; | ||
475 | 645 | priv->active_monitor = NULL; | ||
476 | 557 | 646 | ||
477 | 558 | gint i; | 647 | gint i; |
478 | 559 | for(i = 0; i < priv->monitors_size; ++i) | 648 | for(i = 0; i < priv->monitors_size; ++i) |
479 | @@ -610,6 +699,8 @@ | |||
480 | 610 | const Monitor* monitor = g_hash_table_lookup(priv->monitors_map, iter->data); | 699 | const Monitor* monitor = g_hash_table_lookup(priv->monitors_map, iter->data); |
481 | 611 | if(monitor && monitor->background && greeter_background_monitor_enabled(background, monitor)) | 700 | if(monitor && monitor->background && greeter_background_monitor_enabled(background, monitor)) |
482 | 612 | active = monitor; | 701 | active = monitor; |
483 | 702 | if(active) | ||
484 | 703 | g_debug("[Background] Active monitor is not specified, using first enabled monitor from 'active-monitor' list"); | ||
485 | 613 | } | 704 | } |
486 | 614 | 705 | ||
487 | 615 | /* All monitors listed in active-monitor-config are disabled (or option is empty) */ | 706 | /* All monitors listed in active-monitor-config are disabled (or option is empty) */ |
488 | @@ -617,9 +708,13 @@ | |||
489 | 617 | /* Using primary monitor */ | 708 | /* Using primary monitor */ |
490 | 618 | if(!active) | 709 | if(!active) |
491 | 619 | { | 710 | { |
493 | 620 | active = &priv->monitors[gdk_screen_get_primary_monitor(priv->screen)]; | 711 | gint num = gdk_screen_get_primary_monitor(priv->screen); |
494 | 712 | g_return_if_fail(num < priv->monitors_size); | ||
495 | 713 | active = &priv->monitors[num]; | ||
496 | 621 | if(!active->background || !greeter_background_monitor_enabled(background, active)) | 714 | if(!active->background || !greeter_background_monitor_enabled(background, active)) |
497 | 622 | active = NULL; | 715 | active = NULL; |
498 | 716 | if(active) | ||
499 | 717 | g_debug("[Background] Active monitor is not specified, using primary monitor"); | ||
500 | 623 | } | 718 | } |
501 | 624 | 719 | ||
502 | 625 | /* Fallback: first enabled and/or not skipped monitor (screen always have one) */ | 720 | /* Fallback: first enabled and/or not skipped monitor (screen always have one) */ |
503 | @@ -639,7 +734,25 @@ | |||
504 | 639 | } | 734 | } |
505 | 640 | if(!active) | 735 | if(!active) |
506 | 641 | active = first_not_skipped; | 736 | active = first_not_skipped; |
508 | 642 | } | 737 | if(active) |
509 | 738 | g_debug("[Background] Active monitor is not specified, using first enabled monitor"); | ||
510 | 739 | } | ||
511 | 740 | |||
512 | 741 | if(!active && priv->laptop_monitors) | ||
513 | 742 | { | ||
514 | 743 | active = priv->laptop_monitors->data; | ||
515 | 744 | g_debug("[Background] Active monitor is not specified, using laptop monitor"); | ||
516 | 745 | } | ||
517 | 746 | } | ||
518 | 747 | |||
519 | 748 | if(!active) | ||
520 | 749 | { | ||
521 | 750 | if(priv->active_monitor) | ||
522 | 751 | g_warning("[Background] Active monitor is not specified, failed to identify. Active monitor stays the same: %s #%d", | ||
523 | 752 | priv->active_monitor->name, priv->active_monitor->number); | ||
524 | 753 | else | ||
525 | 754 | g_warning("[Background] Active monitor is not specified, failed to identify. Active monitor stays the same: <not defined>"); | ||
526 | 755 | return; | ||
527 | 643 | } | 756 | } |
528 | 644 | 757 | ||
529 | 645 | if(active == priv->active_monitor) | 758 | if(active == priv->active_monitor) |
530 | @@ -647,12 +760,25 @@ | |||
531 | 647 | 760 | ||
532 | 648 | priv->active_monitor = active; | 761 | priv->active_monitor = active; |
533 | 649 | 762 | ||
540 | 650 | GtkWidget* old_parent = gtk_widget_get_parent(priv->child); | 763 | g_return_if_fail(priv->active_monitor != NULL); |
541 | 651 | if(old_parent) | 764 | |
542 | 652 | gtk_container_remove(GTK_CONTAINER(old_parent), priv->child); | 765 | if(priv->child) |
543 | 653 | gtk_container_add(GTK_CONTAINER(active->window), priv->child); | 766 | { |
544 | 654 | 767 | GtkWidget* old_parent = gtk_widget_get_parent(priv->child); | |
545 | 655 | g_debug("Active monitor changed to: %s #%d", active->name, active->number); | 768 | gpointer focus = greeter_save_focus(priv->child); |
546 | 769 | |||
547 | 770 | if(old_parent) | ||
548 | 771 | gtk_container_remove(GTK_CONTAINER(old_parent), priv->child); | ||
549 | 772 | gtk_container_add(GTK_CONTAINER(active->window), priv->child); | ||
550 | 773 | |||
551 | 774 | gtk_window_present(active->window); | ||
552 | 775 | greeter_restore_focus(focus); | ||
553 | 776 | g_free(focus); | ||
554 | 777 | } | ||
555 | 778 | else | ||
556 | 779 | g_warning("[Background] Child widget is destroyed or not defined"); | ||
557 | 780 | |||
558 | 781 | g_debug("[Background] Active monitor changed to: %s #%d", active->name, active->number); | ||
559 | 656 | g_signal_emit(background, background_signals[BACKGROUND_SIGNAL_ACTIVE_MONITOR_CHANGED], 0); | 782 | g_signal_emit(background, background_signals[BACKGROUND_SIGNAL_ACTIVE_MONITOR_CHANGED], 0); |
560 | 657 | 783 | ||
561 | 658 | gint x, y; | 784 | gint x, y; |
562 | @@ -691,7 +817,7 @@ | |||
563 | 691 | static void | 817 | static void |
564 | 692 | greeter_background_try_init_dbus(GreeterBackground* background) | 818 | greeter_background_try_init_dbus(GreeterBackground* background) |
565 | 693 | { | 819 | { |
567 | 694 | g_debug("Creating DBus proxy"); | 820 | g_debug("[Background] Creating DBus proxy"); |
568 | 695 | GError* error = NULL; | 821 | GError* error = NULL; |
569 | 696 | GreeterBackgroundPrivate* priv = background->priv; | 822 | GreeterBackgroundPrivate* priv = background->priv; |
570 | 697 | 823 | ||
571 | @@ -710,7 +836,7 @@ | |||
572 | 710 | if(!priv->laptop_upower_proxy) | 836 | if(!priv->laptop_upower_proxy) |
573 | 711 | { | 837 | { |
574 | 712 | if(error) | 838 | if(error) |
576 | 713 | g_warning("Failed to create dbus proxy: %s", error->message); | 839 | g_warning("[Background] Failed to create dbus proxy: %s", error->message); |
577 | 714 | g_clear_error(&error); | 840 | g_clear_error(&error); |
578 | 715 | return; | 841 | return; |
579 | 716 | } | 842 | } |
580 | @@ -719,7 +845,7 @@ | |||
581 | 719 | gboolean lid_present = g_variant_get_boolean(variant); | 845 | gboolean lid_present = g_variant_get_boolean(variant); |
582 | 720 | g_variant_unref(variant); | 846 | g_variant_unref(variant); |
583 | 721 | 847 | ||
585 | 722 | g_debug("UPower.%s property value: %d", DBUS_UPOWER_PROP_LID_IS_PRESENT, lid_present); | 848 | g_debug("[Background] UPower.%s property value: %d", DBUS_UPOWER_PROP_LID_IS_PRESENT, lid_present); |
586 | 723 | 849 | ||
587 | 724 | if(!lid_present) | 850 | if(!lid_present) |
588 | 725 | greeter_background_stop_dbus(background); | 851 | greeter_background_stop_dbus(background); |
589 | @@ -769,13 +895,21 @@ | |||
590 | 769 | if(new_state == priv->laptop_lid_closed) | 895 | if(new_state == priv->laptop_lid_closed) |
591 | 770 | return; | 896 | return; |
592 | 771 | 897 | ||
593 | 772 | g_debug("UPower: lid state changed to '%s'", priv->laptop_lid_closed ? "closed" : "opened"); | ||
594 | 773 | |||
595 | 774 | priv->laptop_lid_closed = new_state; | 898 | priv->laptop_lid_closed = new_state; |
596 | 899 | g_debug("[Background] UPower: lid state changed to '%s'", priv->laptop_lid_closed ? "closed" : "opened"); | ||
597 | 900 | |||
598 | 775 | if(priv->laptop_monitors) | 901 | if(priv->laptop_monitors) |
599 | 776 | { | 902 | { |
602 | 777 | if(!priv->follow_cursor || (new_state && priv->laptop_monitors->data == priv->active_monitor)) | 903 | if(priv->laptop_lid_closed) |
603 | 778 | greeter_background_set_active_monitor(background, NULL); | 904 | { |
604 | 905 | if(g_slist_find(priv->laptop_monitors, priv->active_monitor)) | ||
605 | 906 | greeter_background_set_active_monitor(background, NULL); | ||
606 | 907 | } | ||
607 | 908 | else | ||
608 | 909 | { | ||
609 | 910 | if(!priv->follow_cursor) | ||
610 | 911 | greeter_background_set_active_monitor(background, NULL); | ||
611 | 912 | } | ||
612 | 779 | } | 913 | } |
613 | 780 | } | 914 | } |
614 | 781 | 915 | ||
615 | @@ -787,6 +921,13 @@ | |||
616 | 787 | greeter_background_connect(background, screen); | 921 | greeter_background_connect(background, screen); |
617 | 788 | } | 922 | } |
618 | 789 | 923 | ||
619 | 924 | static void | ||
620 | 925 | greeter_background_child_destroyed_cb(GtkWidget* child, | ||
621 | 926 | GreeterBackground* background) | ||
622 | 927 | { | ||
623 | 928 | background->priv->child = NULL; | ||
624 | 929 | } | ||
625 | 930 | |||
626 | 790 | void | 931 | void |
627 | 791 | greeter_background_set_custom_background(GreeterBackground* background, | 932 | greeter_background_set_custom_background(GreeterBackground* background, |
628 | 792 | const gchar* value) | 933 | const gchar* value) |
629 | @@ -809,13 +950,19 @@ | |||
630 | 809 | { | 950 | { |
631 | 810 | Monitor *monitor = iter->data; | 951 | Monitor *monitor = iter->data; |
632 | 811 | 952 | ||
637 | 812 | background_finalize(&monitor->background_custom); | 953 | /* Old background_custom (if used) will be unrefed in monitor_set_background() */ |
638 | 813 | if(config.type != BACKGROUND_TYPE_INVALID && | 954 | Background* bg = NULL; |
639 | 814 | background_initialize(&monitor->background_custom, &config, monitor, images_cache)) | 955 | if(config.type != BACKGROUND_TYPE_INVALID) |
640 | 815 | monitor_set_background(monitor, &monitor->background_custom); | 956 | bg = background_new(&config, monitor, images_cache); |
641 | 957 | if(bg) | ||
642 | 958 | { | ||
643 | 959 | monitor_set_background(monitor, bg); | ||
644 | 960 | background_unref(&bg); | ||
645 | 961 | } | ||
646 | 816 | else | 962 | else |
648 | 817 | monitor_set_background(monitor, &monitor->background_configured); | 963 | monitor_set_background(monitor, monitor->background_configured); |
649 | 818 | } | 964 | } |
650 | 965 | |||
651 | 819 | if(images_cache) | 966 | if(images_cache) |
652 | 820 | g_hash_table_unref(images_cache); | 967 | g_hash_table_unref(images_cache); |
653 | 821 | if(config.type != BACKGROUND_TYPE_INVALID) | 968 | if(config.type != BACKGROUND_TYPE_INVALID) |
654 | @@ -831,18 +978,43 @@ | |||
655 | 831 | cairo_surface_t* surface = create_root_surface(priv->screen); | 978 | cairo_surface_t* surface = create_root_surface(priv->screen); |
656 | 832 | cairo_t* cr = cairo_create(surface); | 979 | cairo_t* cr = cairo_create(surface); |
657 | 833 | gsize i; | 980 | gsize i; |
660 | 834 | 981 | gdouble child_opacity; | |
661 | 835 | for(i = 0; i <= priv->monitors_size; ++i) | 982 | |
662 | 983 | const GdkRGBA ROOT_COLOR = {1.0, 1.0, 1.0, 1.0}; | ||
663 | 984 | gdk_cairo_set_source_rgba(cr, &ROOT_COLOR); | ||
664 | 985 | cairo_paint(cr); | ||
665 | 986 | |||
666 | 987 | for(i = 0; i < priv->monitors_size; ++i) | ||
667 | 836 | { | 988 | { |
668 | 837 | const Monitor* monitor = &priv->monitors[i]; | 989 | const Monitor* monitor = &priv->monitors[i]; |
670 | 838 | if(monitor == priv->active_monitor || !monitor->background) | 990 | if(!monitor->background) |
671 | 839 | continue; | 991 | continue; |
674 | 840 | if(i == priv->monitors_size) | 992 | |
675 | 841 | monitor = priv->active_monitor; | 993 | #ifdef XROOT_DRAW_BACKGROUND_DIRECTLY |
676 | 994 | /* Old method: can't draw default GtkWindow background */ | ||
677 | 842 | cairo_save(cr); | 995 | cairo_save(cr); |
678 | 843 | cairo_translate(cr, monitor->geometry.x, monitor->geometry.y); | 996 | cairo_translate(cr, monitor->geometry.x, monitor->geometry.y); |
680 | 844 | monitor_draw_background(monitor, cr); | 997 | monitor_draw_background(monitor, monitor->background, cr); |
681 | 845 | cairo_restore(cr); | 998 | cairo_restore(cr); |
682 | 999 | #else | ||
683 | 1000 | /* New - can draw anything, but looks tricky a bit */ | ||
684 | 1001 | child_opacity = gtk_widget_get_opacity(priv->child); | ||
685 | 1002 | if(monitor == priv->active_monitor) | ||
686 | 1003 | { | ||
687 | 1004 | gtk_widget_set_opacity(priv->child, 0.0); | ||
688 | 1005 | gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(priv->child)), FALSE); | ||
689 | 1006 | } | ||
690 | 1007 | |||
691 | 1008 | gdk_cairo_set_source_window(cr, gtk_widget_get_window(GTK_WIDGET(monitor->window)), | ||
692 | 1009 | monitor->geometry.x, monitor->geometry.y); | ||
693 | 1010 | cairo_paint(cr); | ||
694 | 1011 | |||
695 | 1012 | if(monitor == priv->active_monitor) | ||
696 | 1013 | { | ||
697 | 1014 | gtk_widget_set_opacity(priv->child, child_opacity); | ||
698 | 1015 | gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(priv->child)), FALSE); | ||
699 | 1016 | } | ||
700 | 1017 | #endif | ||
701 | 846 | } | 1018 | } |
702 | 847 | set_surface_as_root(priv->screen, surface); | 1019 | set_surface_as_root(priv->screen, surface); |
703 | 848 | 1020 | ||
704 | @@ -887,6 +1059,8 @@ | |||
705 | 887 | return FALSE; | 1059 | return FALSE; |
706 | 888 | if(g_strcmp0(value, BACKGROUND_TYPE_SKIP_VALUE) == 0) | 1060 | if(g_strcmp0(value, BACKGROUND_TYPE_SKIP_VALUE) == 0) |
707 | 889 | config->type = BACKGROUND_TYPE_SKIP; | 1061 | config->type = BACKGROUND_TYPE_SKIP; |
708 | 1062 | else if(g_strcmp0(value, BACKGROUND_TYPE_DEFAULT_VALUE) == 0) | ||
709 | 1063 | config->type = BACKGROUND_TYPE_DEFAULT; | ||
710 | 890 | else if(gdk_rgba_parse(&config->options.color, value)) | 1064 | else if(gdk_rgba_parse(&config->options.color, value)) |
711 | 891 | config->type = BACKGROUND_TYPE_COLOR; | 1065 | config->type = BACKGROUND_TYPE_COLOR; |
712 | 892 | else | 1066 | else |
713 | @@ -904,7 +1078,7 @@ | |||
714 | 904 | config->options.image.mode = SCALING_MODE_ZOOMED; | 1078 | config->options.image.mode = SCALING_MODE_ZOOMED; |
715 | 905 | 1079 | ||
716 | 906 | config->options.image.path = g_strdup(value); | 1080 | config->options.image.path = g_strdup(value); |
718 | 907 | config->type = BACKGROUND_TYPE_IMAGE; | 1081 | config->type = BACKGROUND_TYPE_IMAGE; |
719 | 908 | } | 1082 | } |
720 | 909 | return TRUE; | 1083 | return TRUE; |
721 | 910 | } | 1084 | } |
722 | @@ -912,8 +1086,19 @@ | |||
723 | 912 | static void | 1086 | static void |
724 | 913 | background_config_finalize(BackgroundConfig* config) | 1087 | background_config_finalize(BackgroundConfig* config) |
725 | 914 | { | 1088 | { |
728 | 915 | if(config->type == BACKGROUND_TYPE_IMAGE) | 1089 | switch(config->type) |
729 | 916 | g_free(config->options.image.path); | 1090 | { |
730 | 1091 | case BACKGROUND_TYPE_IMAGE: | ||
731 | 1092 | g_free(config->options.image.path); | ||
732 | 1093 | break; | ||
733 | 1094 | case BACKGROUND_TYPE_COLOR: | ||
734 | 1095 | case BACKGROUND_TYPE_DEFAULT: | ||
735 | 1096 | case BACKGROUND_TYPE_SKIP: | ||
736 | 1097 | break; | ||
737 | 1098 | case BACKGROUND_TYPE_INVALID: | ||
738 | 1099 | g_return_if_reached(); | ||
739 | 1100 | } | ||
740 | 1101 | |||
741 | 917 | config->type = BACKGROUND_TYPE_INVALID; | 1102 | config->type = BACKGROUND_TYPE_INVALID; |
742 | 918 | } | 1103 | } |
743 | 919 | 1104 | ||
744 | @@ -922,8 +1107,19 @@ | |||
745 | 922 | BackgroundConfig* dest) | 1107 | BackgroundConfig* dest) |
746 | 923 | { | 1108 | { |
747 | 924 | *dest = *source; | 1109 | *dest = *source; |
750 | 925 | if(source->type == BACKGROUND_TYPE_IMAGE) | 1110 | |
751 | 926 | dest->options.image.path = g_strdup(source->options.image.path); | 1111 | switch(dest->type) |
752 | 1112 | { | ||
753 | 1113 | case BACKGROUND_TYPE_IMAGE: | ||
754 | 1114 | dest->options.image.path = g_strdup(source->options.image.path); | ||
755 | 1115 | break; | ||
756 | 1116 | case BACKGROUND_TYPE_COLOR: | ||
757 | 1117 | case BACKGROUND_TYPE_DEFAULT: | ||
758 | 1118 | case BACKGROUND_TYPE_SKIP: | ||
759 | 1119 | break; | ||
760 | 1120 | case BACKGROUND_TYPE_INVALID: | ||
761 | 1121 | g_return_if_reached(); | ||
762 | 1122 | } | ||
763 | 927 | } | 1123 | } |
764 | 928 | 1124 | ||
765 | 929 | static void | 1125 | static void |
766 | @@ -941,84 +1137,238 @@ | |||
767 | 941 | background_config_copy(&source->bg, &dest->bg); | 1137 | background_config_copy(&source->bg, &dest->bg); |
768 | 942 | dest->user_bg = source->user_bg; | 1138 | dest->user_bg = source->user_bg; |
769 | 943 | dest->laptop = source->laptop; | 1139 | dest->laptop = source->laptop; |
770 | 1140 | dest->transition = source->transition; | ||
771 | 944 | return dest; | 1141 | return dest; |
772 | 945 | } | 1142 | } |
773 | 946 | 1143 | ||
799 | 947 | static gboolean | 1144 | static Background* |
800 | 948 | background_initialize(Background* bg, | 1145 | background_new(const BackgroundConfig* config, |
801 | 949 | const BackgroundConfig* config, | 1146 | const Monitor* monitor, |
802 | 950 | const Monitor* monitor, | 1147 | GHashTable* images_cache) |
803 | 951 | GHashTable* images_cache) | 1148 | { |
804 | 952 | { | 1149 | Background bg = {0}; |
805 | 953 | if(config->type == BACKGROUND_TYPE_IMAGE) | 1150 | |
806 | 954 | { | 1151 | switch(config->type) |
807 | 955 | GdkPixbuf* pixbuf = scale_image_file(config->options.image.path, | 1152 | { |
808 | 956 | config->options.image.mode, | 1153 | case BACKGROUND_TYPE_IMAGE: |
809 | 957 | monitor->geometry.width, monitor->geometry.height, | 1154 | bg.options.image = scale_image_file(config->options.image.path, config->options.image.mode, |
810 | 958 | images_cache); | 1155 | monitor->geometry.width, monitor->geometry.height, |
811 | 959 | if(!pixbuf) | 1156 | images_cache); |
812 | 960 | { | 1157 | if(!bg.options.image) |
813 | 961 | g_warning("Failed to read wallpaper: %s", config->options.image.path); | 1158 | { |
814 | 962 | return FALSE; | 1159 | g_warning("[Background] Failed to read wallpaper: %s", config->options.image.path); |
815 | 963 | } | 1160 | return NULL; |
816 | 964 | bg->options.image = pixbuf; | 1161 | } |
817 | 965 | } | 1162 | break; |
818 | 966 | else if(config->type == BACKGROUND_TYPE_COLOR) | 1163 | case BACKGROUND_TYPE_COLOR: |
819 | 967 | bg->options.color = config->options.color; | 1164 | bg.options.color = config->options.color; |
820 | 968 | else | 1165 | break; |
821 | 969 | return FALSE; | 1166 | case BACKGROUND_TYPE_DEFAULT: |
822 | 970 | bg->type = config->type; | 1167 | break; |
823 | 971 | return TRUE; | 1168 | case BACKGROUND_TYPE_SKIP: |
824 | 1169 | case BACKGROUND_TYPE_INVALID: | ||
825 | 1170 | g_return_val_if_reached(NULL); | ||
826 | 1171 | } | ||
827 | 1172 | |||
828 | 1173 | bg.type = config->type; | ||
829 | 1174 | bg.ref_count = 1; | ||
830 | 1175 | |||
831 | 1176 | Background* result = g_new(Background, 1); | ||
832 | 1177 | *result = bg; | ||
833 | 1178 | return result; | ||
834 | 1179 | } | ||
835 | 1180 | |||
836 | 1181 | static Background* | ||
837 | 1182 | background_ref(Background* bg) | ||
838 | 1183 | { | ||
839 | 1184 | bg->ref_count++; | ||
840 | 1185 | return bg; | ||
841 | 1186 | } | ||
842 | 1187 | |||
843 | 1188 | static void | ||
844 | 1189 | background_unref(Background** bg) | ||
845 | 1190 | { | ||
846 | 1191 | if(!*bg) | ||
847 | 1192 | return; | ||
848 | 1193 | (*bg)->ref_count--; | ||
849 | 1194 | if((*bg)->ref_count == 0) | ||
850 | 1195 | { | ||
851 | 1196 | background_finalize(*bg); | ||
852 | 1197 | *bg = NULL; | ||
853 | 1198 | } | ||
854 | 972 | } | 1199 | } |
855 | 973 | 1200 | ||
856 | 974 | static void | 1201 | static void |
857 | 975 | background_finalize(Background* bg) | 1202 | background_finalize(Background* bg) |
858 | 976 | { | 1203 | { |
861 | 977 | if(bg->type == BACKGROUND_TYPE_IMAGE) | 1204 | switch(bg->type) |
862 | 978 | g_clear_object(&bg->options.image); | 1205 | { |
863 | 1206 | case BACKGROUND_TYPE_IMAGE: | ||
864 | 1207 | g_clear_object(&bg->options.image); | ||
865 | 1208 | break; | ||
866 | 1209 | case BACKGROUND_TYPE_COLOR: | ||
867 | 1210 | case BACKGROUND_TYPE_DEFAULT: | ||
868 | 1211 | break; | ||
869 | 1212 | case BACKGROUND_TYPE_SKIP: | ||
870 | 1213 | case BACKGROUND_TYPE_INVALID: | ||
871 | 1214 | g_return_if_reached(); | ||
872 | 1215 | } | ||
873 | 1216 | |||
874 | 979 | bg->type = BACKGROUND_TYPE_INVALID; | 1217 | bg->type = BACKGROUND_TYPE_INVALID; |
875 | 980 | } | 1218 | } |
876 | 981 | 1219 | ||
877 | 982 | static void | 1220 | static void |
878 | 983 | monitor_set_background(Monitor* monitor, | 1221 | monitor_set_background(Monitor* monitor, |
883 | 984 | const Background* background) | 1222 | Background* background) |
884 | 985 | { | 1223 | { |
885 | 986 | monitor->background = background; | 1224 | if(monitor->background == background) |
886 | 987 | gtk_widget_queue_draw(GTK_WIDGET(monitor->window)); | 1225 | return; |
887 | 1226 | monitor_stop_transition(monitor); | ||
888 | 1227 | |||
889 | 1228 | switch(background->type) | ||
890 | 1229 | { | ||
891 | 1230 | case BACKGROUND_TYPE_IMAGE: | ||
892 | 1231 | case BACKGROUND_TYPE_COLOR: | ||
893 | 1232 | gtk_widget_set_app_paintable(GTK_WIDGET(monitor->window), TRUE); | ||
894 | 1233 | if(monitor->transition.config.duration > 0 && monitor->background && | ||
895 | 1234 | monitor->background->type != BACKGROUND_TYPE_DEFAULT) | ||
896 | 1235 | monitor_start_transition(monitor, monitor->background, background); | ||
897 | 1236 | break; | ||
898 | 1237 | case BACKGROUND_TYPE_DEFAULT: | ||
899 | 1238 | gtk_widget_set_app_paintable(GTK_WIDGET(monitor->window), FALSE); | ||
900 | 1239 | break; | ||
901 | 1240 | case BACKGROUND_TYPE_SKIP: | ||
902 | 1241 | case BACKGROUND_TYPE_INVALID: | ||
903 | 1242 | g_return_val_if_reached(NULL); | ||
904 | 1243 | } | ||
905 | 1244 | |||
906 | 1245 | background_unref(&monitor->background); | ||
907 | 1246 | monitor->background = background_ref(background); | ||
908 | 1247 | gtk_widget_queue_draw(GTK_WIDGET(monitor->window)); | ||
909 | 1248 | } | ||
910 | 1249 | |||
911 | 1250 | static void | ||
912 | 1251 | monitor_start_transition(Monitor* monitor, | ||
913 | 1252 | Background* from, | ||
914 | 1253 | Background* to) | ||
915 | 1254 | { | ||
916 | 1255 | monitor_stop_transition(monitor); | ||
917 | 1256 | |||
918 | 1257 | monitor->transition.from = background_ref(from); | ||
919 | 1258 | monitor->transition.to = background_ref(to); | ||
920 | 1259 | |||
921 | 1260 | monitor->transition.started = g_get_monotonic_time(); | ||
922 | 1261 | monitor->transition.timer_id = gtk_widget_add_tick_callback(GTK_WIDGET(monitor->window), | ||
923 | 1262 | (GtkTickCallback)monitor_transition_cb, | ||
924 | 1263 | monitor, | ||
925 | 1264 | NULL); | ||
926 | 1265 | monitor->transition.stage = 0; | ||
927 | 1266 | } | ||
928 | 1267 | |||
929 | 1268 | static void | ||
930 | 1269 | monitor_stop_transition(Monitor* monitor) | ||
931 | 1270 | { | ||
932 | 1271 | if(!monitor->transition.timer_id) | ||
933 | 1272 | return; | ||
934 | 1273 | gtk_widget_remove_tick_callback(GTK_WIDGET(monitor->window), monitor->transition.timer_id); | ||
935 | 1274 | monitor->transition.timer_id = 0; | ||
936 | 1275 | monitor->transition.started = 0; | ||
937 | 1276 | monitor->transition.stage = 0; | ||
938 | 1277 | background_unref(&monitor->transition.to); | ||
939 | 1278 | background_unref(&monitor->transition.from); | ||
940 | 1279 | } | ||
941 | 1280 | |||
942 | 1281 | static gboolean | ||
943 | 1282 | monitor_transition_cb(GtkWidget *widget, | ||
944 | 1283 | GdkFrameClock* frame_clock, | ||
945 | 1284 | Monitor* monitor) | ||
946 | 1285 | { | ||
947 | 1286 | if(!monitor->transition.timer_id) | ||
948 | 1287 | return G_SOURCE_REMOVE; | ||
949 | 1288 | |||
950 | 1289 | gint64 span = g_get_monotonic_time() - monitor->transition.started; | ||
951 | 1290 | gdouble x = CLAMP(span/monitor->transition.config.duration/1000.0, 0.0, 1.0); | ||
952 | 1291 | monitor->transition.stage = monitor->transition.config.func(x); | ||
953 | 1292 | |||
954 | 1293 | if(x >= 1.0) | ||
955 | 1294 | monitor_stop_transition(monitor); | ||
956 | 1295 | |||
957 | 1296 | gtk_widget_queue_draw(GTK_WIDGET(monitor->window)); | ||
958 | 1297 | return x >= 1.0 ? G_SOURCE_REMOVE : G_SOURCE_CONTINUE; | ||
959 | 1298 | } | ||
960 | 1299 | |||
961 | 1300 | static void | ||
962 | 1301 | monitor_transition_draw_alpha(const Monitor* monitor, | ||
963 | 1302 | cairo_t* cr) | ||
964 | 1303 | { | ||
965 | 1304 | monitor_draw_background(monitor, monitor->transition.from, cr); | ||
966 | 1305 | |||
967 | 1306 | cairo_push_group(cr); | ||
968 | 1307 | monitor_draw_background(monitor, monitor->transition.to, cr); | ||
969 | 1308 | cairo_pop_group_to_source(cr); | ||
970 | 1309 | |||
971 | 1310 | cairo_pattern_t* alpha_pattern = cairo_pattern_create_rgba(0.0, 0.0, 0.0, monitor->transition.stage); | ||
972 | 1311 | cairo_mask(cr, alpha_pattern); | ||
973 | 1312 | cairo_pattern_destroy(alpha_pattern); | ||
974 | 988 | } | 1313 | } |
975 | 989 | 1314 | ||
976 | 990 | static void | 1315 | static void |
977 | 991 | monitor_finalize(Monitor* monitor) | 1316 | monitor_finalize(Monitor* monitor) |
978 | 992 | { | 1317 | { |
982 | 993 | background_finalize(&monitor->background_configured); | 1318 | if(monitor->transition.config.duration) |
983 | 994 | background_finalize(&monitor->background_custom); | 1319 | { |
984 | 995 | g_free(monitor->name); | 1320 | monitor_stop_transition(monitor); |
985 | 1321 | if(monitor->transition.timer_id) | ||
986 | 1322 | g_source_remove(monitor->transition.timer_id); | ||
987 | 1323 | monitor->transition.config.duration = 0; | ||
988 | 1324 | } | ||
989 | 1325 | |||
990 | 996 | if(monitor->window_draw_handler_id) | 1326 | if(monitor->window_draw_handler_id) |
991 | 997 | g_signal_handler_disconnect(monitor->window, monitor->window_draw_handler_id); | 1327 | g_signal_handler_disconnect(monitor->window, monitor->window_draw_handler_id); |
992 | 1328 | |||
993 | 1329 | background_unref(&monitor->background_configured); | ||
994 | 1330 | background_unref(&monitor->background); | ||
995 | 1331 | |||
996 | 998 | if(monitor->window) | 1332 | if(monitor->window) |
997 | 1333 | { | ||
998 | 1334 | GtkWidget* child = gtk_bin_get_child(GTK_BIN(monitor->window)); | ||
999 | 1335 | if(child) /* remove greeter widget to avoid "destroy" signal */ | ||
1000 | 1336 | gtk_container_remove(GTK_CONTAINER(monitor->window), child); | ||
1001 | 999 | gtk_widget_destroy(GTK_WIDGET(monitor->window)); | 1337 | gtk_widget_destroy(GTK_WIDGET(monitor->window)); |
1005 | 1000 | monitor->name = NULL; | 1338 | } |
1006 | 1001 | monitor->window = NULL; | 1339 | |
1007 | 1002 | monitor->window_draw_handler_id = 0; | 1340 | g_free(monitor->name); |
1008 | 1341 | |||
1009 | 1342 | *monitor = INVALID_MONITOR_STRUCT; | ||
1010 | 1003 | } | 1343 | } |
1011 | 1004 | 1344 | ||
1012 | 1005 | static void | 1345 | static void |
1013 | 1006 | monitor_draw_background(const Monitor* monitor, | 1346 | monitor_draw_background(const Monitor* monitor, |
1014 | 1347 | const Background* background, | ||
1015 | 1007 | cairo_t* cr) | 1348 | cairo_t* cr) |
1016 | 1008 | { | 1349 | { |
1017 | 1009 | g_return_if_fail(monitor != NULL); | 1350 | g_return_if_fail(monitor != NULL); |
1019 | 1010 | g_return_if_fail(monitor->background != NULL); | 1351 | g_return_if_fail(background != NULL); |
1020 | 1011 | 1352 | ||
1031 | 1012 | if(monitor->background->type == BACKGROUND_TYPE_IMAGE && monitor->background->options.image) | 1353 | switch(background->type) |
1032 | 1013 | { | 1354 | { |
1033 | 1014 | gdk_cairo_set_source_pixbuf(cr, monitor->background->options.image, 0, 0); | 1355 | case BACKGROUND_TYPE_IMAGE: |
1034 | 1015 | cairo_paint(cr); | 1356 | if(background->options.image) |
1035 | 1016 | } | 1357 | { |
1036 | 1017 | else if(monitor->background->type == BACKGROUND_TYPE_COLOR) | 1358 | gdk_cairo_set_source_pixbuf(cr, background->options.image, 0, 0); |
1037 | 1018 | { | 1359 | cairo_paint(cr); |
1038 | 1019 | cairo_rectangle(cr, 0, 0, monitor->geometry.width, monitor->geometry.height); | 1360 | } |
1039 | 1020 | gdk_cairo_set_source_rgba(cr, &monitor->background->options.color); | 1361 | break; |
1040 | 1021 | cairo_fill(cr); | 1362 | case BACKGROUND_TYPE_COLOR: |
1041 | 1363 | cairo_rectangle(cr, 0, 0, monitor->geometry.width, monitor->geometry.height); | ||
1042 | 1364 | gdk_cairo_set_source_rgba(cr, &background->options.color); | ||
1043 | 1365 | cairo_fill(cr); | ||
1044 | 1366 | break; | ||
1045 | 1367 | case BACKGROUND_TYPE_DEFAULT: | ||
1046 | 1368 | break; | ||
1047 | 1369 | case BACKGROUND_TYPE_SKIP: | ||
1048 | 1370 | case BACKGROUND_TYPE_INVALID: | ||
1049 | 1371 | g_return_if_reached(); | ||
1050 | 1022 | } | 1372 | } |
1051 | 1023 | } | 1373 | } |
1052 | 1024 | 1374 | ||
1053 | @@ -1027,8 +1377,14 @@ | |||
1054 | 1027 | cairo_t* cr, | 1377 | cairo_t* cr, |
1055 | 1028 | const Monitor* monitor) | 1378 | const Monitor* monitor) |
1056 | 1029 | { | 1379 | { |
1059 | 1030 | if(monitor->background) | 1380 | if(!monitor->background) |
1060 | 1031 | monitor_draw_background(monitor, cr); | 1381 | return FALSE; |
1061 | 1382 | |||
1062 | 1383 | if(monitor->transition.started) | ||
1063 | 1384 | monitor->transition.config.draw(monitor, cr); | ||
1064 | 1385 | else | ||
1065 | 1386 | monitor_draw_background(monitor, monitor->background, cr); | ||
1066 | 1387 | |||
1067 | 1032 | return FALSE; | 1388 | return FALSE; |
1068 | 1033 | } | 1389 | } |
1069 | 1034 | 1390 | ||
1070 | @@ -1051,35 +1407,43 @@ | |||
1071 | 1051 | { | 1407 | { |
1072 | 1052 | gchar* key = NULL; | 1408 | gchar* key = NULL; |
1073 | 1053 | GdkPixbuf* pixbuf = NULL; | 1409 | GdkPixbuf* pixbuf = NULL; |
1074 | 1410 | |||
1075 | 1054 | if(cache) | 1411 | if(cache) |
1076 | 1055 | { | 1412 | { |
1077 | 1056 | key = g_strdup_printf("%s\n%d %dx%d", path, mode, width, height); | 1413 | key = g_strdup_printf("%s\n%d %dx%d", path, mode, width, height); |
1079 | 1057 | if (g_hash_table_lookup_extended(cache, key, NULL, (gpointer*)&pixbuf)) | 1414 | if(g_hash_table_lookup_extended(cache, key, NULL, (gpointer*)&pixbuf)) |
1080 | 1415 | { | ||
1081 | 1416 | g_free(key); | ||
1082 | 1058 | return GDK_PIXBUF(g_object_ref(pixbuf)); | 1417 | return GDK_PIXBUF(g_object_ref(pixbuf)); |
1083 | 1418 | } | ||
1084 | 1059 | } | 1419 | } |
1085 | 1060 | 1420 | ||
1087 | 1061 | if (!cache || !g_hash_table_lookup_extended(cache, path, NULL, (gpointer*)&pixbuf)) | 1421 | if(!cache || !g_hash_table_lookup_extended(cache, path, NULL, (gpointer*)&pixbuf)) |
1088 | 1062 | { | 1422 | { |
1089 | 1063 | GError *error = NULL; | 1423 | GError *error = NULL; |
1090 | 1064 | pixbuf = gdk_pixbuf_new_from_file(path, &error); | 1424 | pixbuf = gdk_pixbuf_new_from_file(path, &error); |
1091 | 1065 | if(error) | 1425 | if(error) |
1092 | 1066 | { | 1426 | { |
1094 | 1067 | g_warning("Failed to load background: %s", error->message); | 1427 | g_warning("[Background] Failed to load background: %s", error->message); |
1095 | 1068 | g_clear_error(&error); | 1428 | g_clear_error(&error); |
1096 | 1069 | } | 1429 | } |
1097 | 1070 | else if(cache) | 1430 | else if(cache) |
1099 | 1071 | g_hash_table_insert(cache, g_strdup(path), g_object_ref (pixbuf)); | 1431 | g_hash_table_insert(cache, g_strdup(path), g_object_ref(pixbuf)); |
1100 | 1072 | } | 1432 | } |
1101 | 1433 | else | ||
1102 | 1434 | pixbuf = g_object_ref(pixbuf); | ||
1103 | 1073 | 1435 | ||
1104 | 1074 | if(pixbuf) | 1436 | if(pixbuf) |
1105 | 1075 | { | 1437 | { |
1106 | 1076 | GdkPixbuf* scaled = scale_image(pixbuf, mode, width, height); | 1438 | GdkPixbuf* scaled = scale_image(pixbuf, mode, width, height); |
1108 | 1077 | if (cache) | 1439 | if(cache) |
1109 | 1078 | g_hash_table_insert(cache, g_strdup(key), g_object_ref(scaled)); | 1440 | g_hash_table_insert(cache, g_strdup(key), g_object_ref(scaled)); |
1110 | 1079 | g_object_unref(pixbuf); | 1441 | g_object_unref(pixbuf); |
1111 | 1080 | pixbuf = scaled; | 1442 | pixbuf = scaled; |
1112 | 1081 | } | 1443 | } |
1113 | 1082 | 1444 | ||
1114 | 1445 | g_free(key); | ||
1115 | 1446 | |||
1116 | 1083 | return pixbuf; | 1447 | return pixbuf; |
1117 | 1084 | } | 1448 | } |
1118 | 1085 | 1449 | ||
1119 | @@ -1142,7 +1506,7 @@ | |||
1120 | 1142 | display = XOpenDisplay (gdk_display_get_name (gdk_screen_get_display (screen))); | 1506 | display = XOpenDisplay (gdk_display_get_name (gdk_screen_get_display (screen))); |
1121 | 1143 | if (!display) | 1507 | if (!display) |
1122 | 1144 | { | 1508 | { |
1124 | 1145 | g_warning ("Failed to create root pixmap"); | 1509 | g_warning("[Background] Failed to create root pixmap"); |
1125 | 1146 | return NULL; | 1510 | return NULL; |
1126 | 1147 | } | 1511 | } |
1127 | 1148 | 1512 | ||
1128 | @@ -1165,7 +1529,7 @@ | |||
1129 | 1165 | Display* display, | 1529 | Display* display, |
1130 | 1166 | Pixmap xpixmap) | 1530 | Pixmap xpixmap) |
1131 | 1167 | { | 1531 | { |
1133 | 1168 | 1532 | ||
1134 | 1169 | Window xroot = RootWindow (display, gdk_screen_get_number (screen)); | 1533 | Window xroot = RootWindow (display, gdk_screen_get_number (screen)); |
1135 | 1170 | char *atom_names[] = {"_XROOTPMAP_ID", "ESETROOT_PMAP_ID"}; | 1534 | char *atom_names[] = {"_XROOTPMAP_ID", "ESETROOT_PMAP_ID"}; |
1136 | 1171 | Atom atoms[G_N_ELEMENTS(atom_names)] = {0}; | 1535 | Atom atoms[G_N_ELEMENTS(atom_names)] = {0}; |
1137 | @@ -1214,7 +1578,7 @@ | |||
1138 | 1214 | */ | 1578 | */ |
1139 | 1215 | if (!XInternAtoms (display, atom_names, G_N_ELEMENTS(atom_names), False, atoms) || | 1579 | if (!XInternAtoms (display, atom_names, G_N_ELEMENTS(atom_names), False, atoms) || |
1140 | 1216 | atoms[0] == None || atoms[1] == None) { | 1580 | atoms[0] == None || atoms[1] == None) { |
1142 | 1217 | g_warning("Could not create atoms needed to set root pixmap id/properties.\n"); | 1581 | g_warning("[Background] Could not create atoms needed to set root pixmap id/properties.\n"); |
1143 | 1218 | return; | 1582 | return; |
1144 | 1219 | } | 1583 | } |
1145 | 1220 | 1584 | ||
1146 | @@ -1261,3 +1625,15 @@ | |||
1147 | 1261 | XFlush (display); | 1625 | XFlush (display); |
1148 | 1262 | XUngrabServer (display); | 1626 | XUngrabServer (display); |
1149 | 1263 | } | 1627 | } |
1150 | 1628 | |||
1151 | 1629 | static gdouble | ||
1152 | 1630 | transition_func_linear(gdouble x) | ||
1153 | 1631 | { | ||
1154 | 1632 | return x; | ||
1155 | 1633 | } | ||
1156 | 1634 | |||
1157 | 1635 | static gdouble | ||
1158 | 1636 | transition_func_easy_in_out(gdouble x) | ||
1159 | 1637 | { | ||
1160 | 1638 | return (1 - cos(M_PI*x))/2; | ||
1161 | 1639 | } | ||
1162 | 1264 | 1640 | ||
1163 | === modified file 'src/greeterbackground.h' | |||
1164 | --- src/greeterbackground.h 2014-08-31 17:45:52 +0000 | |||
1165 | +++ src/greeterbackground.h 2014-12-10 07:59:47 +0000 | |||
1166 | @@ -12,6 +12,8 @@ | |||
1167 | 12 | #define GREETER_IS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GREETER_BACKGROUND_TYPE)) | 12 | #define GREETER_IS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GREETER_BACKGROUND_TYPE)) |
1168 | 13 | #define GREETER_IS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GREETER_BACKGROUND_TYPE)) | 13 | #define GREETER_IS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GREETER_BACKGROUND_TYPE)) |
1169 | 14 | 14 | ||
1170 | 15 | #define GREETER_BACKGROUND_DEFAULT "*" | ||
1171 | 16 | |||
1172 | 15 | typedef struct _GreeterBackground GreeterBackground; | 17 | typedef struct _GreeterBackground GreeterBackground; |
1173 | 16 | typedef struct _GreeterBackgroundClass GreeterBackgroundClass; | 18 | typedef struct _GreeterBackgroundClass GreeterBackgroundClass; |
1174 | 17 | 19 | ||
1175 | @@ -20,15 +22,13 @@ | |||
1176 | 20 | GreeterBackground* greeter_background_new (GtkWidget* child); | 22 | GreeterBackground* greeter_background_new (GtkWidget* child); |
1177 | 21 | void greeter_background_set_active_monitor_config (GreeterBackground* background, | 23 | void greeter_background_set_active_monitor_config (GreeterBackground* background, |
1178 | 22 | const gchar* value); | 24 | const gchar* value); |
1179 | 23 | void greeter_background_set_default_config (GreeterBackground* background, | ||
1180 | 24 | const gchar* bg, | ||
1181 | 25 | gboolean user_bg, | ||
1182 | 26 | gboolean laptop); | ||
1183 | 27 | void greeter_background_set_monitor_config (GreeterBackground* background, | 25 | void greeter_background_set_monitor_config (GreeterBackground* background, |
1184 | 28 | const gchar* name, | 26 | const gchar* name, |
1185 | 29 | const gchar* bg, | 27 | const gchar* bg, |
1186 | 30 | gboolean user_bg, gboolean user_bg_used, | 28 | gboolean user_bg, gboolean user_bg_used, |
1188 | 31 | gboolean laptop, gboolean laptop_used); | 29 | gboolean laptop, gboolean laptop_used, |
1189 | 30 | gint transition_duration, | ||
1190 | 31 | const gchar* transition_func); | ||
1191 | 32 | void greeter_background_remove_monitor_config (GreeterBackground* background, | 32 | void greeter_background_remove_monitor_config (GreeterBackground* background, |
1192 | 33 | const gchar* name); | 33 | const gchar* name); |
1193 | 34 | gchar** greeter_background_get_configured_monitors (GreeterBackground* background); | 34 | gchar** greeter_background_get_configured_monitors (GreeterBackground* background); |
1194 | 35 | 35 | ||
1195 | === modified file 'src/lightdm-gtk-greeter.c' | |||
1196 | --- src/lightdm-gtk-greeter.c 2014-09-01 07:58:56 +0000 | |||
1197 | +++ src/lightdm-gtk-greeter.c 2014-12-10 07:59:47 +0000 | |||
1198 | @@ -127,9 +127,6 @@ | |||
1199 | 127 | static const WindowPosition KEYBOARD_POSITION = {.x = { 50, +1, TRUE, 0}, .y = { 0, -1, FALSE, +1}, .use_size = TRUE, | 127 | static const WindowPosition KEYBOARD_POSITION = {.x = { 50, +1, TRUE, 0}, .y = { 0, -1, FALSE, +1}, .use_size = TRUE, |
1200 | 128 | .width = {50, 0, TRUE, 0}, .height = {25, 0, TRUE, 0}}; | 128 | .width = {50, 0, TRUE, 0}, .height = {25, 0, TRUE, 0}}; |
1201 | 129 | 129 | ||
1202 | 130 | /* Configuration */ | ||
1203 | 131 | static gboolean key_file_get_boolean_extended (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean default_value); | ||
1204 | 132 | |||
1205 | 133 | /* Clock */ | 130 | /* Clock */ |
1206 | 134 | static gchar *clock_format; | 131 | static gchar *clock_format; |
1207 | 135 | static gboolean clock_timeout_thread (void); | 132 | static gboolean clock_timeout_thread (void); |
1208 | @@ -183,6 +180,7 @@ | |||
1209 | 183 | static int timeout, interval, prefer_blanking, allow_exposures; | 180 | static int timeout, interval, prefer_blanking, allow_exposures; |
1210 | 184 | 181 | ||
1211 | 185 | /* Handling monitors backgrounds */ | 182 | /* Handling monitors backgrounds */ |
1212 | 183 | static const gint USER_BACKGROUND_DELAY = 250; | ||
1213 | 186 | static GreeterBackground *greeter_background; | 184 | static GreeterBackground *greeter_background; |
1214 | 187 | 185 | ||
1215 | 188 | /* Authentication state */ | 186 | /* Authentication state */ |
1216 | @@ -285,6 +283,42 @@ | |||
1217 | 285 | void restart_cb (GtkWidget *widget, LightDMGreeter *greeter); | 283 | void restart_cb (GtkWidget *widget, LightDMGreeter *greeter); |
1218 | 286 | void shutdown_cb (GtkWidget *widget, LightDMGreeter *greeter); | 284 | void shutdown_cb (GtkWidget *widget, LightDMGreeter *greeter); |
1219 | 287 | 285 | ||
1220 | 286 | gpointer greeter_save_focus(GtkWidget* widget); | ||
1221 | 287 | void greeter_restore_focus(const gpointer saved_data); | ||
1222 | 288 | |||
1223 | 289 | struct SavedFocusData | ||
1224 | 290 | { | ||
1225 | 291 | GtkWidget *widget; | ||
1226 | 292 | gint editable_pos; | ||
1227 | 293 | }; | ||
1228 | 294 | |||
1229 | 295 | gpointer | ||
1230 | 296 | greeter_save_focus(GtkWidget* widget) | ||
1231 | 297 | { | ||
1232 | 298 | GtkWidget *window = gtk_widget_get_toplevel(widget); | ||
1233 | 299 | if (!GTK_IS_WINDOW (window)) | ||
1234 | 300 | return NULL; | ||
1235 | 301 | |||
1236 | 302 | struct SavedFocusData *data = g_new0 (struct SavedFocusData, 1); | ||
1237 | 303 | data->widget = gtk_window_get_focus (GTK_WINDOW (window)); | ||
1238 | 304 | data->editable_pos = GTK_IS_EDITABLE(data->widget) ? gtk_editable_get_position (GTK_EDITABLE (data->widget)) : -1; | ||
1239 | 305 | |||
1240 | 306 | return data; | ||
1241 | 307 | } | ||
1242 | 308 | |||
1243 | 309 | void | ||
1244 | 310 | greeter_restore_focus(const gpointer saved_data) | ||
1245 | 311 | { | ||
1246 | 312 | if (!saved_data) | ||
1247 | 313 | return; | ||
1248 | 314 | |||
1249 | 315 | struct SavedFocusData *data = saved_data; | ||
1250 | 316 | if (GTK_IS_WIDGET (data->widget)) | ||
1251 | 317 | gtk_widget_grab_focus (data->widget); | ||
1252 | 318 | if (GTK_IS_EDITABLE(data->widget) && data->editable_pos > -1) | ||
1253 | 319 | gtk_editable_set_position(GTK_EDITABLE(data->widget), data->editable_pos); | ||
1254 | 320 | } | ||
1255 | 321 | |||
1256 | 288 | /* State file */ | 322 | /* State file */ |
1257 | 289 | 323 | ||
1258 | 290 | static void | 324 | static void |
1259 | @@ -536,21 +570,6 @@ | |||
1260 | 536 | return TRUE; | 570 | return TRUE; |
1261 | 537 | } | 571 | } |
1262 | 538 | 572 | ||
1263 | 539 | /* Configuration */ | ||
1264 | 540 | |||
1265 | 541 | static gboolean | ||
1266 | 542 | key_file_get_boolean_extended (GKeyFile *key_file, const gchar *group_name, const gchar *key, gboolean default_value) | ||
1267 | 543 | { | ||
1268 | 544 | GError* error = NULL; | ||
1269 | 545 | gboolean result = g_key_file_get_boolean (key_file, group_name, key, &error); | ||
1270 | 546 | if (error) | ||
1271 | 547 | { | ||
1272 | 548 | g_clear_error (&error); | ||
1273 | 549 | return default_value; | ||
1274 | 550 | } | ||
1275 | 551 | return result; | ||
1276 | 552 | } | ||
1277 | 553 | |||
1278 | 554 | /* Clock */ | 573 | /* Clock */ |
1279 | 555 | 574 | ||
1280 | 556 | static gboolean | 575 | static gboolean |
1281 | @@ -1771,24 +1790,47 @@ | |||
1282 | 1771 | gtk_button_set_label (login_button, _("Unlock")); | 1790 | gtk_button_set_label (login_button, _("Unlock")); |
1283 | 1772 | else | 1791 | else |
1284 | 1773 | gtk_button_set_label (login_button, _("Log In")); | 1792 | gtk_button_set_label (login_button, _("Log In")); |
1285 | 1774 | gtk_widget_set_can_default (GTK_WIDGET (login_button), TRUE); | ||
1286 | 1775 | gtk_widget_grab_default (GTK_WIDGET (login_button)); | ||
1287 | 1776 | /* and disable the session and language widgets */ | 1793 | /* and disable the session and language widgets */ |
1288 | 1777 | gtk_widget_set_sensitive (GTK_WIDGET (session_menuitem), !logged_in); | 1794 | gtk_widget_set_sensitive (GTK_WIDGET (session_menuitem), !logged_in); |
1289 | 1778 | gtk_widget_set_sensitive (GTK_WIDGET (language_menuitem), !logged_in); | 1795 | gtk_widget_set_sensitive (GTK_WIDGET (language_menuitem), !logged_in); |
1290 | 1779 | } | 1796 | } |
1291 | 1780 | 1797 | ||
1292 | 1798 | static guint set_user_background_delayed_id = 0; | ||
1293 | 1799 | |||
1294 | 1800 | static gboolean | ||
1295 | 1801 | set_user_background_delayed_cb (const gchar *value) | ||
1296 | 1802 | { | ||
1297 | 1803 | greeter_background_set_custom_background (greeter_background, value); | ||
1298 | 1804 | set_user_background_delayed_id = 0; | ||
1299 | 1805 | return G_SOURCE_REMOVE; | ||
1300 | 1806 | } | ||
1301 | 1807 | |||
1302 | 1781 | static void | 1808 | static void |
1304 | 1782 | set_user_background (const gchar *username) | 1809 | set_user_background (const gchar *user_name) |
1305 | 1783 | { | 1810 | { |
1308 | 1784 | const gchar *path = NULL; | 1811 | const gchar *value = NULL; |
1309 | 1785 | if (username) | 1812 | if (user_name) |
1310 | 1786 | { | 1813 | { |
1312 | 1787 | LightDMUser *user = lightdm_user_list_get_user_by_name (lightdm_user_list_get_instance (), username); | 1814 | LightDMUser *user = lightdm_user_list_get_user_by_name (lightdm_user_list_get_instance (), user_name); |
1313 | 1788 | if (user) | 1815 | if (user) |
1317 | 1789 | path = lightdm_user_get_background (user); | 1816 | value = lightdm_user_get_background (user); |
1318 | 1790 | } | 1817 | } |
1319 | 1791 | greeter_background_set_custom_background (greeter_background, path); | 1818 | |
1320 | 1819 | if (set_user_background_delayed_id) | ||
1321 | 1820 | { | ||
1322 | 1821 | g_source_remove (set_user_background_delayed_id); | ||
1323 | 1822 | set_user_background_delayed_id = 0; | ||
1324 | 1823 | } | ||
1325 | 1824 | |||
1326 | 1825 | if (!value) | ||
1327 | 1826 | greeter_background_set_custom_background (greeter_background, NULL); | ||
1328 | 1827 | else | ||
1329 | 1828 | { | ||
1330 | 1829 | /* Small delay before changing background */ | ||
1331 | 1830 | set_user_background_delayed_id = g_timeout_add_full (G_PRIORITY_DEFAULT, USER_BACKGROUND_DELAY, | ||
1332 | 1831 | (GSourceFunc)set_user_background_delayed_cb, | ||
1333 | 1832 | g_strdup (value), g_free); | ||
1334 | 1833 | } | ||
1335 | 1792 | } | 1834 | } |
1336 | 1793 | 1835 | ||
1337 | 1794 | static void | 1836 | static void |
1338 | @@ -2852,36 +2894,45 @@ | |||
1339 | 2852 | greeter_background_set_active_monitor_config (greeter_background, value ? value : "#cursor"); | 2894 | greeter_background_set_active_monitor_config (greeter_background, value ? value : "#cursor"); |
1340 | 2853 | g_free (value); | 2895 | g_free (value); |
1341 | 2854 | 2896 | ||
1342 | 2855 | value = g_key_file_get_value (config, "greeter", "background", NULL); | ||
1343 | 2856 | greeter_background_set_default_config (greeter_background, value, | ||
1344 | 2857 | key_file_get_boolean_extended (config, "greeter", "user-background", TRUE), | ||
1345 | 2858 | key_file_get_boolean_extended (config, "greeter", "laptop", FALSE)); | ||
1346 | 2859 | g_free (value); | ||
1347 | 2860 | |||
1348 | 2861 | const gchar *CONFIG_MONITOR_PREFIX = "monitor:"; | 2897 | const gchar *CONFIG_MONITOR_PREFIX = "monitor:"; |
1349 | 2862 | gchar **config_group; | 2898 | gchar **config_group; |
1350 | 2863 | gchar **config_groups = g_key_file_get_groups (config, NULL); | 2899 | gchar **config_groups = g_key_file_get_groups (config, NULL); |
1351 | 2864 | for (config_group = config_groups; *config_group; ++config_group) | 2900 | for (config_group = config_groups; *config_group; ++config_group) |
1352 | 2865 | { | 2901 | { |
1358 | 2866 | if (!g_str_has_prefix (*config_group, CONFIG_MONITOR_PREFIX)) | 2902 | gchar *name_to_free = NULL; |
1359 | 2867 | continue; | 2903 | const gchar *name = *config_group; |
1360 | 2868 | const gchar *name = *config_group + sizeof (CONFIG_MONITOR_PREFIX); | 2904 | |
1361 | 2869 | while (*name && g_ascii_isspace (*name)) | 2905 | if (g_strcmp0 (*config_group, "greeter") != 0) |
1362 | 2870 | ++name; | 2906 | { |
1363 | 2907 | if (!g_str_has_prefix (name, CONFIG_MONITOR_PREFIX)) | ||
1364 | 2908 | continue; | ||
1365 | 2909 | name = *config_group + sizeof (CONFIG_MONITOR_PREFIX); | ||
1366 | 2910 | while (*name && g_ascii_isspace (*name)) | ||
1367 | 2911 | ++name; | ||
1368 | 2912 | } | ||
1369 | 2913 | else | ||
1370 | 2914 | name = name_to_free = g_strdup (GREETER_BACKGROUND_DEFAULT); | ||
1371 | 2915 | |||
1372 | 2871 | g_debug ("Monitor configuration found: '%s'", name); | 2916 | g_debug ("Monitor configuration found: '%s'", name); |
1373 | 2872 | 2917 | ||
1375 | 2873 | GError *user_bg_error = NULL, *laptop_error = NULL; | 2918 | GError *user_bg_error = NULL, *laptop_error = NULL, *duration_error = NULL; |
1376 | 2874 | gboolean user_bg = g_key_file_get_boolean (config, *config_group, "user-background", &user_bg_error); | 2919 | gboolean user_bg = g_key_file_get_boolean (config, *config_group, "user-background", &user_bg_error); |
1377 | 2875 | gboolean laptop = g_key_file_get_boolean (config, *config_group, "laptop", &laptop_error); | 2920 | gboolean laptop = g_key_file_get_boolean (config, *config_group, "laptop", &laptop_error); |
1379 | 2876 | value = g_key_file_get_value (config, *config_group, "background", NULL); | 2921 | gchar *background = g_key_file_get_value (config, *config_group, "background", NULL); |
1380 | 2922 | gchar *tr_type = g_key_file_get_string (config, *config_group, "transition-type", NULL); | ||
1381 | 2923 | gint tr_duration = g_key_file_get_integer (config, *config_group, "transition-duration", &duration_error); | ||
1382 | 2877 | 2924 | ||
1384 | 2878 | greeter_background_set_monitor_config (greeter_background, name, value, | 2925 | greeter_background_set_monitor_config (greeter_background, name, background, |
1385 | 2879 | user_bg, user_bg_error == NULL, | 2926 | user_bg, user_bg_error == NULL, |
1387 | 2880 | laptop, laptop_error == NULL); | 2927 | laptop, laptop_error == NULL, |
1388 | 2928 | duration_error == NULL ? tr_duration : -1, | ||
1389 | 2929 | tr_type); | ||
1390 | 2881 | 2930 | ||
1392 | 2882 | g_free (value); | 2931 | g_free (tr_type); |
1393 | 2932 | g_free (background); | ||
1394 | 2933 | g_free (name_to_free); | ||
1395 | 2934 | g_clear_error (&user_bg_error); | ||
1396 | 2883 | g_clear_error (&laptop_error); | 2935 | g_clear_error (&laptop_error); |
1397 | 2884 | g_clear_error (&user_bg_error); | ||
1398 | 2885 | } | 2936 | } |
1399 | 2886 | g_strfreev (config_groups); | 2937 | g_strfreev (config_groups); |
1400 | 2887 | 2938 | ||
1401 | 2888 | 2939 | ||
1402 | === modified file 'src/lightdm-gtk-greeter.glade' | |||
1403 | --- src/lightdm-gtk-greeter.glade 2014-09-24 17:41:33 +0000 | |||
1404 | +++ src/lightdm-gtk-greeter.glade 2014-12-10 07:59:47 +0000 | |||
1405 | @@ -282,7 +282,6 @@ | |||
1406 | 282 | <property name="name">cancel_button</property> | 282 | <property name="name">cancel_button</property> |
1407 | 283 | <property name="visible">True</property> | 283 | <property name="visible">True</property> |
1408 | 284 | <property name="can_focus">True</property> | 284 | <property name="can_focus">True</property> |
1409 | 285 | <property name="receives_default">True</property> | ||
1410 | 286 | <signal name="clicked" handler="power_button_clicked_cb" swapped="no"/> | 285 | <signal name="clicked" handler="power_button_clicked_cb" swapped="no"/> |
1411 | 287 | </object> | 286 | </object> |
1412 | 288 | <packing> | 287 | <packing> |
1413 | @@ -297,7 +296,6 @@ | |||
1414 | 297 | <property name="name">power_ok_button</property> | 296 | <property name="name">power_ok_button</property> |
1415 | 298 | <property name="visible">True</property> | 297 | <property name="visible">True</property> |
1416 | 299 | <property name="can_focus">True</property> | 298 | <property name="can_focus">True</property> |
1417 | 300 | <property name="receives_default">True</property> | ||
1418 | 301 | <signal name="clicked" handler="power_button_clicked_cb" swapped="no"/> | 299 | <signal name="clicked" handler="power_button_clicked_cb" swapped="no"/> |
1419 | 302 | </object> | 300 | </object> |
1420 | 303 | <packing> | 301 | <packing> |
1421 | @@ -432,7 +430,6 @@ | |||
1422 | 432 | <object class="GtkEntry" id="username_entry"> | 430 | <object class="GtkEntry" id="username_entry"> |
1423 | 433 | <property name="name">prompt_entry</property> | 431 | <property name="name">prompt_entry</property> |
1424 | 434 | <property name="can_focus">True</property> | 432 | <property name="can_focus">True</property> |
1425 | 435 | <property name="no_show_all">True</property> | ||
1426 | 436 | <property name="hexpand">True</property> | 433 | <property name="hexpand">True</property> |
1427 | 437 | <property name="invisible_char">•</property> | 434 | <property name="invisible_char">•</property> |
1428 | 438 | <property name="placeholder_text" translatable="yes">Enter your username</property> | 435 | <property name="placeholder_text" translatable="yes">Enter your username</property> |
1429 | @@ -480,7 +477,6 @@ | |||
1430 | 480 | <child> | 477 | <child> |
1431 | 481 | <object class="GtkInfoBar" id="greeter_infobar"> | 478 | <object class="GtkInfoBar" id="greeter_infobar"> |
1432 | 482 | <property name="name">greeter_infobar</property> | 479 | <property name="name">greeter_infobar</property> |
1433 | 483 | <property name="app_paintable">True</property> | ||
1434 | 484 | <property name="can_focus">False</property> | 480 | <property name="can_focus">False</property> |
1435 | 485 | <child internal-child="action_area"> | 481 | <child internal-child="action_area"> |
1436 | 486 | <object class="GtkButtonBox" id="infobar-action_area"> | 482 | <object class="GtkButtonBox" id="infobar-action_area"> |
1437 | @@ -545,7 +541,6 @@ | |||
1438 | 545 | <property name="name">cancel_button</property> | 541 | <property name="name">cancel_button</property> |
1439 | 546 | <property name="visible">True</property> | 542 | <property name="visible">True</property> |
1440 | 547 | <property name="can_focus">True</property> | 543 | <property name="can_focus">True</property> |
1441 | 548 | <property name="receives_default">True</property> | ||
1442 | 549 | <signal name="clicked" handler="cancel_cb" swapped="no"/> | 544 | <signal name="clicked" handler="cancel_cb" swapped="no"/> |
1443 | 550 | </object> | 545 | </object> |
1444 | 551 | <packing> | 546 | <packing> |
1445 | @@ -560,7 +555,6 @@ | |||
1446 | 560 | <property name="name">login_button</property> | 555 | <property name="name">login_button</property> |
1447 | 561 | <property name="visible">True</property> | 556 | <property name="visible">True</property> |
1448 | 562 | <property name="can_focus">True</property> | 557 | <property name="can_focus">True</property> |
1449 | 563 | <property name="receives_default">True</property> | ||
1450 | 564 | <signal name="clicked" handler="login_cb" swapped="no"/> | 558 | <signal name="clicked" handler="login_cb" swapped="no"/> |
1451 | 565 | </object> | 559 | </object> |
1452 | 566 | <packing> | 560 | <packing> |
There is one bug related to this branch: https:/ /bugs.launchpad .net/ubuntu/ +source/ lightdm- gtk-greeter/ +bug/1394639/ comments/ 8
I can't confirm it so I can't fix it. I'm not even sure that trunk version is not effected.