Example #1
0
GtkWidget* get_container()
{
    static GtkWidget* container = NULL;
    if (container == NULL) {
        container = create_web_container (FALSE, TRUE);
    }
    return container;
}
Example #2
0
int main()
{
    gtk_init(NULL, NULL);
    GtkWidget* container = create_web_container(FALSE, TRUE);
    GtkWidget* webview = d_webview_new_with_uri("file:///home/liliqiang/dde/app/launcher/test/bg_test.html");

    gtk_container_add(GTK_CONTAINER(container), GTK_WIDGET(webview));
    gtk_widget_show_all(container);

    gtk_main();
    return 0;
}
Example #3
0
int main(int argc, char* argv[])
{
    init_i18n();
    gtk_init(&argc, &argv);
    GtkWidget* container = create_web_container(TRUE, TRUE);
    gtk_window_set_wmclass(GTK_WINDOW(container), "dde-launcher", "DDELauncher");

    set_default_theme("Deepin");
    set_desktop_env_name("GNOME");


    GtkWidget *webview = d_webview_new_with_uri(GET_HTML_PATH("dominant_color"));

    gtk_container_add(GTK_CONTAINER(container), GTK_WIDGET(webview));

    g_signal_connect (container , "destroy", G_CALLBACK (gtk_main_quit), NULL);
    g_signal_connect(webview, "draw", G_CALLBACK(clear_bg), NULL);

    monitor_resource_file("dominant_color", webview);

    gtk_widget_show_all(container);
    gtk_main();
    return 0;
}
Example #4
0
int main(int argc, char **argv)
{
    if (argc == 2 && 0 == g_strcmp0(argv[1], "-d")) {
        g_setenv("G_MESSAGES_DEBUG", "all", FALSE);
    }
    GOptionContext *context = g_option_context_new("- Deepin Installer");
    g_option_context_add_main_entries(context, entries, "INSTALLER");
    g_option_context_add_group (context, gtk_get_option_group (TRUE));
    if (!g_option_context_parse (context, &argc, &argv, NULL)) {
        g_warning ("context parse failed\n");
    }
    if (auto_conf_path != NULL &&
        !g_file_test(auto_conf_path, G_FILE_TEST_IS_REGULAR)) {
        g_warning("the configure is invalid: %s", auto_conf_path);
        exit(1);
    }
    g_option_context_free(context);

    redirect_log(log_path);

    gtk_init (&argc, &argv);

    setlocale(LC_MESSAGES, "");
    textdomain("INSTALLER");

    if (geteuid () != 0) {
        g_warning ("must run installer as root\n");
        exit (0);
    }

    if (installer_is_running ()) {
        g_warning ("another instance of installer is running\n");
        exit (0);
    }

    signal (SIGTERM, sigterm_cb);
    signal (SIGINT, sigterm_cb);
    signal (SIGQUIT, sigterm_cb);
    signal (SIGKILL, sigterm_cb);
    signal (SIGTSTP, sigterm_cb);

    installer_container = create_web_container (FALSE, TRUE);
    gtk_window_set_decorated (GTK_WINDOW (installer_container), FALSE);
    GtkWidget *webview = d_webview_new_with_uri (INSTALLER_HTML_PATH);
    g_signal_connect (webview, "draw", G_CALLBACK (erase_background), NULL);
    gtk_container_add (GTK_CONTAINER (installer_container),
                       GTK_WIDGET (webview));

    WebKitWebSettings *setting = webkit_web_view_get_settings(
        WEBKIT_WEB_VIEW(webview));
    g_object_set(G_OBJECT(setting),
                 "enable-default-context-menu", FALSE,
                 NULL);

    if (nowm) {
        fix_without_wm(webview);
    } else {
        g_signal_connect (installer_container, "button-press-event",
                          G_CALLBACK (move_window), NULL);
        gtk_window_set_position (GTK_WINDOW (installer_container),
                                 GTK_WIN_POS_CENTER);
    }
    gtk_window_set_default_size (GTK_WINDOW (installer_container),
                                 INSTALLER_WIN_WIDTH, INSTALLER_WIN_HEIGHT);
    gtk_window_set_resizable (GTK_WINDOW (installer_container), FALSE);
    GdkGeometry geometry;
    geometry.min_width = INSTALLER_WIN_WIDTH;
    geometry.max_width = INSTALLER_WIN_WIDTH;
    geometry.base_width = INSTALLER_WIN_WIDTH;
    geometry.min_height = INSTALLER_WIN_HEIGHT;
    geometry.max_height = INSTALLER_WIN_HEIGHT;
    geometry.base_height = INSTALLER_WIN_HEIGHT;
    gtk_window_set_geometry_hints (GTK_WINDOW (installer_container), webview,
                                   &geometry,
                                   GDK_HINT_MIN_SIZE |
                                   GDK_HINT_MAX_SIZE |
                                   GDK_HINT_BASE_SIZE);

    gtk_widget_show_all (installer_container);
/*#ifndef NDEBUG*/
    /*monitor_resource_file("installer", webview);*/
/*#endif*/
    gtk_main ();

    return 0;
}
int main(int argc, char **argv)
{
    GOptionContext *context = g_option_context_new ("- Deepin Installer");
    g_option_context_add_main_entries (context, entries, "INSTALLER");
    g_option_context_add_group (context, gtk_get_option_group (TRUE));
    if (!g_option_context_parse (context, &argc, &argv, NULL)) {
        g_warning ("context parse failed\n");
    }
    g_option_context_free (context);

    global_argv = argv;
    gtk_init (&argc, &argv);

    setlocale(LC_MESSAGES, "");
    textdomain("INSTALLER");

    if (geteuid () != 0) {
        g_warning ("must run installer as root\n");
        exit (0);
    }

    if (installer_is_running ()) {
        g_warning ("another instance of installer is running\n");
        exit (0);
    }

    signal (SIGTERM, sigterm_cb);
    signal (SIGINT, sigterm_cb);
    signal (SIGQUIT, sigterm_cb);
    signal (SIGKILL, sigterm_cb);
    signal (SIGTSTP, sigterm_cb);

    installer_container = create_web_container (FALSE, TRUE);
    g_signal_connect (installer_container, "button-press-event", G_CALLBACK (move_window), NULL);

    gtk_window_set_decorated (GTK_WINDOW (installer_container), FALSE);
    //gtk_window_set_skip_taskbar_hint (GTK_WINDOW (installer_container), TRUE);
    //gtk_window_set_skip_pager_hint (GTK_WINDOW (installer_container), TRUE);
    GtkWidget *webview = d_webview_new_with_uri (INSTALLER_HTML_PATH);
    g_signal_connect (webview, "draw", G_CALLBACK (expose_cb), NULL);

    gtk_container_add (GTK_CONTAINER (installer_container), GTK_WIDGET (webview));
    gtk_window_set_default_size (GTK_WINDOW (installer_container), INSTALLER_WIN_WIDTH, INSTALLER_WIN_HEIGHT);
    gtk_window_set_resizable (GTK_WINDOW (installer_container), FALSE);
    gtk_window_set_position (GTK_WINDOW (installer_container), GTK_WIN_POS_CENTER);

    GdkGeometry geometry;
    geometry.min_width = INSTALLER_WIN_WIDTH;
    geometry.max_width = INSTALLER_WIN_WIDTH;
    geometry.base_width = INSTALLER_WIN_WIDTH;
    geometry.min_height = INSTALLER_WIN_HEIGHT;
    geometry.max_height = INSTALLER_WIN_HEIGHT;
    geometry.base_height = INSTALLER_WIN_HEIGHT;
    gtk_window_set_geometry_hints (GTK_WINDOW (installer_container), webview, &geometry, GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE);

    gtk_widget_realize (installer_container);
    gtk_widget_show_all (installer_container);
    //monitor_resource_file ("installer", webview);
    gtk_main ();

    return 0;
}
Example #6
0
int main (int argc, char **argv)
{
    if (argc == 2 && 0 == g_strcmp0(argv[1], "-d"))
        g_setenv("G_MESSAGES_DEBUG", "all", FALSE);
    if (is_application_running(SHUTDOWN_ID_NAME)) {
        g_warning("another instance of application dosd is running...\n");
        return 0;
    }

    singleton(SHUTDOWN_ID_NAME);


    check_version();
    init_i18n ();

    gtk_init (&argc, &argv);
    input_argv = argv;
    gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new (GDK_LEFT_PTR));

    container = create_web_container (FALSE, TRUE);

    gtk_window_set_decorated (GTK_WINDOW (container), FALSE);
    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (container), TRUE);
    gtk_window_set_skip_pager_hint (GTK_WINDOW (container), TRUE);
    gtk_window_set_keep_above (GTK_WINDOW (container), TRUE);
    gtk_window_set_position (GTK_WINDOW (container), GTK_WIN_POS_CENTER_ALWAYS);
    gtk_window_resize (GTK_WINDOW (container), width,height);
    
   
    gtk_widget_set_events (GTK_WIDGET (container),
                           gtk_widget_get_events (GTK_WIDGET (container))
                           | GDK_POINTER_MOTION_MASK
                           | GDK_BUTTON_PRESS_MASK
                           | GDK_BUTTON_RELEASE_MASK
                           | GDK_KEY_PRESS_MASK
                           | GDK_KEY_RELEASE_MASK
                           | GDK_EXPOSURE_MASK
                           | GDK_VISIBILITY_NOTIFY_MASK
                           | GDK_ENTER_NOTIFY_MASK
                           | GDK_LEAVE_NOTIFY_MASK
                           );



    GtkWidget *webview = d_webview_new_with_uri (CHOICE_HTML_PATH);
    gtk_container_add (GTK_CONTAINER(container), GTK_WIDGET (webview));
    gtk_widget_realize (container);
    gtk_widget_realize (webview);
    
/*    style_context = gtk_widget_get_style_context(webview);*/
    /*gtk_style_context_add_class(style_context,GTK_STYLE_CLASS_OSD);*/
    /*gtk_style_context_add_class(style_context,GTK_STYLE_PROPERTY_BORDER_RADIUS);*/
    /*cairo_t *cr;*/
    /*cairo_surface_t *surface;*/
    /*surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);*/
    /*cr = cairo_create(surface);*/
    /*[>cairo_set_source_rgba (cr, 1, 0, 0, 0.80);<]*/
    /*[>cairo_fill (cr);<]*/
    /*gtk_render_background(style_context,cr,radius,radius,width,height);*/
    /*[>gtk_style_context_set_background(style_context,gdkwindow);<]*/
    /*gtk_style_context_restore(style_context);*/
    /*[>cairo_destory(cr);<]*/
    /*[>cairo_surface_write_to_png(surface,"gtkbackground.png");<]*/
    /*[>cairo_surface_destory(surface);<]*/
    
    
    GdkWindow* gdkwindow = gtk_widget_get_window (container);
    
    GdkRGBA rgba = { 0, 0, 0, 0.0 };
    gdk_window_set_background_rgba (gdkwindow, &rgba);
    gdk_window_set_opacity (gdkwindow, 0.7);
    gdk_window_set_keep_above (gdkwindow, TRUE);
    
    osd_set_focus(FALSE);
   
    /*gdk_window_show(gdkwindow);*/
    /*gtk_widget_show_all (container);*/

    gtk_main ();

    return 0;
}
Example #7
0
int main (int argc, char **argv)
{
    /* if (argc == 2 && 0 == g_strcmp0(argv[1], "-d")) */
    g_setenv("G_MESSAGES_DEBUG", "all", FALSE);
    if (is_application_running(SHUTDOWN_ID_NAME)) {
        g_warning("another instance of application shutdown is running...\n");
        return 0;
    }

    singleton(SHUTDOWN_ID_NAME);

    //remove  option -f
    parse_cmd_line (&argc, &argv);


    check_version();
    init_i18n ();
    gtk_init (&argc, &argv);


    gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new (GDK_LEFT_PTR));

    container = create_web_container (FALSE, TRUE);
    ensure_fullscreen (container);

    gtk_window_set_decorated (GTK_WINDOW (container), FALSE);
    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (container), TRUE);
    gtk_window_set_skip_pager_hint (GTK_WINDOW (container), TRUE);
    /*gtk_window_set_keep_above (GTK_WINDOW (container), TRUE);*/

    gtk_window_fullscreen (GTK_WINDOW (container));
    gtk_widget_set_events (GTK_WIDGET (container),
                           gtk_widget_get_events (GTK_WIDGET (container))
                           | GDK_POINTER_MOTION_MASK
                           | GDK_BUTTON_PRESS_MASK
                           | GDK_BUTTON_RELEASE_MASK
                           | GDK_KEY_PRESS_MASK
                           | GDK_KEY_RELEASE_MASK
                           | GDK_EXPOSURE_MASK
                           | GDK_VISIBILITY_NOTIFY_MASK
                           | GDK_ENTER_NOTIFY_MASK
                           | GDK_LEAVE_NOTIFY_MASK);

    webview = d_webview_new_with_uri (SHUTDOWN_HTML_PATH);
    gtk_container_add (GTK_CONTAINER(container), GTK_WIDGET (webview));
    /*g_signal_connect (container, "show", G_CALLBACK (show_cb), NULL);*/
    /*g_signal_connect (webview, "focus-out-event", G_CALLBACK( focus_out_cb), NULL);*/

    gtk_widget_realize (container);
    gtk_widget_realize (webview);

    GdkWindow* gdkwindow = gtk_widget_get_window (container);
    GdkRGBA rgba = { 0, 0, 0, 0.0 };
    gdk_window_set_background_rgba (gdkwindow, &rgba);
    gdk_window_set_skip_taskbar_hint (gdkwindow, TRUE);
    gdk_window_set_cursor (gdkwindow, gdk_cursor_new(GDK_LEFT_PTR));

    /*gdk_window_set_override_redirect (gdkwindow, TRUE);*/
    /*select_popup_events ();*/
    /*gdk_window_add_filter (NULL, (GdkFilterFunc)xevent_filter, gdkwindow);*/

    dde_bg_g_settings = g_settings_new(SCHEMA_ID);
    set_background(gtk_widget_get_window(webview), dde_bg_g_settings,
                            gdk_screen_width(), gdk_screen_height());

    grab = gs_grab_new ();
    gtk_widget_show_all (container);

    gdk_window_focus (gtk_widget_get_window (container), 0);
    gdk_window_stick (gdkwindow);


    gtk_main ();

    return 0;
}