From 18fe612f7038ac3c23d59d08b6d68c61454bce98 Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Wed, 28 Oct 2015 12:57:50 -0500 Subject: [PATCH] fix compiler errors --- .gitignore | 2 ++ autogen.sh | 4 +--- configure.ac | 15 ++++++++++----- src/Makefile.am | 7 +++++-- src/lightdm-webkit2-greeter-ext.c | 21 +++++++++++++-------- src/lightdm-webkit2-greeter.c | 24 +++++++++++++----------- themes/Makefile.am | 5 ++++- 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index f7596b9..932956a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/ChangeLog +/AUTHORS ### ArchLinuxPackages template *.tar *.tar.* diff --git a/autogen.sh b/autogen.sh index f99b10d..8d38749 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,10 +5,8 @@ srcdir=`dirname $0` test -z "$srcdir" && srcdir=. PKG_NAME="lightdm-webkit2-greeter" -REQUIRED_AUTOMAKE_VERSION=1.7 -(test -f $srcdir/configure.ac \ - && test -d $srcdir/src) || { +(test -f $srcdir/configure.ac && test -d $srcdir/src) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level lightdm-webkit2-greeter directory" exit 1 diff --git a/configure.ac b/configure.ac index 0162db7..ba3e75f 100644 --- a/configure.ac +++ b/configure.ac @@ -3,6 +3,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(lightdm-webkit2-greeter, 0.2.3) AC_SUBST(THEME_DIR) AC_CONFIG_HEADER(config.h) +AC_PREREQ([2.59]) LT_INIT() @@ -17,7 +18,7 @@ dnl ########################################################################### dnl Dependencies dnl ########################################################################### -PKG_CHECK_MODULES(GREETER, [ +PKG_CHECK_MODULES([GREETER], [ liblightdm-gobject-1 gtk+-3.0 webkit2gtk-4.0 @@ -25,9 +26,14 @@ PKG_CHECK_MODULES(GREETER, [ x11 ]) -PKG_CHECK_MODULES(WEB_EXTENSION, [webkit2gtk-4.0 >= 2.8.0]) -AC_SUBST(WEB_EXTENSION_CFLAGS) -AC_SUBST(WEB_EXTENSION_LIBS) +dnl PKG_CHECK_MODULES(WEB_EXTENSION, [webkit2gtk-4.0 >= 2.8.0]) +dnl AC_SUBST(WEB_EXTENSION_CFLAGS) +dnl AC_SUBST(WEB_EXTENSION_LIBS) + +PKG_CHECK_MODULES([WEB_EXTENSION], [ + webkit2gtk-web-extension-4.0 >= 2.8.0]) +AC_SUBST([WEB_EXTENSION_CFLAGS]) +AC_SUBST([WEB_EXTENSION_LIBS]) dnl ########################################################################### dnl Configurable values @@ -83,7 +89,6 @@ data/Makefile src/Makefile po/Makefile.in themes/Makefile -themes/webkit/Makefile ]) dnl ########################################################################### diff --git a/src/Makefile.am b/src/Makefile.am index 3043303..a1daeaf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,6 +15,10 @@ liblightdm_webkit2_greeter_ext_la_LIBADD = \ $(WEB_EXTENSION_LIBS) \ $(GREETER_LIBS) +liblightdm_webkit2_greeter_ext_LDADD = \ + $(WEB_EXTENSION_LIBS) \ + $(GREETER_LIBS) + liblightdm_webkit2_greeter_ext_la_LDFLAGS = -module -avoid-version -no-undefined greeter_PROGRAMS = lightdm-webkit2-greeter @@ -23,8 +27,6 @@ greeterdir = $(bindir) lightdm_webkit2_greeter_SOURCES = \ lightdm-webkit2-greeter.c -myapp_CPPFLAGS = - lightdm_webkit2_greeter_CFLAGS = \ $(GREETER_CFLAGS) \ $(WARN_CFLAGS) \ @@ -35,6 +37,7 @@ lightdm_webkit2_greeter_CFLAGS = \ lightdm_webkit2_greeter_LDADD = \ $(GREETER_LIBS) \ + $(WEB_EXTENSION_LIBS) \ $(LIBX11_LIBS) DISTCLEANFILES = \ diff --git a/src/lightdm-webkit2-greeter-ext.c b/src/lightdm-webkit2-greeter-ext.c index 54af08e..c945e6e 100644 --- a/src/lightdm-webkit2-greeter-ext.c +++ b/src/lightdm-webkit2-greeter-ext.c @@ -35,7 +35,9 @@ #include #include -#include +#define WEBKIT_DOM_USE_UNSTABLE_API +#include +#include #include #include @@ -512,7 +514,7 @@ get_lock_hint_cb(JSContextRef context, JSValueRef *exception) { LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); - return JSValueMakeBoolean(lightdm_greeter_get_lock_hint(greeter)); + return JSValueMakeBoolean(context, lightdm_greeter_get_lock_hint(greeter)); } @@ -971,15 +973,15 @@ static const JSClassDefinition gettext_definition = { }; -static void +/*static void web_page_created_callback(WebKitWebExtension *extension, WebKitWebPage *web_page, gpointer user_data) { - /*@formatter:off*/ + g_print("Page %" G_GUINT64_FORMAT "created for %s\n", webkit_web_page_get_id(web_page), webkit_web_page_get_uri(web_page) ); - /*@formatter:on*/ -} + +}*/ static void @@ -991,7 +993,8 @@ window_object_cleared_callback(WebKitScriptWorld *world, JSGlobalContextRef jsContext; JSObjectRef globalObject; WebKitDOMDocument *dom_document; - WebkitDOMDOMWindow *dom_window; + WebKitDOMDOMWindow *dom_window; + gchar *message = "LockHint"; page_id = webkit_web_page_get_id(web_page); @@ -1026,7 +1029,9 @@ window_object_cleared_callback(WebKitScriptWorld *world, dom_document = webkit_web_page_get_dom_document(web_page); dom_window = webkit_dom_document_get_default_view(dom_document); - webkit_dom_dom_window_webkit_message_handlers_post_message(dom_window, 'Greeter', 'lock_hint_cb'); + if (dom_window) { + webkit_dom_dom_window_webkit_message_handlers_post_message(dom_window, "GreeterBridge", message); + } } } diff --git a/src/lightdm-webkit2-greeter.c b/src/lightdm-webkit2-greeter.c index 9a20186..f2b1f4d 100644 --- a/src/lightdm-webkit2-greeter.c +++ b/src/lightdm-webkit2-greeter.c @@ -48,6 +48,10 @@ static GtkWidget *window; static WebKitSettings *webkit_settings; static GdkDisplay *default_display; +/* Screensaver values */ +static int timeout, interval, prefer_blanking, allow_exposures; +static gint config_timeout; + static GdkFilterReturn wm_window_filter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) { @@ -116,13 +120,13 @@ context_menu_cb(WebKitWebView *view, static void -lock_hint_cb(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. Display *display = gdk_x11_display_get_xdisplay(default_display); XGetScreenSaver(display, &timeout, &interval, &prefer_blanking, &allow_exposures); XForceScreenSaver(display, ScreenSaverActive); XSetScreenSaver(display, - config_get_int(NULL, CONFIG_KEY_SCREENSAVER_TIMEOUT, 60), + config_timeout, 0, ScreenSaverActive, DefaultExposures); @@ -133,14 +137,11 @@ static void message_received_cb(WebKitUserContentManager *manager, WebKitJavascriptResult *message, gpointer user_data) { - char *message_str; - - message_str = get_js_result_as_string(message); /* TODO: * Abstract this by using JSON for exchanging messages so the handler can be used for more than one task/event. */ - lock_hint_cb(); + greeter_bridge_lock_hint_cb(); } @@ -188,18 +189,19 @@ main(int argc, char **argv) { keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, "/etc/lightdm/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 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); screen = gtk_window_get_screen(GTK_WINDOW(window)); root_window = gdk_get_default_root_window(); - display = gdk_display_get_default(); + default_display = gdk_display_get_default(); gtk_window_set_decorated(GTK_WINDOW(window), FALSE); gdk_screen_get_monitor_geometry(screen, gdk_screen_get_primary_monitor(screen), &geometry); gtk_window_set_default_size(GTK_WINDOW(window), geometry.width, geometry.height); gtk_window_move(GTK_WINDOW(window), geometry.x, geometry.y); - gdk_window_set_cursor(root_window, gdk_cursor_new_for_display(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 gdk_window_set_events(root_window, gdk_window_get_events(root_window) | GDK_SUBSTRUCTURE_MASK); @@ -211,15 +213,15 @@ main(int argc, char **argv) { // Register and connect handler for messages sent from our web extension manager = webkit_user_content_manager_new(); - webkit_user_content_manager_register_script_message_handler(manager, "Greeter"); - g_signal_connect(manager, "script-message-received::Greeter", G_CALLBACK(message_received_cb), NULL); + webkit_user_content_manager_register_script_message_handler(manager, "GreeterBridge"); + g_signal_connect(manager, "script-message-received::GreeterBridge", G_CALLBACK(message_received_cb), NULL); // Create the web_view web_view = webkit_web_view_new_with_user_content_manager(manager); // Set the web_view's settings. create_new_webkit_settings_object(); - webkit_web_view_set_settings(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. gdk_rgba_parse(&bg_color, "#000000"); diff --git a/themes/Makefile.am b/themes/Makefile.am index c956455..4b5c792 100644 --- a/themes/Makefile.am +++ b/themes/Makefile.am @@ -1,4 +1,7 @@ -SUBDIRS = webkit +EXTRA_DIST = antergos +dist-hook: + chmod -R u+w $(distdir)/antergos + rm -rf $(distdir)/antergos/.git DISTCLEANFILES = \ Makefile.in