<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">I build webkitgtk 1.9.92 by below configuration<br>./configure --prefix=/usr --enable-accelerated-compositing  --enable-fast-mobile-scrolling --enable-jit --disable-webkit2 --disable-plugin-process --disable-gtk-doc-html --with-gtk=2.0 --with-acceleration-backend=opengl<br>

<br>After that, I write a simple app to make the content of webview transparent by calling webkit_web_view_set_transparent(). But it failed. <br>I tryied version 1.11.5, it also does not work.<br>The same app source code works in a old version of gtk-webkit, AFAIK, it was about gtk-webkit 1.3.<br>

<br>Why I want to a build a new version of gtk-webkit, is to use the compositing accelerating feature.<br><br>Anyone know something about this problem?<br><br>The test code is here:<br>-----------app code---------<br>#include &lt;gtk/gtk.h&gt;<br>

#include &lt;gdk/gdkx.h&gt;<br>#include &lt;webkit/webkit.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;string.h&gt;<br>static void destroy_cb(GtkWidget* widget, gpointer data) {<br>    gtk_main_quit();<br>}<br><br>
bool transparent = true;<br>
bool decorate = false;<br>int width = 800;<br>int height = 480;<br>gchar * url = &quot;/home/meego/httproot/htdocs/hmi/hmi/index.html&quot;;<br>char *window_name = &quot;HMI&quot;;<br>WebKitWebView* view;<br>GdkColormap* rgba;<br>

GdkScreen* screen;<br><br>gint key_press_cb(GtkWidget *widget, GdkEventKey *kevent, gpointer data)  {<br>    GtkWidget *btn = (GtkWidget *)data;<br><br>    if(kevent-&gt;type == GDK_KEY_PRESS &amp;&amp; kevent-&gt;keyval == &#39;p&#39;)  {<br>

        <br>        GdkPixbuf * pixbuf;<br>        pixbuf = gdk_pixbuf_get_from_drawable( NULL, GTK_WIDGET(view)-&gt;window, rgba, 0, 0, 0, 0, 600, 400 );<br>        gdk_pixbuf_save(pixbuf, &quot;/home/meego/dump.png&quot;, &quot;png&quot;, NULL, NULL);<br>

        printf(&quot;colormap is %s\n&quot;, rgba ? &quot;not NULL&quot; : &quot;NULL&quot;);<br>        printf(&quot;screen %s compoisted\n&quot;, gdk_screen_is_composited(screen)? &quot;is&quot; : &quot;is not&quot;);<br>

        printf(&quot;webview %s transparent\n&quot;, webkit_web_view_get_transparent(view) ? &quot;is&quot; : &quot;is not&quot;);<br>    }<br>    return TRUE;<br>}<br><br>static gboolean window_delete_event(GtkWidget *widget, GdkEvent  *event, gpointer user_data)<br>

{<br>    gtk_widget_destroy(widget);<br>    gtk_main_quit();<br>    return TRUE;<br>}<br><br>int main(int argc, char* argv[]) {<br>    int ret;<br><br>    if(argc &gt;= 2) {<br>        url = argv[1];<br>    }<br>    gtk_init(&amp;argc, &amp;argv);<br>

<br>    // Create a Window, set colormap to RGBA<br>    GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);<br>    screen = gtk_widget_get_screen(window);<br>    rgba = gdk_screen_get_rgba_colormap (screen);<br><br>
    gtk_window_set_title(GTK_WINDOW(window), (const gchar*)window_name);<br>
    if (rgba &amp;&amp; gdk_screen_is_composited (screen)) {<br>        gtk_widget_set_default_colormap(rgba);<br>        gtk_widget_set_colormap(GTK_WIDGET(window), rgba);<br>    }<br><br>    gtk_widget_set_size_request(window, width, height);<br>

<br>    if(!decorate)<br>    {<br>        gtk_window_set_decorated(GTK_WINDOW(window), FALSE);<br>    }<br><br>    view = WEBKIT_WEB_VIEW(webkit_web_view_new());<br>    gtk_widget_set_colormap(GTK_WIDGET(view), rgba);<br>

    if(transparent) {<br>        if(gdk_screen_is_composited(screen)) {<br>            printf(&quot;set transparent\n&quot;);<br>            webkit_web_view_set_transparent(view, TRUE);<br>        }<br>    }<br><br>    WebKitWebSettings *settings = webkit_web_settings_new();<br>

<br>    if(NULL == settings) {<br>        return -1;<br>    } else {<br>        g_object_set (G_OBJECT(settings), &quot;enable-file-access-from-file-uris&quot;, TRUE, NULL);<br>        g_object_set (G_OBJECT(settings), &quot;enable-default-context-menu&quot;, FALSE, NULL);<br>

        webkit_web_view_set_settings (WEBKIT_WEB_VIEW(view), settings);<br>    }<br>    gtk_container_add (GTK_CONTAINER(window), GTK_WIDGET(view));<br><br><br>    g_signal_connect(window, &quot;delete-event&quot;, G_CALLBACK(window_delete_event), NULL);<br>

    g_signal_connect(window, &quot;destroy&quot;, G_CALLBACK(destroy_cb), NULL);<br><br>    g_signal_connect(G_OBJECT(window), &quot;key_press_event&quot;, G_CALLBACK(key_press_cb), window);<br>    //g_signal_emit_by_name(G_OBJECT(window), &quot;activate&quot;, NULL);<br>

<br>    // Load a default page<br>    if (g_str_has_prefix(url, &quot;http://&quot;)<br>            || g_str_has_prefix(url, &quot;https://&quot;)<br>            || g_str_has_prefix(url, &quot;file://&quot;))<br>    {<br>

        webkit_web_view_open(WEBKIT_WEB_VIEW(view), url);<br>    } else {<br>        gchar *t_url = NULL;<br>        if (g_path_is_absolute(url)) {<br>            t_url = g_strjoin(&quot;&quot;, &quot;file://&quot;, url, NULL);<br>

        } else {<br>            gchar *pwd = g_get_current_dir();<br>            t_url = g_strjoin(&quot;/&quot;, &quot;file://&quot;, pwd, url, NULL);<br>            g_free(pwd);<br>        }<br>        webkit_web_view_open(WEBKIT_WEB_VIEW(view), t_url);<br>

        g_free(t_url);<br>    }<br><br>    gtk_widget_show_all(window);<br>    gtk_main();<br>    return 0;<br>}<br><br><br>-----------html code-----------<br>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>&quot;&gt;<br>

&lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>&quot;&gt;&lt;head&gt;<br>&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;<br>
  &lt;title&gt;Transparency Test&lt;/title&gt;<br>
  &lt;style type=&quot;text/css&quot;&gt;<br>    /*&lt;![CDATA[*/<br>    body { background: rgba(220, 220, 0, .5); }<br>    /*]]&gt;*/<br>  &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;p&gt;<br>    Text on a yellowish, semi-transparent background.<br>

  &lt;/p&gt;<br><br><br>&lt;/body&gt;&lt;/html&gt;<br><br><br><br><br></div>
</div><br></div>