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
1=== modified file 'src/unity-greeter.vala'
2--- src/unity-greeter.vala 2012-03-13 14:00:28 +0000
3+++ src/unity-greeter.vala 2012-03-20 07:20:22 +0000
4@@ -39,7 +39,7 @@
5 private File state_file;
6 private KeyFile state;
7
8- private static Cairo.Surface background_surface;
9+ private static Cairo.XlibSurface background_surface;
10
11 private SettingsDaemon settings_daemon;
12
13@@ -402,9 +402,9 @@
14 {
15 /* Set the background */
16 var c = new Cairo.Context (background_surface);
17- user_list.background.draw (c);
18+ user_list.background.draw_full (c, Background.DrawFlags.NONE);
19 c = null;
20- refresh_background (Gdk.Screen.get_default ());
21+ refresh_background (Gdk.Screen.get_default (), background_surface);
22
23 try
24 {
25@@ -439,6 +439,12 @@
26 }
27 else
28 {
29+ /* Set the background */
30+ var c = new Cairo.Context (background_surface);
31+ user_list.background.draw_full (c, Background.DrawFlags.NONE);
32+ c = null;
33+ refresh_background (Gdk.Screen.get_default (), background_surface);
34+
35 debug ("Successfully logged in! Quitting...");
36 Gtk.main_quit ();
37 }
38@@ -694,19 +700,12 @@
39 root.add_filter ((Gdk.FilterFunc) focus_upon_map);
40 }
41
42- private static Cairo.Surface? create_root_surface (Gdk.Screen screen)
43+ private static Cairo.XlibSurface? create_root_surface (Gdk.Screen screen)
44 {
45 var visual = screen.get_system_visual ();
46
47- /* Open a new connection so with Retain Permanent so the pixmap remains when the greeter quits */
48- Gdk.flush ();
49- var display = new X.Display (screen.get_display ().get_name ());
50- if (display == null)
51- {
52- warning ("Failed to create root pixmap");
53- return null;
54- }
55- display.set_close_down_mode (X.RetainPermanent);
56+ unowned X.Display display = Gdk.X11Display.get_xdisplay (screen.get_display ());
57+
58 var pixmap = X.CreatePixmap (display,
59 Gdk.X11Window.get_xid (screen.get_root_window ()),
60 screen.width (),
61@@ -714,25 +713,28 @@
62 visual.get_depth ());
63
64 /* Convert into a Cairo surface */
65- unowned X.Display xdisplay = Gdk.X11Display.get_xdisplay (screen.get_display ());
66- var surface = new Cairo.XlibSurface (xdisplay,
67+ var surface = new Cairo.XlibSurface (display,
68 pixmap,
69 Gdk.X11Visual.get_xvisual (visual),
70 screen.width (), screen.height ());
71
72+ return surface;
73+ }
74+
75+ private void refresh_background (Gdk.Screen screen, Cairo.XlibSurface surface)
76+ {
77+ Gdk.flush ();
78+
79+ unowned X.Display display = Gdk.X11Display.get_xdisplay (screen.get_display ());
80+
81+ /* Ensure Cairo has actually finished its drawing */
82+ surface.flush ();
83 /* Use this pixmap for the background */
84- X.SetWindowBackgroundPixmap (xdisplay,
85+ X.SetWindowBackgroundPixmap (display,
86 Gdk.X11Window.get_xid (screen.get_root_window ()),
87 surface.get_drawable ());
88
89-
90- return surface;
91- }
92-
93- private void refresh_background (Gdk.Screen screen)
94- {
95- Gdk.flush ();
96- X.ClearWindow (Gdk.X11Display.get_xdisplay (screen.get_display ()), Gdk.X11Window.get_xid (screen.get_root_window ()));
97+ X.ClearWindow (display, Gdk.X11Window.get_xid (screen.get_root_window ()));
98 }
99
100 private static void log_cb (string? log_domain, LogLevelFlags log_level, string message)

Subscribers

People subscribed via source and target branches