Browse Source

fix race condition with theme heartbeat. finalize 2.1.4 release. updated translations.

sisyphus
Dustin Falgout 9 years ago
parent
commit
c6991b7388
  1. 5
      NEWS
  2. 2
      configure.ac
  3. 19
      src/lightdm-webkit2-greeter.c
  4. 18
      themes/antergos/i18n/bg.json
  5. 24
      themes/antergos/i18n/sr.json
  6. 39
      themes/antergos/js/greeter.js

5
NEWS

@ -1,3 +1,8 @@
Overview of changes in lightdm-webkit2-greeter 2.1.4
* Implemented a theme heartbeat to allow the greeter to detect and respond to theme failures.
* Updated translations.
Overview of changes in lightdm-webkit2-greeter 2.1.3
* Implemented work-around in default theme for webkit2gtk localStorage bug.

2
configure.ac

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(lightdm-webkit2-greeter, 2.1.3)
AC_INIT(lightdm-webkit2-greeter, 2.1.4)
AC_SUBST(THEME_DIR)
AC_CONFIG_HEADER(config.h)
AC_PREREQ([2.59])

19
src/lightdm-webkit2-greeter.c

@ -60,7 +60,7 @@ static int timeout, interval, prefer_blanking, allow_exposures;
static gint config_timeout;
static gboolean debug_mode, heartbeat;
static gboolean debug_mode, heartbeat, heartbeat_exit;
static GdkFilterReturn
wm_window_filter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) {
@ -130,7 +130,7 @@ context_menu_cb(WebKitWebView *view,
static gboolean
check_theme_heartbeat_cb(void) {
if (! heartbeat) {
if (! heartbeat && ! heartbeat_exit) {
/* Theme heartbeat not received. We assume that an error has occured
* which broke script execution. We will fallback to the simple theme
* so the user won't be stuck with a broken login screen.
@ -161,10 +161,23 @@ theme_heartbeat_cb(void) {
/* Setup g_timeout callback for theme heartbeat check */
g_timeout_add_seconds(8, (GSourceFunc) check_theme_heartbeat_cb, NULL);
heartbeat = TRUE;
heartbeat_exit = FALSE;
}
}
/**
* Heartbeat exit callback.
*
* Before starting the user's session, themes should exit the heartbeat
* to prevent a race condition while the greeter is shutting down.
*/
static void
theme_heartbeat_exit_cb(void) {
heartbeat_exit = TRUE;
}
/**
* Lock Hint enabled handler.
*
@ -221,6 +234,8 @@ message_received_cb(WebKitUserContentManager *manager,
lock_hint_enabled_handler();
} else if (strcmp(message_str, "Heartbeat") == 0) {
theme_heartbeat_cb();
} else if (strcmp(message_str, "Heartbeat::Exit") == 0) {
theme_heartbeat_exit_cb();
}
g_free(message_str);

18
themes/antergos/i18n/bg.json

@ -1,14 +1,14 @@
{
"auth_failed": "Uh Oh! Неуспешна идентификация. Моля, опитайте отново.",
"background_options": "Опции Предистория",
"auth_failed": "Опа! Неуспешна идентификация. Моля, опитайте отново.",
"background_options": "Опции на фона",
"cancel": "Отказ",
"confirm_system_action": "Сигурен ли си?",
"debug_log": "Debug Log",
"greeting": "Добре дошла!",
"hibernate": "спя зимен сън",
"random": "произволен",
"debug_log": "Лог за отстраняване на грешки",
"greeting": "Добре дошли!",
"hibernate": "Хибернация",
"random": "Произволен",
"reset": "Нулиране",
"restart": "Рестарт",
"shutdown": "Изключвам",
"suspend": "Задържане"
"restart": "Рестартиране",
"shutdown": "Изключване",
"suspend": "Преустановяване"
}

24
themes/antergos/i18n/sr.json

@ -1,14 +1,14 @@
{
"auth_failed": "Uh Oh! Аутхентицатион фаилед. Molim vas, pokušajte ponovo.",
"background_options": "Бацкгроунд Опције",
"cancel": "отказати",
"confirm_system_action": "Da li si siguran?",
"debug_log": "дебуг се",
"greeting": "Dobrodošao!",
"hibernate": "хибернирати",
"random": "случајан",
"reset": "Ресет",
"restart": "Ponovo pokreni",
"shutdown": "Isključi",
"suspend": "суспендовати"
"auth_failed": "Ahhh! Autentifikacija nepoznata. Molim Vas, pokušajte ponovo.",
"background_options": "Opcije za pozadinu",
"cancel": "Odustani",
"confirm_system_action": "Da li ste sigurni?",
"debug_log": "Debug log datoteka",
"greeting": "Dobrodošli!",
"hibernate": "Hibernacija",
"random": "Slučajni odabir",
"reset": "Resetovanje",
"restart": "Ponovno pokretanje",
"shutdown": "Isključivanje",
"suspend": "Suspendovanje rada računara"
}

39
themes/antergos/js/greeter.js

@ -81,6 +81,13 @@ class AntergosThemeUtils {
}
/**
* Initialize greeter theme heartbeat. Themes start the heartbeat by sending a post message
* via JavaScript. Once started, the heartbeat will schedule a check to ensure that the
* theme has sent a subsequent heartbeat message. Once started, if a heartbeat message was not
* received by the time greeter's check runs it will assume that there has been an error
* in the web process and fallback to the simple theme.
*/
initialize_theme_heartbeat() {
var heartbeats = 0;
@ -95,6 +102,18 @@ class AntergosThemeUtils {
}
/**
* Exits the heartbeat.
*
* Before starting the user's session, themes should exit the heartbeat
* to prevent a race condition when the greeter is shutting down.
*/
stop_theme_heartbeat() {
window.webkit.messageHandlers.GreeterBridge.postMessage('Heartbeat::Exit');
clearInterval(this.heartbeat);
}
setup_cache_backend() {
// Do we have access to localStorage?
try {
@ -264,7 +283,6 @@ class AntergosThemeUtils {
/**
* This class handles the theme's background switcher.
*/
@ -466,25 +484,15 @@ class AntergosTheme {
* Initialize the theme.
*/
initialize() {
_util.log('initialize() starting.');
this.prepare_translations();
_util.log('initialize() 1.');
this.do_static_translations();
_util.log('initialize() 2.');
this.initialize_clock();
_util.log('initialize() 3.');
this.prepare_login_panel_header();
_util.log('initialize() 4.');
this.prepare_user_list();
_util.log('initialize() 5.');
this.prepare_session_list();
_util.log('initialize() 6.');
this.prepare_system_action_buttons();
_util.log('initialize() 7.');
this.register_callbacks();
_util.log('initialize() 8.');
this.background_manager.setup_background_thumbnails();
_util.log('initialize() finished.');
}
@ -769,6 +777,9 @@ class AntergosTheme {
if ( lightdm.is_authenticated ) {
// The user entered the correct password. Let's log them in.
// But first, we need to exit the theme heartbeat to prevent a race condition.
_util.stop_theme_heartbeat();
$( 'body' ).fadeOut( 1000, () => {
lightdm.login( lightdm.authentication_user, selected_session );
} );
@ -823,6 +834,8 @@ class AntergosTheme {
$modal.find( '.btn-primary' ).text( _util.translations[ action ] ).click( action, ( event ) => {
$( this ).off( 'click' );
// Stop theme heartbeat to prevent race condition.
_util.stop_theme_heartbeat();
lightdm[ event.data ]();
} );
$modal.find( '.btn-default' ).click( () => {
@ -883,6 +896,9 @@ class AntergosTheme {
}
/**
* Initialize the theme once the window has loaded.
*/
@ -890,4 +906,3 @@ $( window ).load( () => {
new AntergosThemeUtils();
new AntergosTheme();
} );

Loading…
Cancel
Save