[webkit-gtk] Nothing shown in the widget when compiling with Fedora 37

Philippe Normand philn at igalia.com
Thu Jan 5 01:46:35 PST 2023


If your GPU is a nvidia chipset you might be hitting this bug:

https://bugs.webkit.org/show_bug.cgi?id=228268

On Wed, 2023-01-04 at 18:31 -0500, Lothar Scholz wrote:
> Hello,
> 
> So after a year of silence i tried again to get things going in the
> hope that it now reached some workable out of the box state. But
> using
> the CMakeLists.txt and C++ Code below it compiles and runs, it does
> only show a naked empty window.
> 
> By the way, where is the example code from the website? It seems they
> are removed.
> 
> ---------------------------------------------------------------------
> --------------------------------------
> cmake_minimum_required(VERSION 3.25)
> project(example LANGUAGES C CXX)
> set(CMAKE_CXX_STANDARD 20)
> set(CMAKE_CXX_STANDARD_REQUIRED ON)
> set(CMAKE_CXX_EXTENSIONS OFF)
> 
> find_package(PkgConfig REQUIRED)
> 
> pkg_check_modules(lib_gtk REQUIRED IMPORTED_TARGET gtk4 cairo)
> pkg_check_modules(lib_glib REQUIRED IMPORTED_TARGET glib-2.0
> gio-unix-2.0 gio-2.0)
> pkg_check_modules(lib_webkit REQUIRED IMPORTED_TARGET webkit2gtk-5.0)
> 
> add_executable(FooBar "code.cpp")
> target_link_libraries(FooBar PRIVATE PkgConfig::lib_glib)
> target_link_libraries(FooBar PRIVATE PkgConfig::lib_gtk)
> target_link_libraries(FooBar PRIVATE PkgConfig::lib_webkit)
> install(TARGETS FooBar)
> install(DIRECTORY "share/" DESTINATION "/app/share")
> ---------------------------------------------------------------------
> --------------------------------------
> #include <gtk/gtk.h>
> #include <webkit2/webkit2.h>
> 
> 
> static gboolean closeWebViewCb(WebKitWebView*, GtkWidget* window) {
>     gtk_window_destroy(GTK_WINDOW(window));
>     return TRUE;
> }
> 
> 
> static void activate (GtkApplication* app, gpointer) {
>   GtkWidget *window = gtk_application_window_new(app);
>   gtk_window_set_title (GTK_WINDOW (window), "FooBar in WebKit2Gtk");
>   gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
> 
>   WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
>   g_signal_connect(webView, "close", G_CALLBACK(closeWebViewCb),
> window);
>   webkit_web_view_load_uri(webView, "https://www.webkitgtk.org/");
> 
>   gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET(webView));
>   gtk_widget_grab_focus(GTK_WIDGET(webView));
>   gtk_widget_show(window);
> }
> 
> 
> int main(int argc, char* argv[]) {
> 
> GtkApplication *app = gtk_application_new
> ("app.filesqueezer.example",
> G_APPLICATION_DEFAULT_FLAGS);
> g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
> int status = g_application_run(G_APPLICATION (app), argc, argv);
> g_object_unref (app);
> 
> return status;
> }
> _______________________________________________
> webkit-gtk mailing list
> webkit-gtk at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-gtk
> 



More information about the webkit-gtk mailing list