Browse Source

still fighting to get the webkit extension to work again

sisyphus
Dustin Falgout 8 years ago
parent
commit
45459acd0d
  1. 4
      meson.build
  2. 12
      src/greeter.c
  3. 7
      src/meson.build
  4. 8
      src/webkit2-extension.c

4
meson.build

@ -29,8 +29,8 @@ webkit2_webext = dependency('webkit2gtk-web-extension-4.0', version: '>=2.10.7')
x11 = dependency('x11')
deps = [dbus_glib, gtk3, libldm_gobject, webkit2, x11]
webext_deps = deps + [webkit2_webext]
greeter_deps = [dbus_glib, gtk3, webkit2, x11]
webext_deps = [webkit2_webext, libldm_gobject]
# =================================== #

12
src/greeter.c

@ -44,8 +44,6 @@
#include <glib/gi18n.h>
#include <sys/mman.h>
#include <lightdm.h>
#include <config.h>
#include "gresource/greeter-resources.h"
@ -178,7 +176,7 @@ theme_heartbeat_script_loaded_cb(GObject *object,
GAsyncResult *result,
gpointer user_data) {
g_message("UI PROCESS - theme heartbeat loaded fired!");
printf("UI PROCESS - theme heartbeat loaded fired!");
WebKitJavascriptResult *js_result;
JSValueRef value;
JSGlobalContextRef context;
@ -224,7 +222,7 @@ lock_hint_enabled_handler(void) {
static void
load_theme_heartbeat_script(void) {
g_message("UI PROCESS - load theme heartbeat fired!");
printf("UI PROCESS - load theme heartbeat fired!");
webkit_web_view_run_javascript_from_gresource(
WEBKIT_WEB_VIEW(web_view),
"/com/antergos/lightdm-webkit2-greeter/js/heartbeat.js",
@ -238,7 +236,7 @@ load_theme_heartbeat_script(void) {
static void
page_loaded_handler(void) {
g_message("UI PROCESS - page loaded handler fired!");
printf("UI PROCESS - page loaded handler fired!");
load_theme_heartbeat_script();
}
@ -262,7 +260,7 @@ message_received_cb(WebKitUserContentManager *manager,
JSValueRef message_val;
JSStringRef js_str_val;
gsize message_str_length;
g_message("UI PROCESS - message received fired!");
printf("UI PROCESS - message received fired!");
context = webkit_javascript_result_get_global_context(message);
message_val = webkit_javascript_result_get_value(message);
@ -291,7 +289,7 @@ message_received_cb(WebKitUserContentManager *manager,
} else if (strcmp(message_str, "Heartbeat::Exit") == 0) {
theme_heartbeat_exit_handler();
} else {
g_message("UI PROCESS - message received no match!");
printf("UI PROCESS - message received no match!");
}
g_free(message_str);

7
src/meson.build

@ -7,13 +7,12 @@ extdir = '@0@/@1@'.format(get_option('libdir'), 'lightdm-webkit2-greeter')
# ------->>> Webkit2 Extension <<<------- #
# ======================================= #
webext_sources = ['gresource/greeter-resources.c', 'webkit2-extension.c']
webext_sources = ['webkit2-extension.c']
webext = shared_library(
webext = library(
'lightdm-webkit2-greeter-webext',
webext_sources,
dependencies: webext_deps,
include_directories : gresource_sources,
install: true,
install_dir : extdir
)
@ -32,7 +31,7 @@ greeter_cargs = [
greeter = executable(
'lightdm-webkit2-greeter',
greeter_sources,
dependencies: deps,
dependencies: greeter_deps,
c_args: greeter_cargs,
include_directories : gresource_sources,
install: true

8
src/webkit2-extension.c

@ -32,12 +32,10 @@
*/
#include <stdlib.h>
#include <config.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <webkit2/webkit-web-extension.h>
#include <webkitdom/WebKitDOMCustom.h>
#include <JavaScriptCore/JavaScript.h>
@ -1451,7 +1449,7 @@ window_object_cleared_callback(WebKitScriptWorld *world,
WebKitFrame *frame,
LightDMGreeter *greeter) {
g_message("web extension window object cleared fired!");
printf("web extension window object cleared fired!");
JSGlobalContextRef jsContext;
WebKitDOMDOMWindow *dom_window;
@ -1518,7 +1516,7 @@ window_object_cleared_callback(WebKitScriptWorld *world,
dom_window = webkit_dom_document_get_default_view(dom_document);
if (dom_window) {
g_message("notifying UI process that page loaded!");
printf("notifying UI process that page loaded!");
/* Notify the UI process that the page is loaded */
webkit_dom_dom_window_webkit_message_handlers_post_message(
dom_window, "GreeterBridge", page_loaded_message
@ -1658,7 +1656,7 @@ autologin_timer_expired_cb(LightDMGreeter *greeter, WebKitWebExtension *extensio
G_MODULE_EXPORT void
webkit_web_extension_initialize(WebKitWebExtension *extension) {
g_message("web extension initialize fired!");
printf("web extension initialize fired!");
LightDMGreeter *greeter = lightdm_greeter_new();
g_signal_connect(G_OBJECT(greeter),

Loading…
Cancel
Save