Merge lp:~raof/unity-greeter/fix-login-corruption into lp:unity-greeter

Proposed by Chris Halse Rogers
Status: Merged
Merged at revision: 362
Proposed branch: lp:~raof/unity-greeter/fix-login-corruption
Merge into: lp:unity-greeter
Diff against target: 100 lines (+26/-24)
1 file modified
src/unity-greeter.vala (+26/-24)
To merge this branch: bzr merge lp:~raof/unity-greeter/fix-login-corruption
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Review via email: mp+98351@code.launchpad.net

Description of the change

Fix the corruption between unity-greeter and Unity loading (bug #931967)

This was caused by the root-window backing pixmap code being a smoking pile of
only-accidentally-works on Intel, and uses-uninitialised-VRAM on everything else.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/unity-greeter.vala'
--- src/unity-greeter.vala 2012-03-13 14:00:28 +0000
+++ src/unity-greeter.vala 2012-03-20 07:20:22 +0000
@@ -39,7 +39,7 @@
39 private File state_file;39 private File state_file;
40 private KeyFile state;40 private KeyFile state;
4141
42 private static Cairo.Surface background_surface;42 private static Cairo.XlibSurface background_surface;
4343
44 private SettingsDaemon settings_daemon;44 private SettingsDaemon settings_daemon;
4545
@@ -402,9 +402,9 @@
402 {402 {
403 /* Set the background */403 /* Set the background */
404 var c = new Cairo.Context (background_surface);404 var c = new Cairo.Context (background_surface);
405 user_list.background.draw (c);405 user_list.background.draw_full (c, Background.DrawFlags.NONE);
406 c = null;406 c = null;
407 refresh_background (Gdk.Screen.get_default ());407 refresh_background (Gdk.Screen.get_default (), background_surface);
408408
409 try409 try
410 {410 {
@@ -439,6 +439,12 @@
439 }439 }
440 else440 else
441 {441 {
442 /* Set the background */
443 var c = new Cairo.Context (background_surface);
444 user_list.background.draw_full (c, Background.DrawFlags.NONE);
445 c = null;
446 refresh_background (Gdk.Screen.get_default (), background_surface);
447
442 debug ("Successfully logged in! Quitting...");448 debug ("Successfully logged in! Quitting...");
443 Gtk.main_quit ();449 Gtk.main_quit ();
444 }450 }
@@ -694,19 +700,12 @@
694 root.add_filter ((Gdk.FilterFunc) focus_upon_map);700 root.add_filter ((Gdk.FilterFunc) focus_upon_map);
695 }701 }
696702
697 private static Cairo.Surface? create_root_surface (Gdk.Screen screen)703 private static Cairo.XlibSurface? create_root_surface (Gdk.Screen screen)
698 {704 {
699 var visual = screen.get_system_visual ();705 var visual = screen.get_system_visual ();
700706
701 /* Open a new connection so with Retain Permanent so the pixmap remains when the greeter quits */707 unowned X.Display display = Gdk.X11Display.get_xdisplay (screen.get_display ());
702 Gdk.flush ();708
703 var display = new X.Display (screen.get_display ().get_name ());
704 if (display == null)
705 {
706 warning ("Failed to create root pixmap");
707 return null;
708 }
709 display.set_close_down_mode (X.RetainPermanent);
710 var pixmap = X.CreatePixmap (display,709 var pixmap = X.CreatePixmap (display,
711 Gdk.X11Window.get_xid (screen.get_root_window ()),710 Gdk.X11Window.get_xid (screen.get_root_window ()),
712 screen.width (),711 screen.width (),
@@ -714,25 +713,28 @@
714 visual.get_depth ());713 visual.get_depth ());
715714
716 /* Convert into a Cairo surface */715 /* Convert into a Cairo surface */
717 unowned X.Display xdisplay = Gdk.X11Display.get_xdisplay (screen.get_display ());716 var surface = new Cairo.XlibSurface (display,
718 var surface = new Cairo.XlibSurface (xdisplay,
719 pixmap,717 pixmap,
720 Gdk.X11Visual.get_xvisual (visual),718 Gdk.X11Visual.get_xvisual (visual),
721 screen.width (), screen.height ());719 screen.width (), screen.height ());
722720
721 return surface;
722 }
723
724 private void refresh_background (Gdk.Screen screen, Cairo.XlibSurface surface)
725 {
726 Gdk.flush ();
727
728 unowned X.Display display = Gdk.X11Display.get_xdisplay (screen.get_display ());
729
730 /* Ensure Cairo has actually finished its drawing */
731 surface.flush ();
723 /* Use this pixmap for the background */732 /* Use this pixmap for the background */
724 X.SetWindowBackgroundPixmap (xdisplay,733 X.SetWindowBackgroundPixmap (display,
725 Gdk.X11Window.get_xid (screen.get_root_window ()),734 Gdk.X11Window.get_xid (screen.get_root_window ()),
726 surface.get_drawable ());735 surface.get_drawable ());
727736
728737 X.ClearWindow (display, Gdk.X11Window.get_xid (screen.get_root_window ()));
729 return surface;
730 }
731
732 private void refresh_background (Gdk.Screen screen)
733 {
734 Gdk.flush ();
735 X.ClearWindow (Gdk.X11Display.get_xdisplay (screen.get_display ()), Gdk.X11Window.get_xid (screen.get_root_window ()));
736 }738 }
737739
738 private static void log_cb (string? log_domain, LogLevelFlags log_level, string message)740 private static void log_cb (string? log_domain, LogLevelFlags log_level, string message)

Subscribers

People subscribed via source and target branches