Merge lp:~kaihengfeng/unity-greeter/16.04-sru-fix-1571640 into lp:unity-greeter/16.04

Proposed by Kai-Heng Feng
Status: Merged
Merged at revision: 1850
Proposed branch: lp:~kaihengfeng/unity-greeter/16.04-sru-fix-1571640
Merge into: lp:unity-greeter/16.04
Diff against target: 188 lines (+95/-44)
2 files modified
debian/changelog (+7/-0)
src/unity-greeter.vala (+88/-44)
To merge this branch: bzr merge lp:~kaihengfeng/unity-greeter/16.04-sru-fix-1571640
Reviewer Review Type Date Requested Status
Unity Greeter Development Team Pending
Review via email: mp+298105@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Does this require the u-s-d changes to be present? i.e. should we depend on that version of u-s-d?

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Yes, the changes in u-s-d are required.

Should I make an update for dependency?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Yes, please do.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-03-24 01:12:26 +0000
3+++ debian/changelog 2016-06-22 08:34:00 +0000
4@@ -1,3 +1,10 @@
5+unity-greeter (16.04.2-0ubuntu2) xenial; urgency=medium
6+
7+ * Wait for unity-settings-daemon xsettings plugin is ready to avoid HiDPI
8+ resolution changing (LP: #1571640)
9+
10+ -- Kai-Heng Feng <kai.heng.feng@canonical.com> Wed, 22 Jun 2016 15:56:16 +0800
11+
12 unity-greeter (16.04.2-0ubuntu1) xenial; urgency=medium
13
14 * New upstream release:
15
16=== modified file 'src/unity-greeter.vala'
17--- src/unity-greeter.vala 2016-03-16 06:42:17 +0000
18+++ src/unity-greeter.vala 2016-06-22 08:34:00 +0000
19@@ -47,16 +47,15 @@
20 private static Timer log_timer;
21
22 private DialogDBusInterface dbus_object;
23+ private SettingsDaemonDBusInterface settings_daemon_proxy;
24+ public signal void xsettings_ready ();
25+ public signal void greeter_ready ();
26
27 private UnityGreeter (bool test_mode_)
28 {
29 singleton = this;
30 test_mode = test_mode_;
31
32- /* Prepare to set the background */
33- debug ("Creating background surface");
34- background_surface = create_root_surface (Gdk.Screen.get_default ());
35-
36 greeter = new LightDM.Greeter ();
37 greeter.show_message.connect ((text, type) => { show_message (text, type); });
38 greeter.show_prompt.connect ((text, type) => { show_prompt (text, type); });
39@@ -98,44 +97,32 @@
40 warning ("Failed to load state from %s: %s\n", state_file, e.message);
41 }
42
43- main_window = new MainWindow ();
44-
45- Bus.own_name (BusType.SESSION, "com.canonical.UnityGreeter", BusNameOwnerFlags.NONE);
46-
47- dbus_object = new DialogDBusInterface ();
48- dbus_object.open_dialog.connect ((type) =>
49- {
50- ShutdownDialogType dialog_type;
51- switch (type)
52- {
53- default:
54- case 1:
55- dialog_type = ShutdownDialogType.LOGOUT;
56- break;
57- case 2:
58- dialog_type = ShutdownDialogType.RESTART;
59- break;
60- }
61- main_window.show_shutdown_dialog (dialog_type);
62- });
63- dbus_object.close_dialog.connect ((type) => { main_window.close_shutdown_dialog (); });
64- Bus.own_name (BusType.SESSION, "com.canonical.Unity", BusNameOwnerFlags.NONE,
65- (c) =>
66- {
67- try
68- {
69- c.register_object ("/org/gnome/SessionManager/EndSessionDialog", dbus_object);
70- }
71- catch (Error e)
72- {
73- warning ("Failed to register /org/gnome/SessionManager/EndSessionDialog: %s", e.message);
74- }
75- },
76- null,
77- () => debug ("Failed to acquire name com.canonical.Unity"));
78-
79- start_fake_wm ();
80- Gdk.threads_add_idle (ready_cb);
81+ /* Render things after xsettings is ready */
82+ xsettings_ready.connect ( xsettings_ready_cb );
83+
84+ GLib.Bus.watch_name (BusType.SESSION, "org.gnome.SettingsDaemon", BusNameWatcherFlags.NONE,
85+ (c, name, owner) =>
86+ {
87+ try {
88+ settings_daemon_proxy = GLib.Bus.get_proxy_sync (
89+ BusType.SESSION, "org.gnome.SettingsDaemon", "/org/gnome/SettingsDaemon");
90+ settings_daemon_proxy.plugin_activated.connect (
91+ (name) =>
92+ {
93+ if (name == "xsettings") {
94+ debug ("xsettings is ready");
95+ xsettings_ready ();
96+ }
97+ }
98+ );
99+ }
100+ catch (Error e)
101+ {
102+ debug ("Failed to get USD proxy, proceed anyway");
103+ xsettings_ready ();
104+ }
105+ },
106+ null);
107 }
108
109 public string? get_state (string key)
110@@ -456,6 +443,53 @@
111 stderr.printf ("[%+.2fs] %s %s\n", log_timer.elapsed (), prefix, message);
112 }
113
114+ private void xsettings_ready_cb ()
115+ {
116+ /* Prepare to set the background */
117+ debug ("Creating background surface");
118+ background_surface = create_root_surface (Gdk.Screen.get_default ());
119+
120+ main_window = new MainWindow ();
121+
122+ Bus.own_name (BusType.SESSION, "com.canonical.UnityGreeter", BusNameOwnerFlags.NONE);
123+
124+ dbus_object = new DialogDBusInterface ();
125+ dbus_object.open_dialog.connect ((type) =>
126+ {
127+ ShutdownDialogType dialog_type;
128+ switch (type)
129+ {
130+ default:
131+ case 1:
132+ dialog_type = ShutdownDialogType.LOGOUT;
133+ break;
134+ case 2:
135+ dialog_type = ShutdownDialogType.RESTART;
136+ break;
137+ }
138+ main_window.show_shutdown_dialog (dialog_type);
139+ });
140+ dbus_object.close_dialog.connect ((type) => { main_window.close_shutdown_dialog (); });
141+ Bus.own_name (BusType.SESSION, "com.canonical.Unity", BusNameOwnerFlags.NONE,
142+ (c) =>
143+ {
144+ try
145+ {
146+ c.register_object ("/org/gnome/SessionManager/EndSessionDialog", dbus_object);
147+ }
148+ catch (Error e)
149+ {
150+ warning ("Failed to register /org/gnome/SessionManager/EndSessionDialog: %s", e.message);
151+ }
152+ },
153+ null,
154+ () => debug ("Failed to acquire name com.canonical.Unity"));
155+
156+ start_fake_wm ();
157+ Gdk.threads_add_idle (ready_cb);
158+ greeter_ready ();
159+ }
160+
161 public static int main (string[] args)
162 {
163 /* Protect memory from being paged to disk, as we deal with passwords */
164@@ -570,8 +604,11 @@
165 debug ("Creating Unity Greeter");
166 var greeter = new UnityGreeter (do_test_mode);
167
168- debug ("Showing greeter");
169- greeter.show ();
170+ greeter.greeter_ready.connect (() => {
171+ debug ("Showing greeter");
172+ greeter.show ();
173+ });
174+
175
176 if (!do_test_mode)
177 {
178@@ -664,3 +701,10 @@
179 close_dialog ();
180 }
181 }
182+
183+[DBus (name="org.gnome.SettingsDaemon")]
184+private interface SettingsDaemonDBusInterface : Object
185+{
186+ public signal void plugin_activated (string name);
187+ public signal void plugin_deactivated (string name);
188+}

Subscribers

People subscribed via source and target branches