Bug 219844 - [GTK] Build failures with GTK4
Summary: [GTK] Build failures with GTK4
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Lauro Moura
Depends on:
Reported: 2020-12-13 20:22 PST by Lauro Moura
Modified: 2021-01-07 02:02 PST (History)
13 users (show)

See Also:

Initial patch (9.66 KB, patch)
2020-12-13 21:00 PST, Lauro Moura
no flags Details | Formatted Diff | Diff
Patch (6.31 KB, patch)
2020-12-14 02:37 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch (6.29 KB, patch)
2020-12-14 02:41 PST, Carlos Garcia Campos
pnormand: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Moura 2020-12-13 20:22:32 PST
While updating GTK4 from 3.99.4 to 3.99.5 in bug219781, the compilation failed due to some deprecated API that were removed between 3.99.4 and 3.99.5:

* gtk_window_get_size
* gtk_window_resize
* gtk_native_check_resize
Comment 1 Lauro Moura 2020-12-13 21:00:39 PST
Created attachment 416136 [details]
Initial patch

Initial patch with tentative fixes where the build failed. In `webkitWebViewBaseSizeAllocate` I left the gtk_native_check_resize commented out as I'm not sure how to proceed with it. The GTK changes replaced it with explicit calls to the child types. Should WebKitGTK then do something similar and go through each of the internal children and call the appropiate functions?
Comment 2 EWS Watchlist 2020-12-13 21:01:15 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Carlos Garcia Campos 2020-12-14 02:36:02 PST
Comment on attachment 416136 [details]
Initial patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416136&action=review

I had to fix the build too, I'll submit a new patch

> Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp:201
> +#if USE(GTK4)
> +                gtk_window_get_default_size(GTK_WINDOW(window), &width, &height);
> +#else
>                  gtk_window_get_size(GTK_WINDOW(window), &width, &height);
> +#endif

We normally add the missing function to GtkVersioning.h to avoid the ifdefs.

> Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:868
> -        if (GTK_IS_NATIVE(child))
> -            gtk_native_check_resize(GTK_NATIVE(child));
> +        // FIXME
> +        // GTK Replaced check_resize with explicit calls on each widget (eg gtk_popover_present)
> +        // if (GTK_IS_NATIVE(child))
> +        //     gtk_native_check_resize(GTK_NATIVE(child));

This is always a popover in our case, it's either the context menu or an input drop down list.

> Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp:303
> +#if USE(GTK4)
> +            // FIXME get the default_widget and resize or just NOP as we just got the default_size?
> +#else
>              gtk_window_resize(window, x, y);
> +#endif

This is a good point, I guess we will have to save the previous size now in the case of gtk4.
Comment 4 Carlos Garcia Campos 2020-12-14 02:37:09 PST
Created attachment 416142 [details]
Comment 5 Carlos Garcia Campos 2020-12-14 02:41:50 PST
Created attachment 416144 [details]
Comment 6 Carlos Garcia Campos 2021-01-07 02:02:54 PST
Committed r271231: <https://trac.webkit.org/changeset/271231>