Browse Source

😒

sisyphus
Dustin Falgout 10 years ago
parent
commit
37f38d24a9
  1. 43
      src/lightdm-webkit2-greeter.c

43
src/lightdm-webkit2-greeter.c

@ -28,6 +28,7 @@
static GtkWidget *web_view;
static GtkWidget *window;
static WebKitSettings *webkit_settings;
/*
static void
@ -42,17 +43,14 @@ timed_login_cb (LightDMGreeter *greeter, const gchar *username, WebKitWebView *v
static void
sigterm_cb (int signum)
{
sigterm_cb(int signum) {
exit(0);
}
static GdkFilterReturn
wm_window_filter (GdkXEvent *gxevent, GdkEvent *event, gpointer data)
{
wm_window_filter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) {
XEvent *xevent = (XEvent *) gxevent;
if (xevent->type == MapNotify)
{
if (xevent->type == MapNotify) {
GdkDisplay *display = gdk_x11_lookup_xdisplay(xevent->xmap.display);
GdkWindow *win = gdk_x11_window_foreign_new_for_display(display, xevent->xmap.window);
GdkWindowTypeHint win_type = gdk_window_get_type_hint(win);
@ -66,8 +64,7 @@ wm_window_filter (GdkXEvent *gxevent, GdkEvent *event, gpointer data)
*/
gdk_window_focus(win, GDK_CURRENT_TIME);
}
else if (xevent->type == UnmapNotify)
{
else if (xevent->type == UnmapNotify) {
Window xwin;
int revert_to = RevertToNone;
@ -89,12 +86,25 @@ main(int argc, char **argv) {
WebKitWebContext *context = webkit_web_context_get_default();
webkit_web_context_set_web_extensions_directory(context, LIGHTDM_WEBKIT2_GREETER_EXTENSIONS_DIR);
webkit_settings = webkit_settings_new_with_settings("enable-developer-extras", TRUE,
"enable-fullscreen", TRUE,
"enable-site-specific-quirks", TRUE,
"enable-dns-prefetching", TRUE,
"javascript-can-open-windows-automatically", TRUE,
"allow-file-access-from-file-urls", TRUE,
"enable-accelerated-2d-canvas", TRUE,
"enable-smooth-scrolling", TRUE,
"enable-webgl", TRUE,
"enable-write-console-messages-to-stdout", TRUE,
NULL);
signal(SIGTERM, sigterm_cb);
gtk_init(&argc, &argv);
gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new_for_display (gdk_display_get_default (), GDK_LEFT_PTR));
gdk_window_set_cursor(gdk_get_default_root_window(),
gdk_cursor_new_for_display(gdk_display_get_default(), GDK_LEFT_PTR));
/* settings */
@ -112,11 +122,20 @@ main(int argc, char **argv) {
gtk_window_set_default_size(GTK_WINDOW(window), geometry.width, geometry.height);
gtk_window_move(GTK_WINDOW(window), geometry.x, geometry.y);
web_view = webkit_web_view_new_with_settings(webkit_settings);
gdk_rgba_parse(&bg_color, "#000000");
web_view = webkit_web_view_new();
if (gdk_rgba_parse(&bg_color, "#000000")) {
if (bg_color.alpha < 1) {
GdkVisual *rgba_visual = gdk_screen_get_rgba_visual(screen);
if (rgba_visual) {
gtk_widget_set_visual(GTK_WIDGET(window), rgba_visual);
gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE);
}
}
webkit_web_view_set_background_color(WEBKIT_WEB_VIEW(web_view), gdk_rgba_copy(&bg_color));
};
gtk_container_add(GTK_CONTAINER(window), web_view);

Loading…
Cancel
Save