Merge lp:~kalgasnik/lightdm-gtk-greeter/background-fixes-r333 into lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/trunk

Proposed by Andrew P.
Status: Merged
Merged at revision: 334
Proposed branch: lp:~kalgasnik/lightdm-gtk-greeter/background-fixes-r333
Merge into: lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/trunk
Diff against target: 183 lines (+48/-54)
2 files modified
src/greeterbackground.c (+47/-54)
src/lightdm-gtk-greeter.glade (+1/-0)
To merge this branch: bzr merge lp:~kalgasnik/lightdm-gtk-greeter/background-fixes-r333
Reviewer Review Type Date Requested Status
Sean Davis Approve
Review via email: mp+263066@code.launchpad.net

Description of the change

1. Restoring user background after changing display setup.
2. Patch removes login box blinking on login.
3. Solid color instead of background for some themes - must be ok now.

To post a comment you must log in.
336. By Andrew P.

Missing property for #screen child (solid color background fix)

Revision history for this message
Sean Davis (bluesabre) wrote :

This looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/greeterbackground.c'
--- src/greeterbackground.c 2015-03-27 05:29:45 +0000
+++ src/greeterbackground.c 2015-06-29 15:11:32 +0000
@@ -165,6 +165,8 @@
165165
166 /* List of monitors <Monitor*> with user-background=true*/166 /* List of monitors <Monitor*> with user-background=true*/
167 GSList* customized_monitors;167 GSList* customized_monitors;
168 /* Initialized by set_custom_background() */
169 BackgroundConfig customized_background;
168170
169 /* List of monitors <Monitor*> with laptop=true */171 /* List of monitors <Monitor*> with laptop=true */
170 GSList* laptop_monitors;172 GSList* laptop_monitors;
@@ -339,25 +341,28 @@
339static void341static void
340greeter_background_init(GreeterBackground* self)342greeter_background_init(GreeterBackground* self)
341{343{
342 self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self, GREETER_BACKGROUND_TYPE, GreeterBackgroundPrivate);344 GreeterBackgroundPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(self, GREETER_BACKGROUND_TYPE, GreeterBackgroundPrivate);
343 self->priv->screen = NULL;345 self->priv = priv;
344 self->priv->screen_monitors_changed_handler_id = 0;346
345 self->priv->accel_groups = NULL;347 priv->screen = NULL;
346348 priv->screen_monitors_changed_handler_id = 0;
347 self->priv->configs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)monitor_config_free);349 priv->accel_groups = NULL;
348 self->priv->default_config = monitor_config_copy(&DEFAULT_MONITOR_CONFIG, NULL);350
349351 priv->configs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)monitor_config_free);
350 self->priv->monitors = NULL;352 priv->default_config = monitor_config_copy(&DEFAULT_MONITOR_CONFIG, NULL);
351 self->priv->monitors_size = 0;353
352 self->priv->monitors_map = NULL;354 priv->monitors = NULL;
353355 priv->monitors_size = 0;
354 self->priv->customized_monitors = NULL;356 priv->monitors_map = NULL;
355 self->priv->active_monitors_config = NULL;357
356 self->priv->active_monitor = NULL;358 priv->customized_monitors = NULL;
357359 priv->customized_background.type = BACKGROUND_TYPE_INVALID;
358 self->priv->laptop_monitors = NULL;360 priv->active_monitors_config = NULL;
359 self->priv->laptop_upower_proxy = NULL;361 priv->active_monitor = NULL;
360 self->priv->laptop_lid_closed = FALSE;362
363 priv->laptop_monitors = NULL;
364 priv->laptop_upower_proxy = NULL;
365 priv->laptop_lid_closed = FALSE;
361}366}
362367
363GreeterBackground*368GreeterBackground*
@@ -594,13 +599,24 @@
594 if(config->laptop)599 if(config->laptop)
595 priv->laptop_monitors = g_slist_prepend(priv->laptop_monitors, monitor);600 priv->laptop_monitors = g_slist_prepend(priv->laptop_monitors, monitor);
596601
602 if(config->transition.duration && config->transition.func)
603 monitor->transition.config = config->transition;
604
597 monitor->background_configured = background_new(&config->bg, monitor, images_cache);605 monitor->background_configured = background_new(&config->bg, monitor, images_cache);
598 if(!monitor->background_configured)606 if(!monitor->background_configured)
599 monitor->background_configured = background_new(&DEFAULT_MONITOR_CONFIG.bg, monitor, images_cache);607 monitor->background_configured = background_new(&DEFAULT_MONITOR_CONFIG.bg, monitor, images_cache);
600 monitor_set_background(monitor, monitor->background_configured);608
601609 Background* background = NULL;
602 if(config->transition.duration && config->transition.func)610 if(config->user_bg && priv->customized_background.type != BACKGROUND_TYPE_INVALID)
603 monitor->transition.config = config->transition;611 background = background_new(&priv->customized_background, monitor, images_cache);
612
613 if(background)
614 {
615 monitor_set_background(monitor, background);
616 background_unref(&background);
617 }
618 else
619 monitor_set_background(monitor, monitor->background_configured);
604620
605 if(monitor->name)621 if(monitor->name)
606 g_hash_table_insert(priv->monitors_map, g_strdup(monitor->name), monitor);622 g_hash_table_insert(priv->monitors_map, g_strdup(monitor->name), monitor);
@@ -949,14 +965,16 @@
949 g_return_if_fail(GREETER_IS_BACKGROUND(background));965 g_return_if_fail(GREETER_IS_BACKGROUND(background));
950966
951 GreeterBackgroundPrivate* priv = background->priv;967 GreeterBackgroundPrivate* priv = background->priv;
968
969 if(priv->customized_background.type != BACKGROUND_TYPE_INVALID)
970 background_config_finalize(&priv->customized_background);
971 background_config_initialize(&priv->customized_background, value);
972
952 if(!priv->customized_monitors)973 if(!priv->customized_monitors)
953 return;974 return;
954975
955 BackgroundConfig config;
956 background_config_initialize(&config, value);
957
958 GHashTable *images_cache = NULL;976 GHashTable *images_cache = NULL;
959 if(config.type == BACKGROUND_TYPE_IMAGE)977 if(priv->customized_background.type == BACKGROUND_TYPE_IMAGE)
960 images_cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref);978 images_cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref);
961979
962 GSList* iter;980 GSList* iter;
@@ -966,8 +984,8 @@
966984
967 /* Old background_custom (if used) will be unrefed in monitor_set_background() */985 /* Old background_custom (if used) will be unrefed in monitor_set_background() */
968 Background* bg = NULL;986 Background* bg = NULL;
969 if(config.type != BACKGROUND_TYPE_INVALID)987 if(priv->customized_background.type != BACKGROUND_TYPE_INVALID)
970 bg = background_new(&config, monitor, images_cache);988 bg = background_new(&priv->customized_background, monitor, images_cache);
971 if(bg)989 if(bg)
972 {990 {
973 monitor_set_background(monitor, bg);991 monitor_set_background(monitor, bg);
@@ -979,8 +997,6 @@
979997
980 if(images_cache)998 if(images_cache)
981 g_hash_table_unref(images_cache);999 g_hash_table_unref(images_cache);
982 if(config.type != BACKGROUND_TYPE_INVALID)
983 background_config_finalize(&config);
984}1000}
9851001
986void1002void
@@ -992,7 +1008,6 @@
992 cairo_surface_t* surface = create_root_surface(priv->screen);1008 cairo_surface_t* surface = create_root_surface(priv->screen);
993 cairo_t* cr = cairo_create(surface);1009 cairo_t* cr = cairo_create(surface);
994 gsize i;1010 gsize i;
995 gdouble child_opacity;
9961011
997 const GdkRGBA ROOT_COLOR = {1.0, 1.0, 1.0, 1.0};1012 const GdkRGBA ROOT_COLOR = {1.0, 1.0, 1.0, 1.0};
998 gdk_cairo_set_source_rgba(cr, &ROOT_COLOR);1013 gdk_cairo_set_source_rgba(cr, &ROOT_COLOR);
@@ -1003,32 +1018,10 @@
1003 const Monitor* monitor = &priv->monitors[i];1018 const Monitor* monitor = &priv->monitors[i];
1004 if(!monitor->background)1019 if(!monitor->background)
1005 continue;1020 continue;
1006
1007 #ifdef XROOT_DRAW_BACKGROUND_DIRECTLY
1008 /* Old method: can't draw default GtkWindow background */
1009 cairo_save(cr);1021 cairo_save(cr);
1010 cairo_translate(cr, monitor->geometry.x, monitor->geometry.y);1022 cairo_translate(cr, monitor->geometry.x, monitor->geometry.y);
1011 monitor_draw_background(monitor, monitor->background, cr);1023 monitor_draw_background(monitor, monitor->background, cr);
1012 cairo_restore(cr);1024 cairo_restore(cr);
1013 #else
1014 /* New - can draw anything, but looks tricky a bit */
1015 child_opacity = gtk_widget_get_opacity(priv->child);
1016 if(monitor == priv->active_monitor)
1017 {
1018 gtk_widget_set_opacity(priv->child, 0.0);
1019 gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(priv->child)), FALSE);
1020 }
1021
1022 gdk_cairo_set_source_window(cr, gtk_widget_get_window(GTK_WIDGET(monitor->window)),
1023 monitor->geometry.x, monitor->geometry.y);
1024 cairo_paint(cr);
1025
1026 if(monitor == priv->active_monitor)
1027 {
1028 gtk_widget_set_opacity(priv->child, child_opacity);
1029 gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(priv->child)), FALSE);
1030 }
1031 #endif
1032 }1025 }
1033 set_surface_as_root(priv->screen, surface);1026 set_surface_as_root(priv->screen, surface);
10341027
10351028
=== modified file 'src/lightdm-gtk-greeter.glade'
--- src/lightdm-gtk-greeter.glade 2015-02-25 08:25:32 +0000
+++ src/lightdm-gtk-greeter.glade 2015-06-29 15:11:32 +0000
@@ -331,6 +331,7 @@
331 <object class="GtkEventBox" id="screen_overlay_child">331 <object class="GtkEventBox" id="screen_overlay_child">
332 <property name="visible">True</property>332 <property name="visible">True</property>
333 <property name="can_focus">False</property>333 <property name="can_focus">False</property>
334 <property name="visible_window">False</property>
334 <child>335 <child>
335 <placeholder/>336 <placeholder/>
336 </child>337 </child>

Subscribers

People subscribed via source and target branches