我无法让gtkmozembed工作:

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gtkmozembed.h>
#include <stdlib.h>
#include <stdio.h>
static void destroy( GtkWidget *widget,
                     gpointer   data )
{
    gtk_main_quit ();
}

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window, *mozwidget;

    gtk_init (&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect (window, "destroy",
                      G_CALLBACK (destroy), NULL);

    mozwidget=gtk_moz_embed_new();

    gtk_moz_embed_load_url (GTK_MOZ_EMBED(mozwidget),"http://www.google.com");

    gtk_container_add (GTK_CONTAINER (window), mozwidget);

       //last line running correctly
    gtk_widget_show_all(window);
       //not running anything after this line

    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE);
    gtk_window_set_type_hint(GTK_WINDOW(window),GDK_WINDOW_TYPE_HINT_DOCK),
    gtk_window_set_skip_pager_hint(GTK_WINDOW(window),TRUE);
    gtk_window_set_keep_below(GTK_WINDOW(window),TRUE);
    gtk_window_set_decorated(GTK_WINDOW(window),FALSE);
    gtk_window_stick(GTK_WINDOW(window));

    gtk_main ();

    return 0;
}


我编译使用:

gcc -g main.c -o xulwidget $(pkg-config --cflags --libs gtk+-2.0) -I /usr/include/xulrunner-2.0 -L /usr/lib/xulrunner-2.0 -lxul


错误:第30行附近的细分错误(请参见上面的注释)

Stacktrace(没有用于xul和gtk的调试库):

#0  0x00007ffff3b2fc05 in ?? () from //usr/lib64/xulrunner-2.0/libxul.so
#1  0x00007ffff3b2e706 in ?? () from //usr/lib64/xulrunner-2.0/libxul.so
#2  0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#3  0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#4  0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#5  0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#6  0x00007ffff7a253a7 in gtk_widget_realize () from /usr/lib64/libgtk-x11-2.0.so.0
#7  0x00007ffff7a25b98 in gtk_widget_map () from /usr/lib64/libgtk-x11-2.0.so.0
#8  0x00007ffff7a3644a in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#9  0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#10 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#11 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#12 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#13 0x00007ffff7a25b6e in gtk_widget_map () from /usr/lib64/libgtk-x11-2.0.so.0
#14 0x00007ffff7a36580 in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#15 0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#16 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#17 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#18 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#19 0x00007ffff7a262e3 in gtk_widget_show () from /usr/lib64/libgtk-x11-2.0.so.0
#20 0x0000000000400f11 in main (argc=1, argv=0x7fffffffd8f8) at main.c:29

最佳答案

从4.0开始,Mozilla不再是可嵌入的。

不要尝试,请使用GtkWebkit,如果您在Windows / MacOSX上需要它,请踢一下维护者的屁股,他们不应该过于依赖单个平台。

关于c - gtkmozembed段隔离,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7379251/

10-09 13:15