Browse Source

code formatting cleanup. bump version to 2.0.0. update NEWS file. update theme submodule ref.

sisyphus
Dustin Falgout 9 years ago
parent
commit
75d70de9c8
  1. 19
      NEWS
  2. 2
      configure.ac
  3. 11
      man/lightdm-webkit2-greeter.1
  4. 37
      src/lightdm-webkit2-greeter-ext.c
  5. 76
      src/lightdm-webkit2-greeter.c
  6. 2
      themes/antergos

19
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. * Completed API including the guest and auto-login functions.
* API is now completely in-line with LightDM API. * API is now completely in-line with LightDM API.
* Several functional code improvements. * 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. - Theme's script was completely rewritten in ES6.
- Use babel to compile ES6->ES5 until webkit catches up. - 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. * Add support for getting the lock_hint from lightdm.
* Default webkit theme is now antergos. * Default webkit theme is now antergos.
* Code formatting cleanup * 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. * Handle tasks that a WM would normally handle.
* Code clean-up * 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 * Add missing lightdm.set_language function
* Fix compile warnings * 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 * Port from webkitgtk -> webkit2gtk
* Use GTK+ 3.0 * Use GTK+ 3.0

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, 0.3.0) AC_INIT(lightdm-webkit2-greeter, 2.0.0)
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])

11
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 .nh
.ad l .ad l
.SH "NAME" .SH "NAME"
lightdm-webkit2-greeter \- LightDM greeter that uses webkit2 for theming via HTML/JavaScript\&. lightdm-webkit2-greeter
.SH "SYNOPSIS" .SH "SYNOPSIS"
.HP \w'\fBlightdm-webkit2-greeter\fR\ 'u .PP
\fBlightdm-webkit2-greeter\fR LightDM greeter that uses webkit2 for theming via HTML/JavaScript\&.
.PP
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
lightdm-webkit2-greeter is a LightDM greeter that uses webkit2 for theming\&. Themes can be written 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 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 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 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 .PP
The following functions \fBmust\fR be provided by the greeter theme and callable on the global "window" object\&. The following functions \fBmust\fR be provided by the greeter theme and callable on the global "window" object\&.
.PP .PP

37
src/lightdm-webkit2-greeter-ext.c

@ -3,7 +3,7 @@
* *
* Copyright © 2014-2016 Antergos Developers <dev@antergos.com> * Copyright © 2014-2016 Antergos Developers <dev@antergos.com>
* *
* Contributed Code: * Includes Code Contributed By:
* Copyright © 2016 Scott Balneaves <sbalneav@ltsp.org> * Copyright © 2016 Scott Balneaves <sbalneav@ltsp.org>
* *
* Based on code from lightdm-webkit-greeter: * Based on code from lightdm-webkit-greeter:
@ -29,7 +29,6 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with lightdm-webkit2-greeter; If not, see <http://www.gnu.org/licenses/>. * along with lightdm-webkit2-greeter; If not, see <http://www.gnu.org/licenses/>.
*
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -47,11 +46,11 @@ G_MODULE_EXPORT void webkit_web_extension_initialize(WebKitWebExtension *extensi
guint64 page_id = -1; guint64 page_id = -1;
#define USER ((LightDMUser *) JSObjectGetPrivate (thisObject)) #define USER ((LightDMUser *) JSObjectGetPrivate (thisObject))
#define LANGUAGE ((LightDMLanguage *)JSObjectGetPrivate (thisObject)) #define LAYOUT ((LightDMLayout *) JSObjectGetPrivate (thisObject))
#define LAYOUT ((LightDMLayout *) JSObjectGetPrivate (thisObject)) #define SESSION ((LightDMSession *) JSObjectGetPrivate (thisObject))
#define SESSION ((LightDMSession *) JSObjectGetPrivate (thisObject)) #define GREETER ((LightDMGreeter *) JSObjectGetPrivate (thisObject))
#define GREETER ((LightDMGreeter *) JSObjectGetPrivate (thisObject)) #define LANGUAGE ((LightDMLanguage *) JSObjectGetPrivate (thisObject))
static JSClassRef static JSClassRef
lightdm_greeter_class, lightdm_greeter_class,
@ -448,7 +447,8 @@ get_language_cb(JSContextRef context,
JSObjectRef thisObject, JSObjectRef thisObject,
JSStringRef propertyName, JSStringRef propertyName,
JSValueRef *exception) { 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, kJSPropertyAttributeNone,
NULL); 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)) { if (lightdm_greeter_get_lock_hint(greeter)) {
dom_document = webkit_web_page_get_dom_document(web_page); dom_document = webkit_web_page_get_dom_document(web_page);
dom_window = webkit_dom_document_get_default_view(dom_document); dom_window = webkit_dom_document_get_default_view(dom_document);
if (dom_window) { 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) { webkit_web_extension_initialize(WebKitWebExtension *extension) {
LightDMGreeter *greeter = lightdm_greeter_new(); 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),
g_signal_connect(G_OBJECT(greeter), "show-prompt", G_CALLBACK(show_prompt_cb), extension); "authentication-complete",
g_signal_connect(G_OBJECT(greeter), "show-message", G_CALLBACK(show_message_cb), extension); G_CALLBACK(authentication_complete_cb),
g_signal_connect(G_OBJECT(greeter), "autologin-timer-expired", G_CALLBACK(autologin_timer_expired_cb), extension); 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(), g_signal_connect(webkit_script_world_get_default(),
"window-object-cleared", "window-object-cleared",
G_CALLBACK(window_object_cleared_callback), G_CALLBACK(window_object_cleared_callback),
greeter); 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); lightdm_greeter_connect_sync(greeter, NULL);
} }

76
src/lightdm-webkit2-greeter.c

@ -3,6 +3,9 @@
* *
* Copyright © 2014-2016 Antergos Developers <dev@antergos.com> * Copyright © 2014-2016 Antergos Developers <dev@antergos.com>
* *
* Includes Code Contributed By:
* Copyright © 2016 Scott Balneaves <sbalneav@ltsp.org>
*
* Based on code from lightdm-webkit-greeter: * Based on code from lightdm-webkit-greeter:
* Copyright © 2010-2015 Robert Ancell <robert.ancell@canonical.com> * Copyright © 2010-2015 Robert Ancell <robert.ancell@canonical.com>
* *
@ -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 static void
greeter_bridge_lock_hint_cb(void) { lock_hint_enabled_handler(void) {
// Make the greeter behave a bit more like a screensaver if used as [un]lock-screen by blanking the screen.
Display *display = gdk_x11_display_get_xdisplay(default_display); Display *display = gdk_x11_display_get_xdisplay(default_display);
XGetScreenSaver(display, &timeout, &interval, &prefer_blanking, &allow_exposures); XGetScreenSaver(display, &timeout, &interval, &prefer_blanking, &allow_exposures);
XForceScreenSaver(display, ScreenSaverActive); XForceScreenSaver(display, ScreenSaverActive);
XSetScreenSaver(display, XSetScreenSaver(display, config_timeout, 0, ScreenSaverActive, DefaultExposures);
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 static void
message_received_cb(WebKitUserContentManager *manager, message_received_cb(WebKitUserContentManager *manager,
WebKitJavascriptResult *message, WebKitJavascriptResult *message,
@ -146,7 +159,7 @@ message_received_cb(WebKitUserContentManager *manager,
* Abstract this by using JSON for exchanging messages so the handler can * Abstract this by using JSON for exchanging messages so the handler can
* be used for more than one task/event. * 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); gtk_init(&argc, &argv);
// Apply greeter settings from conf file /* Apply greeter settings from config file */
keyfile = g_key_file_new(); 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); theme = g_key_file_get_string(keyfile, "greeter", "webkit-theme", NULL);
config_timeout = g_key_file_get_integer(keyfile, "greeter", "screensaver-timeout", 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); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
screen = gtk_window_get_screen(GTK_WINDOW(window)); screen = gtk_window_get_screen(GTK_WINDOW(window));
root_window = gdk_get_default_root_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); 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)); 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_set_events(root_window, gdk_window_get_events(root_window) | GDK_SUBSTRUCTURE_MASK);
gdk_window_add_filter(root_window, wm_window_filter, NULL); 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(); css_provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(css_provider, gtk_css_provider_load_from_data(css_provider,
lightdm_webkit2_greeter_css_application, lightdm_webkit2_greeter_css_application,
@ -223,33 +242,44 @@ main(int argc, char **argv) {
GTK_STYLE_PROVIDER(css_provider), GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); 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(); 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(); manager = webkit_user_content_manager_new();
webkit_user_content_manager_register_script_message_handler(manager, "GreeterBridge"); 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); 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(); create_new_webkit_settings_object();
webkit_web_view_set_settings(WEBKIT_WEB_VIEW(web_view), webkit_settings); 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"); gdk_rgba_parse(&bg_color, "#000000");
webkit_web_view_set_background_color(WEBKIT_WEB_VIEW(web_view), gdk_rgba_copy(&bg_color)); 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); 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); 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)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view),
gtk_widget_show_all(window); g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme));
gtk_widget_show_all(window);
gtk_main(); gtk_main();

2
themes/antergos

@ -1 +1 @@
Subproject commit 2fadc5a849993d1331708b89e18629e013983581 Subproject commit facac68f8cb59ed96d7e7ef0f6f9e4b3aafe8ca3
Loading…
Cancel
Save