diff --git a/NEWS b/NEWS index f47c9fe..c14bb42 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ -Overview of changes in lightdm-webkit-greeter 0.3.0 - +Overview of changes in lightdm-webkit2-greeter 2.0.0 + + * Version scheme updated for both the webkit1 and webkit2 greeters as follows: + - MAJOR.MINOR.UNIQUE_FIXES + * MAJOR: Denotes a major release. Shared by legacy webkit1 and webkit2 greeters. + * MINOR: Denotes small changes/fixes. Also shared by webkit 1 and webkit2 greeters. + * UNIQUE_FIXES: Denotes fixes unique to either the legacy webkit1 or webkit2 greeters. + * Legacy Webkit1 greeter development is officially in maintenance-only mode (bug fixes only). + * Webkit2 greeter supersedes the Webkit1 greeter and is the focus of all new development. * Completed API including the guest and auto-login functions. * API is now completely in-line with LightDM API. * Several functional code improvements. @@ -11,23 +18,23 @@ Overview of changes in lightdm-webkit-greeter 0.3.0 - Theme's script was completely rewritten in ES6. - Use babel to compile ES6->ES5 until webkit catches up. -Overview of changes in lightdm-webkit-greeter 0.2.3 +Overview of changes in lightdm-webkit2-greeter 0.2.3 * Add support for getting the lock_hint from lightdm. * Default webkit theme is now antergos. * Code formatting cleanup -Overview of changes in lightdm-webkit-greeter 0.2.1 +Overview of changes in lightdm-webkit2-greeter 0.2.1 * Handle tasks that a WM would normally handle. * Code clean-up -Overview of changes in lightdm-webkit-greeter 0.2.0 +Overview of changes in lightdm-webkit2-greeter 0.2.0 * Add missing lightdm.set_language function * Fix compile warnings -Overview of changes in lightdm-webkit-greeter 0.1.3 +Overview of changes in lightdm-webkit2-greeter 0.1.3 * Port from webkitgtk -> webkit2gtk * Use GTK+ 3.0 diff --git a/configure.ac b/configure.ac index ed07c79..861e424 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(lightdm-webkit2-greeter, 0.3.0) +AC_INIT(lightdm-webkit2-greeter, 2.0.0) AC_SUBST(THEME_DIR) AC_CONFIG_HEADER(config.h) AC_PREREQ([2.59]) diff --git a/man/lightdm-webkit2-greeter.1 b/man/lightdm-webkit2-greeter.1 index 74794c8..d517f66 100644 --- a/man/lightdm-webkit2-greeter.1 +++ b/man/lightdm-webkit2-greeter.1 @@ -1,11 +1,12 @@ -.TH "lightdm-webkit2-greeter" "1" "2016.01.09" +.TH "lightdm-webkit2-greeter" "1" "2016.01.10" .nh .ad l .SH "NAME" -lightdm-webkit2-greeter \- LightDM greeter that uses webkit2 for theming via HTML/JavaScript\&. +lightdm-webkit2-greeter .SH "SYNOPSIS" -.HP \w'\fBlightdm-webkit2-greeter\fR\ 'u -\fBlightdm-webkit2-greeter\fR +.PP +LightDM greeter that uses webkit2 for theming via HTML/JavaScript\&. +.PP .SH "DESCRIPTION" .PP lightdm-webkit2-greeter is a LightDM greeter that uses webkit2 for theming\&. Themes can be written @@ -16,7 +17,7 @@ Please note that all properties and functions which are marked as "deprecated" a only available for backwards compatibility and will be removed in a future version of lightdm-webkit2-greeter\&. Theme authors should not use any deprecated properties or functions in new works and should update any existing works which make use of -deprecated properties and/or functions\&. +deprecated properties and/or functions to ensure continued proper functionality\&. .PP The following functions \fBmust\fR be provided by the greeter theme and callable on the global "window" object\&. .PP diff --git a/src/lightdm-webkit2-greeter-ext.c b/src/lightdm-webkit2-greeter-ext.c index f5bbd73..2ff2d16 100644 --- a/src/lightdm-webkit2-greeter-ext.c +++ b/src/lightdm-webkit2-greeter-ext.c @@ -3,7 +3,7 @@ * * Copyright © 2014-2016 Antergos Developers * - * Contributed Code: + * Includes Code Contributed By: * Copyright © 2016 Scott Balneaves * * Based on code from lightdm-webkit-greeter: @@ -29,7 +29,6 @@ * * You should have received a copy of the GNU General Public License * along with lightdm-webkit2-greeter; If not, see . - * */ #include @@ -47,11 +46,11 @@ G_MODULE_EXPORT void webkit_web_extension_initialize(WebKitWebExtension *extensi guint64 page_id = -1; -#define USER ((LightDMUser *) JSObjectGetPrivate (thisObject)) -#define LANGUAGE ((LightDMLanguage *)JSObjectGetPrivate (thisObject)) -#define LAYOUT ((LightDMLayout *) JSObjectGetPrivate (thisObject)) -#define SESSION ((LightDMSession *) JSObjectGetPrivate (thisObject)) -#define GREETER ((LightDMGreeter *) JSObjectGetPrivate (thisObject)) +#define USER ((LightDMUser *) JSObjectGetPrivate (thisObject)) +#define LAYOUT ((LightDMLayout *) JSObjectGetPrivate (thisObject)) +#define SESSION ((LightDMSession *) JSObjectGetPrivate (thisObject)) +#define GREETER ((LightDMGreeter *) JSObjectGetPrivate (thisObject)) +#define LANGUAGE ((LightDMLanguage *) JSObjectGetPrivate (thisObject)) static JSClassRef lightdm_greeter_class, @@ -448,7 +447,8 @@ get_language_cb(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef *exception) { - return string_or_null(context, lightdm_language_get_name((LightDMLanguage *) lightdm_get_language())); + return string_or_null(context, + lightdm_language_get_name((LightDMLanguage *) lightdm_get_language())); } @@ -1203,13 +1203,14 @@ window_object_cleared_callback(WebKitScriptWorld *world, kJSPropertyAttributeNone, NULL); - // If lightdm was started as a lock-screen, send signal to our UI process. + /* If the greeter was started as a lock-screen, send message to our UI process. */ if (lightdm_greeter_get_lock_hint(greeter)) { dom_document = webkit_web_page_get_dom_document(web_page); dom_window = webkit_dom_document_get_default_view(dom_document); if (dom_window) { - webkit_dom_dom_window_webkit_message_handlers_post_message(dom_window, "GreeterBridge", message); + webkit_dom_dom_window_webkit_message_handlers_post_message(dom_window, + "GreeterBridge", message); } } @@ -1342,15 +1343,23 @@ G_MODULE_EXPORT void webkit_web_extension_initialize(WebKitWebExtension *extension) { LightDMGreeter *greeter = lightdm_greeter_new(); - g_signal_connect(G_OBJECT(greeter), "authentication-complete", G_CALLBACK(authentication_complete_cb), extension); - g_signal_connect(G_OBJECT(greeter), "show-prompt", G_CALLBACK(show_prompt_cb), extension); - g_signal_connect(G_OBJECT(greeter), "show-message", G_CALLBACK(show_message_cb), extension); - g_signal_connect(G_OBJECT(greeter), "autologin-timer-expired", G_CALLBACK(autologin_timer_expired_cb), extension); + g_signal_connect(G_OBJECT(greeter), + "authentication-complete", + G_CALLBACK(authentication_complete_cb), + extension); + + g_signal_connect(G_OBJECT(greeter), + "autologin-timer-expired", + G_CALLBACK(autologin_timer_expired_cb), + extension); g_signal_connect(webkit_script_world_get_default(), "window-object-cleared", G_CALLBACK(window_object_cleared_callback), greeter); + g_signal_connect(G_OBJECT(greeter), "show-prompt", G_CALLBACK(show_prompt_cb), extension); + g_signal_connect(G_OBJECT(greeter), "show-message", G_CALLBACK(show_message_cb), extension); + lightdm_greeter_connect_sync(greeter, NULL); } diff --git a/src/lightdm-webkit2-greeter.c b/src/lightdm-webkit2-greeter.c index 2eba62a..63345a2 100644 --- a/src/lightdm-webkit2-greeter.c +++ b/src/lightdm-webkit2-greeter.c @@ -3,6 +3,9 @@ * * Copyright © 2014-2016 Antergos Developers * + * Includes Code Contributed By: + * Copyright © 2016 Scott Balneaves + * * Based on code from lightdm-webkit-greeter: * Copyright © 2010-2015 Robert Ancell * @@ -122,21 +125,31 @@ context_menu_cb(WebKitWebView *view, } +/** + * Lock Hint enabled handler. + * + * Makes the greeter behave a bit more like a screensaver if it was launched as + * a lock-screen by blanking the screen. + */ static void -greeter_bridge_lock_hint_cb(void) { - // Make the greeter behave a bit more like a screensaver if used as [un]lock-screen by blanking the screen. +lock_hint_enabled_handler(void) { Display *display = gdk_x11_display_get_xdisplay(default_display); XGetScreenSaver(display, &timeout, &interval, &prefer_blanking, &allow_exposures); XForceScreenSaver(display, ScreenSaverActive); - XSetScreenSaver(display, - config_timeout, - 0, - ScreenSaverActive, - DefaultExposures); + XSetScreenSaver(display, config_timeout, 0, ScreenSaverActive, DefaultExposures); } +/** + * Message received callback. + * + * Receives messages from our web extension process and calls appropriate handlers. + * + * @param: manager The WebKitUserContentManager instance that was created in #main. + * @param: message The message sent from web extension process. + * @param: user_data Data that is private to the current user. + */ static void message_received_cb(WebKitUserContentManager *manager, WebKitJavascriptResult *message, @@ -146,7 +159,7 @@ message_received_cb(WebKitUserContentManager *manager, * Abstract this by using JSON for exchanging messages so the handler can * be used for more than one task/event. */ - greeter_bridge_lock_hint_cb(); + lock_hint_enabled_handler(); } @@ -192,13 +205,17 @@ main(int argc, char **argv) { gtk_init(&argc, &argv); - // Apply greeter settings from conf file + /* Apply greeter settings from config file */ keyfile = g_key_file_new(); - g_key_file_load_from_file(keyfile, CONFIG_DIR "/lightdm-webkit2-greeter.conf", G_KEY_FILE_NONE, NULL); + + g_key_file_load_from_file(keyfile, + CONFIG_DIR "/lightdm-webkit2-greeter.conf", + G_KEY_FILE_NONE, NULL); + theme = g_key_file_get_string(keyfile, "greeter", "webkit-theme", NULL); config_timeout = g_key_file_get_integer(keyfile, "greeter", "screensaver-timeout", NULL); - // Setup the main window + /* Setup the main window */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); screen = gtk_window_get_screen(GTK_WINDOW(window)); root_window = gdk_get_default_root_window(); @@ -210,11 +227,13 @@ main(int argc, char **argv) { gtk_window_move(GTK_WINDOW(window), geometry.x, geometry.y); gdk_window_set_cursor(root_window, gdk_cursor_new_for_display(default_display, GDK_LEFT_PTR)); - // There is no window manager, so we need to implement some of its functionality + /* There is no window manager, so we need to implement some of its functionality */ gdk_window_set_events(root_window, gdk_window_get_events(root_window) | GDK_SUBSTRUCTURE_MASK); gdk_window_add_filter(root_window, wm_window_filter, NULL); - // Setup CSS provider + /* Setup CSS provider. We use CSS to set the window background to black instead + * of default white so the screen doesnt flash during startup. + */ css_provider = gtk_css_provider_new(); gtk_css_provider_load_from_data(css_provider, lightdm_webkit2_greeter_css_application, @@ -223,33 +242,44 @@ main(int argc, char **argv) { GTK_STYLE_PROVIDER(css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - // Register and connect handler for setting the web extensions directory so webkit can find our extension + /* Register and connect handler that will set the web extensions directory + * so webkit can find our extension. + */ context = webkit_web_context_get_default(); - g_signal_connect(context, "initialize-web-extensions", G_CALLBACK(initialize_web_extensions_cb), NULL); + g_signal_connect(context, + "initialize-web-extensions", + G_CALLBACK(initialize_web_extensions_cb), NULL); - // Register and connect handler for messages sent from our web extension + /* Register and connect handler of any messages we send from our web extension process. */ manager = webkit_user_content_manager_new(); webkit_user_content_manager_register_script_message_handler(manager, "GreeterBridge"); - g_signal_connect(manager, "script-message-received::GreeterBridge", G_CALLBACK(message_received_cb), NULL); + g_signal_connect(manager, + "script-message-received::GreeterBridge", + G_CALLBACK(message_received_cb), NULL); - // Create the web_view + /* Create the web_view */ web_view = webkit_web_view_new_with_user_content_manager(manager); - // Set the web_view's settings. + /* Set the web_view's settings. */ create_new_webkit_settings_object(); webkit_web_view_set_settings(WEBKIT_WEB_VIEW(web_view), webkit_settings); - // The default background is white which causes a flash effect when the greeter starts. Make it black instead. + /* The default background is white which causes a flash effect when the greeter starts. + * We make it black instead. This is for backwards compatibility with Gtk versions that + * don't use the new CSS provider. + */ gdk_rgba_parse(&bg_color, "#000000"); webkit_web_view_set_background_color(WEBKIT_WEB_VIEW(web_view), gdk_rgba_copy(&bg_color)); - // Disable the context (right-click) menu. + /* Disable the context (right-click) menu. */ g_signal_connect(web_view, "context-menu", G_CALLBACK(context_menu_cb), NULL); + /* There's no turning back now, let's go! */ gtk_container_add(GTK_CONTAINER(window), web_view); - webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme)); - gtk_widget_show_all(window); + webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), + g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme)); + gtk_widget_show_all(window); gtk_main(); diff --git a/themes/antergos b/themes/antergos index 2fadc5a..facac68 160000 --- a/themes/antergos +++ b/themes/antergos @@ -1 +1 @@ -Subproject commit 2fadc5a849993d1331708b89e18629e013983581 +Subproject commit facac68f8cb59ed96d7e7ef0f6f9e4b3aafe8ca3