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 Overview of changes in lightdm-webkit2-greeter 2.1.3
* Implemented work-around in default theme for webkit2gtk localStorage bug. * 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. 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_SUBST(THEME_DIR)
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
AC_PREREQ([2.59]) 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 gint config_timeout;
static gboolean debug_mode, heartbeat; static gboolean debug_mode, heartbeat, heartbeat_exit;
static GdkFilterReturn static GdkFilterReturn
wm_window_filter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) { wm_window_filter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) {
@ -130,7 +130,7 @@ context_menu_cb(WebKitWebView *view,
static gboolean static gboolean
check_theme_heartbeat_cb(void) { check_theme_heartbeat_cb(void) {
if (! heartbeat) { if (! heartbeat && ! heartbeat_exit) {
/* Theme heartbeat not received. We assume that an error has occured /* Theme heartbeat not received. We assume that an error has occured
* which broke script execution. We will fallback to the simple theme * which broke script execution. We will fallback to the simple theme
* so the user won't be stuck with a broken login screen. * 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 */ /* Setup g_timeout callback for theme heartbeat check */
g_timeout_add_seconds(8, (GSourceFunc) check_theme_heartbeat_cb, NULL); g_timeout_add_seconds(8, (GSourceFunc) check_theme_heartbeat_cb, NULL);
heartbeat = TRUE; 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. * Lock Hint enabled handler.
* *
@ -221,6 +234,8 @@ message_received_cb(WebKitUserContentManager *manager,
lock_hint_enabled_handler(); lock_hint_enabled_handler();
} else if (strcmp(message_str, "Heartbeat") == 0) { } else if (strcmp(message_str, "Heartbeat") == 0) {
theme_heartbeat_cb(); theme_heartbeat_cb();
} else if (strcmp(message_str, "Heartbeat::Exit") == 0) {
theme_heartbeat_exit_cb();
} }
g_free(message_str); g_free(message_str);

18
themes/antergos/i18n/bg.json

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

24
themes/antergos/i18n/sr.json

@ -1,14 +1,14 @@
{ {
"auth_failed": "Uh Oh! Аутхентицатион фаилед. Molim vas, pokušajte ponovo.", "auth_failed": "Ahhh! Autentifikacija nepoznata. Molim Vas, pokušajte ponovo.",
"background_options": "Бацкгроунд Опције", "background_options": "Opcije za pozadinu",
"cancel": "отказати", "cancel": "Odustani",
"confirm_system_action": "Da li si siguran?", "confirm_system_action": "Da li ste sigurni?",
"debug_log": "дебуг се", "debug_log": "Debug log datoteka",
"greeting": "Dobrodošao!", "greeting": "Dobrodošli!",
"hibernate": "хибернирати", "hibernate": "Hibernacija",
"random": "случајан", "random": "Slučajni odabir",
"reset": "Ресет", "reset": "Resetovanje",
"restart": "Ponovo pokreni", "restart": "Ponovno pokretanje",
"shutdown": "Isključi", "shutdown": "Isključivanje",
"suspend": "суспендовати" "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() { initialize_theme_heartbeat() {
var heartbeats = 0; 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() { setup_cache_backend() {
// Do we have access to localStorage? // Do we have access to localStorage?
try { try {
@ -264,7 +283,6 @@ class AntergosThemeUtils {
/** /**
* This class handles the theme's background switcher. * This class handles the theme's background switcher.
*/ */
@ -466,25 +484,15 @@ class AntergosTheme {
* Initialize the theme. * Initialize the theme.
*/ */
initialize() { initialize() {
_util.log('initialize() starting.');
this.prepare_translations(); this.prepare_translations();
_util.log('initialize() 1.');
this.do_static_translations(); this.do_static_translations();
_util.log('initialize() 2.');
this.initialize_clock(); this.initialize_clock();
_util.log('initialize() 3.');
this.prepare_login_panel_header(); this.prepare_login_panel_header();
_util.log('initialize() 4.');
this.prepare_user_list(); this.prepare_user_list();
_util.log('initialize() 5.');
this.prepare_session_list(); this.prepare_session_list();
_util.log('initialize() 6.');
this.prepare_system_action_buttons(); this.prepare_system_action_buttons();
_util.log('initialize() 7.');
this.register_callbacks(); this.register_callbacks();
_util.log('initialize() 8.');
this.background_manager.setup_background_thumbnails(); this.background_manager.setup_background_thumbnails();
_util.log('initialize() finished.');
} }
@ -769,6 +777,9 @@ class AntergosTheme {
if ( lightdm.is_authenticated ) { if ( lightdm.is_authenticated ) {
// The user entered the correct password. Let's log them in. // 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, () => { $( 'body' ).fadeOut( 1000, () => {
lightdm.login( lightdm.authentication_user, selected_session ); lightdm.login( lightdm.authentication_user, selected_session );
} ); } );
@ -823,6 +834,8 @@ class AntergosTheme {
$modal.find( '.btn-primary' ).text( _util.translations[ action ] ).click( action, ( event ) => { $modal.find( '.btn-primary' ).text( _util.translations[ action ] ).click( action, ( event ) => {
$( this ).off( 'click' ); $( this ).off( 'click' );
// Stop theme heartbeat to prevent race condition.
_util.stop_theme_heartbeat();
lightdm[ event.data ](); lightdm[ event.data ]();
} ); } );
$modal.find( '.btn-default' ).click( () => { $modal.find( '.btn-default' ).click( () => {
@ -883,6 +896,9 @@ class AntergosTheme {
} }
/** /**
* Initialize the theme once the window has loaded. * Initialize the theme once the window has loaded.
*/ */
@ -890,4 +906,3 @@ $( window ).load( () => {
new AntergosThemeUtils(); new AntergosThemeUtils();
new AntergosTheme(); new AntergosTheme();
} ); } );

Loading…
Cancel
Save