[GTK4] Make it possible to build with GTK4 without errors
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Apr 2020 13:10:10 +0000 (13:10 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Apr 2020 13:10:10 +0000 (13:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=210967

Reviewed by Adrian Perez de Castro.

.:

Disable API tests and GObject introspection when building with GTK4.

* Source/cmake/OptionsGTK.cmake:

Source/WebCore:

* platform/PlatformPasteboard.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor):
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
* platform/graphics/gtk/DisplayRefreshMonitorGtk.h:
* platform/graphics/gtk/GdkCairoUtilities.cpp:
(WebCore::getDefaultCairoFontOptions):
* platform/gtk/CursorGtk.cpp:
(WebCore::createCustomCursor):
* platform/gtk/DragImageGtk.cpp:
(WebCore::dissolveDragImageToFraction):
* platform/gtk/GRefPtrGtk.cpp:
* platform/gtk/GRefPtrGtk.h:
* platform/gtk/GUniquePtrGtk.h:
* platform/gtk/GtkVersioning.h:
(gdk_event_copy):
(gtk_widget_size_allocate):
(gtk_widget_queue_resize_no_redraw):
(gdk_event_get_state):
(gdk_event_get_coords):
(gdk_event_get_root_coords):
(gdk_event_is_scroll_stop_event):
(gdk_event_get_scroll_direction):
(gdk_event_get_scroll_deltas):
(gdk_event_get_button):
* platform/gtk/PasteboardHelper.cpp:
* platform/gtk/PasteboardHelper.h:
* platform/gtk/PlatformKeyboardEventGtk.cpp:
(WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
* platform/gtk/PlatformPasteboardGtk.cpp:
(WebCore::PlatformPasteboard::PlatformPasteboard):
(WebCore::PlatformPasteboard::writeToClipboard):
(WebCore::PlatformPasteboard::readFromClipboard):
* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::getCurrentScreenMonitor):

Source/WebKit:

Add ifdefs when needed to make it possible to complete a build with GTK4. This way we can continue working on
every feature individually and checking it actually works. Move public headers containing API specific to GTK3
and GTK4 into their own gtk3 and gtk4 directory.

* PlatformGTK.cmake:
* Shared/API/glib/WebKitContextMenuItem.cpp:
* Shared/NativeWebKeyboardEvent.h:
* Shared/NativeWebMouseEvent.h:
* Shared/NativeWebWheelEvent.h:
* Shared/glib/WebContextMenuItemGlib.cpp:
(WebKit::WebContextMenuItemGlib::WebContextMenuItemGlib):
(WebKit::WebContextMenuItemGlib::buildActionName const):
(WebKit::WebContextMenuItemGlib::createActionIfNeeded):
* Shared/glib/WebContextMenuItemGlib.h:
* Shared/gtk/NativeWebKeyboardEventGtk.cpp:
* Shared/gtk/NativeWebMouseEventGtk.cpp:
(WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
* Shared/gtk/NativeWebTouchEventGtk.cpp:
(WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
* Shared/gtk/NativeWebWheelEventGtk.cpp:
* Shared/gtk/WebEventFactory.cpp:
(WebKit::buttonForEvent):
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebKeyboardEvent):
(WebKit::WebEventFactory::createWebTouchEvent):
* Shared/gtk/WebEventFactory.h:
* SourcesGTK.txt:
* UIProcess/API/C/WKNativeEvent.h:
* UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::filterKeyEvent):
* UIProcess/API/glib/InputMethodFilter.h:
* UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp:
(createGstInstallPluginsContext):
* UIProcess/API/glib/WebKitPrivate.cpp:
* UIProcess/API/glib/WebKitUIClient.cpp:
(UIClient::setWindowFrameTimerFired):
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextGetProperty):
(webkitWebContextSetProperty):
(webkit_web_context_class_init):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewRunAsModal):
(webkitWebViewPopulateContextMenu):
* UIProcess/API/gtk/InputMethodFilterGtk.cpp:
(WebKit::InputMethodFilter::platformEventKeyIsKeyPress const):
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::setViewNeedsDisplay):
(WebKit::PageClientImpl::setCursor):
(WebKit::PageClientImpl::doneWithKeyEvent):
(WebKit::PageClientImpl::createPopupMenuProxy):
(WebKit::PageClientImpl::createDataListSuggestionsDropdown):
(WebKit::PageClientImpl::startDrag):
(WebKit::PageClientImpl::doneWithTouchEvent):
(WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
* UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
* UIProcess/API/gtk/WebKitAuthenticationDialog.h:
* UIProcess/API/gtk/WebKitEmojiChooser.cpp:
* UIProcess/API/gtk/WebKitEmojiChooser.h:
* UIProcess/API/gtk/WebKitInputMethodContextGtk.cpp:
(webkit_input_method_context_filter_key_event):
* UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp:
(webkitInputMethodContextImplGtkFilterKeyEvent):
(webkitInputMethodContextImplGtkSetClientWindow):
* UIProcess/API/gtk/WebKitPopupMenu.cpp:
(WebKit::WebKitPopupMenu::WebKitPopupMenu):
(WebKit::WebKitPopupMenu::showPopupMenu):
(WebKit::WebKitPopupMenu::hidePopupMenu):
(WebKit::WebKitPopupMenu::cancelTracking):
* UIProcess/API/gtk/WebKitPopupMenu.h:
* UIProcess/API/gtk/WebKitPrintOperation.cpp:
* UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
(webkitScriptDialogAccept):
(webkitScriptDialogDismiss):
(webkitScriptDialogSetUserInput):
* UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
* UIProcess/API/gtk/WebKitScriptDialogImpl.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(ClickCounter::currentClickCountForGdkButtonEvent):
(_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
(webkitWebViewBaseSetToplevelOnScreenWindow):
(webkitWebViewBaseRealize):
(webkitWebViewBaseContainerForall):
(webkitWebViewBaseDispose):
(webkitWebViewBaseConstructed):
(webkitWebViewBaseSizeAllocate):
(webkitWebViewBaseKeyPressEvent):
(webkitWebViewBaseKeyReleaseEvent):
(webkitWebViewBaseSetEnableBackForwardNavigationGesture):
(webkitWebViewBaseBeginBackSwipeForTesting):
(webkitWebViewBaseCompleteBackSwipeForTesting):
(webkit_web_view_base_class_init):
(webkitWebViewBaseWillSwapWebProcess):
(webkitWebViewBaseDidExitWebProcess):
(webkitWebViewBaseDidRelaunchWebProcess):
(webkitWebViewBaseTakeViewSnapshot):
(webkitWebViewBaseDidStartProvisionalLoadForMainFrame):
(webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):
(webkitWebViewBaseDidFinishLoadForMainFrame):
(webkitWebViewBaseDidFailLoadForMainFrame):
(webkitWebViewBaseDidSameDocumentNavigationForMainFrame):
(webkitWebViewBaseDidRestoreScrollPosition):
(webkitWebViewBaseShowEmojiChooser):
(webkitWebViewBaseRequestPointerLock):
(webkitWebViewBaseDidLosePointerLock):
(webkitWebViewBaseSynthesizeCompositionKeyPress):
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/API/gtk/WebKitWebViewDialog.cpp:
* UIProcess/API/gtk/WebKitWebViewDialog.h:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkitWebViewAuthenticate):
(webkitWebViewScriptDialog):
(webkitWebViewRunFileChooser):
(webkitWebViewMaximizeWindow):
(webkitWebViewMinimizeWindow):
(webkitWebViewRestoreWindow):
* UIProcess/API/gtk3/WebKitContextMenuItem.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitContextMenuItem.h.
* UIProcess/API/gtk3/WebKitInputMethodContext.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContext.h.
* UIProcess/API/gtk4/WebKitContextMenuItem.h: Renamed from Source/WebKit/UIProcess/API/gtk/WebKitContextMenuItem.h.
* UIProcess/API/gtk4/WebKitInputMethodContext.h: Renamed from Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContext.h.
* UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
(WebKit::WebAutomationSession::platformSimulateMouseInteraction):
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
(WebKit::WebAutomationSession::platformSimulateKeySequence):
* UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
(WebKit::RemoteWebInspectorProxy::platformSave):
* UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::platformSave):
* UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp:
(webkit_inspector_window_init):
(webkitInspectorWindowNew):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/cairo/BackingStoreCairo.cpp:
(WebKit::BackingStore::createBackend):
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext):
(WebKit::AcceleratedBackingStoreWayland::paint):
* UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
(WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11):
(WebKit::AcceleratedBackingStoreX11::update):
* UIProcess/gtk/DragAndDropHandler.cpp:
* UIProcess/gtk/DragAndDropHandler.h:
* UIProcess/gtk/GestureController.cpp:
* UIProcess/gtk/GestureController.h:
* UIProcess/gtk/KeyBindingTranslator.cpp:
(WebKit::KeyBindingTranslator::KeyBindingTranslator):
(WebKit::KeyBindingTranslator::commandsForKeyEvent):
* UIProcess/gtk/KeyBindingTranslator.h:
* UIProcess/gtk/PointerLockManager.cpp:
(WebKit::PointerLockManager::lock):
(WebKit::PointerLockManager::unlock):
* UIProcess/gtk/PointerLockManager.h:
* UIProcess/gtk/PointerLockManagerWayland.cpp:
(WebKit::PointerLockManagerWayland::lock):
* UIProcess/gtk/PointerLockManagerX11.cpp:
(WebKit::PointerLockManagerX11::didReceiveMotionEvent):
* UIProcess/gtk/WebColorPickerGtk.cpp:
* UIProcess/gtk/WebContextMenuProxyGtk.cpp:
(WebKit::WebContextMenuProxyGtk::show):
(WebKit::WebContextMenuProxyGtk::showContextMenuWithItems):
(WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk):
(WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
* UIProcess/gtk/WebContextMenuProxyGtk.h:
* UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp:
* UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h:
* UIProcess/gtk/WebPageProxyGtk.cpp:
* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
* UIProcess/gtk/WebPopupMenuProxyGtk.h:
* WebProcess/Plugins/PluginController.h:
* WebProcess/Plugins/PluginView.cpp:
* WebProcess/Plugins/PluginView.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close):
(WebKit::WebPage::mainFrameDidLayout):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
(WebKit::AcceleratedSurfaceX11::AcceleratedSurfaceX11):
(WebKit::AcceleratedSurfaceX11::createPixmap):
* WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
(WebKit::WebPrintOperationGtk::print):

Tools:

* MiniBrowser/gtk/BrowserCellRendererVariant.c:
* MiniBrowser/gtk/BrowserCellRendererVariant.h:
* MiniBrowser/gtk/BrowserDownloadsBar.c:
* MiniBrowser/gtk/BrowserDownloadsBar.h:
* MiniBrowser/gtk/BrowserMain.c: Added.
(browser_main):
(browser_main_quit):
* MiniBrowser/gtk/BrowserMain.h: Added.
* MiniBrowser/gtk/BrowserSearchBar.c:
* MiniBrowser/gtk/BrowserSearchBar.h:
* MiniBrowser/gtk/BrowserSettingsDialog.c:
* MiniBrowser/gtk/BrowserSettingsDialog.h:
* MiniBrowser/gtk/BrowserTab.c:
(browserTabConstructed):
(browser_tab_start_search):
(browser_tab_stop_search):
(browser_tab_enter_fullscreen):
(browser_tab_leave_fullscreen):
* MiniBrowser/gtk/BrowserTab.h:
* MiniBrowser/gtk/BrowserWindow.c:
(webViewURIChanged):
(resetEntryProgress):
(webViewLoadProgressChanged):
(downloadStarted):
(browserWindowUpdateNavigationActions):
(webViewReadyToShow):
(browserWindowUpdateZoomActions):
(webViewZoomLevelChanged):
(updateUriEntryIcon):
(webViewIsLoadingChanged):
(browserWindowFinalize):
(browserWindowSetupEditorToolbar):
(browserWindowSwitchTab):
(browser_window_init):
(browser_window_class_init):
(browser_window_new):
(browser_window_append_view):
(browser_window_set_background_color):
(browser_window_get_or_create_web_view_for_automation):
* MiniBrowser/gtk/CMakeLists.txt:
* MiniBrowser/gtk/main.c:
(main):
* PlatformGTK.cmake:
* Scripts/webkitpy/style/checker.py:
* TestWebKitAPI/glib/PlatformGTK.cmake:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260752 268f45cc-cd09-0410-ab3c-d52691b4dbfc

119 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/platform/PlatformPasteboard.h
Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp
Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp
Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.h
Source/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
Source/WebCore/platform/gtk/CursorGtk.cpp
Source/WebCore/platform/gtk/DragImageGtk.cpp
Source/WebCore/platform/gtk/GRefPtrGtk.cpp
Source/WebCore/platform/gtk/GRefPtrGtk.h
Source/WebCore/platform/gtk/GUniquePtrGtk.h
Source/WebCore/platform/gtk/GtkVersioning.h
Source/WebCore/platform/gtk/PasteboardHelper.cpp
Source/WebCore/platform/gtk/PasteboardHelper.h
Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp
Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit/Shared/API/glib/WebKitContextMenuItem.cpp
Source/WebKit/Shared/NativeWebKeyboardEvent.h
Source/WebKit/Shared/NativeWebMouseEvent.h
Source/WebKit/Shared/NativeWebWheelEvent.h
Source/WebKit/Shared/glib/WebContextMenuItemGlib.cpp
Source/WebKit/Shared/glib/WebContextMenuItemGlib.h
Source/WebKit/Shared/gtk/NativeWebKeyboardEventGtk.cpp
Source/WebKit/Shared/gtk/NativeWebMouseEventGtk.cpp
Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp
Source/WebKit/Shared/gtk/NativeWebWheelEventGtk.cpp
Source/WebKit/Shared/gtk/WebEventFactory.cpp
Source/WebKit/Shared/gtk/WebEventFactory.h
Source/WebKit/SourcesGTK.txt
Source/WebKit/UIProcess/API/C/WKNativeEvent.h
Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp
Source/WebKit/UIProcess/API/glib/InputMethodFilter.h
Source/WebKit/UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp
Source/WebKit/UIProcess/API/glib/WebKitPrivate.cpp
Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/gtk/InputMethodFilterGtk.cpp
Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
Source/WebKit/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
Source/WebKit/UIProcess/API/gtk/WebKitAuthenticationDialog.h
Source/WebKit/UIProcess/API/gtk/WebKitEmojiChooser.cpp
Source/WebKit/UIProcess/API/gtk/WebKitEmojiChooser.h
Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContextGtk.cpp
Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp
Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.cpp
Source/WebKit/UIProcess/API/gtk/WebKitPopupMenu.h
Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp
Source/WebKit/UIProcess/API/gtk/WebKitScriptDialogGtk.cpp
Source/WebKit/UIProcess/API/gtk/WebKitScriptDialogImpl.cpp
Source/WebKit/UIProcess/API/gtk/WebKitScriptDialogImpl.h
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h
Source/WebKit/UIProcess/API/gtk/WebKitWebViewDialog.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebViewDialog.h
Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp
Source/WebKit/UIProcess/API/gtk3/WebKitContextMenuItem.h [moved from Source/WebKit/UIProcess/API/gtk/WebKitContextMenuItem.h with 100% similarity]
Source/WebKit/UIProcess/API/gtk3/WebKitInputMethodContext.h [moved from Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContext.h with 100% similarity]
Source/WebKit/UIProcess/API/gtk4/WebKitContextMenuItem.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/gtk4/WebKitInputMethodContext.h [new file with mode: 0644]
Source/WebKit/UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp
Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp
Source/WebKit/UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp
Source/WebKit/UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/cairo/BackingStoreCairo.cpp
Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp
Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp
Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp
Source/WebKit/UIProcess/gtk/DragAndDropHandler.cpp
Source/WebKit/UIProcess/gtk/DragAndDropHandler.h
Source/WebKit/UIProcess/gtk/GestureController.cpp
Source/WebKit/UIProcess/gtk/GestureController.h
Source/WebKit/UIProcess/gtk/KeyBindingTranslator.cpp
Source/WebKit/UIProcess/gtk/KeyBindingTranslator.h
Source/WebKit/UIProcess/gtk/PointerLockManager.cpp
Source/WebKit/UIProcess/gtk/PointerLockManager.h
Source/WebKit/UIProcess/gtk/PointerLockManagerWayland.cpp
Source/WebKit/UIProcess/gtk/PointerLockManagerX11.cpp
Source/WebKit/UIProcess/gtk/WebColorPickerGtk.cpp
Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp
Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.h
Source/WebKit/UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp
Source/WebKit/UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h
Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp
Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp
Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.h
Source/WebKit/WebProcess/Plugins/PluginController.h
Source/WebKit/WebProcess/Plugins/PluginView.cpp
Source/WebKit/WebProcess/Plugins/PluginView.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp
Source/WebKit/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
Source/cmake/OptionsGTK.cmake
Tools/ChangeLog
Tools/MiniBrowser/gtk/BrowserCellRendererVariant.c
Tools/MiniBrowser/gtk/BrowserCellRendererVariant.h
Tools/MiniBrowser/gtk/BrowserDownloadsBar.c
Tools/MiniBrowser/gtk/BrowserDownloadsBar.h
Tools/MiniBrowser/gtk/BrowserMain.c [new file with mode: 0644]
Tools/MiniBrowser/gtk/BrowserMain.h [new file with mode: 0644]
Tools/MiniBrowser/gtk/BrowserSearchBar.c
Tools/MiniBrowser/gtk/BrowserSearchBar.h
Tools/MiniBrowser/gtk/BrowserSettingsDialog.c
Tools/MiniBrowser/gtk/BrowserSettingsDialog.h
Tools/MiniBrowser/gtk/BrowserTab.c
Tools/MiniBrowser/gtk/BrowserTab.h
Tools/MiniBrowser/gtk/BrowserWindow.c
Tools/MiniBrowser/gtk/CMakeLists.txt
Tools/MiniBrowser/gtk/main.c
Tools/PlatformGTK.cmake
Tools/Scripts/webkitpy/style/checker.py
Tools/TestWebKitAPI/glib/PlatformGTK.cmake

index c53bf2b..7029548 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2020-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK4] Make it possible to build with GTK4 without errors
+        https://bugs.webkit.org/show_bug.cgi?id=210967
+
+        Reviewed by Adrian Perez de Castro.
+
+        Disable API tests and GObject introspection when building with GTK4.
+
+        * Source/cmake/OptionsGTK.cmake:
+
 2020-04-27  Diego Pino Garcia  <dpino@igalia.com>
 
         Unreviewed, reverting r260672.
index 61a6197..4ddcc34 100644 (file)
@@ -1,3 +1,46 @@
+2020-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK4] Make it possible to build with GTK4 without errors
+        https://bugs.webkit.org/show_bug.cgi?id=210967
+
+        Reviewed by Adrian Perez de Castro.
+
+        * platform/PlatformPasteboard.h:
+        * platform/graphics/DisplayRefreshMonitor.cpp:
+        (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor):
+        * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
+        * platform/graphics/gtk/DisplayRefreshMonitorGtk.h:
+        * platform/graphics/gtk/GdkCairoUtilities.cpp:
+        (WebCore::getDefaultCairoFontOptions):
+        * platform/gtk/CursorGtk.cpp:
+        (WebCore::createCustomCursor):
+        * platform/gtk/DragImageGtk.cpp:
+        (WebCore::dissolveDragImageToFraction):
+        * platform/gtk/GRefPtrGtk.cpp:
+        * platform/gtk/GRefPtrGtk.h:
+        * platform/gtk/GUniquePtrGtk.h:
+        * platform/gtk/GtkVersioning.h:
+        (gdk_event_copy):
+        (gtk_widget_size_allocate):
+        (gtk_widget_queue_resize_no_redraw):
+        (gdk_event_get_state):
+        (gdk_event_get_coords):
+        (gdk_event_get_root_coords):
+        (gdk_event_is_scroll_stop_event):
+        (gdk_event_get_scroll_direction):
+        (gdk_event_get_scroll_deltas):
+        (gdk_event_get_button):
+        * platform/gtk/PasteboardHelper.cpp:
+        * platform/gtk/PasteboardHelper.h:
+        * platform/gtk/PlatformKeyboardEventGtk.cpp:
+        (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
+        * platform/gtk/PlatformPasteboardGtk.cpp:
+        (WebCore::PlatformPasteboard::PlatformPasteboard):
+        (WebCore::PlatformPasteboard::writeToClipboard):
+        (WebCore::PlatformPasteboard::readFromClipboard):
+        * platform/gtk/PlatformScreenGtk.cpp:
+        (WebCore::getCurrentScreenMonitor):
+
 2020-04-27  Rob Buis  <rbuis@igalia.com>
 
         Make loadURLIntoChildFrame private and non-exported
index 2fb6e53..7dff77d 100644 (file)
@@ -126,7 +126,7 @@ private:
 #if PLATFORM(IOS_FAMILY)
     RetainPtr<id> m_pasteboard;
 #endif
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     GtkClipboard* m_clipboard;
 #endif
 #if USE(LIBWPE)
index 76a2081..5d6e534 100644 (file)
@@ -50,7 +50,7 @@ RefPtr<DisplayRefreshMonitor> DisplayRefreshMonitor::createDefaultDisplayRefresh
 #if PLATFORM(IOS_FAMILY)
     return DisplayRefreshMonitorIOS::create(displayID);
 #endif
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     return DisplayRefreshMonitorGtk::create(displayID);
 #endif
     UNUSED_PARAM(displayID);
index 09a8b85..fb4b54f 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "DisplayRefreshMonitorGtk.h"
 
-#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !USE(GTK4)
 
 #include <gtk/gtk.h>
 #include <wtf/RunLoop.h>
@@ -94,4 +94,4 @@ void DisplayRefreshMonitorGtk::displayLinkFired()
 
 } // namespace WebCore
 
-#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !USE(GTK4)
index 9bd1357..e2a0e4c 100644 (file)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !USE(GTK4)
 
 #include "DisplayRefreshMonitor.h"
 
@@ -53,4 +53,4 @@ private:
 
 } // namespace WebCore
 
-#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) && !USE(GTK4)
index d2b40ca..0ec1dc8 100644 (file)
@@ -38,10 +38,12 @@ namespace WebCore {
 
 const cairo_font_options_t* getDefaultCairoFontOptions()
 {
+#if !USE(GTK4)
     if (auto* screen = gdk_screen_get_default()) {
         if (auto* options = gdk_screen_get_font_options(screen))
             return options;
     }
+#endif
 
     static cairo_font_options_t* options;
     static std::once_flag flag;
index 2a1aaee..1ba3f25 100644 (file)
@@ -63,8 +63,14 @@ static GRefPtr<GdkCursor> createCustomCursor(Image* image, const IntPoint& hotSp
 
 #if USE(GTK4)
     ASSERT(cairo_image_surface_get_format(surface.get()) == CAIRO_FORMAT_ARGB32);
-    auto texture = adoptGRef(gdk_memory_texture_new(cairo_image_surface_get_width(surface.get()), cairo_image_surface_get_height(surface.get()),
-        GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, cairo_image_surface_get_data(surface.get()), cairo_image_surface_get_stride(surface.get())));
+    auto width = cairo_image_surface_get_width(surface.get());
+    auto height = cairo_image_surface_get_height(surface.get());
+    auto stride = cairo_image_surface_get_stride(surface.get());
+    GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new_with_free_func(cairo_image_surface_get_data(surface.get()), height * stride,
+        [](gpointer data) {
+            cairo_surface_destroy(static_cast<cairo_surface_t*>(data));
+        }, surface.leakRef()));
+    auto texture = adoptGRef(gdk_memory_texture_new(width, height, GDK_MEMORY_A8R8G8B8_PREMULTIPLIED, bytes.get(), stride));
     return adoptGRef(gdk_cursor_new_from_texture(texture.get(), effectiveHotSpot.x(), effectiveHotSpot.y(), fallbackCursor().get()));
 #else
     return adoptGRef(gdk_cursor_new_from_surface(gdk_display_get_default(), surface.get(), effectiveHotSpot.x(), effectiveHotSpot.y()));
index 845fdaa..6a1a73f 100644 (file)
@@ -72,8 +72,10 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction)
     if (!image)
         return nullptr;
 
+#if !USE(GTK4)
     if (!gdk_screen_is_composited(gdk_screen_get_default()))
         return image;
+#endif
 
     RefPtr<cairo_t> context = adoptRef(cairo_create(image.get()));
     cairo_set_operator(context.get(), CAIRO_OPERATOR_DEST_IN);
index b768c8f..120c622 100644 (file)
@@ -31,6 +31,7 @@
 
 namespace WTF {
 
+#if !USE(GTK4)
 template <> GtkTargetList* refGPtr(GtkTargetList* ptr)
 {
     if (ptr)
@@ -43,6 +44,7 @@ template <> void derefGPtr(GtkTargetList* ptr)
     if (ptr)
         gtk_target_list_unref(ptr);
 }
+#endif
 
 #if USE(LIBSECRET)
 template <> SecretValue* refGPtr(SecretValue* ptr)
@@ -59,6 +61,7 @@ template <> void derefGPtr(SecretValue* ptr)
 }
 #endif
 
+#if !USE(GTK4)
 template <> GtkWidgetPath* refGPtr(GtkWidgetPath* ptr)
 {
     if (ptr)
@@ -71,5 +74,6 @@ template <> void derefGPtr(GtkWidgetPath* ptr)
     if (ptr)
         gtk_widget_path_unref(ptr);
 }
+#endif
 
 }
index d26b055..dcc3b6a 100644 (file)
@@ -27,16 +27,20 @@ typedef struct _SecretValue SecretValue;
 
 namespace WTF {
 
+#if !USE(GTK4)
 template <> GtkTargetList* refGPtr(GtkTargetList* ptr);
 template <> void derefGPtr(GtkTargetList* ptr);
+#endif
 
 #if USE(LIBSECRET)
 template <> SecretValue* refGPtr(SecretValue* ptr);
 template <> void derefGPtr(SecretValue* ptr);
 #endif
 
+#if !USE(GTK4)
 template <> GtkWidgetPath* refGPtr(GtkWidgetPath* ptr);
 template <> void derefGPtr(GtkWidgetPath* ptr);
+#endif
 
 }
 
index db9760b..886a783 100644 (file)
 
 namespace WTF {
 
+#if USE(GTK4)
+// FIXME: Use GRefPtr in GTK4, this is just to fix the build for now.
+WTF_DEFINE_GPTR_DELETER(GdkEvent, gdk_event_unref)
+#else
 WTF_DEFINE_GPTR_DELETER(GdkEvent, gdk_event_free)
+#endif
 WTF_DEFINE_GPTR_DELETER(GtkTreePath, gtk_tree_path_free)
 
 } // namespace WTF
index 73f3f6f..a82efa5 100644 (file)
 
 #if USE(GTK4)
 
+#define GDK_MOD1_MASK GDK_ALT_MASK
+
+typedef GdkKeyEvent GdkEventKey;
+typedef GdkFocusEvent GdkEventFocus;
+
 static inline gboolean
 gtk_widget_is_toplevel(GtkWidget* widget)
 {
@@ -57,59 +62,77 @@ gtk_init_check(int*, char***)
     return gtk_init_check();
 }
 
-#define GDK_MOD1_MASK GDK_ALT_MASK
+static inline GdkEvent*
+gdk_event_copy(GdkEvent* event)
+{
+    return gdk_event_ref(event);
+}
+
+static inline void
+gtk_widget_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
+{
+    gtk_widget_size_allocate(widget, allocation, -1);
+}
+
+static inline void
+gtk_widget_queue_resize_no_redraw(GtkWidget* widget)
+{
+    gtk_widget_queue_resize(widget);
+}
 
 static inline gboolean
-gdk_event_get_state(GdkEvent *event, GdkModifierType *state)
+gdk_event_get_state(const GdkEvent *event, GdkModifierType *state)
 {
-    *state = gdk_event_get_modifier_state(event);
+    *state = gdk_event_get_modifier_state(const_cast<GdkEvent*>(event));
     // The GTK3 method returns TRUE if there is a state, otherwise
     // FALSE.
     return !!*state;
 }
 
 static inline gboolean
-gdk_event_get_coords(GdkEvent *event, double *x, double *y)
+gdk_event_get_coords(const GdkEvent *event, double *x, double *y)
 {
-    return gdk_event_get_position(event, x, y);
+    return gdk_event_get_position(const_cast<GdkEvent*>(event), x, y);
 }
 
 static inline gboolean
-gdk_event_get_root_coords(GdkEvent *event, double *x, double *y)
+gdk_event_get_root_coords(const GdkEvent *event, double *x, double *y)
 {
     // GTK4 does not provide a way of obtaining screen-relative event coordinates, and even
     // on Wayland GTK3 cannot know where a surface is and will return the surface-relative
     // coordinates anyway, so do the same here.
-    return gdk_event_get_position(event, x, y);
+    return gdk_event_get_position(const_cast<GdkEvent*>(event), x, y);
 }
 
 static inline gboolean
-gdk_event_is_scroll_stop_event(GdkEvent* event)
+gdk_event_is_scroll_stop_event(const GdkEvent* event)
 {
-    return gdk_scroll_event_is_stop(event);
+    return gdk_scroll_event_is_stop(const_cast<GdkEvent*>(event));
 }
 
 static inline gboolean
-gdk_event_get_scroll_direction(GdkEvent* event, GdkScrollDirection* direction)
+gdk_event_get_scroll_direction(const GdkEvent* event, GdkScrollDirection* direction)
 {
-    *direction = gdk_scroll_event_get_direction(event);
+    *direction = gdk_scroll_event_get_direction(const_cast<GdkEvent*>(event));
     // The GTK3 method returns TRUE if the scroll direction is not
     // GDK_SCROLL_SMOOTH, so do the same here.
     return *direction != GDK_SCROLL_SMOOTH;
 }
 
 static inline gboolean
-gdk_event_get_scroll_deltas(GdkEvent* event, gdouble *x, gdouble *y)
+gdk_event_get_scroll_deltas(const GdkEvent* event, gdouble *x, gdouble *y)
 {
-    gdk_scroll_event_get_deltas(event, x, y);
+    gdk_scroll_event_get_deltas(const_cast<GdkEvent*>(event), x, y);
     // The GTK3 method returns TRUE if the event is a smooth scroll
     // event, so do the same here.
-    return gdk_scroll_event_get_direction(event) == GDK_SCROLL_SMOOTH;
+    return gdk_scroll_event_get_direction(const_cast<GdkEvent*>(event)) == GDK_SCROLL_SMOOTH;
 }
 
 static inline gboolean
-gdk_event_get_button(GdkEvent* event)
+gdk_event_get_button(const GdkEvent* event, guint* button)
 {
-    return gdk_button_event_get_button(event);
+    if (button)
+        *button = gdk_button_event_get_button(const_cast<GdkEvent*>(event));
+    return true;
 }
 #endif // USE(GTK4)
index af8ff34..574966a 100644 (file)
@@ -23,6 +23,8 @@
 #include "config.h"
 #include "PasteboardHelper.h"
 
+#if !USE(GTK4)
+
 #include "BitmapImage.h"
 #include "SelectionData.h"
 #include <gtk/gtk.h>
@@ -314,5 +316,7 @@ void PasteboardHelper::writeClipboardContents(GtkClipboard* clipboard, const Sel
         gtk_target_table_free(table, numberOfTargets);
 }
 
-}
+} // namespace WebCore
+
+#endif // !USE(GTK4)
 
index 5a395e6..4c3f451 100644 (file)
@@ -22,8 +22,9 @@
  *
  */
 
-#ifndef PasteboardHelper_h
-#define PasteboardHelper_h
+#pragma once
+
+#if !USE(GTK4)
 
 #include "GRefPtrGtk.h"
 #include <wtf/Function.h>
@@ -58,6 +59,6 @@ private:
     GRefPtr<GtkTargetList> m_targetList;
 };
 
-}
+} // namespace WebCore
 
-#endif // PasteboardHelper_h
+#endif // !USE(GTK4)
index e755090..0516e70 100644 (file)
@@ -1374,6 +1374,7 @@ bool PlatformKeyboardEvent::modifiersContainCapsLock(unsigned modifier)
     // the same here. This will also return true in Wayland if there's a caps lock key, so it's not worth it
     // checking the actual display here.
     static bool lockMaskIsCapsLock = false;
+#if !USE(GTK4)
     static bool initialized = false;
     if (!initialized) {
         GUniqueOutPtr<GdkKeymapKey> keys;
@@ -1384,6 +1385,7 @@ bool PlatformKeyboardEvent::modifiersContainCapsLock(unsigned modifier)
         lockMaskIsCapsLock = gdk_keymap_get_entries_for_keyval(gdk_keymap_get_for_display(gdk_display_get_default()), GDK_KEY_Caps_Lock, &keys.outPtr(), &entriesCount) && entriesCount;
 #endif
     }
+#endif
     return lockMaskIsCapsLock;
 }
 
index 38b15cf..0c97e9f 100644 (file)
 
 namespace WebCore {
 
+#if USE(GTK4)
+PlatformPasteboard::PlatformPasteboard(const String&)
+{
+}
+#else
 PlatformPasteboard::PlatformPasteboard(const String& pasteboardName)
     : m_clipboard(gtk_clipboard_get(gdk_atom_intern(pasteboardName.utf8().data(), TRUE)))
 {
     ASSERT(m_clipboard);
 }
+#endif
 
 void PlatformPasteboard::writeToClipboard(const SelectionData& selection, WTF::Function<void()>&& primarySelectionCleared)
 {
+#if !USE(GTK4)
     PasteboardHelper::singleton().writeClipboardContents(m_clipboard, selection, gtk_clipboard_get(GDK_SELECTION_PRIMARY) == m_clipboard ? WTFMove(primarySelectionCleared) : nullptr);
+#endif
 }
 
 Ref<SelectionData> PlatformPasteboard::readFromClipboard()
 {
     Ref<SelectionData> selection(SelectionData::create());
+#if !USE(GTK4)
     PasteboardHelper::singleton().getClipboardContents(m_clipboard, selection.get());
+#endif
     return selection;
 }
 
index 25dfb47..4e977aa 100644 (file)
@@ -166,6 +166,9 @@ void setScreenDPIObserverHandler(Function<void()>&& handler, void* context)
 
 GdkMonitor* getCurrentScreenMonitor()
 {
+#if USE(GTK4)
+    return nullptr;
+#else
     GdkDisplay* display = gdk_display_get_default();
     if (!display)
         return nullptr;
@@ -175,6 +178,7 @@ GdkMonitor* getCurrentScreenMonitor()
         return nullptr;
 
     return gdk_display_get_monitor_at_window(display, rootWindow);
+#endif
 }
 
 
index 6e973ca..181d955 100644 (file)
@@ -1,3 +1,193 @@
+2020-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK4] Make it possible to build with GTK4 without errors
+        https://bugs.webkit.org/show_bug.cgi?id=210967
+
+        Reviewed by Adrian Perez de Castro.
+
+        Add ifdefs when needed to make it possible to complete a build with GTK4. This way we can continue working on
+        every feature individually and checking it actually works. Move public headers containing API specific to GTK3
+        and GTK4 into their own gtk3 and gtk4 directory.
+
+        * PlatformGTK.cmake:
+        * Shared/API/glib/WebKitContextMenuItem.cpp:
+        * Shared/NativeWebKeyboardEvent.h:
+        * Shared/NativeWebMouseEvent.h:
+        * Shared/NativeWebWheelEvent.h:
+        * Shared/glib/WebContextMenuItemGlib.cpp:
+        (WebKit::WebContextMenuItemGlib::WebContextMenuItemGlib):
+        (WebKit::WebContextMenuItemGlib::buildActionName const):
+        (WebKit::WebContextMenuItemGlib::createActionIfNeeded):
+        * Shared/glib/WebContextMenuItemGlib.h:
+        * Shared/gtk/NativeWebKeyboardEventGtk.cpp:
+        * Shared/gtk/NativeWebMouseEventGtk.cpp:
+        (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
+        * Shared/gtk/NativeWebTouchEventGtk.cpp:
+        (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
+        * Shared/gtk/NativeWebWheelEventGtk.cpp:
+        * Shared/gtk/WebEventFactory.cpp:
+        (WebKit::buttonForEvent):
+        (WebKit::WebEventFactory::createWebMouseEvent):
+        (WebKit::WebEventFactory::createWebKeyboardEvent):
+        (WebKit::WebEventFactory::createWebTouchEvent):
+        * Shared/gtk/WebEventFactory.h:
+        * SourcesGTK.txt:
+        * UIProcess/API/C/WKNativeEvent.h:
+        * UIProcess/API/glib/InputMethodFilter.cpp:
+        (WebKit::InputMethodFilter::filterKeyEvent):
+        * UIProcess/API/glib/InputMethodFilter.h:
+        * UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp:
+        (createGstInstallPluginsContext):
+        * UIProcess/API/glib/WebKitPrivate.cpp:
+        * UIProcess/API/glib/WebKitUIClient.cpp:
+        (UIClient::setWindowFrameTimerFired):
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkitWebContextGetProperty):
+        (webkitWebContextSetProperty):
+        (webkit_web_context_class_init):
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkitWebViewRunAsModal):
+        (webkitWebViewPopulateContextMenu):
+        * UIProcess/API/gtk/InputMethodFilterGtk.cpp:
+        (WebKit::InputMethodFilter::platformEventKeyIsKeyPress const):
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::setViewNeedsDisplay):
+        (WebKit::PageClientImpl::setCursor):
+        (WebKit::PageClientImpl::doneWithKeyEvent):
+        (WebKit::PageClientImpl::createPopupMenuProxy):
+        (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
+        (WebKit::PageClientImpl::startDrag):
+        (WebKit::PageClientImpl::doneWithTouchEvent):
+        (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
+        * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
+        * UIProcess/API/gtk/WebKitAuthenticationDialog.h:
+        * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
+        * UIProcess/API/gtk/WebKitEmojiChooser.h:
+        * UIProcess/API/gtk/WebKitInputMethodContextGtk.cpp:
+        (webkit_input_method_context_filter_key_event):
+        * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp:
+        (webkitInputMethodContextImplGtkFilterKeyEvent):
+        (webkitInputMethodContextImplGtkSetClientWindow):
+        * UIProcess/API/gtk/WebKitPopupMenu.cpp:
+        (WebKit::WebKitPopupMenu::WebKitPopupMenu):
+        (WebKit::WebKitPopupMenu::showPopupMenu):
+        (WebKit::WebKitPopupMenu::hidePopupMenu):
+        (WebKit::WebKitPopupMenu::cancelTracking):
+        * UIProcess/API/gtk/WebKitPopupMenu.h:
+        * UIProcess/API/gtk/WebKitPrintOperation.cpp:
+        * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
+        (webkitScriptDialogAccept):
+        (webkitScriptDialogDismiss):
+        (webkitScriptDialogSetUserInput):
+        * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
+        * UIProcess/API/gtk/WebKitScriptDialogImpl.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (ClickCounter::currentClickCountForGdkButtonEvent):
+        (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
+        (webkitWebViewBaseSetToplevelOnScreenWindow):
+        (webkitWebViewBaseRealize):
+        (webkitWebViewBaseContainerForall):
+        (webkitWebViewBaseDispose):
+        (webkitWebViewBaseConstructed):
+        (webkitWebViewBaseSizeAllocate):
+        (webkitWebViewBaseKeyPressEvent):
+        (webkitWebViewBaseKeyReleaseEvent):
+        (webkitWebViewBaseSetEnableBackForwardNavigationGesture):
+        (webkitWebViewBaseBeginBackSwipeForTesting):
+        (webkitWebViewBaseCompleteBackSwipeForTesting):
+        (webkit_web_view_base_class_init):
+        (webkitWebViewBaseWillSwapWebProcess):
+        (webkitWebViewBaseDidExitWebProcess):
+        (webkitWebViewBaseDidRelaunchWebProcess):
+        (webkitWebViewBaseTakeViewSnapshot):
+        (webkitWebViewBaseDidStartProvisionalLoadForMainFrame):
+        (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):
+        (webkitWebViewBaseDidFinishLoadForMainFrame):
+        (webkitWebViewBaseDidFailLoadForMainFrame):
+        (webkitWebViewBaseDidSameDocumentNavigationForMainFrame):
+        (webkitWebViewBaseDidRestoreScrollPosition):
+        (webkitWebViewBaseShowEmojiChooser):
+        (webkitWebViewBaseRequestPointerLock):
+        (webkitWebViewBaseDidLosePointerLock):
+        (webkitWebViewBaseSynthesizeCompositionKeyPress):
+        * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
+        * UIProcess/API/gtk/WebKitWebViewDialog.cpp:
+        * UIProcess/API/gtk/WebKitWebViewDialog.h:
+        * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
+        (webkitWebViewAuthenticate):
+        (webkitWebViewScriptDialog):
+        (webkitWebViewRunFileChooser):
+        (webkitWebViewMaximizeWindow):
+        (webkitWebViewMinimizeWindow):
+        (webkitWebViewRestoreWindow):
+        * UIProcess/API/gtk3/WebKitContextMenuItem.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitContextMenuItem.h.
+        * UIProcess/API/gtk3/WebKitInputMethodContext.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContext.h.
+        * UIProcess/API/gtk4/WebKitContextMenuItem.h: Renamed from Source/WebKit/UIProcess/API/gtk/WebKitContextMenuItem.h.
+        * UIProcess/API/gtk4/WebKitInputMethodContext.h: Renamed from Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContext.h.
+        * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
+        (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
+        (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
+        (WebKit::WebAutomationSession::platformSimulateKeySequence):
+        * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
+        (WebKit::RemoteWebInspectorProxy::platformSave):
+        * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::platformSave):
+        * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp:
+        (webkit_inspector_window_init):
+        (webkitInspectorWindowNew):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/cairo/BackingStoreCairo.cpp:
+        (WebKit::BackingStore::createBackend):
+        * UIProcess/glib/WebProcessPoolGLib.cpp:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
+        (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext):
+        (WebKit::AcceleratedBackingStoreWayland::paint):
+        * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
+        (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11):
+        (WebKit::AcceleratedBackingStoreX11::update):
+        * UIProcess/gtk/DragAndDropHandler.cpp:
+        * UIProcess/gtk/DragAndDropHandler.h:
+        * UIProcess/gtk/GestureController.cpp:
+        * UIProcess/gtk/GestureController.h:
+        * UIProcess/gtk/KeyBindingTranslator.cpp:
+        (WebKit::KeyBindingTranslator::KeyBindingTranslator):
+        (WebKit::KeyBindingTranslator::commandsForKeyEvent):
+        * UIProcess/gtk/KeyBindingTranslator.h:
+        * UIProcess/gtk/PointerLockManager.cpp:
+        (WebKit::PointerLockManager::lock):
+        (WebKit::PointerLockManager::unlock):
+        * UIProcess/gtk/PointerLockManager.h:
+        * UIProcess/gtk/PointerLockManagerWayland.cpp:
+        (WebKit::PointerLockManagerWayland::lock):
+        * UIProcess/gtk/PointerLockManagerX11.cpp:
+        (WebKit::PointerLockManagerX11::didReceiveMotionEvent):
+        * UIProcess/gtk/WebColorPickerGtk.cpp:
+        * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
+        (WebKit::WebContextMenuProxyGtk::show):
+        (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems):
+        (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk):
+        (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
+        * UIProcess/gtk/WebContextMenuProxyGtk.h:
+        * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp:
+        * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h:
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
+        * UIProcess/gtk/WebPopupMenuProxyGtk.h:
+        * WebProcess/Plugins/PluginController.h:
+        * WebProcess/Plugins/PluginView.cpp:
+        * WebProcess/Plugins/PluginView.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::close):
+        (WebKit::WebPage::mainFrameDidLayout):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
+        (WebKit::AcceleratedSurfaceX11::AcceleratedSurfaceX11):
+        (WebKit::AcceleratedSurfaceX11::createPixmap):
+        * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
+        (WebKit::WebPrintOperationGtk::print):
+
 2020-04-27  Rob Buis  <rbuis@igalia.com>
 
         Make loadURLIntoChildFrame private and non-exported
index 7539cc8..9631b99 100644 (file)
@@ -8,6 +8,7 @@ set(PluginProcess_OUTPUT_NAME WebKitPluginProcess)
 
 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR})
 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WEBKIT2GTK_DIR})
+file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR})
 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR})
 
 configure_file(UIProcess/API/gtk/WebKitVersion.h.in ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitVersion.h)
@@ -33,11 +34,20 @@ list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES
     "SourcesGTK.txt"
 )
 
-list(APPEND WebKit_MESSAGES_IN_FILES
-    UIProcess/ViewGestureController.messages.in
+if (NOT USE_GTK4)
+    list(APPEND WebKit_SOURCES
+        UIProcess/ViewGestureController.cpp
 
-    WebProcess/WebPage/ViewGestureGeometryCollector.messages.in
-)
+        UIProcess/gtk/ViewGestureControllerGtk.cpp
+
+        WebProcess/WebPage/ViewGestureGeometryCollector.cpp
+    )
+    list(APPEND WebKit_MESSAGES_IN_FILES
+        UIProcess/ViewGestureController.messages.in
+
+        WebProcess/WebPage/ViewGestureGeometryCollector.messages.in
+    )
+endif ()
 
 list(APPEND WebKit_DERIVED_SOURCES
     ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.c
@@ -55,9 +65,17 @@ if (ENABLE_WAYLAND_TARGET)
     )
 endif ()
 
+if (USE_GTK4)
+    set(GTK_API_VERSION 4)
+else ()
+    set(GTK_API_VERSION 3)
+endif ()
+
 set(WebKit2GTK_INSTALLED_HEADERS
     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitEnumTypes.h
     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitVersion.h
+    ${WEBKIT_DIR}/UIProcess/API/gtk${GTK_API_VERSION}/WebKitContextMenuItem.h
+    ${WEBKIT_DIR}/UIProcess/API/gtk${GTK_API_VERSION}/WebKitInputMethodContext.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitApplicationInfo.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitAuthenticationRequest.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitAutocleanups.h
@@ -68,7 +86,6 @@ set(WebKit2GTK_INSTALLED_HEADERS
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitCredential.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitContextMenu.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitContextMenuActions.h
-    ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitContextMenuItem.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitCookieManager.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitDefines.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h
@@ -84,7 +101,6 @@ set(WebKit2GTK_INSTALLED_HEADERS
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitGeolocationManager.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitGeolocationPermissionRequest.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitHitTestResult.h
-    ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitInputMethodContext.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitInstallMissingMediaPluginsPermissionRequest.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitJavascriptResult.h
     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitMimeInfo.h
@@ -365,6 +381,7 @@ set(WebKitDOM_GTKDOC_HEADERS
 # This is necessary because of a conflict between the GTK+ API WebKitVersion.h and one generated by WebCore.
 list(INSERT WebKit_INCLUDE_DIRECTORIES 0
     "${FORWARDING_HEADERS_WEBKIT2GTK_DIR}"
+    "${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}"
     "${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}"
     "${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}"
     "${DERIVED_SOURCES_WEBKIT2GTK_DIR}"
@@ -392,6 +409,7 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     "${WEBKIT_DIR}/UIProcess/API/C/cairo"
     "${WEBKIT_DIR}/UIProcess/API/C/gtk"
     "${WEBKIT_DIR}/UIProcess/API/glib"
+    "${WEBKIT_DIR}/UIProcess/API/gtk${GTK_API_VERSION}"
     "${WEBKIT_DIR}/UIProcess/API/gtk"
     "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
     "${WEBKIT_DIR}/UIProcess/Inspector/glib"
@@ -587,6 +605,7 @@ target_include_directories(webkit2gtkinjectedbundle PRIVATE
     "${DERIVED_SOURCES_DIR}/InjectedBundle"
     "${FORWARDING_HEADERS_DIR}"
     "${FORWARDING_HEADERS_WEBKIT2GTK_DIR}"
+    "${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}"
     "${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}"
 )
 
@@ -661,6 +680,7 @@ if (ENABLE_INTROSPECTION)
             -I${FORWARDING_HEADERS_DIR}
             -I${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib
             -I${FORWARDING_HEADERS_WEBKIT2GTK_DIR}
+            -I${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}
             ${WebKit2GTK_INSTALLED_HEADERS}
             ${WEBKIT_DIR}/Shared/API/glib/*.cpp
             ${WEBKIT_DIR}/UIProcess/API/glib/*.cpp
@@ -707,6 +727,7 @@ if (ENABLE_INTROSPECTION)
             -I${FORWARDING_HEADERS_DIR}
             -I${FORWARDING_HEADERS_DIR}/JavaScriptCore/glib
             -I${FORWARDING_HEADERS_WEBKIT2GTK_DIR}
+            -I${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}
             -I${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}
             -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk
             ${WebKitDOM_INSTALLED_HEADERS}
@@ -717,9 +738,9 @@ if (ENABLE_INTROSPECTION)
             ${WEBKIT_DIR}/Shared/API/glib/WebKitUserMessage.cpp
             ${WEBKIT_DIR}/Shared/API/glib/WebKitURIRequest.cpp
             ${WEBKIT_DIR}/Shared/API/glib/WebKitURIResponse.cpp
+            ${WEBKIT_DIR}/UIProcess/API/gtk${GTK_API_VERSION}/WebKitContextMenuItem.h
             ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitContextMenu.h
             ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitContextMenuActions.h
-            ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitContextMenuItem.h
             ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitHitTestResult.h
             ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitUserMessage.h
             ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitURIRequest.h
@@ -782,9 +803,11 @@ file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-webkit2gtk.cfg
     "       -I${WEBKIT_DIR}/UIProcess/API/gtk\n"
     "       -I${DERIVED_SOURCES_WEBKIT2GTK_DIR}\n"
     "       -I${FORWARDING_HEADERS_WEBKIT2GTK_DIR}\n"
+    "       -I${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}\n"
     "doc_dir=${WEBKIT_DIR}/UIProcess/API/gtk/docs\n"
     "source_dirs=${WEBKIT_DIR}/Shared/API/glib\n"
     "            ${WEBKIT_DIR}/UIProcess/API/glib\n"
+    "            ${WEBKIT_DIR}/UIProcess/API/gtk${GTK_API_VERSION}\n"
     "            ${WEBKIT_DIR}/UIProcess/API/gtk\n"
     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib\n"
     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk\n"
@@ -803,6 +826,7 @@ file(WRITE ${CMAKE_BINARY_DIR}/gtkdoc-webkitdom.cfg
     "       -I${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk/DOM\n"
     "       -I${DERIVED_SOURCES_WEBKIT2GTK_DIR}\n"
     "       -I${FORWARDING_HEADERS_WEBKIT2GTK_DIR}\n"
+    "       -I${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}\n"
     "doc_dir=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/docs\n"
     "source_dirs=${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/DOM\n"
     "            ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk/DOM\n"
@@ -821,6 +845,11 @@ add_custom_command(
     COMMAND ln -n -s -f ${WEBKIT_DIR}/UIProcess/API/gtk ${FORWARDING_HEADERS_WEBKIT2GTK_DIR}/webkit2
 )
 add_custom_command(
+    OUTPUT ${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}/webkit2
+    DEPENDS ${WEBKIT_DIR}/UIProcess/API/gtk${GTK_API_VERSION}
+    COMMAND ln -n -s -f ${WEBKIT_DIR}/UIProcess/API/gtk${GTK_API_VERSION} ${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}/webkit2
+)
+add_custom_command(
     OUTPUT ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}/webkit2
     DEPENDS ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk
     COMMAND ln -n -s -f ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}/webkit2
@@ -832,6 +861,7 @@ add_custom_command(
 )
 add_custom_target(WebKit-fake-api-headers
     DEPENDS ${FORWARDING_HEADERS_WEBKIT2GTK_DIR}/webkit2
+            ${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}/webkit2
             ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}/webkit2
             ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}/webkitdom
 )
index e5d2e29..db61493 100644 (file)
@@ -124,7 +124,7 @@ WebContextMenuItemData webkitContextMenuItemToWebContextMenuItemData(WebKitConte
     return WebContextMenuItemData(item->priv->menuItem->type(), item->priv->menuItem->action(), item->priv->menuItem->title(), item->priv->menuItem->enabled(), item->priv->menuItem->checked());
 }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
 /**
  * webkit_context_menu_item_new:
  * @action: a #GtkAction
@@ -261,7 +261,7 @@ WebKitContextMenuItem* webkit_context_menu_item_new_separator(void)
     return item;
 }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
 /**
  * webkit_context_menu_item_get_action:
  * @item: a #WebKitContextMenuItem
index f08c19f..24d54e8 100644 (file)
@@ -43,8 +43,12 @@ struct KeypressCommand;
 
 #if PLATFORM(GTK)
 #include <WebCore/GUniquePtrGtk.h>
+#if USE(GTK4)
+typedef struct _GdkEvent GdkEvent;
+#else
 typedef union _GdkEvent GdkEvent;
 #endif
+#endif
 
 #if PLATFORM(IOS_FAMILY)
 #include <wtf/RetainPtr.h>
index 0fa557e..4b8dac8 100644 (file)
@@ -35,8 +35,12 @@ OBJC_CLASS NSView;
 
 #if PLATFORM(GTK)
 #include <WebCore/GUniquePtrGtk.h>
+#if USE(GTK4)
+typedef struct _GdkEvent GdkEvent;
+#else
 typedef union _GdkEvent GdkEvent;
 #endif
+#endif
 
 #if PLATFORM(IOS_FAMILY)
 #include <wtf/RetainPtr.h>
index 3991a47..5e655b4 100644 (file)
@@ -35,8 +35,12 @@ OBJC_CLASS NSView;
 
 #if PLATFORM(GTK)
 #include <WebCore/GUniquePtrGtk.h>
+#if USE(GTK4)
+typedef struct _GdkEvent GdkEvent;
+#else
 typedef union _GdkEvent GdkEvent;
 #endif
+#endif
 
 #if USE(LIBWPE)
 struct wpe_input_axis_event;
index 23574e7..52a6383 100644 (file)
@@ -29,7 +29,7 @@
 #include "APIObject.h"
 #include <gio/gio.h>
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
 #include <gtk/gtk.h>
 #endif
 
@@ -54,7 +54,7 @@ WebContextMenuItemGlib::WebContextMenuItemGlib(const WebContextMenuItemGlib& dat
 {
     m_gAction = data.gAction();
     m_submenuItems = WTFMove(submenu);
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     m_gtkAction = data.gtkAction();
 #endif
 }
@@ -77,7 +77,7 @@ WebContextMenuItemGlib::WebContextMenuItemGlib(GAction* action, const String& ti
     createActionIfNeeded();
 }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
 WebContextMenuItemGlib::WebContextMenuItemGlib(GtkAction* action)
     : WebContextMenuItemData(GTK_IS_TOGGLE_ACTION(action) ? CheckableActionType : ActionType, ContextMenuItemBaseApplicationTag, String::fromUTF8(gtk_action_get_label(action)), gtk_action_get_sensitive(action), GTK_IS_TOGGLE_ACTION(action) ? gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)) : false)
@@ -95,7 +95,7 @@ WebContextMenuItemGlib::~WebContextMenuItemGlib()
 
 GUniquePtr<char> WebContextMenuItemGlib::buildActionName() const
 {
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     if (m_gtkAction)
         return GUniquePtr<char>(g_strdup(gtk_action_get_name(m_gtkAction)));
@@ -120,7 +120,7 @@ void WebContextMenuItemGlib::createActionIfNeeded()
         g_simple_action_set_enabled(G_SIMPLE_ACTION(m_gAction.get()), enabled());
     }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     // Create the GtkAction for backwards compatibility only.
     if (!m_gtkAction) {
index 5ffe6ab..af121dc 100644 (file)
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/glib/GUniquePtr.h>
 
+#if !USE(GTK4)
 typedef struct _GtkAction GtkAction;
 typedef struct _GAction GAction;
+#endif
 
 namespace WebKit {
 
@@ -41,7 +43,7 @@ public:
     WebContextMenuItemGlib(const WebContextMenuItemData&);
     WebContextMenuItemGlib(const WebContextMenuItemGlib&, Vector<WebContextMenuItemGlib>&& submenu);
     WebContextMenuItemGlib(GAction*, const String& title, GVariant* target = nullptr);
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     WebContextMenuItemGlib(GtkAction*);
 #endif
     ~WebContextMenuItemGlib();
@@ -52,7 +54,7 @@ public:
     GVariant* gActionTarget() const { return m_gActionTarget.get(); }
     const Vector<WebContextMenuItemGlib>& submenuItems() const { return m_submenuItems; }
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     GtkAction* gtkAction() const { return m_gtkAction; }
 #endif
 
@@ -63,7 +65,7 @@ private:
     GRefPtr<GAction> m_gAction;
     GRefPtr<GVariant> m_gActionTarget;
     Vector<WebContextMenuItemGlib> m_submenuItems;
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     GtkAction* m_gtkAction { nullptr };
 #endif
 };
index 2357f3d..8c0df42 100644 (file)
@@ -29,7 +29,7 @@
 #include "NativeWebKeyboardEvent.h"
 
 #include "WebEventFactory.h"
-#include <gdk/gdk.h>
+#include <WebCore/GtkVersioning.h>
 
 namespace WebKit {
 
index 58e37fe..c707099 100644 (file)
@@ -39,7 +39,7 @@ NativeWebMouseEvent::NativeWebMouseEvent(GdkEvent* event, int eventClickCount, O
 
 NativeWebMouseEvent::NativeWebMouseEvent(const NativeWebMouseEvent& event)
     : WebMouseEvent(WebEventFactory::createWebMouseEvent(event.nativeEvent(), event.clickCount(), WebCore::IntPoint(event.deltaX(), event.deltaY())))
-    , m_nativeEvent(gdk_event_copy(event.nativeEvent()))
+    , m_nativeEvent(gdk_event_copy(const_cast<GdkEvent*>(event.nativeEvent())))
 {
 }
 
index 5ec476b..6d0e44f 100644 (file)
@@ -41,7 +41,7 @@ NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, Vector<WebPlatformTouc
 
 NativeWebTouchEvent::NativeWebTouchEvent(const NativeWebTouchEvent& event)
     : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), Vector<WebPlatformTouchPoint>(event.touchPoints())))
-    , m_nativeEvent(gdk_event_copy(event.nativeEvent()))
+    , m_nativeEvent(gdk_event_copy(const_cast<GdkEvent*>(event.nativeEvent())))
 {
 }
 
index 5caf3d2..a600467 100644 (file)
@@ -27,7 +27,7 @@
 #include "NativeWebWheelEvent.h"
 
 #include "WebEventFactory.h"
-#include <gdk/gdk.h>
+#include <WebCore/GtkVersioning.h>
 
 namespace WebKit {
 
index a520af0..6a445f7 100644 (file)
 #include "WebEventFactory.h"
 
 #include <WebCore/GtkUtilities.h>
+#include <WebCore/GtkVersioning.h>
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <WebCore/Scrollbar.h>
 #include <WebCore/WindowsKeyboardCodes.h>
 #include <gdk/gdk.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
 #include <wtf/ASCIICType.h>
 
 namespace WebKit {
@@ -72,7 +72,7 @@ static inline OptionSet<WebEvent::Modifier> modifiersForEvent(const GdkEvent* ev
 static inline WebMouseEvent::Button buttonForEvent(const GdkEvent* event)
 {
     unsigned button = 0;
-    GdkEventType type = gdk_event_get_event_type(event);
+    GdkEventType type = gdk_event_get_event_type(const_cast<GdkEvent*>(event));
     switch (type) {
     case GDK_ENTER_NOTIFY:
     case GDK_LEAVE_NOTIFY:
@@ -89,8 +89,10 @@ static inline WebMouseEvent::Button buttonForEvent(const GdkEvent* event)
         break;
     }
     case GDK_BUTTON_PRESS:
+#if !USE(GTK4)
     case GDK_2BUTTON_PRESS:
     case GDK_3BUTTON_PRESS:
+#endif
     case GDK_BUTTON_RELEASE: {
         guint eventButton;
         gdk_event_get_button(event, &eventButton);
@@ -150,7 +152,7 @@ WebMouseEvent WebEventFactory::createWebMouseEvent(const GdkEvent* event, int cu
     WebEvent::Type type = static_cast<WebEvent::Type>(0);
     IntPoint movementDelta;
 
-    GdkEventType eventType = gdk_event_get_event_type(event);
+    GdkEventType eventType = gdk_event_get_event_type(const_cast<GdkEvent*>(event));
     switch (eventType) {
     case GDK_MOTION_NOTIFY:
     case GDK_ENTER_NOTIFY:
@@ -159,9 +161,11 @@ WebMouseEvent WebEventFactory::createWebMouseEvent(const GdkEvent* event, int cu
         if (delta)
             movementDelta = delta.value();
         break;
-    case GDK_BUTTON_PRESS:
+#if !USE(GTK4)
     case GDK_2BUTTON_PRESS:
-    case GDK_3BUTTON_PRESS: {
+    case GDK_3BUTTON_PRESS:
+#endif
+    case GDK_BUTTON_PRESS: {
         type = WebEvent::MouseDown;
         auto modifier = stateModifierForGdkButton(eventButton);
         state = static_cast<GdkModifierType>(state | modifier);
@@ -254,11 +258,16 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(const GdkEvent* event, WebWhe
 
 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent* event, const String& text, bool handledByInputMethod, Optional<Vector<CompositionUnderline>>&& preeditUnderlines, Optional<EditingRange>&& preeditSelectionRange, Vector<String>&& commands)
 {
+#if USE(GTK4)
+    guint keyval = 0;
+    guint16 keycode = 0;
+#else
     guint keyval;
     gdk_event_get_keyval(event, &keyval);
     guint16 keycode;
     gdk_event_get_keycode(event, &keycode);
-    GdkEventType type = gdk_event_get_event_type(event);
+#endif
+    GdkEventType type = gdk_event_get_event_type(const_cast<GdkEvent*>(event));
 
     return WebKeyboardEvent(
         type == GDK_KEY_RELEASE ? WebEvent::KeyUp : WebEvent::KeyDown,
@@ -281,7 +290,7 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent* event,
 WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, Vector<WebPlatformTouchPoint>&& touchPoints)
 {
     WebEvent::Type type = WebEvent::NoType;
-    GdkEventType eventType = gdk_event_get_event_type(event);
+    GdkEventType eventType = gdk_event_get_event_type(const_cast<GdkEvent*>(event));
     switch (eventType) {
     case GDK_TOUCH_BEGIN:
         type = WebEvent::TouchStart;
index 42718e2..54da89e 100644 (file)
 
 #include "WebEvent.h"
 
+#if USE(GTK4)
+typedef struct _GdkEvent GdkEvent;
+#else
 typedef union _GdkEvent GdkEvent;
+#endif
 
 namespace WebKit {
 
index eba3461..5648b7f 100644 (file)
@@ -108,7 +108,6 @@ Shared/unix/AuxiliaryProcessMain.cpp
 UIProcess/BackingStore.cpp
 UIProcess/DefaultUndoController.cpp
 UIProcess/LegacySessionStateCodingNone.cpp
-UIProcess/ViewGestureController.cpp
 UIProcess/ViewSnapshotStore.cpp
 UIProcess/WebGrammarDetail.cpp
 UIProcess/WebMemoryPressureHandler.cpp
@@ -255,7 +254,6 @@ UIProcess/gtk/PointerLockManager.cpp @no-unify
 UIProcess/gtk/PointerLockManagerWayland.cpp @no-unify
 UIProcess/gtk/PointerLockManagerX11.cpp @no-unify
 UIProcess/gtk/TextCheckerGtk.cpp @no-unify
-UIProcess/gtk/ViewGestureControllerGtk.cpp @no-unify
 UIProcess/gtk/ViewSnapshotStoreGtk.cpp
 UIProcess/gtk/WaylandCompositor.cpp @no-unify
 UIProcess/gtk/WebColorPickerGtk.cpp
@@ -413,7 +411,6 @@ WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
 WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
 
 WebProcess/WebPage/AcceleratedSurface.cpp
-WebProcess/WebPage/ViewGestureGeometryCollector.cpp
 
 WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
 WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
index 9ca0ab3..44d6e77 100644 (file)
@@ -44,7 +44,6 @@ struct NSEvent;
 #endif
 typedef NSEvent *WKNativeEventPtr;
 #elif defined(BUILDING_GTK__)
-typedef union _GdkEvent GdkEvent;
 typedef const GdkEvent* WKNativeEventPtr;
 #elif defined(WIN32)
 typedef const struct tagMSG* WKNativeEventPtr;
index ddb82a2..7660c01 100644 (file)
@@ -105,7 +105,11 @@ InputMethodFilter::FilterResult InputMethodFilter::filterKeyEvent(PlatformEventK
     m_filteringContext.preeditChanged = false;
     m_compositionResult = { };
 
+#if PLATFORM(WPE) || USE(GTK4)
     bool handled = webkit_input_method_context_filter_key_event(m_context.get(), keyEvent);
+#else
+    bool handled = webkit_input_method_context_filter_key_event(m_context.get(), reinterpret_cast<GdkEventKey*>(keyEvent));
+#endif
     if (!handled)
         return { };
 
index a110d95..77c84ab 100644 (file)
 typedef struct _WebKitInputMethodContext WebKitInputMethodContext;
 
 #if PLATFORM(GTK)
-typedef struct _GdkEventKey GdkEventKey;
+#if USE(GTK4)
+typedef struct _GdkEvent GdkEvent;
+#else
+typedef union _GdkEvent GdkEvent;
+#endif
 #elif PLATFORM(WPE)
 struct wpe_input_keyboard_event;
 #endif
@@ -53,7 +57,7 @@ public:
     void setState(Optional<InputMethodState>&&);
 
 #if PLATFORM(GTK)
-    using PlatformEventKey = GdkEventKey;
+    using PlatformEventKey = GdkEvent;
 #elif PLATFORM(WPE)
     using PlatformEventKey = struct wpe_input_keyboard_event;
 #endif
index 50e17e3..68a3406 100644 (file)
@@ -27,7 +27,7 @@
 
 #if ENABLE(VIDEO)
 #include <WebCore/PlatformDisplay.h>
-#if PLATFORM(X11)
+#if PLATFORM(X11) && !USE(GTK4)
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #endif
@@ -70,7 +70,7 @@ WEBKIT_DEFINE_TYPE_WITH_CODE(
 #if ENABLE(VIDEO)
 static GUniquePtr<GstInstallPluginsContext> createGstInstallPluginsContext(WebPageProxy& page)
 {
-#if PLATFORM(X11)
+#if PLATFORM(X11) && !USE(GTK4)
     if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
         GUniquePtr<GstInstallPluginsContext> context(gst_install_plugins_context_new());
         gst_install_plugins_context_set_xid(context.get(), GDK_WINDOW_XID(gtk_widget_get_window(page.viewWidget())));
index 85dd40e..90a5e78 100644 (file)
@@ -25,7 +25,7 @@
 #include "WebKitError.h"
 
 #if PLATFORM(GTK)
-#include <gdk/gdk.h>
+#include <WebCore/GtkVersioning.h>
 #elif PLATFORM(WPE)
 #include <wpe/wpe.h>
 #endif
index 13f733c..f9a1add 100644 (file)
@@ -41,6 +41,7 @@
 
 #if PLATFORM(GTK)
 #include <WebCore/GtkUtilities.h>
+#include <WebCore/GtkVersioning.h>
 #endif
 
 using namespace WebKit;
@@ -160,12 +161,12 @@ private:
         RunLoop::current().stop();
         return FALSE;
     }
+#endif // PLATFORM(GTK) && !USE(GTK4)
 
     void setWindowFrameTimerFired()
     {
         RunLoop::current().stop();
     }
-#endif // PLATFORM(GTK) && !USE(GTK4)
 
     void setWindowFrame(WebPageProxy&, const WebCore::FloatRect& frame) final
     {
@@ -215,7 +216,9 @@ private:
             timer->startOneShot(200_ms);
             RunLoop::run();
             timer = nullptr;
+#if !USE(GTK4)
             g_signal_handler_disconnect(window, signalID);
+#endif
         } else
             webkitWindowPropertiesSetGeometry(webkit_web_view_get_window_properties(m_webView), &geometry);
 #endif // PLATFORM(GTK)
index 4b7f221..7222a91 100644 (file)
@@ -121,8 +121,10 @@ enum {
     PROP_WEBSITE_DATA_MANAGER,
 #if PLATFORM(GTK)
     PROP_PSON_ENABLED,
+#if !USE(GTK4)
     PROP_USE_SYSYEM_APPEARANCE_FOR_SCROLLBARS
 #endif
+#endif
 };
 
 enum {
@@ -337,10 +339,12 @@ static void webkitWebContextGetProperty(GObject* object, guint propID, GValue* v
     case PROP_PSON_ENABLED:
         g_value_set_boolean(value, context->priv->psonEnabled);
         break;
+#if !USE(GTK4)
     case PROP_USE_SYSYEM_APPEARANCE_FOR_SCROLLBARS:
         g_value_set_boolean(value, webkit_web_context_get_use_system_appearance_for_scrollbars(context));
         break;
 #endif
+#endif
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
     }
@@ -365,10 +369,12 @@ static void webkitWebContextSetProperty(GObject* object, guint propID, const GVa
     case PROP_PSON_ENABLED:
         context->priv->psonEnabled = g_value_get_boolean(value);
         break;
+#if !USE(GTK4)
     case PROP_USE_SYSYEM_APPEARANCE_FOR_SCROLLBARS:
         webkit_web_context_set_use_system_appearance_for_scrollbars(context, g_value_get_boolean(value));
         break;
 #endif
+#endif
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
     }
@@ -533,6 +539,7 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
             FALSE,
             static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
 
+#if !USE(GTK4)
     /**
      * WebKitWebContext:use-system-appearance-for-scrollbars:
      *
@@ -554,6 +561,7 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
             TRUE,
             static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
 #endif
+#endif
 
     /**
      * WebKitWebContext::download-started:
index b743a0d..cb995ba 100644 (file)
@@ -2350,7 +2350,7 @@ void webkitWebViewRunAsModal(WebKitWebView* webView)
 
     webView->priv->modalLoop = adoptGRef(g_main_loop_new(0, FALSE));
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
 // This is to suppress warnings about gdk_threads_leave and gdk_threads_enter.
     ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     gdk_threads_leave();
@@ -2358,7 +2358,7 @@ void webkitWebViewRunAsModal(WebKitWebView* webView)
 
     g_main_loop_run(webView->priv->modalLoop.get());
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     gdk_threads_enter();
     ALLOW_DEPRECATED_DECLARATIONS_END
 #endif
@@ -2580,13 +2580,16 @@ void webkitWebViewRunFileChooserRequest(WebKitWebView* webView, WebKitFileChoose
 }
 
 #if PLATFORM(GTK)
+#if !USE(GTK4)
 static void contextMenuDismissed(GtkMenuShell*, WebKitWebView* webView)
 {
     g_signal_emit(webView, signals[CONTEXT_MENU_DISMISSED], 0, NULL);
 }
+#endif
 
 void webkitWebViewPopulateContextMenu(WebKitWebView* webView, const Vector<WebContextMenuItemData>& proposedMenu, const WebHitTestResultData& hitTestResultData, GVariant* userData)
 {
+#if !USE(GTK4)
     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView);
     WebContextMenuProxyGtk* contextMenuProxy = webkitWebViewBaseGetActiveContextMenuProxy(webViewBase);
     ASSERT(contextMenuProxy);
@@ -2610,6 +2613,7 @@ void webkitWebViewPopulateContextMenu(WebKitWebView* webView, const Vector<WebCo
 
     // Clear the menu to make sure it's useless after signal emission.
     webkit_context_menu_remove_all(contextMenu.get());
+#endif
 }
 #elif PLATFORM(WPE)
 void webkitWebViewPopulateContextMenu(WebKitWebView* webView, const Vector<WebContextMenuItemData>& proposedMenu, const WebHitTestResultData& hitTestResultData, GVariant* userData)
index 8d85da7..8a08f6f 100644 (file)
@@ -38,7 +38,7 @@ IntRect InputMethodFilter::platformTransformCursorRectToViewCoordinates(const In
 
 bool InputMethodFilter::platformEventKeyIsKeyPress(PlatformEventKey* event) const
 {
-    return event->type == GDK_KEY_PRESS;
+    return gdk_event_get_event_type(event) == GDK_KEY_PRESS;
 }
 
 } // namespace WebKit
index a68a309..59a282c 100644 (file)
@@ -70,6 +70,9 @@ std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy(WebProc
 
 void PageClientImpl::setViewNeedsDisplay(const WebCore::Region& region)
 {
+#if USE(GTK4)
+    gtk_widget_queue_draw(m_viewWidget);
+#else
     WebPageProxy* pageProxy = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
     ASSERT(pageProxy);
 
@@ -81,6 +84,7 @@ void PageClientImpl::setViewNeedsDisplay(const WebCore::Region& region)
     }
 
     gtk_widget_queue_draw_region(m_viewWidget, toCairoRegion(region).get());
+#endif
 }
 
 void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&)
@@ -148,11 +152,18 @@ void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
     // http://bugs.webkit.org/show_bug.cgi?id=16388
     // Setting the cursor may be an expensive operation in some backends,
     // so don't re-set the cursor if it's already set to the target value.
+#if USE(GTK4)
+    GdkCursor* currentCursor = gtk_widget_get_cursor(m_viewWidget);
+    GdkCursor* newCursor = cursor.platformCursor().get();
+    if (currentCursor != newCursor)
+        gtk_widget_set_cursor(m_viewWidget, newCursor);
+#else
     GdkWindow* window = gtk_widget_get_window(m_viewWidget);
     GdkCursor* currentCursor = gdk_window_get_cursor(window);
     GdkCursor* newCursor = cursor.platformCursor().get();
     if (currentCursor != newCursor)
         gdk_window_set_cursor(window, newCursor);
+#endif
 }
 
 void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
@@ -230,17 +241,22 @@ void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool
 {
     if (wasEventHandled)
         return;
-
+#if !USE(GTK4)
     WebKitWebViewBase* webkitWebViewBase = WEBKIT_WEB_VIEW_BASE(m_viewWidget);
     webkitWebViewBaseForwardNextKeyEvent(webkitWebViewBase);
     gtk_main_do_event(event.nativeEvent());
+#endif
 }
 
 RefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy& page)
 {
+#if USE(GTK4)
+    return nullptr;
+#else
     if (WEBKIT_IS_WEB_VIEW(m_viewWidget))
         return WebKitPopupMenu::create(m_viewWidget, page);
     return WebPopupMenuProxyGtk::create(m_viewWidget, page);
+#endif
 }
 
 Ref<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy& page, ContextMenuContextData&& context, const UserData& userData)
@@ -258,7 +274,11 @@ RefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, con
 #if ENABLE(DATALIST_ELEMENT)
 RefPtr<WebDataListSuggestionsDropdown> PageClientImpl::createDataListSuggestionsDropdown(WebPageProxy& page)
 {
+#if USE(GTK4)
+    return nullptr;
+#else
     return WebDataListSuggestionsDropdownGtk::create(m_viewWidget, page);
+#endif
 }
 #endif
 
@@ -307,12 +327,14 @@ void PageClientImpl::didChangeContentSize(const IntSize& size)
 #if ENABLE(DRAG_SUPPORT)
 void PageClientImpl::startDrag(Ref<SelectionData>&& selection, DragOperation dragOperation, RefPtr<ShareableBitmap>&& dragImage)
 {
+#if !USE(GTK4)
     WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(m_viewWidget);
     webkitWebViewBaseDragAndDropHandler(webView).startDrag(WTFMove(selection), dragOperation, WTFMove(dragImage));
 
     // A drag starting should prevent a double-click from happening. This might
     // happen if a drag is followed very quickly by another click (like in the WTR).
     webkitWebViewBaseResetClickCounter(webView);
+#endif
 }
 #endif
 
@@ -386,6 +408,7 @@ void PageClientImpl::beganExitFullScreen(const IntRect& /* initialFrame */, cons
 #if ENABLE(TOUCH_EVENTS)
 void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
 {
+#if !USE(GTK4)
     const GdkEvent* touchEvent = event.nativeEvent();
 
     GestureController& gestureController = webkitWebViewBaseGestureController(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
@@ -441,11 +464,13 @@ void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& event, bool w
     pointerEvent->any.send_event = TRUE;
 
     gtk_widget_event(m_viewWidget, pointerEvent.get());
+#endif
 }
 #endif // ENABLE(TOUCH_EVENTS)
 
 void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent& event)
 {
+#if !USE(GTK4)
     ViewGestureController* controller = webkitWebViewBaseViewGestureController(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
     if (controller && controller->isSwipeGestureEnabled()) {
         controller->wheelEventWasNotHandledByWebCore(&event.nativeEvent()->scroll);
@@ -454,6 +479,7 @@ void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&
 
     webkitWebViewBaseForwardNextWheelEvent(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
     gtk_main_do_event(event.nativeEvent());
+#endif
 }
 
 void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String&, const IPC::DataReference&)
index 1674ee1..acfd303 100644 (file)
@@ -20,6 +20,8 @@
 #include "config.h"
 #include "WebKitAuthenticationDialog.h"
 
+#if !USE(GTK4)
+
 #include "AuthenticationDecisionListener.h"
 #include "WebKitAuthenticationRequestPrivate.h"
 #include "WebKitCredentialPrivate.h"
@@ -235,3 +237,5 @@ GtkWidget* webkitAuthenticationDialogNew(WebKitAuthenticationRequest* request, C
     webkitAuthenticationDialogInitialize(authDialog);
     return GTK_WIDGET(authDialog);
 }
+
+#endif
index 7e689fa..4d03ebc 100644 (file)
@@ -19,6 +19,8 @@
 
 #pragma once
 
+#if !USE(GTK4)
+
 #include "WebKitAuthenticationRequest.h"
 #include "WebKitWebViewDialog.h"
 #include <gtk/gtk.h>
@@ -56,3 +58,4 @@ GtkWidget* webkitAuthenticationDialogNew(WebKitAuthenticationRequest*, Credentia
 
 G_END_DECLS
 
+#endif
index f30d8ef..17e9430 100644 (file)
@@ -25,7 +25,7 @@
 #include "config.h"
 #include "WebKitEmojiChooser.h"
 
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
 
 #include <glib/gi18n-lib.h>
 #include <wtf/HashSet.h>
@@ -637,4 +637,4 @@ GtkWidget* webkitEmojiChooserNew()
     return GTK_WIDGET(authDialog);
 }
 
-#endif // GTK_CHECK_VERSION(3, 24, 0)
+#endif // GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
index 2b3d0e5..e5e4070 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <gtk/gtk.h>
 
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
 
 G_BEGIN_DECLS
 
@@ -51,4 +51,4 @@ GtkWidget* webkitEmojiChooserNew();
 
 G_END_DECLS
 
-#endif // GTK_CHECK_VERSION(3, 24, 0)
+#endif // GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
index e275650..8e5e5f9 100644 (file)
@@ -60,7 +60,11 @@ void webkit_input_method_underline_set_color(WebKitInputMethodUnderline* underli
  *
  * Since: 2.28
  */
+#if USE(GTK4)
+gboolean webkit_input_method_context_filter_key_event(WebKitInputMethodContext* context, GdkEvent* keyEvent)
+#else
 gboolean webkit_input_method_context_filter_key_event(WebKitInputMethodContext* context, GdkEventKey* keyEvent)
+#endif
 {
     g_return_val_if_fail(WEBKIT_IS_INPUT_METHOD_CONTEXT(context), FALSE);
     g_return_val_if_fail(keyEvent, FALSE);
index 2e70976..11b0de4 100644 (file)
@@ -168,7 +168,11 @@ static void webkitInputMethodContextImplGtkGetPreedit(WebKitInputMethodContext*
         *cursorOffset = clampTo<unsigned>(offset);
 }
 
+#if USE(GTK4)
+static gboolean webkitInputMethodContextImplGtkFilterKeyEvent(WebKitInputMethodContext* context, GdkEvent* keyEvent)
+#else
 static gboolean webkitInputMethodContextImplGtkFilterKeyEvent(WebKitInputMethodContext* context, GdkEventKey* keyEvent)
+#endif
 {
     auto* priv = WEBKIT_INPUT_METHOD_CONTEXT_IMPL_GTK(context)->priv;
     return gtk_im_context_filter_keypress(priv->context.get(), keyEvent);
@@ -229,5 +233,7 @@ WebKitInputMethodContext* webkitInputMethodContextImplGtkNew()
 
 void webkitInputMethodContextImplGtkSetClientWindow(WebKitInputMethodContextImplGtk* context, GdkWindow* window)
 {
+#if !USE(GTK4)
     gtk_im_context_set_client_window(context->priv->context.get(), window);
+#endif
 }
index 8b11eac..a4fb592 100644 (file)
@@ -28,17 +28,24 @@ namespace WebKit {
 using namespace WebCore;
 
 WebKitPopupMenu::WebKitPopupMenu(GtkWidget* webView, WebPopupMenuProxy::Client& client)
+#if USE(GTK4)
+    : WebPopupMenuProxy(client)
+#else
     : WebPopupMenuProxyGtk(webView, client)
+#endif
 {
 }
 
+#if !USE(GTK4)
 static void menuCloseCallback(WebKitPopupMenu* popupMenu)
 {
     popupMenu->activateItem(WTF::nullopt);
 }
+#endif
 
 void WebKitPopupMenu::showPopupMenu(const IntRect& rect, TextDirection direction, double pageScaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& platformData, int32_t selectedIndex)
 {
+#if !USE(GTK4)
     GRefPtr<WebKitOptionMenu> menu = adoptGRef(webkitOptionMenuCreate(*this, items, selectedIndex));
     const GdkEvent* event = m_client->currentlyProcessedMouseDownEvent() ? m_client->currentlyProcessedMouseDownEvent()->nativeEvent() : nullptr;
     if (webkitWebViewShowOptionMenu(WEBKIT_WEB_VIEW(m_webView), rect, menu.get(), event)) {
@@ -46,28 +53,34 @@ void WebKitPopupMenu::showPopupMenu(const IntRect& rect, TextDirection direction
         g_signal_connect_swapped(m_menu.get(), "close", G_CALLBACK(menuCloseCallback), this);
     } else
         WebPopupMenuProxyGtk::showPopupMenu(rect, direction, pageScaleFactor, items, platformData, selectedIndex);
+#endif
 }
 
 void WebKitPopupMenu::hidePopupMenu()
 {
+#if !USE(GTK4)
     if (!m_menu) {
         WebPopupMenuProxyGtk::hidePopupMenu();
         return;
     }
     g_signal_handlers_disconnect_matched(m_menu.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
     webkit_option_menu_close(m_menu.get());
+#endif
 }
 
 void WebKitPopupMenu::cancelTracking()
 {
+#if !USE(GTK4)
     if (!m_menu) {
         WebPopupMenuProxyGtk::cancelTracking();
         return;
     }
     hidePopupMenu();
     m_menu = nullptr;
+#endif
 }
 
+#if !USE(GTK4)
 void WebKitPopupMenu::activateItem(Optional<unsigned> itemIndex)
 {
     WebPopupMenuProxyGtk::activateItem(itemIndex);
@@ -76,5 +89,6 @@ void WebKitPopupMenu::activateItem(Optional<unsigned> itemIndex)
         m_menu = nullptr;
     }
 }
+#endif
 
 } // namespace WebKit
index 84ba688..b3524a7 100644 (file)
@@ -26,7 +26,11 @@ typedef struct _WebKitOptionMenu WebKitOptionMenu;
 
 namespace WebKit {
 
+#if USE(GTK4)
+class WebKitPopupMenu final : public WebPopupMenuProxy {
+#else
 class WebKitPopupMenu final : public WebPopupMenuProxyGtk {
+#endif
 public:
     static Ref<WebKitPopupMenu> create(GtkWidget* webView, WebPopupMenuProxy::Client& client)
     {
@@ -34,7 +38,12 @@ public:
     }
     ~WebKitPopupMenu() = default;
 
+#if USE(GTK4)
+    void selectItem(unsigned) { };
+    void activateItem(Optional<unsigned>) { };
+#else
     void activateItem(Optional<unsigned> itemIndex) override;
+#endif
 
 private:
     WebKitPopupMenu(GtkWidget*, WebPopupMenuProxy::Client&);
@@ -43,7 +52,10 @@ private:
     void hidePopupMenu() override;
     void cancelTracking() override;
 
+#if !USE(GTK4)
     GRefPtr<WebKitOptionMenu> m_menu;
+#endif
 };
 
 } // namespace WebKit
+
index 40834a8..67eccad 100644 (file)
@@ -26,6 +26,7 @@
 #include "WebKitWebViewPrivate.h"
 #include "WebPageProxy.h"
 #include <WebCore/GtkUtilities.h>
+#include <WebCore/GtkVersioning.h>
 #include <WebCore/NotImplemented.h>
 #include <glib/gi18n-lib.h>
 #include <wtf/glib/GRefPtr.h>
index 0f2cc27..9303e41 100644 (file)
 
 void webkitScriptDialogAccept(WebKitScriptDialog* scriptDialog)
 {
+#if !USE(GTK4)
     if (!WEBKIT_IS_SCRIPT_DIALOG_IMPL(scriptDialog->nativeDialog))
         return;
     webkitScriptDialogImplConfirm(WEBKIT_SCRIPT_DIALOG_IMPL(scriptDialog->nativeDialog));
+#endif
 }
 
 void webkitScriptDialogDismiss(WebKitScriptDialog* scriptDialog)
 {
+#if !USE(GTK4)
     if (!WEBKIT_IS_SCRIPT_DIALOG_IMPL(scriptDialog->nativeDialog))
         return;
     webkitScriptDialogImplCancel(WEBKIT_SCRIPT_DIALOG_IMPL(scriptDialog->nativeDialog));
+#endif
 }
 
 void webkitScriptDialogSetUserInput(WebKitScriptDialog* scriptDialog, const String& userInput)
 {
+#if !USE(GTK4)
     if (!WEBKIT_IS_SCRIPT_DIALOG_IMPL(scriptDialog->nativeDialog))
         return;
 
     webkitScriptDialogImplSetEntryText(WEBKIT_SCRIPT_DIALOG_IMPL(scriptDialog->nativeDialog), userInput);
+#endif
 }
index d504a11..b675486 100644 (file)
@@ -20,6 +20,8 @@
 #include "config.h"
 #include "WebKitScriptDialogImpl.h"
 
+#if !USE(GTK4)
+
 #include "WebKitScriptDialogPrivate.h"
 #include <glib/gi18n-lib.h>
 #include <wtf/glib/WTFGType.h>
@@ -272,3 +274,5 @@ void webkitScriptDialogImplSetEntryText(WebKitScriptDialogImpl* dialog, const St
 
     gtk_entry_set_text(GTK_ENTRY(dialog->priv->entry), text.utf8().data());
 }
+
+#endif
index 7f863c4..7c12f01 100644 (file)
@@ -19,6 +19,8 @@
 
 #pragma once
 
+#if !USE(GTK4)
+
 #include "WebKitScriptDialog.h"
 #include "WebKitWebViewDialog.h"
 #include <wtf/text/WTFString.h>
@@ -53,3 +55,5 @@ void webkitScriptDialogImplConfirm(WebKitScriptDialogImpl*);
 void webkitScriptDialogImplSetEntryText(WebKitScriptDialogImpl*, const String&);
 
 G_END_DECLS
+
+#endif
index be387d1..2798c3d 100644 (file)
@@ -56,6 +56,7 @@
 #include <WebCore/CairoUtilities.h>
 #include <WebCore/GUniquePtrGtk.h>
 #include <WebCore/GtkUtilities.h>
+#include <WebCore/GtkVersioning.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/PasteboardHelper.h>
 #include <WebCore/PlatformDisplay.h>
 #include "WebFullScreenManagerProxy.h"
 #endif
 
-#if PLATFORM(X11)
-#include <gdk/gdkx.h>
-#endif
-
 using namespace WebKit;
 using namespace WebCore;
 
@@ -96,6 +93,7 @@ public:
 
     int currentClickCountForGdkButtonEvent(GdkEvent* event)
     {
+#if !USE(GTK4)
         int doubleClickDistance = 250;
         int doubleClickTime = 5;
         g_object_get(gtk_settings_get_for_screen(gdk_event_get_screen(event)),
@@ -132,6 +130,7 @@ public:
         previousClickPoint = IntPoint(x, y);
         previousClickButton = button;
         previousClickTime = eventTime;
+#endif
 
         return currentClickCount;
     }
@@ -149,11 +148,11 @@ typedef HashMap<uint32_t, GUniquePtr<GdkEvent>> TouchEventsMap;
 struct _WebKitWebViewBasePrivate {
     _WebKitWebViewBasePrivate()
         : updateActivityStateTimer(RunLoop::main(), this, &_WebKitWebViewBasePrivate::updateActivityStateTimerFired)
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
         , releaseEmojiChooserTimer(RunLoop::main(), this, &_WebKitWebViewBasePrivate::releaseEmojiChooserTimerFired)
 #endif
     {
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
         releaseEmojiChooserTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
 #endif
     }
@@ -166,7 +165,7 @@ struct _WebKitWebViewBasePrivate {
         activityStateFlagsToUpdate = { };
     }
 
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
     void releaseEmojiChooserTimerFired()
     {
         if (emojiChooser) {
@@ -190,7 +189,9 @@ struct _WebKitWebViewBasePrivate {
     AttachmentSide inspectorAttachmentSide { AttachmentSide::Bottom };
     unsigned inspectorViewSize { 0 };
     GUniquePtr<GdkEvent> contextMenuEvent;
+#if !USE(GTK4)
     WebContextMenuProxyGtk* activeContextMenuProxy { nullptr };
+#endif
     InputMethodFilter inputMethodFilter;
     KeyBindingTranslator keyBindingTranslator;
     TouchEventsMap touchEvents;
@@ -217,15 +218,17 @@ struct _WebKitWebViewBasePrivate {
 
     std::unique_ptr<AcceleratedBackingStore> acceleratedBackingStore;
 
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
     std::unique_ptr<DragAndDropHandler> dragAndDropHandler;
 #endif
 
+#if !USE(GTK4)
     std::unique_ptr<GestureController> gestureController;
     std::unique_ptr<ViewGestureController> viewGestureController;
     bool isBackForwardNavigationGestureEnabled { false };
+#endif
 
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
     GtkWidget* emojiChooser;
     CompletionHandler<void(String)> emojiChooserCompletionHandler;
     RunLoop::Timer<WebKitWebViewBasePrivate> releaseEmojiChooserTimer;
@@ -274,6 +277,7 @@ static gboolean toplevelWindowFocusOutEvent(GtkWidget*, GdkEventFocus*, WebKitWe
     return FALSE;
 }
 
+#if !USE(GTK4)
 static gboolean toplevelWindowStateEvent(GtkWidget*, GdkEventWindowState* event, WebKitWebViewBase* webViewBase)
 {
     WebKitWebViewBasePrivate* priv = webViewBase->priv;
@@ -292,6 +296,7 @@ static gboolean toplevelWindowStateEvent(GtkWidget*, GdkEventWindowState* event,
 
     return FALSE;
 }
+#endif
 
 static void themeChanged(WebKitWebViewBase* webViewBase)
 {
@@ -372,8 +377,10 @@ static void webkitWebViewBaseSetToplevelOnScreenWindow(WebKitWebViewBase* webVie
     priv->toplevelFocusOutEventID =
         g_signal_connect(priv->toplevelOnScreenWindow, "focus-out-event",
                          G_CALLBACK(toplevelWindowFocusOutEvent), webViewBase);
+#if !USE(GTK4)
     priv->toplevelWindowStateEventID =
         g_signal_connect(priv->toplevelOnScreenWindow, "window-state-event", G_CALLBACK(toplevelWindowStateEvent), webViewBase);
+#endif
 
     auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
     priv->themeChangedID =
@@ -392,6 +399,9 @@ static void webkitWebViewBaseRealize(GtkWidget* widget)
     WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(widget);
     WebKitWebViewBasePrivate* priv = webView->priv;
 
+#if USE(GTK4)
+    GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->realize(widget);
+#else
     gtk_widget_set_realized(widget, TRUE);
 
     GtkAllocation allocation;
@@ -432,6 +442,7 @@ static void webkitWebViewBaseRealize(GtkWidget* widget)
     auto* imContext = priv->inputMethodFilter.context();
     if (WEBKIT_IS_INPUT_METHOD_CONTEXT_IMPL_GTK(imContext))
         webkitInputMethodContextImplGtkSetClientWindow(WEBKIT_INPUT_METHOD_CONTEXT_IMPL_GTK(imContext), window);
+#endif
 
     if (priv->acceleratedBackingStore)
         priv->acceleratedBackingStore->realize();
@@ -524,8 +535,15 @@ static void webkitWebViewBaseContainerRemove(GtkContainer* container, GtkWidget*
         gtk_widget_queue_resize(widgetContainer);
 }
 
+#if USE(GTK4)
+static void webkitWebViewBaseContainerForall(GtkContainer* container, GtkCallback callback, gpointer callbackData)
+#else
 static void webkitWebViewBaseContainerForall(GtkContainer* container, gboolean includeInternals, GtkCallback callback, gpointer callbackData)
+#endif
 {
+#if USE(GTK4)
+    bool includeInternals = true;
+#endif
     WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container);
     WebKitWebViewBasePrivate* priv = webView->priv;
 
@@ -551,7 +569,7 @@ void webkitWebViewBaseChildMoveResize(WebKitWebViewBase* webView, GtkWidget* chi
     gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webView));
 }
 
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
 static void webkitWebViewBaseCompleteEmojiChooserRequest(WebKitWebViewBase* webView, const String& text)
 {
     if (auto completionHandler = std::exchange(webView->priv->emojiChooserCompletionHandler, nullptr))
@@ -565,7 +583,7 @@ static void webkitWebViewBaseDispose(GObject* gobject)
     webkitWebViewBaseSetToplevelOnScreenWindow(webView, nullptr);
     if (webView->priv->accessible)
         webkitWebViewAccessibleSetWebView(WEBKIT_WEB_VIEW_ACCESSIBLE(webView->priv->accessible.get()), nullptr);
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
     webkitWebViewBaseCompleteEmojiChooserRequest(webView, emptyString());
 #endif
     if (webView->priv->pointerLockManager) {
@@ -585,15 +603,18 @@ static void webkitWebViewBaseConstructed(GObject* object)
 
     GtkWidget* viewWidget = GTK_WIDGET(object);
     gtk_widget_set_can_focus(viewWidget, TRUE);
+#if !USE(GTK4)
     gtk_drag_dest_set(viewWidget, static_cast<GtkDestDefaults>(0), nullptr, 0,
         static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE));
     gtk_drag_dest_set_target_list(viewWidget, PasteboardHelper::singleton().targetList());
+#endif
 
     WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(object)->priv;
     priv->pageClient = makeUnique<PageClientImpl>(viewWidget);
     priv->dialog = nullptr;
 }
 
+#if !USE(GTK4)
 static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr)
 {
     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
@@ -627,6 +648,7 @@ static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr)
 
     return FALSE;
 }
+#endif
 
 static void webkitWebViewBaseChildAllocate(GtkWidget* child, gpointer userData)
 {
@@ -644,9 +666,19 @@ static void webkitWebViewBaseChildAllocate(GtkWidget* child, gpointer userData)
     priv->children.set(child, IntRect());
 }
 
+#if USE(GTK4)
+static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, int width, int height, int baseline)
+#else
 static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation)
+#endif
 {
+#if USE(GTK4)
+    GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, width, height, baseline);
+    GtkAllocation allocationStack = { 0, 0, width, height };
+    GtkAllocation* allocation = &allocationStack;
+#else
     GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation);
+#endif
 
     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
     gtk_container_foreach(GTK_CONTAINER(webViewBase), webkitWebViewBaseChildAllocate, webViewBase);
@@ -688,6 +720,7 @@ static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allo
         drawingArea->setSize(viewRect.size());
 }
 
+#if !USE(GTK4)
 static void webkitWebViewBaseGetPreferredWidth(GtkWidget* widget, gint* minimumSize, gint* naturalSize)
 {
     WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
@@ -701,6 +734,7 @@ static void webkitWebViewBaseGetPreferredHeight(GtkWidget* widget, gint* minimum
     *minimumSize = 0;
     *naturalSize = priv->contentsSize.height();
 }
+#endif
 
 static void webkitWebViewBaseMap(GtkWidget* widget)
 {
@@ -737,6 +771,7 @@ static void webkitWebViewBaseUnmap(GtkWidget* widget)
     webkitWebViewBaseScheduleUpdateActivityState(webViewBase, ActivityState::IsVisible);
 }
 
+#if !USE(GTK4)
 static gboolean webkitWebViewBaseFocusInEvent(GtkWidget* widget, GdkEventFocus* event)
 {
     WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
@@ -799,7 +834,7 @@ static gboolean webkitWebViewBaseKeyPressEvent(GtkWidget* widget, GdkEventKey* k
         priv->shouldForwardNextKeyEvent = FALSE;
         return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_press_event(widget, keyEvent);
     }
-    auto filterResult = priv->inputMethodFilter.filterKeyEvent(keyEvent);
+    auto filterResult = priv->inputMethodFilter.filterKeyEvent(reinterpret_cast<GdkEvent*>(keyEvent));
     if (!filterResult.handled) {
         priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(keyEvent), filterResult.keyText,
             NativeWebKeyboardEvent::HandledByInputMethod::No, WTF::nullopt, WTF::nullopt, priv->keyBindingTranslator.commandsForKeyEvent(keyEvent)));
@@ -818,7 +853,7 @@ static gboolean webkitWebViewBaseKeyReleaseEvent(GtkWidget* widget, GdkEventKey*
         return GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->key_release_event(widget, keyEvent);
     }
 
-    if (!priv->inputMethodFilter.filterKeyEvent(keyEvent).handled) {
+    if (!priv->inputMethodFilter.filterKeyEvent(reinterpret_cast<GdkEvent*>(keyEvent)).handled) {
         priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(keyEvent), { },
             NativeWebKeyboardEvent::HandledByInputMethod::No, WTF::nullopt, WTF::nullopt, { }));
     }
@@ -1043,8 +1078,9 @@ static gboolean webkitWebViewBaseCrossingNotifyEvent(GtkWidget* widget, GdkEvent
 
     return GDK_EVENT_PROPAGATE;
 }
+#endif
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(TOUCH_EVENTS) && !USE(GTK4)
 static void appendTouchEvent(Vector<WebPlatformTouchPoint>& touchPoints, const GdkEvent* event, WebPlatformTouchPoint::TouchPointState state)
 {
     gdouble x, y;
@@ -1134,6 +1170,7 @@ static gboolean webkitWebViewBaseTouchEvent(GtkWidget* widget, GdkEventTouch* ev
 }
 #endif // ENABLE(TOUCH_EVENTS)
 
+#if !USE(GTK4)
 class TouchGestureController final : public GestureControllerClient {
     WTF_MAKE_FAST_ALLOCATED;
 
@@ -1260,36 +1297,44 @@ GestureController& webkitWebViewBaseGestureController(WebKitWebViewBase* webView
         priv->gestureController = makeUnique<GestureController>(GTK_WIDGET(webViewBase), makeUnique<TouchGestureController>(webViewBase));
     return *priv->gestureController;
 }
+#endif
 
 void webkitWebViewBaseSetEnableBackForwardNavigationGesture(WebKitWebViewBase* webViewBase, bool enabled)
 {
     WebKitWebViewBasePrivate* priv = webViewBase->priv;
-
+#if !USE(GTK4)
     priv->isBackForwardNavigationGestureEnabled = enabled;
 
     if (auto* controller = webkitWebViewBaseViewGestureController(webViewBase))
         controller->setSwipeGestureEnabled(enabled);
 
     priv->pageProxy->setShouldRecordNavigationSnapshots(enabled);
+#endif
 }
 
+#if !USE(GTK4)
 ViewGestureController* webkitWebViewBaseViewGestureController(WebKitWebViewBase* webViewBase)
 {
     return webViewBase->priv->viewGestureController.get();
 }
+#endif
 
 bool webkitWebViewBaseBeginBackSwipeForTesting(WebKitWebViewBase* webViewBase)
 {
+#if !USE(GTK4)
     if (auto* gestureController = webkitWebViewBaseViewGestureController(webViewBase))
         return gestureController->beginSimulatedSwipeInDirectionForTesting(ViewGestureController::SwipeDirection::Back);
+#endif
 
     return FALSE;
 }
 
 bool webkitWebViewBaseCompleteBackSwipeForTesting(WebKitWebViewBase* webViewBase)
 {
+#if !USE(GTK4)
     if (auto* gestureController = webkitWebViewBaseViewGestureController(webViewBase))
         return gestureController->completeSimulatedSwipeInDirectionForTesting(ViewGestureController::SwipeDirection::Back);
+#endif
 
     return FALSE;
 }
@@ -1317,7 +1362,7 @@ static gboolean webkitWebViewBaseQueryTooltip(GtkWidget* widget, gint /* x */, g
     return TRUE;
 }
 
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
 static void webkitWebViewBaseDragDataGet(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint /* time */)
 {
     WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
@@ -1338,12 +1383,14 @@ static void webkitWebViewBaseDragDataReceived(GtkWidget* widget, GdkDragContext*
 }
 #endif // ENABLE(DRAG_SUPPORT)
 
+#if !USE(GTK4)
 static gboolean webkitWebViewBaseEvent(GtkWidget* widget, GdkEvent* event)
 {
     if (gdk_event_get_event_type(event) == GDK_TOUCHPAD_PINCH)
         webkitWebViewBaseGestureController(WEBKIT_WEB_VIEW_BASE(widget)).handleEvent(event);
     return GDK_EVENT_PROPAGATE;
 }
+#endif
 
 static AtkObject* webkitWebViewBaseGetAccessible(GtkWidget* widget)
 {
@@ -1362,7 +1409,7 @@ static AtkObject* webkitWebViewBaseGetAccessible(GtkWidget* widget)
     return priv->accessible.get();
 }
 
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
 static gboolean webkitWebViewBaseDragMotion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
 {
     webkitWebViewBaseDragAndDropHandler(WEBKIT_WEB_VIEW_BASE(widget)).dragMotion(context, IntPoint(x, y), time);
@@ -1384,6 +1431,7 @@ static gboolean webkitWebViewBaseDragDrop(GtkWidget* widget, GdkDragContext* con
 }
 #endif // ENABLE(DRAG_SUPPORT)
 
+#if !USE(GTK4)
 static void webkitWebViewBaseHierarchyChanged(GtkWidget* widget, GtkWidget* oldToplevel)
 {
     WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
@@ -1398,6 +1446,7 @@ static void webkitWebViewBaseHierarchyChanged(GtkWidget* widget, GtkWidget* oldT
             webkitWebViewBaseSetToplevelOnScreenWindow(WEBKIT_WEB_VIEW_BASE(widget), GTK_WINDOW(toplevel));
     }
 }
+#endif
 
 static gboolean webkitWebViewBaseFocus(GtkWidget* widget, GtkDirectionType direction)
 {
@@ -1427,12 +1476,17 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie
     GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webkitWebViewBaseClass);
     widgetClass->realize = webkitWebViewBaseRealize;
     widgetClass->unrealize = webkitWebViewBaseUnrealize;
+#if !USE(GTK4)
     widgetClass->draw = webkitWebViewBaseDraw;
+#endif
     widgetClass->size_allocate = webkitWebViewBaseSizeAllocate;
+#if !USE(GTK4)
     widgetClass->get_preferred_width = webkitWebViewBaseGetPreferredWidth;
     widgetClass->get_preferred_height = webkitWebViewBaseGetPreferredHeight;
+#endif
     widgetClass->map = webkitWebViewBaseMap;
     widgetClass->unmap = webkitWebViewBaseUnmap;
+#if !USE(GTK4)
     widgetClass->focus = webkitWebViewBaseFocus;
     widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent;
     widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent;
@@ -1445,11 +1499,12 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie
     widgetClass->motion_notify_event = webkitWebViewBaseMotionNotifyEvent;
     widgetClass->enter_notify_event = webkitWebViewBaseCrossingNotifyEvent;
     widgetClass->leave_notify_event = webkitWebViewBaseCrossingNotifyEvent;
-#if ENABLE(TOUCH_EVENTS)
+#endif
+#if ENABLE(TOUCH_EVENTS) && !USE(GTK4)
     widgetClass->touch_event = webkitWebViewBaseTouchEvent;
 #endif
     widgetClass->query_tooltip = webkitWebViewBaseQueryTooltip;
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
     widgetClass->drag_end = webkitWebViewBaseDragEnd;
     widgetClass->drag_data_get = webkitWebViewBaseDragDataGet;
     widgetClass->drag_motion = webkitWebViewBaseDragMotion;
@@ -1457,9 +1512,13 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie
     widgetClass->drag_drop = webkitWebViewBaseDragDrop;
     widgetClass->drag_data_received = webkitWebViewBaseDragDataReceived;
 #endif // ENABLE(DRAG_SUPPORT)
+#if !USE(GTK4)
     widgetClass->event = webkitWebViewBaseEvent;
+#endif
     widgetClass->get_accessible = webkitWebViewBaseGetAccessible;
+#if !USE(GTK4)
     widgetClass->hierarchy_changed = webkitWebViewBaseHierarchyChanged;
+#endif
     widgetClass->destroy = webkitWebViewBaseDestroy;
 
     GObjectClass* gobjectClass = G_OBJECT_CLASS(webkitWebViewBaseClass);
@@ -1528,7 +1587,7 @@ void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase* webViewBase, const IntRe
     webViewBase->priv->tooltipArea = tooltipArea;
 }
 
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
 DragAndDropHandler& webkitWebViewBaseDragAndDropHandler(WebKitWebViewBase* webViewBase)
 {
     WebKitWebViewBasePrivate* priv = webViewBase->priv;
@@ -1602,6 +1661,7 @@ void webkitWebViewBaseSetInspectorViewSize(WebKitWebViewBase* webkitWebViewBase,
         gtk_widget_queue_resize_no_redraw(GTK_WIDGET(webkitWebViewBase));
 }
 
+#if !USE(GTK4)
 static void activeContextMenuUnmapped(GtkMenu* menu, WebKitWebViewBase* webViewBase)
 {
     if (webViewBase->priv->activeContextMenuProxy && webViewBase->priv->activeContextMenuProxy->gtkMenu() == menu)
@@ -1618,6 +1678,7 @@ WebContextMenuProxyGtk* webkitWebViewBaseGetActiveContextMenuProxy(WebKitWebView
 {
     return webkitWebViewBase->priv->activeContextMenuProxy;
 }
+#endif
 
 GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase* webkitWebViewBase)
 {
@@ -1724,14 +1785,17 @@ bool webkitWebViewBaseMakeGLContextCurrent(WebKitWebViewBase* webkitWebViewBase)
 void webkitWebViewBaseWillSwapWebProcess(WebKitWebViewBase* webkitWebViewBase)
 {
     WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
-
+#if !USE(GTK4)
     if (priv->viewGestureController)
         priv->viewGestureController->disconnectFromProcess();
+#endif
 }
 
 void webkitWebViewBaseDidExitWebProcess(WebKitWebViewBase* webkitWebViewBase)
 {
+#if !USE(GTK4)
     webkitWebViewBase->priv->viewGestureController = nullptr;
+#endif
 }
 
 void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase* webkitWebViewBase)
@@ -1744,13 +1808,14 @@ void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase* webkitWebViewBase
         auto* drawingArea = static_cast<DrawingAreaProxyCoordinatedGraphics*>(priv->pageProxy->drawingArea());
         priv->acceleratedBackingStore->update(drawingArea->layerTreeContext());
     }
-
+#if !USE(GTK4)
     if (priv->viewGestureController)
         priv->viewGestureController->connectToProcess();
     else {
         priv->viewGestureController = makeUnique<WebKit::ViewGestureController>(*priv->pageProxy);
         priv->viewGestureController->setSwipeGestureEnabled(priv->isBackForwardNavigationGestureEnabled);
     }
+#endif
 }
 
 void webkitWebViewBasePageClosed(WebKitWebViewBase* webkitWebViewBase)
@@ -1776,54 +1841,68 @@ RefPtr<WebKit::ViewSnapshot> webkitWebViewBaseTakeViewSnapshot(WebKitWebViewBase
         cairo_rectangle(cr.get(), clipRect->x(), clipRect->y(), clipRect->width(), clipRect->height());
         cairo_clip(cr.get());
     }
+#if !USE(GTK4)
     webkitWebViewBaseDraw(GTK_WIDGET(webkitWebViewBase), cr.get());
+#endif
 
     return ViewSnapshot::create(WTFMove(surface));
 }
 
 void webkitWebViewBaseDidStartProvisionalLoadForMainFrame(WebKitWebViewBase* webkitWebViewBase)
 {
+#if !USE(GTK4)
     ViewGestureController* controller = webkitWebViewBaseViewGestureController(webkitWebViewBase);
     if (controller && controller->isSwipeGestureEnabled())
         controller->didStartProvisionalLoadForMainFrame();
+#endif
 }
 
 void webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame(WebKitWebViewBase* webkitWebViewBase)
 {
+#if !USE(GTK4)
     ViewGestureController* controller = webkitWebViewBaseViewGestureController(webkitWebViewBase);
     if (controller && controller->isSwipeGestureEnabled())
         controller->didFirstVisuallyNonEmptyLayoutForMainFrame();
+#endif
 }
 
 void webkitWebViewBaseDidFinishLoadForMainFrame(WebKitWebViewBase* webkitWebViewBase)
 {
+#if !USE(GTK4)
     ViewGestureController* controller = webkitWebViewBaseViewGestureController(webkitWebViewBase);
     if (controller && controller->isSwipeGestureEnabled())
         controller->didFinishLoadForMainFrame();
+#endif
 }
 
 void webkitWebViewBaseDidFailLoadForMainFrame(WebKitWebViewBase* webkitWebViewBase)
 {
+#if !USE(GTK4)
     ViewGestureController* controller = webkitWebViewBaseViewGestureController(webkitWebViewBase);
     if (controller && controller->isSwipeGestureEnabled())
         controller->didFailLoadForMainFrame();
+#endif
 }
 
 void webkitWebViewBaseDidSameDocumentNavigationForMainFrame(WebKitWebViewBase* webkitWebViewBase, SameDocumentNavigationType type)
 {
+#if !USE(GTK4)
     ViewGestureController* controller = webkitWebViewBaseViewGestureController(webkitWebViewBase);
     if (controller && controller->isSwipeGestureEnabled())
         controller->didSameDocumentNavigationForMainFrame(type);
+#endif
 }
 
 void webkitWebViewBaseDidRestoreScrollPosition(WebKitWebViewBase* webkitWebViewBase)
 {
+#if !USE(GTK4)
     ViewGestureController* controller = webkitWebViewBaseViewGestureController(webkitWebViewBase);
     if (controller && controller->isSwipeGestureEnabled())
         webkitWebViewBase->priv->viewGestureController->didRestoreScrollPosition();
+#endif
 }
 
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
 static void emojiChooserEmojiPicked(WebKitWebViewBase* webkitWebViewBase, const char* text)
 {
     webkitWebViewBaseCompleteEmojiChooserRequest(webkitWebViewBase, String::fromUTF8(text));
@@ -1838,7 +1917,7 @@ static void emojiChooserClosed(WebKitWebViewBase* webkitWebViewBase)
 
 void webkitWebViewBaseShowEmojiChooser(WebKitWebViewBase* webkitWebViewBase, const IntRect& caretRect, CompletionHandler<void(String)>&& completionHandler)
 {
-#if GTK_CHECK_VERSION(3, 24, 0)
+#if GTK_CHECK_VERSION(3, 24, 0) && !USE(GTK4)
     WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
     priv->releaseEmojiChooserTimer.stop();
 
@@ -1872,6 +1951,7 @@ int webkitWebViewBaseRenderHostFileDescriptor(WebKitWebViewBase* webkitWebViewBa
 
 void webkitWebViewBaseRequestPointerLock(WebKitWebViewBase* webViewBase)
 {
+#if !USE(GTK4)
     WebKitWebViewBasePrivate* priv = webViewBase->priv;
     RELEASE_ASSERT(!priv->pointerLockManager);
     if (!priv->lastMotionEvent) {
@@ -1897,16 +1977,19 @@ void webkitWebViewBaseRequestPointerLock(WebKitWebViewBase* webViewBase)
 
     priv->pointerLockManager = nullptr;
     priv->pageProxy->didDenyPointerLock();
+#endif
 }
 
 void webkitWebViewBaseDidLosePointerLock(WebKitWebViewBase* webViewBase)
 {
+#if !USE(GTK4)
     WebKitWebViewBasePrivate* priv = webViewBase->priv;
     if (!priv->pointerLockManager)
         return;
 
     priv->pointerLockManager->unlock();
     priv->pointerLockManager = nullptr;
+#endif
 }
 
 void webkitWebViewBaseSetInputMethodContext(WebKitWebViewBase* webViewBase, WebKitInputMethodContext* context)
@@ -1921,6 +2004,7 @@ WebKitInputMethodContext* webkitWebViewBaseGetInputMethodContext(WebKitWebViewBa
 
 void webkitWebViewBaseSynthesizeCompositionKeyPress(WebKitWebViewBase* webViewBase, const String& text, Optional<Vector<CompositionUnderline>>&& underlines, Optional<EditingRange>&& selectionRange)
 {
+#if !USE(GTK4)
     static GdkEvent* event = nullptr;
     if (!event) {
         event = gdk_event_new(GDK_KEY_PRESS);
@@ -1935,4 +2019,5 @@ void webkitWebViewBaseSynthesizeCompositionKeyPress(WebKitWebViewBase* webViewBa
 
     WebKitWebViewBasePrivate* priv = webViewBase->priv;
     priv->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(event, text, NativeWebKeyboardEvent::HandledByInputMethod::Yes, WTFMove(underlines), WTFMove(selectionRange), { }));
+#endif
 }
index dfc02da..c553080 100644 (file)
@@ -53,8 +53,10 @@ void webkitWebViewBaseEnterFullScreen(WebKitWebViewBase*);
 void webkitWebViewBaseExitFullScreen(WebKitWebViewBase*);
 bool webkitWebViewBaseIsFullScreen(WebKitWebViewBase*);
 void webkitWebViewBaseSetInspectorViewSize(WebKitWebViewBase*, unsigned size);
+#if !USE(GTK4)
 void webkitWebViewBaseSetActiveContextMenuProxy(WebKitWebViewBase*, WebKit::WebContextMenuProxyGtk*);
 WebKit::WebContextMenuProxyGtk* webkitWebViewBaseGetActiveContextMenuProxy(WebKitWebViewBase*);
+#endif
 GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase*);
 void webkitWebViewBaseSetInputMethodState(WebKitWebViewBase*, Optional<WebKit::InputMethodState>&&);
 void webkitWebViewBaseUpdateTextInputState(WebKitWebViewBase*);
@@ -78,16 +80,19 @@ void webkitWebViewBaseDidExitWebProcess(WebKitWebViewBase*);
 void webkitWebViewBaseDidRelaunchWebProcess(WebKitWebViewBase*);
 void webkitWebViewBasePageClosed(WebKitWebViewBase*);
 
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
 WebKit::DragAndDropHandler& webkitWebViewBaseDragAndDropHandler(WebKitWebViewBase*);
 #endif
 
+#if !USE(GTK4)
 WebKit::GestureController& webkitWebViewBaseGestureController(WebKitWebViewBase*);
+#endif
 
 RefPtr<WebKit::ViewSnapshot> webkitWebViewBaseTakeViewSnapshot(WebKitWebViewBase*, Optional<WebCore::IntRect>&&);
-
 void webkitWebViewBaseSetEnableBackForwardNavigationGesture(WebKitWebViewBase*, bool enabled);
+#if !USE(GTK4)
 WebKit::ViewGestureController* webkitWebViewBaseViewGestureController(WebKitWebViewBase*);
+#endif
 
 bool webkitWebViewBaseBeginBackSwipeForTesting(WebKitWebViewBase*);
 bool webkitWebViewBaseCompleteBackSwipeForTesting(WebKitWebViewBase*);
index 70e6d39..e653bec 100644 (file)
@@ -20,6 +20,8 @@
 #include "config.h"
 #include "WebKitWebViewDialog.h"
 
+#if !USE(GTK4)
+
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/glib/WTFGType.h>
 
@@ -89,3 +91,5 @@ static void webkit_web_view_dialog_class_init(WebKitWebViewDialogClass* klass)
 
     gtk_widget_class_set_css_name(widgetClass, "messagedialog");
 }
+
+#endif
index 6521c77..6a7e064 100644 (file)
@@ -19,6 +19,8 @@
 
 #pragma once
 
+#if !USE(GTK4)
+
 #include <gtk/gtk.h>
 
 G_BEGIN_DECLS
@@ -47,3 +49,5 @@ struct _WebKitWebViewDialogClass {
 GType webkit_web_view_dialog_get_type();
 
 G_END_DECLS
+
+#endif
index af71e3b..c295418 100644 (file)
 
 gboolean webkitWebViewAuthenticate(WebKitWebView* webView, WebKitAuthenticationRequest* request)
 {
+#if !USE(GTK4)
     CredentialStorageMode credentialStorageMode = webkit_authentication_request_can_save_credentials(request) ? AllowPersistentStorage : DisallowPersistentStorage;
     webkitWebViewBaseAddDialog(WEBKIT_WEB_VIEW_BASE(webView), webkitAuthenticationDialogNew(request, credentialStorageMode));
+#endif
 
     return TRUE;
 }
 
 gboolean webkitWebViewScriptDialog(WebKitWebView* webView, WebKitScriptDialog* scriptDialog)
 {
+#if !USE(GTK4)
     GUniquePtr<char> title(g_strdup_printf("JavaScript - %s", webkitWebViewGetPage(webView).pageLoadState().url().utf8().data()));
     // Limit script dialog size to 80% of the web view size.
     GtkRequisition maxSize = { static_cast<int>(gtk_widget_get_allocated_width(GTK_WIDGET(webView)) * 0.80), static_cast<int>(gtk_widget_get_allocated_height(GTK_WIDGET(webView)) * 0.80) };
     webkitWebViewBaseAddDialog(WEBKIT_WEB_VIEW_BASE(webView), webkitScriptDialogImplNew(scriptDialog, title.get(), &maxSize));
+#endif
 
     return TRUE;
 }
 
+#if !USE(GTK4)
 static void fileChooserDialogResponseCallback(GtkFileChooser* dialog, gint responseID, WebKitFileChooserRequest* request)
 {
     GRefPtr<WebKitFileChooserRequest> adoptedRequest = adoptGRef(request);
@@ -64,9 +69,11 @@ static void fileChooserDialogResponseCallback(GtkFileChooser* dialog, gint respo
 
     g_object_unref(dialog);
 }
+#endif
 
 gboolean webkitWebViewRunFileChooser(WebKitWebView* webView, WebKitFileChooserRequest* request)
 {
+#if !USE(GTK4)
     GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(webView));
     if (!WebCore::widgetIsOnscreenToplevelWindow(toplevel))
         toplevel = 0;
@@ -88,10 +95,12 @@ gboolean webkitWebViewRunFileChooser(WebKitWebView* webView, WebKitFileChooserRe
     g_signal_connect(dialog, "response", G_CALLBACK(fileChooserDialogResponseCallback), g_object_ref(request));
 
     gtk_native_dialog_show(GTK_NATIVE_DIALOG(dialog));
+#endif
 
     return TRUE;
 }
 
+#if !USE(GTK4)
 struct WindowStateEvent {
     enum class Type { Maximize, Minimize, Restore };
 
@@ -153,9 +162,11 @@ static gboolean windowStateEventCallback(GtkWidget* window, GdkEventWindowState*
 
     return FALSE;
 }
+#endif
 
 void webkitWebViewMaximizeWindow(WebKitWebView* view, CompletionHandler<void()>&& completionHandler)
 {
+#if !USE(GTK4)
     auto* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(view));
     if (!gtk_widget_is_toplevel(topLevel)) {
         completionHandler();
@@ -185,10 +196,12 @@ void webkitWebViewMaximizeWindow(WebKitWebView* view, CompletionHandler<void()>&
     }
 #endif
     gtk_widget_show(topLevel);
+#endif
 }
 
 void webkitWebViewMinimizeWindow(WebKitWebView* view, CompletionHandler<void()>&& completionHandler)
 {
+#if !USE(GTK4)
     auto* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(view));
     if (!gtk_widget_is_toplevel(topLevel)) {
         completionHandler();
@@ -202,10 +215,12 @@ void webkitWebViewMinimizeWindow(WebKitWebView* view, CompletionHandler<void()>&
     g_signal_connect_object(window, "window-state-event", G_CALLBACK(windowStateEventCallback), view, G_CONNECT_AFTER);
     gtk_window_iconify(window);
     gtk_widget_hide(topLevel);
+#endif
 }
 
 void webkitWebViewRestoreWindow(WebKitWebView* view, CompletionHandler<void()>&& completionHandler)
 {
+#if !USE(GTK4)
     auto* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(view));
     if (!gtk_widget_is_toplevel(topLevel)) {
         completionHandler();
@@ -238,6 +253,7 @@ void webkitWebViewRestoreWindow(WebKitWebView* view, CompletionHandler<void()>&&
     }
 #endif
     gtk_widget_show(topLevel);
+#endif
 }
 
 /**
diff --git a/Source/WebKit/UIProcess/API/gtk4/WebKitContextMenuItem.h b/Source/WebKit/UIProcess/API/gtk4/WebKitContextMenuItem.h
new file mode 100644 (file)
index 0000000..2e34369
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) && !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitContextMenuItem_h
+#define WebKitContextMenuItem_h
+
+#include <gtk/gtk.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitContextMenu.h>
+#include <webkit2/WebKitContextMenuActions.h>
+#include <webkit2/WebKitForwardDeclarations.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_CONTEXT_MENU_ITEM            (webkit_context_menu_item_get_type())
+#define WEBKIT_CONTEXT_MENU_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_CONTEXT_MENU_ITEM, WebKitContextMenuItem))
+#define WEBKIT_IS_CONTEXT_MENU_ITEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_CONTEXT_MENU_ITEM))
+#define WEBKIT_CONTEXT_MENU_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_CONTEXT_MENU_ITEM, WebKitContextMenuItemClass))
+#define WEBKIT_IS_CONTEXT_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_CONTEXT_MENU_ITEM))
+#define WEBKIT_CONTEXT_MENU_ITEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_CONTEXT_MENU_ITEM, WebKitContextMenuItemClass))
+
+typedef struct _WebKitContextMenuItemClass   WebKitContextMenuItemClass;
+typedef struct _WebKitContextMenuItemPrivate WebKitContextMenuItemPrivate;
+
+struct _WebKitContextMenuItem {
+    GInitiallyUnowned parent;
+
+    WebKitContextMenuItemPrivate *priv;
+};
+
+struct _WebKitContextMenuItemClass {
+    GInitiallyUnownedClass parent_class;
+
+    void (*_webkit_reserved0) (void);
+    void (*_webkit_reserved1) (void);
+    void (*_webkit_reserved2) (void);
+    void (*_webkit_reserved3) (void);
+};
+
+WEBKIT_API GType
+webkit_context_menu_item_get_type                         (void);
+
+WEBKIT_API WebKitContextMenuItem *
+webkit_context_menu_item_new_from_gaction                 (GAction                *action,
+                                                           const gchar            *label,
+                                                           GVariant               *target);
+
+WEBKIT_API WebKitContextMenuItem *
+webkit_context_menu_item_new_from_stock_action            (WebKitContextMenuAction action);
+
+WEBKIT_API WebKitContextMenuItem *
+webkit_context_menu_item_new_from_stock_action_with_label (WebKitContextMenuAction action,
+                                                           const gchar            *label);
+
+WEBKIT_API WebKitContextMenuItem *
+webkit_context_menu_item_new_with_submenu                 (const gchar            *label,
+                                                           WebKitContextMenu      *submenu);
+
+WEBKIT_API WebKitContextMenuItem *
+webkit_context_menu_item_new_separator                    (void);
+
+WEBKIT_API GAction *
+webkit_context_menu_item_get_gaction                      (WebKitContextMenuItem  *item);
+
+WEBKIT_API WebKitContextMenuAction
+webkit_context_menu_item_get_stock_action                 (WebKitContextMenuItem  *item);
+
+WEBKIT_API gboolean
+webkit_context_menu_item_is_separator                     (WebKitContextMenuItem  *item);
+
+WEBKIT_API void
+webkit_context_menu_item_set_submenu                      (WebKitContextMenuItem  *item,
+                                                           WebKitContextMenu      *submenu);
+
+WEBKIT_API WebKitContextMenu *
+webkit_context_menu_item_get_submenu                      (WebKitContextMenuItem  *item);
+
+G_END_DECLS
+
+#endif
diff --git a/Source/WebKit/UIProcess/API/gtk4/WebKitInputMethodContext.h b/Source/WebKit/UIProcess/API/gtk4/WebKitInputMethodContext.h
new file mode 100644 (file)
index 0000000..cafeda0
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitInputMethodContext_h
+#define WebKitInputMethodContext_h
+
+#include <glib-object.h>
+#include <gdk/gdk.h>
+#include <webkit2/WebKitDefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_INPUT_METHOD_CONTEXT            (webkit_input_method_context_get_type())
+#define WEBKIT_INPUT_METHOD_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_INPUT_METHOD_CONTEXT, WebKitInputMethodContext))
+#define WEBKIT_INPUT_METHOD_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_INPUT_METHOD_CONTEXT, WebKitInputMethodContextClass))
+#define WEBKIT_IS_INPUT_METHOD_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_INPUT_METHOD_CONTEXT))
+#define WEBKIT_IS_INPUT_METHOD_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_INPUT_METHOD_CONTEXT))
+#define WEBKIT_INPUT_METHOD_CONTEXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_INPUT_METHOD_CONTEXT, WebKitInputMethodContextClass))
+
+#define WEBKIT_TYPE_INPUT_METHOD_UNDERLINE          (webkit_input_method_underline_get_type())
+
+/**
+ * WebKitInputPurpose:
+ * @WEBKIT_INPUT_PURPOSE_FREE_FORM: Editable element expects any characters
+ * @WEBKIT_INPUT_PURPOSE_DIGITS: Editable element expects digits
+ * @WEBKIT_INPUT_PURPOSE_NUMBER: Editable element expects a number
+ * @WEBKIT_INPUT_PURPOSE_PHONE: Editable element expects a telephone
+ * @WEBKIT_INPUT_PURPOSE_URL: Editable element expects a URL
+ * @WEBKIT_INPUT_PURPOSE_EMAIL: Editable element expects an email
+ * @WEBKIT_INPUT_PURPOSE_PASSWORD: Editable element expects a password
+ *
+ * Enum values used to describe the primary purpose of the active editable element.
+ *
+ * Since: 2.28
+ */
+typedef enum {
+    WEBKIT_INPUT_PURPOSE_FREE_FORM,
+    WEBKIT_INPUT_PURPOSE_DIGITS,
+    WEBKIT_INPUT_PURPOSE_NUMBER,
+    WEBKIT_INPUT_PURPOSE_PHONE,
+    WEBKIT_INPUT_PURPOSE_URL,
+    WEBKIT_INPUT_PURPOSE_EMAIL,
+    WEBKIT_INPUT_PURPOSE_PASSWORD
+} WebKitInputPurpose;
+
+/**
+ * WebKitInputHints:
+ * @WEBKIT_INPUT_HINT_NONE: No special behavior suggested
+ * @WEBKIT_INPUT_HINT_SPELLCHECK: Suggest spell checking
+ * @WEBKIT_INPUT_HINT_LOWERCASE: Suggest to not autocapitlize
+ * @WEBKIT_INPUT_HINT_UPPERCASE_CHARS: Suggest to capitalize all text
+ * @WEBKIT_INPUT_HINT_UPPERCASE_WORDS: Suggest to capitalize the first character of each word
+ * @WEBKIT_INPUT_HINT_UPPERCASE_SENTENCES: Suggest to capitalize the first word of each sentence
+ * @WEBKIT_INPUT_HINT_INHIBIT_OSK: Suggest to not show an onscreen keyboard
+ *
+ * Enum values used to describe hints that might be taken into account by input methods.
+ *
+ * Since: 2.28
+ */
+typedef enum {
+    WEBKIT_INPUT_HINT_NONE                = 0,
+    WEBKIT_INPUT_HINT_SPELLCHECK          = 1 << 0,
+    WEBKIT_INPUT_HINT_LOWERCASE           = 1 << 1,
+    WEBKIT_INPUT_HINT_UPPERCASE_CHARS     = 1 << 2,
+    WEBKIT_INPUT_HINT_UPPERCASE_WORDS     = 1 << 3,
+    WEBKIT_INPUT_HINT_UPPERCASE_SENTENCES = 1 << 4,
+    WEBKIT_INPUT_HINT_INHIBIT_OSK         = 1 << 5
+} WebKitInputHints;
+
+typedef struct _WebKitInputMethodContext        WebKitInputMethodContext;
+typedef struct _WebKitInputMethodContextClass   WebKitInputMethodContextClass;
+typedef struct _WebKitInputMethodContextPrivate WebKitInputMethodContextPrivate;
+typedef struct _WebKitInputMethodUnderline      WebKitInputMethodUnderline;
+
+struct _WebKitInputMethodContext {
+    GObject parent;
+
+    /*< private >*/
+    WebKitInputMethodContextPrivate *priv;
+};
+
+struct _WebKitInputMethodContextClass {
+    GObjectClass parent_class;
+
+    /* Signals */
+    void     (* preedit_started)    (WebKitInputMethodContext *context);
+    void     (* preedit_changed)    (WebKitInputMethodContext *context);
+    void     (* preedit_finished)   (WebKitInputMethodContext *context);
+    void     (* committed)          (WebKitInputMethodContext *context,
+                                     const char               *text);
+    void     (* delete_surrounding) (WebKitInputMethodContext *context,
+                                     int                       offset,
+                                     guint                     n_chars);
+
+    /* Virtual functions */
+    void     (* set_enable_preedit) (WebKitInputMethodContext *context,
+                                     gboolean                  enabled);
+    void     (* get_preedit)        (WebKitInputMethodContext *context,
+                                     gchar                   **text,
+                                     GList                   **underlines,
+                                     guint                    *cursor_offset);
+    gboolean (* filter_key_event)   (WebKitInputMethodContext *context,
+                                     GdkEvent                 *key_event);
+    void     (* notify_focus_in)    (WebKitInputMethodContext *context);
+    void     (* notify_focus_out)   (WebKitInputMethodContext *context);
+    void     (* notify_cursor_area) (WebKitInputMethodContext *context,
+                                     int                       x,
+                                     int                       y,
+                                     int                       width,
+                                     int                       height);
+    void     (* notify_surrounding) (WebKitInputMethodContext *context,
+                                     const gchar              *text,
+                                     guint                     length,
+                                     guint                     cursor_index,
+                                     guint                     selection_index);
+    void     (* reset)              (WebKitInputMethodContext *context);
+
+    void (*_webkit_reserved0) (void);
+    void (*_webkit_reserved1) (void);
+    void (*_webkit_reserved2) (void);
+    void (*_webkit_reserved3) (void);
+    void (*_webkit_reserved4) (void);
+    void (*_webkit_reserved5) (void);
+    void (*_webkit_reserved6) (void);
+    void (*_webkit_reserved7) (void);
+};
+
+WEBKIT_API GType
+webkit_input_method_context_get_type           (void);
+
+WEBKIT_API void
+webkit_input_method_context_set_enable_preedit (WebKitInputMethodContext   *context,
+                                                gboolean                    enabled);
+
+WEBKIT_API void
+webkit_input_method_context_get_preedit        (WebKitInputMethodContext   *context,
+                                                char                      **text,
+                                                GList                     **underlines,
+                                                guint                      *cursor_offset);
+
+WEBKIT_API gboolean
+webkit_input_method_context_filter_key_event   (WebKitInputMethodContext   *context,
+                                                GdkEvent                   *key_event);
+
+WEBKIT_API void
+webkit_input_method_context_notify_focus_in    (WebKitInputMethodContext   *context);
+
+WEBKIT_API void
+webkit_input_method_context_notify_focus_out   (WebKitInputMethodContext   *context);
+
+WEBKIT_API void
+webkit_input_method_context_notify_cursor_area (WebKitInputMethodContext   *context,
+                                                int                         x,
+                                                int                         y,
+                                                int                         width,
+                                                int                         height);
+
+WEBKIT_API void
+webkit_input_method_context_notify_surrounding (WebKitInputMethodContext   *context,
+                                                const gchar                *text,
+                                                int                         length,
+                                                guint                       cursor_index,
+                                                guint                       selection_index);
+
+WEBKIT_API void
+webkit_input_method_context_reset              (WebKitInputMethodContext   *context);
+
+
+WEBKIT_API GType
+webkit_input_method_underline_get_type         (void);
+
+WEBKIT_API WebKitInputMethodUnderline *
+webkit_input_method_underline_new              (guint                       start_offset,
+                                                guint                       end_offset);
+
+WEBKIT_API WebKitInputMethodUnderline *
+webkit_input_method_underline_copy             (WebKitInputMethodUnderline *underline);
+
+WEBKIT_API void
+webkit_input_method_underline_free             (WebKitInputMethodUnderline *underline);
+
+WEBKIT_API void
+webkit_input_method_underline_set_color        (WebKitInputMethodUnderline *underline,
+                                                const GdkRGBA              *rgba);
+
+WEBKIT_API WebKitInputPurpose
+webkit_input_method_context_get_input_purpose  (WebKitInputMethodContext   *context);
+
+WEBKIT_API void
+webkit_input_method_context_set_input_purpose  (WebKitInputMethodContext   *context,
+                                                WebKitInputPurpose          purpose);
+
+WEBKIT_API WebKitInputHints
+webkit_input_method_context_get_input_hints    (WebKitInputMethodContext   *context);
+
+WEBKIT_API void
+webkit_input_method_context_set_input_hints    (WebKitInputMethodContext   *context,
+                                                WebKitInputHints            hints);
+
+
+G_END_DECLS
+
+#endif
index d6031d9..428022e 100644 (file)
 #include "WebPageProxy.h"
 #include <WebCore/GtkUtilities.h>
 #include <WebCore/GtkVersioning.h>
-#include <gtk/gtk.h>
 
 namespace WebKit {
 using namespace WebCore;
 
 #if ENABLE(WEBDRIVER_MOUSE_INTERACTIONS)
+#if !USE(GTK4)
 static unsigned modifiersToEventState(OptionSet<WebEvent::Modifier> modifiers)
 {
     unsigned state = 0;
@@ -102,9 +102,11 @@ static void doMotionEvent(GtkWidget* widget, const WebCore::IntPoint& location,
     event->motion.y_root = yRoot;
     gtk_main_do_event(event.get());
 }
+#endif
 
 void WebAutomationSession::platformSimulateMouseInteraction(WebPageProxy& page, MouseInteraction interaction, MouseButton button, const WebCore::IntPoint& locationInView, OptionSet<WebEvent::Modifier> keyModifiers)
 {
+#if !USE(GTK4)
     unsigned gdkButton = mouseButtonToGdkButton(button);
     auto modifier = stateModifierForGdkButton(gdkButton);
     unsigned state = modifiersToEventState(keyModifiers) | m_currentModifiers;
@@ -132,10 +134,12 @@ void WebAutomationSession::platformSimulateMouseInteraction(WebPageProxy& page,
         doMouseEvent(GDK_BUTTON_RELEASE, page.viewWidget(), locationInView, gdkButton, state | modifier);
         break;
     }
+#endif
 }
 #endif // ENABLE(WEBDRIVER_MOUSE_INTERACTIONS)
 
 #if ENABLE(WEBDRIVER_KEYBOARD_INTERACTIONS)
+#if !USE(GTK4)
 static void doKeyStrokeEvent(GdkEventType type, GtkWidget* widget, unsigned keyVal, unsigned state, bool doReleaseAfterPress = false)
 {
     ASSERT(type == GDK_KEY_PRESS || type == GDK_KEY_RELEASE);
@@ -304,9 +308,11 @@ static unsigned modifiersForKeyCode(unsigned keyCode)
     }
     return 0;
 }
+#endif
 
 void WebAutomationSession::platformSimulateKeyboardInteraction(WebPageProxy& page, KeyboardInteraction interaction, WTF::Variant<VirtualKey, CharKey>&& key)
 {
+#if !USE(GTK4)
     unsigned keyCode;
     WTF::switchOn(key,
         [&] (VirtualKey virtualKey) {
@@ -331,16 +337,19 @@ void WebAutomationSession::platformSimulateKeyboardInteraction(WebPageProxy& pag
         doKeyStrokeEvent(GDK_KEY_PRESS, page.viewWidget(), keyCode, m_currentModifiers, true);
         break;
     }
+#endif
 }
 
 void WebAutomationSession::platformSimulateKeySequence(WebPageProxy& page, const String& keySequence)
 {
+#if !USE(GTK4)
     CString keySequenceUTF8 = keySequence.utf8();
     const char* p = keySequenceUTF8.data();
     do {
         doKeyStrokeEvent(GDK_KEY_PRESS, page.viewWidget(), gdk_unicode_to_keyval(g_utf8_get_char(p)), m_currentModifiers, true);
         p = g_utf8_next_char(p);
     } while (*p);
+#endif
 }
 #endif // ENABLE(WEBDRIVER_KEYBOARD_INTERACTIONS)
 
index 78f61f0..dcb896e 100644 (file)
@@ -120,7 +120,9 @@ void RemoteWebInspectorProxy::platformSave(const String& suggestedURL, const Str
         GTK_WINDOW(m_window), GTK_FILE_CHOOSER_ACTION_SAVE, "Save", "Cancel"));
 
     GtkFileChooser* chooser = GTK_FILE_CHOOSER(dialog.get());
+#if !USE(GTK4)
     gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE);
+#endif
 
     // Some inspector views (Audits for instance) use a custom URI scheme, such
     // as web-inspector. So we can't rely on the URL being a valid file:/// URL
index 78fca74..89f8dd7 100644 (file)
@@ -44,6 +44,7 @@
 #include "WebProcessProxy.h"
 #include <WebCore/CertificateInfo.h>
 #include <WebCore/GtkUtilities.h>
+#include <WebCore/GtkVersioning.h>
 #include <WebCore/InspectorDebuggableType.h>
 #include <WebCore/NotImplemented.h>
 #include <wtf/FileSystem.h>
@@ -494,7 +495,9 @@ void WebInspectorProxy::platformSave(const String& suggestedURL, const String& c
         GTK_WINDOW(parent), GTK_FILE_CHOOSER_ACTION_SAVE, "Save", "Cancel"));
 
     GtkFileChooser* chooser = GTK_FILE_CHOOSER(dialog.get());
+#if !USE(GTK4)
     gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE);
+#endif
 
     // Some inspector views (Audits for instance) use a custom URI scheme, such
     // as web-inspector. So we can't rely on the URL being a valid file:/// URL
index 550d003..d8b6936 100644 (file)
@@ -52,14 +52,19 @@ static void webkit_inspector_window_init(WebKitInspectorWindow* window)
 {
     window->headerBar = gtk_header_bar_new();
     gtk_header_bar_set_title(GTK_HEADER_BAR(window->headerBar), _("Web Inspector"));
+#if !USE(GTK4)
     gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(window->headerBar), TRUE);
+#endif
     gtk_window_set_titlebar(GTK_WINDOW(window), window->headerBar);
     gtk_widget_show(window->headerBar);
 }
 
 GtkWidget* webkitInspectorWindowNew()
 {
-    return GTK_WIDGET(g_object_new(WEBKIT_TYPE_INSPECTOR_WINDOW, "type", GTK_WINDOW_TOPLEVEL,
+    return GTK_WIDGET(g_object_new(WEBKIT_TYPE_INSPECTOR_WINDOW,
+#if !USE(GTK4)
+        "type", GTK_WINDOW_TOPLEVEL,
+#endif
         "default-width", WebInspectorProxy::initialWindowWidth, "default-height", WebInspectorProxy::initialWindowHeight, nullptr));
 }
 
index 8df4640..d493fa3 100644 (file)
@@ -2171,7 +2171,7 @@ private:
 
     void setRenderTreeSize(uint64_t treeSize) { m_renderTreeSize = treeSize; }
 
-#if PLATFORM(X11)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
     void createPluginContainer(CompletionHandler<void(uint64_t)>&&);
     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID);
index 2eee1b0..4b4d408 100644 (file)
@@ -395,7 +395,7 @@ messages -> WebPageProxy {
     DictationAlternatives(uint64_t dictationContext) -> (Vector<String> alternatives) Synchronous
 #endif
 
-#if PLATFORM(X11)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
     # X11 windowed plugin messages
     CreatePluginContainer() -> (uint64_t windowID) Synchronous
     WindowedPluginGeometryDidChange(WebCore::IntRect frameRect, WebCore::IntRect clipRect, uint64_t windowID)
index 3035f6f..dc0a70b 100644 (file)
@@ -37,7 +37,7 @@
 #include <WebCore/RefPtrCairo.h>
 #include <cairo.h>
 
-#if PLATFORM(GTK) && PLATFORM(X11) && defined(GDK_WINDOWING_X11)
+#if PLATFORM(GTK) && PLATFORM(X11) && defined(GDK_WINDOWING_X11) && !USE(GTK4)
 #include <WebCore/BackingStoreBackendCairoX11.h>
 #include <WebCore/PlatformDisplayX11.h>
 #include <gdk/gdkx.h>
@@ -48,7 +48,7 @@ using namespace WebCore;
 
 std::unique_ptr<BackingStoreBackendCairo> BackingStore::createBackend()
 {
-#if PLATFORM(GTK) && PLATFORM(X11) && defined(GDK_WINDOWING_X11)
+#if PLATFORM(GTK) && PLATFORM(X11) && defined(GDK_WINDOWING_X11) && !USE(GTK4)
     const auto& sharedDisplay = PlatformDisplay::sharedDisplay();
     if (is<PlatformDisplayX11>(sharedDisplay)) {
         GdkVisual* visual = gtk_widget_get_visual(m_webPageProxy.viewWidget());
index 8c4259b..ab7d7d0 100644 (file)
@@ -136,7 +136,7 @@ void WebProcessPool::platformInitializeWebProcess(const WebProcessProxy& process
     parameters.gstreamerOptions = WebCore::extractGStreamerOptionsFromCommandLine();
 #endif
 
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(GTK4)
     parameters.useSystemAppearanceForScrollbars = m_configuration->useSystemAppearanceForScrollbars();
 #endif
 }
index 589a5ac..ea22b4d 100644 (file)
 #include "WebPageProxy.h"
 // These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM
 // and eglplatform.h, included by egl.h, checks that to decide whether it's Wayland platform.
+#if USE(GTK4)
+#include <gdk/wayland/gdkwayland.h>
+#else
 #include <gdk/gdkwayland.h>
+#endif
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 #include <WebCore/CairoUtilities.h>
@@ -211,6 +215,7 @@ void AcceleratedBackingStoreWayland::tryEnsureGLContext()
 
     m_glContextInitialized = true;
 
+#if !USE(GTK4)
     GUniqueOutPtr<GError> error;
     m_gdkGLContext = adoptGRef(gdk_window_create_gl_context(gtk_widget_get_window(m_webPage.viewWidget()), &error.outPtr()));
     if (m_gdkGLContext) {
@@ -221,6 +226,7 @@ void AcceleratedBackingStoreWayland::tryEnsureGLContext()
     }
 
     g_warning("GDK is not able to create a GL context, falling back to glReadPixels (slow!): %s", error->message);
+#endif
 
     m_glContext = GLContext::createOffscreenContext();
 }
@@ -313,11 +319,13 @@ bool AcceleratedBackingStoreWayland::paint(cairo_t* cr, const IntRect& clipRect)
 
     cairo_save(cr);
 
+#if !USE(GTK4)
     if (m_gdkGLContext) {
         gdk_cairo_draw_from_gl(cr, gtk_widget_get_window(m_webPage.viewWidget()), texture, GL_TEXTURE, m_webPage.deviceScaleFactor(), 0, 0, textureSize.width(), textureSize.height());
         cairo_restore(cr);
         return true;
     }
+#endif
 
     ASSERT(m_glContext);
 
index 8b86f98..491d30c 100644 (file)
 #include <X11/Xlib.h>
 #include <X11/extensions/Xdamage.h>
 #include <cairo-xlib.h>
+#if USE(GTK4)
+#include <gdk/x11/gdkx.h>
+#else
 #include <gdk/gdkx.h>
+#endif
 #include <gtk/gtk.h>
 #include <wtf/HashMap.h>
 #include <wtf/NeverDestroyed.h>
@@ -48,6 +52,7 @@ using namespace WebCore;
 static Optional<int> s_damageEventBase;
 static Optional<int> s_damageErrorBase;
 
+#if !USE(GTK4)
 class XDamageNotifier {
     WTF_MAKE_NONCOPYABLE(XDamageNotifier);
     friend NeverDestroyed<XDamageNotifier>;
@@ -102,6 +107,7 @@ private:
 
     HashMap<Damage, WTF::Function<void()>> m_notifyFunctions;
 };
+#endif
 
 bool AcceleratedBackingStoreX11::checkRequirements()
 {
@@ -131,6 +137,7 @@ AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11()
     if (!m_surface && !m_damage)
         return;
 
+#if !USE(GTK4)
     Display* display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native();
     XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
     if (m_damage) {
@@ -138,6 +145,7 @@ AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11()
         m_damage.reset();
         XSync(display, False);
     }
+#endif
 }
 
 void AcceleratedBackingStoreX11::update(const LayerTreeContext& layerTreeContext)
@@ -149,12 +157,14 @@ void AcceleratedBackingStoreX11::update(const LayerTreeContext& layerTreeContext
     Display* display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native();
 
     if (m_surface) {
+#if !USE(GTK4)
         XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
         if (m_damage) {
             XDamageNotifier::singleton().remove(m_damage.get());
             m_damage.reset();
             XSync(display, False);
         }
+#endif
         m_surface = nullptr;
     }
 
@@ -168,7 +178,7 @@ void AcceleratedBackingStoreX11::update(const LayerTreeContext& layerTreeContext
     IntSize size = drawingArea->size();
     float deviceScaleFactor = m_webPage.deviceScaleFactor();
     size.scale(deviceScaleFactor);
-
+#if !USE(GTK4)
     XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
     ASSERT(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native() == GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
     GdkVisual* visual = gdk_screen_get_rgba_visual(gdk_screen_get_default());
@@ -182,6 +192,7 @@ void AcceleratedBackingStoreX11::update(const LayerTreeContext& layerTreeContext
             gtk_widget_queue_draw(m_webPage.viewWidget());
     });
     XSync(display, False);
+#endif
 }
 
 bool AcceleratedBackingStoreX11::paint(cairo_t* cr, const IntRect& clipRect)
index 6cd8723..52b85fb 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "DragAndDropHandler.h"
 
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
 
 #include "WebPageProxy.h"
 #include <WebCore/DragData.h>
index 5914b7e..2b305aa 100644 (file)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && !USE(GTK4)
 
 #include <WebCore/DragActions.h>
 #include <WebCore/IntPoint.h>
index 76498b8..f2c451c 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "GestureController.h"
 
+#if !USE(GTK4)
+
 #include <WebCore/Scrollbar.h>
 #include <gtk/gtk.h>
 
@@ -270,3 +272,5 @@ GestureController::LongPressGesture::LongPressGesture(GtkWidget* widget, Gesture
 }
 
 } // namespace WebKit
+
+#endif
index 2addbcd..5146d45 100644 (file)
@@ -25,6 +25,8 @@
 
 #pragma once
 
+#if !USE(GTK4)
+
 #include <WebCore/FloatPoint.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/RunLoop.h>
@@ -35,6 +37,7 @@ typedef struct _GdkEventTouch GdkEventTouch;
 typedef struct _GdkEventSequence GdkEventSequence;
 typedef struct _GtkGesture GtkGesture;
 
+
 namespace WebKit {
 
 class GestureControllerClient {
@@ -158,3 +161,5 @@ private:
 };
 
 } // namespace WebKit
+
+#endif
index 3a9ee8c..7e65225 100644 (file)
@@ -19,8 +19,8 @@
 #include "config.h"
 #include "KeyBindingTranslator.h"
 
+#include <WebCore/GtkVersioning.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
 
 namespace WebKit {
 
@@ -68,6 +68,7 @@ static void insertEmojiCallback(GtkWidget* widget, KeyBindingTranslator* transla
 }
 #endif
 
+#if !USE(GTK4)
 // GTK+ will still send these signals to the web view. So we can safely stop signal
 // emission without breaking accessibility.
 static void popupMenuCallback(GtkWidget* widget, KeyBindingTranslator*)
@@ -79,6 +80,7 @@ static void showHelpCallback(GtkWidget* widget, KeyBindingTranslator*)
 {
     g_signal_stop_emission_by_name(widget, "show-help");
 }
+#endif
 
 static const char* const gtkDeleteCommands[][2] = {
     { "DeleteBackward",               "DeleteForward"                        }, // Characters
@@ -179,8 +181,10 @@ KeyBindingTranslator::KeyBindingTranslator()
     g_signal_connect(m_nativeWidget.get(), "move-cursor", G_CALLBACK(moveCursorCallback), this);
     g_signal_connect(m_nativeWidget.get(), "delete-from-cursor", G_CALLBACK(deleteFromCursorCallback), this);
     g_signal_connect(m_nativeWidget.get(), "toggle-overwrite", G_CALLBACK(toggleOverwriteCallback), this);
+#if !USE(GTK4)
     g_signal_connect(m_nativeWidget.get(), "popup-menu", G_CALLBACK(popupMenuCallback), this);
     g_signal_connect(m_nativeWidget.get(), "show-help", G_CALLBACK(showHelpCallback), this);
+#endif
 #if GTK_CHECK_VERSION(3, 24, 0)
     g_signal_connect(m_nativeWidget.get(), "insert-emoji", G_CALLBACK(insertEmojiCallback), this);
 #endif
@@ -213,10 +217,15 @@ Vector<String> KeyBindingTranslator::commandsForKeyEvent(GdkEventKey* event)
 
     guint keyval;
     GdkModifierType state;
+#if USE(GTK4)
+    keyval = 0;
+    state = static_cast<GdkModifierType>(0);
+#else
     gdk_event_get_keyval(reinterpret_cast<GdkEvent*>(event), &keyval);
     gdk_event_get_state(reinterpret_cast<GdkEvent*>(event), &state);
 
     gtk_bindings_activate_event(G_OBJECT(m_nativeWidget.get()), event);
+#endif
     if (!m_pendingEditorCommands.isEmpty())
         return WTFMove(m_pendingEditorCommands);
 
index b2ded5d..8ebb144 100644 (file)
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
+#if USE(GTK4)
+typedef struct _GdkKeyEvent GdkKeyEvent;
+typedef GdkKeyEvent GdkEventKey;
+#else
 typedef struct _GdkEventKey GdkEventKey;
+#endif
 
 namespace WebKit {
 
index 6d23c39..d17e647 100644 (file)
@@ -71,6 +71,7 @@ bool PointerLockManager::lock()
 {
     RELEASE_ASSERT(!m_device);
 
+#if !USE(GTK4)
     auto* viewWidget = m_webPage.viewWidget();
     m_device = gdk_seat_get_pointer(gdk_display_get_default_seat(gtk_widget_get_display(viewWidget)));
     GRefPtr<GdkCursor> cursor = adoptGRef(gdk_cursor_new_from_name(gtk_widget_get_display(viewWidget), "none"));
@@ -80,6 +81,7 @@ bool PointerLockManager::lock()
         m_device = nullptr;
         return false;
     }
+#endif
 
     return true;
 }
@@ -89,8 +91,10 @@ bool PointerLockManager::unlock()
     if (!m_device)
         return false;
 
+#if !USE(GTK4)
     gdk_seat_ungrab(gdk_device_get_seat(m_device));
     m_device = nullptr;
+#endif
     return true;
 }
 
index c70cf7e..157eabe 100644 (file)
 #include <wtf/Noncopyable.h>
 
 typedef struct _GdkDevice GdkDevice;
+#if USE(GTK4)
+typedef struct _GdkEvent GdkEvent;
+#else
 typedef union _GdkEvent GdkEvent;
+#endif
 
 namespace WebCore {
 class IntPoint;
index 61bae57..1faab62 100644 (file)
 #include "WebPageProxy.h"
 #include "pointer-constraints-unstable-v1-client-protocol.h"
 #include <WebCore/WlUniquePtr.h>
+#if USE(GTK4)
+#include <gdk/wayland/gdkwayland.h>
+#else
 #include <gdk/gdkwayland.h>
+#endif
 #include <gtk/gtk.h>
 
 namespace WebKit {
@@ -91,9 +95,11 @@ bool PointerLockManagerWayland::lock()
     m_relativePointer = zwp_relative_pointer_manager_v1_get_relative_pointer(m_relativePointerManager, pointer);
     zwp_relative_pointer_v1_add_listener(m_relativePointer, &s_relativePointerListener, this);
 
+#if !USE(GTK4)
     RELEASE_ASSERT(!m_lockedPointer);
     auto* surface = gdk_wayland_window_get_wl_surface(gtk_widget_get_window(m_webPage.viewWidget()));
     m_lockedPointer = zwp_pointer_constraints_v1_lock_pointer(m_pointerConstraints, surface, pointer, nullptr, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
+#endif
     return true;
 }
 
index 03d8416..fef212b 100644 (file)
@@ -29,7 +29,9 @@
 #if PLATFORM(X11)
 
 #include "WebPageProxy.h"
+#if !USE(GTK4)
 #include <gdk/gdkx.h>
+#endif
 #include <gtk/gtk.h>
 
 namespace WebKit {
@@ -42,6 +44,7 @@ PointerLockManagerX11::PointerLockManagerX11(WebPageProxy& webPage, const GdkEve
 
 void PointerLockManagerX11::didReceiveMotionEvent(const GdkEvent* event)
 {
+#if !USE(GTK4)
     double currentX, currentY;
     gdk_event_get_root_coords(event, &currentX, &currentY);
     double initialX, initialY;
@@ -51,6 +54,7 @@ void PointerLockManagerX11::didReceiveMotionEvent(const GdkEvent* event)
 
     handleMotion(IntPoint(currentX - initialX, currentY - initialY));
     gdk_device_warp(m_device, gtk_widget_get_screen(m_webPage.viewWidget()), initialX, initialY);
+#endif
 }
 
 } // namespace WebKit
index 14cf211..f62dcbb 100644 (file)
@@ -30,8 +30,8 @@
 
 #include "WebPageProxy.h"
 #include <WebCore/GtkUtilities.h>
+#include <WebCore/GtkVersioning.h>
 #include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
 
 namespace WebKit {
 using namespace WebCore;
index 5fad2ff..41032b8 100644 (file)
@@ -47,6 +47,7 @@ static const char* gContextMenuItemGroup = "webkitContextMenu";
 namespace WebKit {
 using namespace WebCore;
 
+#if !USE(GTK4)
 static void contextMenuItemActivatedCallback(GAction* action, GVariant*, WebPageProxy* page)
 {
     auto* stateType = g_action_get_state_type(action);
@@ -158,9 +159,11 @@ void WebContextMenuProxyGtk::populate(const Vector<Ref<WebContextMenuItem>>& ite
     }
     gtk_menu_shell_bind_model(GTK_MENU_SHELL(m_menu), G_MENU_MODEL(menu.get()), nullptr, TRUE);
 }
+#endif
 
 void WebContextMenuProxyGtk::show()
 {
+#if !USE(GTK4)
     Vector<Ref<WebContextMenuItem>> proposedAPIItems;
     for (auto& item : m_context.menuItems()) {
         if (item.action() != ContextMenuItemTagShareMenu)
@@ -168,10 +171,12 @@ void WebContextMenuProxyGtk::show()
     }
 
     m_page->contextMenuClient().getContextMenuFromProposedMenu(*m_page, WTFMove(proposedAPIItems), WebContextMenuListenerProxy::create(this).get(), m_context.webHitTestResultData(), m_page->process().transformHandlesToObjects(m_userData.object()).get());
+#endif
 }
 
 void WebContextMenuProxyGtk::showContextMenuWithItems(Vector<Ref<WebContextMenuItem>>&& items)
 {
+#if !USE(GTK4)
     if (!items.isEmpty())
         populate(items);
 
@@ -187,21 +192,27 @@ void WebContextMenuProxyGtk::showContextMenuWithItems(Vector<Ref<WebContextMenuI
     const GdkEvent* event = mouseEvent ? mouseEvent->nativeEvent() : 0;
     gtk_menu_attach_to_widget(m_menu, GTK_WIDGET(m_webView), nullptr);
     gtk_menu_popup(m_menu, nullptr, nullptr, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, event ? event->button.button : 3, event ? event->button.time : GDK_CURRENT_TIME);
+#endif
 }
 
 WebContextMenuProxyGtk::WebContextMenuProxyGtk(GtkWidget* webView, WebPageProxy& page, ContextMenuContextData&& context, const UserData& userData)
     : WebContextMenuProxy(WTFMove(context), userData)
+#if !USE(GTK4)
     , m_webView(webView)
     , m_page(&page)
     , m_menu(GTK_MENU(gtk_menu_new()))
+#endif
 {
+#if !USE(GTK4)
     GRefPtr<GSimpleActionGroup> group = adoptGRef(g_simple_action_group_new());
     gtk_widget_insert_action_group(GTK_WIDGET(m_menu), gContextMenuItemGroup, G_ACTION_GROUP(group.get()));
     webkitWebViewBaseSetActiveContextMenuProxy(WEBKIT_WEB_VIEW_BASE(m_webView), this);
+#endif
 }
 
 WebContextMenuProxyGtk::~WebContextMenuProxyGtk()
 {
+#if !USE(GTK4)
     gtk_menu_popdown(m_menu);
 
     for (auto& handler : m_signalHandlers)
@@ -210,8 +221,10 @@ WebContextMenuProxyGtk::~WebContextMenuProxyGtk()
 
     gtk_widget_insert_action_group(GTK_WIDGET(m_menu), gContextMenuItemGroup, nullptr);
     gtk_widget_destroy(GTK_WIDGET(m_menu));
+#endif
 }
 
+#if !USE(GTK4)
 void WebContextMenuProxyGtk::menuPositionFunction(GtkMenu* menu, gint* x, gint* y, gboolean* pushIn, WebContextMenuProxyGtk* popupMenu)
 {
     GtkRequisition menuSize;
@@ -228,6 +241,7 @@ void WebContextMenuProxyGtk::menuPositionFunction(GtkMenu* menu, gint* x, gint*
 
     *pushIn = FALSE;
 }
+#endif
 
 } // namespace WebKit
 #endif // ENABLE(CONTEXT_MENUS)
index e5c5ea0..aa33589 100644 (file)
@@ -49,13 +49,16 @@ public:
     }
     ~WebContextMenuProxyGtk();
 
+#if !USE(GTK4)
     void populate(const Vector<WebContextMenuItemGlib>&);
     GtkMenu* gtkMenu() const { return m_menu; }
+#endif
 
 private:
     WebContextMenuProxyGtk(GtkWidget*, WebPageProxy&, ContextMenuContextData&&, const UserData&);
     void show() override;
     void showContextMenuWithItems(Vector<Ref<WebContextMenuItem>>&&) override;
+#if !USE(GTK4)
     void append(GMenu*, const WebContextMenuItemGlib&);
     GRefPtr<GMenu> buildMenu(const Vector<WebContextMenuItemGlib>&);
     void populate(const Vector<Ref<WebContextMenuItem>>&);
@@ -67,6 +70,7 @@ private:
     GtkMenu* m_menu;
     WebCore::IntPoint m_popupPosition;
     HashMap<unsigned long, void*> m_signalHandlers;
+#endif
 };
 
 
index 6a36789..4d67d5f 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "WebDataListSuggestionsDropdownGtk.h"
 
-#if ENABLE(DATALIST_ELEMENT)
+#if ENABLE(DATALIST_ELEMENT) && !USE(GTK4)
 
 #include "WebPageProxy.h"
 #include <WebCore/DataListSuggestionInformation.h>
index 6407d62..0fdcb17 100644 (file)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#if ENABLE(DATALIST_ELEMENT)
+#if ENABLE(DATALIST_ELEMENT) && !USE(GTK4)
 
 #include "WebDataListSuggestionsDropdown.h"
 
index e98b052..aabf626 100644 (file)
 #include <WebCore/NotImplemented.h>
 #include <WebCore/PlatformDisplay.h>
 #include <WebCore/UserAgent.h>
-#include <gtk/gtkx.h>
 #include <wtf/NeverDestroyed.h>
 
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
+#include <gtk/gtkx.h>
+#endif
+
 namespace WebKit {
 
 void WebPageProxy::platformInitialize()
@@ -93,7 +96,7 @@ void WebPageProxy::updateEditorState(const EditorState& editorState)
     pageClient().selectionDidChange();
 }
 
-#if PLATFORM(X11)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 typedef HashMap<uint64_t, GtkWidget* > PluginWindowMap;
 static PluginWindowMap& pluginWindowMap()
 {
@@ -147,7 +150,7 @@ void WebPageProxy::windowedPluginVisibilityDidChange(bool isVisible, uint64_t wi
     else
         gtk_widget_hide(plugin);
 }
-#endif // PLATFORM(X11)
+#endif // PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 
 void WebPageProxy::setInputMethodState(Optional<InputMethodState>&& state)
 {
index f2b9745..464de6c 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "WebPopupMenuProxyGtk.h"
 
+#if !USE(GTK4)
+
 #include "NativeWebMouseEvent.h"
 #include "WebPopupItem.h"
 #include <WebCore/GtkUtilities.h>
@@ -441,3 +443,5 @@ bool WebPopupMenuProxyGtk::typeAheadFind(GdkEventKey* event)
 }
 
 } // namespace WebKit
+
+#endif
index 87d0b6f..5575c78 100644 (file)
@@ -20,6 +20,7 @@
 #pragma once
 
 #include "WebPopupMenuProxy.h"
+#if !USE(GTK4)
 #include <WebCore/GUniquePtrGtk.h>
 #include <wtf/Vector.h>
 #include <wtf/glib/GRefPtr.h>
@@ -87,3 +88,5 @@ private:
 };
 
 } // namespace WebKit
+
+#endif
index b572aa3..63136bf 100644 (file)
@@ -144,7 +144,7 @@ public:
     // Decrements a counter that, when it reaches 0, stops preventing the plug-in from being destroyed.
     virtual void unprotectPluginFromDestruction() = 0;
 
-#if PLATFORM(X11)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
     // Create a plugin container for windowed plugins
     virtual uint64_t createPluginContainer() = 0;
     virtual void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID) = 0;
index c3e83b3..ab48b61 100644 (file)
@@ -73,7 +73,7 @@
 #include <wtf/CompletionHandler.h>
 #include <wtf/text/StringBuilder.h>
 
-#if PLATFORM(X11)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 #include <WebCore/PlatformDisplay.h>
 #endif
 
@@ -1682,7 +1682,7 @@ void PluginView::didFailLoad(WebFrame* webFrame, bool wasCancelled)
     m_plugin->frameDidFail(request->requestID(), wasCancelled);
 }
 
-#if PLATFORM(X11)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
 uint64_t PluginView::createPluginContainer()
 {
     uint64_t windowID = 0;
index 03a91bc..ac94804 100644 (file)
@@ -226,7 +226,7 @@ private:
     bool artificialPluginInitializationDelayEnabled() const override;
     void protectPluginFromDestruction() override;
     void unprotectPluginFromDestruction() override;
-#if PLATFORM(X11)
+#if PLATFORM(X11) && ENABLE(NETSCAPE_PLUGIN_API)
     uint64_t createPluginContainer() override;
     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID) override;
     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID) override;
index 8d70b97..45634c6 100644 (file)
@@ -407,7 +407,7 @@ WebPage::WebPage(PageIdentifier pageID, WebPageCreationParameters&& parameters)
 #if ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING)
     , m_textCheckingControllerProxy(makeUniqueRef<TextCheckingControllerProxy>(*this))
 #endif
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || (PLATFORM(GTK) && !USE(GTK4))
     , m_viewGestureGeometryCollector(makeUnique<ViewGestureGeometryCollector>(*this))
 #elif ENABLE(ACCESSIBILITY) && PLATFORM(GTK)
     , m_accessibilityObject(nullptr)
@@ -1441,7 +1441,7 @@ void WebPage::close()
 #if ENABLE(FULLSCREEN_API)
     webProcess.removeMessageReceiver(Messages::WebFullScreenManager::messageReceiverName(), m_identifier);
 #endif
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || (PLATFORM(GTK) && !USE(GTK4))
     m_viewGestureGeometryCollector = nullptr;
 #endif
 
@@ -4447,7 +4447,7 @@ void WebPage::mainFrameDidLayout()
         m_cachedPageCount = pageCount;
     }
 
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || (PLATFORM(GTK) && !USE(GTK4))
     if (m_viewGestureGeometryCollector)
         m_viewGestureGeometryCollector->mainFrameDidLayout();
 #endif
index 71940e1..4f11a53 100644 (file)
@@ -1812,7 +1812,7 @@ private:
     UniqueRef<TextCheckingControllerProxy> m_textCheckingControllerProxy;
 #endif
 
-#if PLATFORM(COCOA) || PLATFORM(GTK)
+#if PLATFORM(COCOA) || (PLATFORM(GTK) && !USE(GTK4))
     std::unique_ptr<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
 #endif
 
index e3ea844..6f1d747 100644 (file)
 #include <X11/Xlib.h>
 #include <X11/extensions/Xcomposite.h>
 #include <cairo-xlib.h>
+#if USE(GTK4)
+#include <gdk/x11/gdkx.h>
+#else
 #include <gdk/gdkx.h>
+#endif
 #include <wtf/RunLoop.h>
 
 namespace WebKit {
@@ -47,17 +51,20 @@ std::unique_ptr<AcceleratedSurfaceX11> AcceleratedSurfaceX11::create(WebPage& we
     return std::unique_ptr<AcceleratedSurfaceX11>(new AcceleratedSurfaceX11(webPage, client));
 }
 
+#if !USE(GTK4)
 static GdkVisual* defaultVisual()
 {
     if (GdkVisual* visual = gdk_screen_get_rgba_visual(gdk_screen_get_default()))
         return visual;
     return gdk_screen_get_system_visual(gdk_screen_get_default());
 }
+#endif
 
 AcceleratedSurfaceX11::AcceleratedSurfaceX11(WebPage& webPage, Client& client)
     : AcceleratedSurface(webPage, client)
     , m_display(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native())
 {
+#if !USE(GTK4)
     Screen* screen = DefaultScreenOfDisplay(m_display);
 
     ASSERT(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native() == m_display);
@@ -110,6 +117,7 @@ AcceleratedSurfaceX11::AcceleratedSurfaceX11(WebPage& webPage, Client& client)
     XSelectInput(m_display, m_window.get(), NoEventMask);
     XCompositeRedirectWindow(m_display, m_window.get(), CompositeRedirectManual);
     createPixmap();
+#endif
 }
 
 AcceleratedSurfaceX11::~AcceleratedSurfaceX11()
@@ -125,12 +133,14 @@ AcceleratedSurfaceX11::~AcceleratedSurfaceX11()
 
 void AcceleratedSurfaceX11::createPixmap()
 {
+#if !USE(GTK4)
     m_pixmap = XCompositeNameWindowPixmap(m_display, m_window.get());
     RefPtr<cairo_surface_t> surface = adoptRef(cairo_xlib_surface_create(m_display, m_pixmap.get(), GDK_VISUAL_XVISUAL(defaultVisual()), m_size.width(), m_size.height()));
     RefPtr<cairo_t> cr = adoptRef(cairo_create(surface.get()));
     cairo_set_operator(cr.get(), CAIRO_OPERATOR_CLEAR);
     cairo_paint(cr.get());
     XSync(m_display, False);
+#endif
 }
 
 bool AcceleratedSurfaceX11::hostResize(const IntSize& size)
index 31eff11..e9113c9 100644 (file)
@@ -737,7 +737,7 @@ void WebPrintOperationGtk::print(cairo_surface_t* surface, double xDPI, double y
     m_xDPI = xDPI;
     m_yDPI = yDPI;
     m_cairoContext = adoptRef(cairo_create(surface));
-
+#if !USE(GTK4)
     // Make sure the print pages idle has more priority than IPC messages comming from
     // the IO thread, so that the EndPrinting message is always handled once the print
     // operation has finished. See https://bugs.webkit.org/show_bug.cgi?id=122801.
@@ -748,6 +748,7 @@ void WebPrintOperationGtk::print(cairo_surface_t* surface, double xDPI, double y
         ASSERT(mainLoop);
         g_main_loop_run(mainLoop);
     }
+#endif
 }
 
 }
index 95fc606..b1700b2 100644 (file)
@@ -120,7 +120,11 @@ WEBKIT_OPTION_DEPEND(USE_WPE_RENDERER ENABLE_WAYLAND_TARGET)
 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
 if (DEVELOPER_MODE)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
-    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
+    if (USE_GTK4)
+        WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE OFF)
+    else ()
+        WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
+    endif ()
 else ()
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC OFF)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE OFF)
@@ -262,6 +266,10 @@ if (USE_LIBSECRET)
     endif ()
 endif ()
 
+if (USE_GTK4)
+    set(ENABLE_INTROSPECTION OFF)
+endif ()
+
 if (ENABLE_INTROSPECTION)
     find_package(GObjectIntrospection)
     if (NOT INTROSPECTION_FOUND)
@@ -432,6 +440,7 @@ set(DERIVED_SOURCES_WEBKIT2GTK_API_DIR ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/webkit2
 set(DERIVED_SOURCES_JAVASCRIPCOREGTK_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcoregtk)
 set(DERIVED_SOURCES_JAVASCRIPCORE_GLIB_API_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcoregtk/jsc)
 set(FORWARDING_HEADERS_WEBKIT2GTK_DIR ${FORWARDING_HEADERS_DIR}/webkit2gtk)
+set(FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR ${FORWARDING_HEADERS_DIR}/webkit2gtk-${WEBKITGTK_API_VERSION})
 set(FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/webkit2gtk-webextension)
 
 set(JavaScriptCore_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/Source/JavaScriptCore/javascriptcoregtk-${WEBKITGTK_API_VERSION}.pc)
index 33d1ac0..afcd4e9 100644 (file)
@@ -1,3 +1,56 @@
+2020-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK4] Make it possible to build with GTK4 without errors
+        https://bugs.webkit.org/show_bug.cgi?id=210967
+
+        Reviewed by Adrian Perez de Castro.
+
+        * MiniBrowser/gtk/BrowserCellRendererVariant.c:
+        * MiniBrowser/gtk/BrowserCellRendererVariant.h:
+        * MiniBrowser/gtk/BrowserDownloadsBar.c:
+        * MiniBrowser/gtk/BrowserDownloadsBar.h:
+        * MiniBrowser/gtk/BrowserMain.c: Added.
+        (browser_main):
+        (browser_main_quit):
+        * MiniBrowser/gtk/BrowserMain.h: Added.
+        * MiniBrowser/gtk/BrowserSearchBar.c:
+        * MiniBrowser/gtk/BrowserSearchBar.h:
+        * MiniBrowser/gtk/BrowserSettingsDialog.c:
+        * MiniBrowser/gtk/BrowserSettingsDialog.h:
+        * MiniBrowser/gtk/BrowserTab.c:
+        (browserTabConstructed):
+        (browser_tab_start_search):
+        (browser_tab_stop_search):
+        (browser_tab_enter_fullscreen):
+        (browser_tab_leave_fullscreen):
+        * MiniBrowser/gtk/BrowserTab.h:
+        * MiniBrowser/gtk/BrowserWindow.c:
+        (webViewURIChanged):
+        (resetEntryProgress):
+        (webViewLoadProgressChanged):
+        (downloadStarted):
+        (browserWindowUpdateNavigationActions):
+        (webViewReadyToShow):
+        (browserWindowUpdateZoomActions):
+        (webViewZoomLevelChanged):
+        (updateUriEntryIcon):
+        (webViewIsLoadingChanged):
+        (browserWindowFinalize):
+        (browserWindowSetupEditorToolbar):
+        (browserWindowSwitchTab):
+        (browser_window_init):
+        (browser_window_class_init):
+        (browser_window_new):
+        (browser_window_append_view):
+        (browser_window_set_background_color):
+        (browser_window_get_or_create_web_view_for_automation):
+        * MiniBrowser/gtk/CMakeLists.txt:
+        * MiniBrowser/gtk/main.c:
+        (main):
+        * PlatformGTK.cmake:
+        * Scripts/webkitpy/style/checker.py:
+        * TestWebKitAPI/glib/PlatformGTK.cmake:
+
 2020-04-27  Philippe Normand  <pnormand@igalia.com>
 
         [Flatpak SDK] Regenerate toolchains only if new updates were downloaded
index cb2caa3..6f8a23c 100644 (file)
@@ -27,6 +27,8 @@
 #include "BrowserMarshal.h"
 #include <errno.h>
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 enum {
     PROP_0,
 
@@ -344,3 +346,4 @@ GtkCellRenderer *browser_cell_renderer_variant_new(void)
     return GTK_CELL_RENDERER(g_object_new(BROWSER_TYPE_CELL_RENDERER_VARIANT, NULL));
 }
 
+#endif
index 4fce3bb..a793a1a 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <gtk/gtk.h>
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 G_BEGIN_DECLS
 
 #define BROWSER_TYPE_CELL_RENDERER_VARIANT            (browser_cell_renderer_variant_get_type())
@@ -47,3 +49,5 @@ GtkCellRenderer* browser_cell_renderer_variant_new(void);
 G_END_DECLS
 
 #endif
+
+#endif
index b0ec3ce..e7884f5 100644 (file)
@@ -26,6 +26,8 @@
 #include "cmakeconfig.h"
 #include "BrowserDownloadsBar.h"
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 #include <glib/gi18n.h>
 
 #define BROWSER_TYPE_DOWNLOAD (browser_download_get_type())
@@ -275,3 +277,5 @@ void browser_downloads_bar_add_download(BrowserDownloadsBar *downloadsBar, WebKi
     gtk_box_pack_start(GTK_BOX(contentBox), browserDownload, FALSE, TRUE, 0);
     gtk_widget_show(browserDownload);
 }
+
+#endif
index 1704a5d..b3d3b69 100644 (file)
@@ -29,6 +29,8 @@
 #include <gtk/gtk.h>
 #include <webkit2/webkit2.h>
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 G_BEGIN_DECLS
 
 #define BROWSER_TYPE_DOWNLOADS_BAR            (browser_downloads_bar_get_type())
@@ -49,3 +51,5 @@ void browser_downloads_bar_add_download(BrowserDownloadsBar *, WebKitDownload *)
 G_END_DECLS
 
 #endif
+
+#endif
diff --git a/Tools/MiniBrowser/gtk/BrowserMain.c b/Tools/MiniBrowser/gtk/BrowserMain.c
new file mode 100644 (file)
index 0000000..258f130
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "BrowserMain.h"
+
+#if GTK_CHECK_VERSION(3, 98, 0)
+static GMainLoop *mainLoop;
+#endif
+
+void browser_main()
+{
+#if GTK_CHECK_VERSION(3, 98, 0)
+    mainLoop = g_main_loop_new(NULL, TRUE);
+    g_main_loop_run(mainLoop);
+#else
+    gtk_main();
+#endif
+}
+
+void browser_main_quit()
+{
+#if GTK_CHECK_VERSION(3, 98, 0)
+    g_main_loop_quit(mainLoop);
+    g_main_loop_unref(mainLoop);
+#else
+    gtk_main_quit();
+#endif
+}
diff --git a/Tools/MiniBrowser/gtk/BrowserMain.h b/Tools/MiniBrowser/gtk/BrowserMain.h
new file mode 100644 (file)
index 0000000..22cd803
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BrowserMain_h
+#define BrowserMain_h
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+void browser_main(void);
+void browser_main_quit(void);
+
+G_END_DECLS
+
+#endif /* BrowserMain_h */
index 22930c4..351243c 100644 (file)
@@ -26,6 +26,8 @@
 #include "cmakeconfig.h"
 #include "BrowserSearchBar.h"
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 static const char *searchEntryFailedStyle = "GtkEntry#searchEntry {background-color: #ff6666;}";
 
 struct _BrowserSearchBar {
@@ -291,3 +293,5 @@ void browser_search_bar_close(BrowserSearchBar *searchBar)
     WebKitFindController *controller = webkit_web_view_get_find_controller(searchBar->webView);
     webkit_find_controller_search_finish(controller);
 }
+
+#endif
index 1de8d8a..9baa22e 100644 (file)
@@ -29,6 +29,8 @@
 #include <gtk/gtk.h>
 #include <webkit2/webkit2.h>
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 G_BEGIN_DECLS
 
 #define BROWSER_TYPE_SEARCH_BAR            (browser_search_bar_get_type())
@@ -55,3 +57,5 @@ void browser_search_bar_close(BrowserSearchBar *);
 G_END_DECLS
 
 #endif
+
+#endif
index f9350f8..178f053 100644 (file)
@@ -26,6 +26,8 @@
 #include "BrowserSettingsDialog.h"
 #include "BrowserCellRendererVariant.h"
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 enum {
     PROP_0,
 
@@ -236,3 +238,4 @@ GtkWidget *browser_settings_dialog_new(WebKitSettings *settings)
     return GTK_WIDGET(g_object_new(BROWSER_TYPE_SETTINGS_DIALOG, "settings", settings, NULL));
 }
 
+#endif
index f3dbcd0..2c33977 100644 (file)
@@ -29,6 +29,8 @@
 #include <gtk/gtk.h>
 #include <webkit2/webkit2.h>
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
+
 G_BEGIN_DECLS
 
 #define BROWSER_TYPE_SETTINGS_DIALOG            (browser_settings_dialog_get_type())
@@ -48,3 +50,5 @@ GtkWidget* browser_settings_dialog_new(WebKitSettings *settings);
 G_END_DECLS
 
 #endif
+
+#endif
index 9e9978e..6c179c4 100644 (file)
@@ -42,7 +42,9 @@ struct _BrowserTab {
     GtkBox parent;
 
     WebKitWebView *webView;
+#if !GTK_CHECK_VERSION(3, 98, 0)
     BrowserSearchBar *searchBar;
+#endif
     GtkWidget *statusLabel;
     gboolean wasSearchingWhenEnteredFullscreen;
     gboolean inspectorIsVisible;
@@ -95,7 +97,7 @@ static gchar *getWebViewOrigin(WebKitWebView *webView)
 
     return originStr;
 }
-
+#if !GTK_CHECK_VERSION(3, 98, 0)
 static void titleChanged(WebKitWebView *webView, GParamSpec *pspec, BrowserTab *tab)
 {
     const char *title = webkit_web_view_get_title(webView);
@@ -343,6 +345,7 @@ static gboolean runColorChooserCallback(WebKitWebView *webView, WebKitColorChoos
 
     return TRUE;
 }
+#endif
 
 static gboolean inspectorOpenedInWindow(WebKitWebInspector *inspector, BrowserTab *tab)
 {
@@ -392,6 +395,7 @@ static void browserTabConstructed(GObject *gObject)
 
     G_OBJECT_CLASS(browser_tab_parent_class)->constructed(gObject);
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     tab->searchBar = BROWSER_SEARCH_BAR(browser_search_bar_new(tab->webView));
     gtk_box_pack_start(GTK_BOX(tab), GTK_WIDGET(tab->searchBar), FALSE, FALSE, 0);
 
@@ -422,7 +426,11 @@ static void browserTabConstructed(GObject *gObject)
 
     gtk_container_add(GTK_CONTAINER(overlay), GTK_WIDGET(tab->webView));
     gtk_widget_show(GTK_WIDGET(tab->webView));
+#else
+    gtk_container_add(GTK_CONTAINER(tab), GTK_WIDGET(tab->webView));
+#endif
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     tab->titleBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4);
 
     GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
@@ -460,6 +468,7 @@ static void browserTabConstructed(GObject *gObject)
     g_signal_connect(tab->webView, "load-failed-with-tls-errors", G_CALLBACK(loadFailedWithTLSerrors), tab);
     g_signal_connect(tab->webView, "permission-request", G_CALLBACK(decidePermissionRequest), tab);
     g_signal_connect(tab->webView, "run-color-chooser", G_CALLBACK(runColorChooserCallback), tab);
+#endif
 
     WebKitWebInspector *inspector = webkit_web_view_get_inspector(tab->webView);
     g_signal_connect(inspector, "open-window", G_CALLBACK(inspectorOpenedInWindow), tab);
@@ -562,19 +571,22 @@ void browser_tab_toggle_inspector(BrowserTab *tab)
 void browser_tab_start_search(BrowserTab *tab)
 {
     g_return_if_fail(BROWSER_IS_TAB(tab));
-
+#if !GTK_CHECK_VERSION(3, 98, 0)
     if (!gtk_widget_get_visible(GTK_WIDGET(tab->searchBar)))
         browser_search_bar_open(tab->searchBar);
+#endif
 }
 
 void browser_tab_stop_search(BrowserTab *tab)
 {
     g_return_if_fail(BROWSER_IS_TAB(tab));
-
+#if !GTK_CHECK_VERSION(3, 98, 0)
     if (gtk_widget_get_visible(GTK_WIDGET(tab->searchBar)))
         browser_search_bar_close(tab->searchBar);
+#endif
 }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
 void browser_tab_add_accelerators(BrowserTab *tab, GtkAccelGroup *accelGroup)
 {
     g_return_if_fail(BROWSER_IS_TAB(tab));
@@ -582,6 +594,7 @@ void browser_tab_add_accelerators(BrowserTab *tab, GtkAccelGroup *accelGroup)
 
     browser_search_bar_add_accelerators(tab->searchBar, accelGroup);
 }
+#endif
 
 static gboolean fullScreenMessageTimeoutCallback(BrowserTab *tab)
 {
@@ -607,8 +620,10 @@ void browser_tab_enter_fullscreen(BrowserTab *tab)
     tab->fullScreenMessageLabelId = g_timeout_add_seconds(2, (GSourceFunc)fullScreenMessageTimeoutCallback, tab);
     g_source_set_name_by_id(tab->fullScreenMessageLabelId, "[WebKit] fullScreenMessageTimeoutCallback");
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     tab->wasSearchingWhenEnteredFullscreen = gtk_widget_get_visible(GTK_WIDGET(tab->searchBar));
     browser_tab_stop_search(tab);
+#endif
 }
 
 void browser_tab_leave_fullscreen(BrowserTab *tab)
@@ -622,6 +637,7 @@ void browser_tab_leave_fullscreen(BrowserTab *tab)
 
     gtk_widget_hide(tab->fullScreenMessageLabel);
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     if (tab->wasSearchingWhenEnteredFullscreen) {
         /* Opening the search bar steals the focus. Usually, we want
          * this but not when coming back from fullscreen.
@@ -631,6 +647,7 @@ void browser_tab_leave_fullscreen(BrowserTab *tab)
         browser_tab_start_search(tab);
         gtk_window_set_focus(window, focusWidget);
     }
+#endif
 }
 
 void browser_tab_set_background_color(BrowserTab *tab, GdkRGBA *rgba)
index d455737..c50a809 100644 (file)
@@ -51,7 +51,9 @@ void browser_tab_set_status_text(BrowserTab*, const char* text);
 void browser_tab_toggle_inspector(BrowserTab*);
 void browser_tab_start_search(BrowserTab*);
 void browser_tab_stop_search(BrowserTab*);
+#if !GTK_CHECK_VERSION(3, 98, 0)
 void browser_tab_add_accelerators(BrowserTab*, GtkAccelGroup*);
+#endif
 void browser_tab_enter_fullscreen(BrowserTab*);
 void browser_tab_leave_fullscreen(BrowserTab*);
 void browser_tab_set_background_color(BrowserTab*, GdkRGBA*);
index 21c3c3d..53c564f 100644 (file)
@@ -31,6 +31,7 @@
 #include "BrowserWindow.h"
 
 #include "BrowserDownloadsBar.h"
+#include "BrowserMain.h"
 #include "BrowserSearchBar.h"
 #include "BrowserSettingsDialog.h"
 #include "BrowserTab.h"
@@ -42,7 +43,9 @@ struct _BrowserWindow {
 
     WebKitWebContext *webContext;
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     GtkAccelGroup *accelGroup;
+#endif
     GtkWidget *mainBox;
     GtkWidget *toolbar;
     GtkWidget *uriEntry;
@@ -100,6 +103,7 @@ static void resetStatusText(GtkWidget *widget, BrowserWindow *window)
     browserWindowSetStatusText(window, NULL);
 }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
 static void activateUriEntryCallback(BrowserWindow *window)
 {
     browser_window_load_uri(window, gtk_entry_get_text(GTK_ENTRY(window->uriEntry)));
@@ -139,15 +143,18 @@ static void settingsCallback(BrowserWindow *window)
     g_object_add_weak_pointer(G_OBJECT(window->settingsDialog), (gpointer *)&window->settingsDialog);
     gtk_widget_show(window->settingsDialog);
 }
+#endif
 
 static void webViewURIChanged(WebKitWebView *webView, GParamSpec *pspec, BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     char *externalURI = getExternalURI(webkit_web_view_get_uri(webView));
     if (externalURI) {
         gtk_entry_set_text(GTK_ENTRY(window->uriEntry), externalURI);
         g_free(externalURI);
     } else
         gtk_entry_set_text(GTK_ENTRY(window->uriEntry), "");
+#endif
 }
 
 static void webViewTitleChanged(WebKitWebView *webView, GParamSpec *pspec, BrowserWindow *window)
@@ -166,7 +173,9 @@ static void webViewTitleChanged(WebKitWebView *webView, GParamSpec *pspec, Brows
 
 static gboolean resetEntryProgress(BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), 0);
+#endif
     window->resetEntryProgressTimeoutId = 0;
     return FALSE;
 }
@@ -174,7 +183,9 @@ static gboolean resetEntryProgress(BrowserWindow *window)
 static void webViewLoadProgressChanged(WebKitWebView *webView, GParamSpec *pspec, BrowserWindow *window)
 {
     gdouble progress = webkit_web_view_get_estimated_load_progress(webView);
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), progress);
+#endif
     if (progress == 1.0) {
         window->resetEntryProgressTimeoutId = g_timeout_add(500, (GSourceFunc)resetEntryProgress, window);
         g_source_set_name_by_id(window->resetEntryProgressTimeoutId, "[WebKit] resetEntryProgress");
@@ -186,6 +197,7 @@ static void webViewLoadProgressChanged(WebKitWebView *webView, GParamSpec *pspec
 
 static void downloadStarted(WebKitWebContext *webContext, WebKitDownload *download, BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     if (!window->downloadsBar) {
         window->downloadsBar = browser_downloads_bar_new();
         gtk_box_pack_start(GTK_BOX(window->mainBox), window->downloadsBar, FALSE, FALSE, 0);
@@ -194,8 +206,10 @@ static void downloadStarted(WebKitWebContext *webContext, WebKitDownload *downlo
         gtk_widget_show(window->downloadsBar);
     }
     browser_downloads_bar_add_download(BROWSER_DOWNLOADS_BAR(window->downloadsBar), download);
+#endif
 }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
 static void browserWindowHistoryItemSelected(BrowserWindow *window, GtkMenuItem *item)
 {
     GtkAction *action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(item));
@@ -240,9 +254,11 @@ static GtkWidget *browserWindowCreateBackForwardMenu(BrowserWindow *window, GLis
 
     return menu;
 }
+#endif
 
 static void browserWindowUpdateNavigationActions(BrowserWindow *window, WebKitBackForwardList *backForwardlist)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
     gtk_widget_set_sensitive(window->backItem, webkit_web_view_can_go_back(webView));
     gtk_widget_set_sensitive(window->forwardItem, webkit_web_view_can_go_forward(webView));
@@ -256,6 +272,7 @@ static void browserWindowUpdateNavigationActions(BrowserWindow *window, WebKitBa
     gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(window->forwardItem),
         browserWindowCreateBackForwardMenu(window, list));
     g_list_free(list);
+#endif
 }
 
 static void browserWindowTryCloseCurrentWebView(BrowserWindow *window)
@@ -316,8 +333,10 @@ static void webViewReadyToShow(WebKitWebView *webView, BrowserWindow *window)
 
     GdkRectangle geometry;
     webkit_window_properties_get_geometry(windowProperties, &geometry);
+#if !GTK_CHECK_VERSION(3, 98, 0)
     if (geometry.x >= 0 && geometry.y >= 0)
         gtk_window_move(GTK_WINDOW(window), geometry.x, geometry.y);
+#endif
     if (geometry.width > 0 && geometry.height > 0)
         gtk_window_resize(GTK_WINDOW(window), geometry.width, geometry.height);
 
@@ -439,6 +458,7 @@ static gboolean browserWindowZoomOut(BrowserWindow *window)
     return FALSE;
 }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
 static gboolean scrollEventCallback(WebKitWebView *webView, const GdkEventScroll *event, BrowserWindow *window)
 {
     GdkModifierType mod = gtk_accelerator_get_default_mod_mask();
@@ -451,25 +471,32 @@ static gboolean scrollEventCallback(WebKitWebView *webView, const GdkEventScroll
 
     return browserWindowZoomOut(window);
 }
+#endif
 
 static void browserWindowUpdateZoomActions(BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gtk_widget_set_sensitive(window->zoomInItem, browserWindowCanZoomIn(window));
     gtk_widget_set_sensitive(window->zoomOutItem, browserWindowCanZoomOut(window));
+#endif
 }
 
 static void webViewZoomLevelChanged(GObject *object, GParamSpec *paramSpec, BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     browserWindowUpdateZoomActions(window);
+#endif
 }
 
 static void updateUriEntryIcon(BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     GtkEntry *entry = GTK_ENTRY(window->uriEntry);
     if (window->favicon)
         gtk_entry_set_icon_from_pixbuf(entry, GTK_ENTRY_ICON_PRIMARY, window->favicon);
     else
         gtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_NEW);
+#endif
 }
 
 static void faviconChanged(WebKitWebView *webView, GParamSpec *paramSpec, BrowserWindow *window)
@@ -492,11 +519,14 @@ static void faviconChanged(WebKitWebView *webView, GParamSpec *paramSpec, Browse
 
 static void webViewIsLoadingChanged(WebKitWebView *webView, GParamSpec *paramSpec, BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gboolean isLoading = webkit_web_view_is_loading(webView);
     gtk_tool_button_set_label(GTK_TOOL_BUTTON(window->reloadOrStopButton), isLoading ? "Stop" : "Reload");
     gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(window->reloadOrStopButton), isLoading ? GTK_STOCK_STOP : GTK_STOCK_REFRESH);
+#endif
 }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
 static void zoomInCallback(BrowserWindow *window)
 {
     browserWindowZoomIn(window);
@@ -517,6 +547,7 @@ static void searchCallback(BrowserWindow *window)
 {
     browser_tab_start_search(window->activeTab);
 }
+#endif
 
 static void newTabCallback(BrowserWindow *window)
 {
@@ -617,6 +648,7 @@ static gboolean printPage(BrowserWindow *window, gpointer user_data)
     return TRUE;
 }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
 static void editingCommandCallback(GtkWidget *widget, BrowserWindow *window)
 {
     WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
@@ -681,6 +713,7 @@ static void typingAttributesChanged(WebKitEditorState *editorState, GParamSpec *
     browserWindowEditingCommandToggleButtonSetActive(window, window->underlineItem, typingAttributes & WEBKIT_EDITOR_TYPING_ATTRIBUTE_UNDERLINE);
     browserWindowEditingCommandToggleButtonSetActive(window, window->strikethroughItem, typingAttributes & WEBKIT_EDITOR_TYPING_ATTRIBUTE_STRIKETHROUGH);
 }
+#endif
 
 static void browserWindowFinalize(GObject *gObject)
 {
@@ -693,10 +726,12 @@ static void browserWindowFinalize(GObject *gObject)
         window->favicon = NULL;
     }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     if (window->accelGroup) {
         g_object_unref(window->accelGroup);
         window->accelGroup = NULL;
     }
+#endif
 
     if (window->resetEntryProgressTimeoutId)
         g_source_remove(window->resetEntryProgressTimeoutId);
@@ -708,7 +743,7 @@ static void browserWindowFinalize(GObject *gObject)
     G_OBJECT_CLASS(browser_window_parent_class)->finalize(gObject);
 
     if (!windowList)
-        gtk_main_quit();
+        browser_main_quit();
 }
 
 static void browserWindowDispose(GObject *gObject)
@@ -725,6 +760,7 @@ static void browserWindowDispose(GObject *gObject)
 
 static void browserWindowSetupEditorToolbar(BrowserWindow *window)
 {
+#if !GTK_CHECK_VERSION(3, 98, 0)
     GtkWidget *toolbar = gtk_toolbar_new();
     gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL);
     gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ);
@@ -870,6 +906,7 @@ static void browserWindowSetupEditorToolbar(BrowserWindow *window)
     gtk_box_pack_start(GTK_BOX(window->mainBox), toolbar, FALSE, FALSE, 0);
     gtk_box_reorder_child(GTK_BOX(window->mainBox), toolbar, 1);
     gtk_widget_show(toolbar);
+#endif
 }
 
 static void browserWindowSwitchTab(GtkNotebook *notebook, BrowserTab *tab, guint tabIndex, BrowserWindow *window)
@@ -896,7 +933,9 @@ static void browserWindowSwitchTab(GtkNotebook *notebook, BrowserTab *tab, guint
     WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
     if (webkit_web_view_is_editable(webView)) {
         browserWindowSetupEditorToolbar(window);
+#if !GTK_CHECK_VERSION(3, 98, 0)
         g_signal_connect(webkit_web_view_get_editor_state(webView), "notify::typing-attributes", G_CALLBACK(typingAttributesChanged), window);
+#endif
     }
     webViewURIChanged(webView, NULL, window);
     webViewTitleChanged(webView, NULL, window);
@@ -919,7 +958,9 @@ static void browserWindowSwitchTab(GtkNotebook *notebook, BrowserTab *tab, guint
     g_signal_connect(webView, "notify::favicon", G_CALLBACK(faviconChanged), window);
     g_signal_connect(webView, "enter-fullscreen", G_CALLBACK(webViewEnterFullScreen), window);
     g_signal_connect(webView, "leave-fullscreen", G_CALLBACK(webViewLeaveFullScreen), window);
+#if !GTK_CHECK_VERSION(3, 98, 0)
     g_signal_connect(webView, "scroll-event", G_CALLBACK(scrollEventCallback), window);
+#endif
 
     WebKitBackForwardList *backForwardlist = webkit_web_view_get_back_forward_list(webView);
     browserWindowUpdateNavigationActions(window, backForwardlist);
@@ -941,6 +982,7 @@ static void browser_window_init(BrowserWindow *window)
     gtk_window_set_title(GTK_WINDOW(window), defaultWindowTitle);
     gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     window->uriEntry = gtk_entry_new();
     g_signal_connect_swapped(window->uriEntry, "activate", G_CALLBACK(activateUriEntryCallback), (gpointer)window);
     gtk_entry_set_icon_activatable(GTK_ENTRY(window->uriEntry), GTK_ENTRY_ICON_PRIMARY, FALSE);
@@ -1088,11 +1130,13 @@ static void browser_window_init(BrowserWindow *window)
     gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
     gtk_widget_add_accelerator(window->reloadOrStopButton, "clicked", window->accelGroup, GDK_KEY_F5, 0, GTK_ACCEL_VISIBLE);
     gtk_widget_show(window->reloadOrStopButton);
-
+#endif
     GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     window->mainBox = vbox;
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
     gtk_widget_show(toolbar);
+#endif
 
     window->notebook = gtk_notebook_new();
     g_signal_connect(window->notebook, "switch-page", G_CALLBACK(browserWindowSwitchTab), window);
@@ -1100,8 +1144,12 @@ static void browser_window_init(BrowserWindow *window)
     g_signal_connect(window->notebook, "page-removed", G_CALLBACK(browserWindowTabAddedOrRemoved), window);
     gtk_notebook_set_show_tabs(GTK_NOTEBOOK(window->notebook), FALSE);
     gtk_notebook_set_show_border(GTK_NOTEBOOK(window->notebook), FALSE);
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gtk_box_pack_start(GTK_BOX(window->mainBox), window->notebook, TRUE, TRUE, 0);
     gtk_widget_show(window->notebook);
+#else
+    gtk_container_add(GTK_CONTAINER(window->mainBox), window->notebook);
+#endif
 
     gtk_container_add(GTK_CONTAINER(window), vbox);
     gtk_widget_show(vbox);
@@ -1125,6 +1173,7 @@ static void browserWindowSaveSession(BrowserWindow *window)
     g_bytes_unref(bytes);
 }
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
 static gboolean browserWindowDeleteEvent(GtkWidget *widget, GdkEventAny* event)
 {
     BrowserWindow *window = BROWSER_WINDOW(widget);
@@ -1132,6 +1181,7 @@ static gboolean browserWindowDeleteEvent(GtkWidget *widget, GdkEventAny* event)
     browserWindowTryClose(window);
     return TRUE;
 }
+#endif
 
 static void browser_window_class_init(BrowserWindowClass *klass)
 {
@@ -1141,8 +1191,10 @@ static void browser_window_class_init(BrowserWindowClass *klass)
     gobjectClass->dispose = browserWindowDispose;
     gobjectClass->finalize = browserWindowFinalize;
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     GtkWidgetClass *widgetClass = GTK_WIDGET_CLASS(klass);
     widgetClass->delete_event = browserWindowDeleteEvent;
+#endif
 }
 
 /* Public API. */
@@ -1151,7 +1203,10 @@ GtkWidget *browser_window_new(GtkWindow *parent, WebKitWebContext *webContext)
     g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(webContext), NULL);
 
     BrowserWindow *window = BROWSER_WINDOW(g_object_new(BROWSER_TYPE_WINDOW,
-        "type", GTK_WINDOW_TOPLEVEL, NULL));
+#if !GTK_CHECK_VERSION(3, 98, 0)
+        "type", GTK_WINDOW_TOPLEVEL,
+#endif
+        NULL));
 
     window->webContext = webContext;
     g_signal_connect(window->webContext, "download-started", G_CALLBACK(downloadStarted), window);
@@ -1181,11 +1236,15 @@ void browser_window_append_view(BrowserWindow *window, WebKitWebView *webView)
     }
 
     GtkWidget *tab = browser_tab_new(webView);
+#if !GTK_CHECK_VERSION(3, 98, 0)
     if (gtk_widget_get_app_paintable(GTK_WIDGET(window)))
         browser_tab_set_background_color(BROWSER_TAB(tab), &window->backgroundColor);
     browser_tab_add_accelerators(BROWSER_TAB(tab), window->accelGroup);
+#endif
     gtk_notebook_append_page(GTK_NOTEBOOK(window->notebook), tab, browser_tab_get_title_widget(BROWSER_TAB(tab)));
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gtk_container_child_set(GTK_CONTAINER(window->notebook), tab, "tab-expand", TRUE, NULL);
+#endif
     gtk_widget_show(tab);
 }
 
@@ -1238,12 +1297,14 @@ void browser_window_set_background_color(BrowserWindow *window, GdkRGBA *rgba)
 
     window->backgroundColor = *rgba;
 
+#if !GTK_CHECK_VERSION(3, 98, 0)
     GdkVisual *rgbaVisual = gdk_screen_get_rgba_visual(gtk_window_get_screen(GTK_WINDOW(window)));
     if (!rgbaVisual)
         return;
 
     gtk_widget_set_visual(GTK_WIDGET(window), rgbaVisual);
     gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE);
+#endif
 }
 
 static BrowserWindow *findActiveWindow(void)
@@ -1278,7 +1339,9 @@ WebKitWebView *browser_window_get_or_create_web_view_for_automation(void)
         "is-controlled-by-automation", TRUE,
         NULL));
     GtkWidget *newWindow = browser_window_new(GTK_WINDOW(window), window->webContext);
+#if !GTK_CHECK_VERSION(3, 98, 0)
     gtk_window_set_focus_on_map(GTK_WINDOW(newWindow), FALSE);
+#endif
     browser_window_append_view(BROWSER_WINDOW(newWindow), newWebView);
     webkit_web_view_load_uri(newWebView, "about:blank");
     gtk_widget_show(newWindow);
index f0aa65b..dfc8413 100644 (file)
@@ -8,6 +8,8 @@ set(MiniBrowser_SOURCES
     BrowserCellRendererVariant.h
     BrowserDownloadsBar.c
     BrowserDownloadsBar.h
+    BrowserMain.c
+    BrowserMain.h
     BrowserSearchBar.c
     BrowserSearchBar.h
     BrowserSettingsDialog.c
@@ -24,6 +26,7 @@ set(MiniBrowser_PRIVATE_INCLUDE_DIRECTORIES
     ${MiniBrowser_DERIVED_SOURCES_DIR}
     ${DERIVED_SOURCES_WEBKIT2GTK_DIR}
     ${FORWARDING_HEADERS_WEBKIT2GTK_DIR}
+    ${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}
     ${FORWARDING_HEADERS_DIR}
     ${CMAKE_SOURCE_DIR}/Source
 )
@@ -56,7 +59,12 @@ add_custom_command(
     COMMAND glib-genmarshal --prefix=browser_marshal ${MiniBrowser_DIR}/browser-marshal.list --header > ${MiniBrowser_DERIVED_SOURCES_DIR}/BrowserMarshal.h
     VERBATIM)
 
-set(MiniBrowser_PRIVATE_DEFINITIONS GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6)
+if (USE_GTK4)
+    set(MiniBrowser_PRIVATE_DEFINITIONS GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_92)
+else ()
+    set(MiniBrowser_PRIVATE_DEFINITIONS GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_22)
+endif ()
+
 if (DEVELOPER_MODE)
     list(APPEND MiniBrowser_PRIVATE_DEFINITIONS -DWEBKIT_INJECTED_BUNDLE_PATH="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
 endif ()
index 92c9a43..e7e7ed6 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "cmakeconfig.h"
 
+#include "BrowserMain.h"
 #include "BrowserWindow.h"
 #include <errno.h>
 #if ENABLE_WEB_AUDIO || ENABLE_VIDEO
@@ -504,11 +505,17 @@ int main(int argc, char *argv[])
     g_setenv("WEBKIT_INJECTED_BUNDLE_PATH", WEBKIT_INJECTED_BUNDLE_PATH, FALSE);
 #endif
 
+#if GTK_CHECK_VERSION(3, 98, 0)
+    gtk_init();
+#else
     gtk_init(&argc, &argv);
+#endif
 
     GOptionContext *context = g_option_context_new(NULL);
     g_option_context_add_main_entries(context, commandLineOptions, 0);
+#if !GTK_CHECK_VERSION(3, 98, 0)
     g_option_context_add_group(context, gtk_get_option_group(TRUE));
+#endif
 #if ENABLE_WEB_AUDIO || ENABLE_VIDEO
     g_option_context_add_group(context, gst_init_get_option_group());
 #endif
@@ -543,7 +550,10 @@ int main(int argc, char *argv[])
 
     WebKitWebsiteDataManager *manager = (privateMode || automationMode) ? webkit_website_data_manager_new_ephemeral() : webkit_website_data_manager_new(NULL);
     WebKitWebContext *webContext = g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager, "process-swap-on-cross-site-navigation-enabled", TRUE,
-        "use-system-appearance-for-scrollbars", FALSE, NULL);
+#if !GTK_CHECK_VERSION(3, 98, 0)
+        "use-system-appearance-for-scrollbars", FALSE,
+#endif
+        NULL);
     g_object_unref(manager);
 
     if (cookiesPolicy) {
@@ -611,8 +621,10 @@ int main(int argc, char *argv[])
         g_object_set(gtk_widget_get_settings(GTK_WIDGET(mainWindow)), "gtk-application-prefer-dark-theme", TRUE, NULL);
     if (fullScreen)
         gtk_window_fullscreen(GTK_WINDOW(mainWindow));
+#if !GTK_CHECK_VERSION(3, 98, 0)
     else if (geometry)
         gtk_window_parse_geometry(GTK_WINDOW(mainWindow), geometry);
+#endif
 
     if (backgroundColor)
         browser_window_set_background_color(mainWindow, backgroundColor);
@@ -647,7 +659,7 @@ int main(int argc, char *argv[])
     g_clear_object(&webkitSettings);
     g_clear_object(&userContentManager);
 
-    gtk_main();
+    browser_main();
 
     if (privateMode)
         g_object_unref(webContext);
index e9ade7a..b35641d 100644 (file)
@@ -1,5 +1,8 @@
 if (DEVELOPER_MODE)
-    add_subdirectory(WebKitTestRunner)
+    if (NOT USE_GTK4)
+        add_subdirectory(WebKitTestRunner)
+    endif ()
+
     add_subdirectory(ImageDiff)
 
     if (ENABLE_API_TESTS)
index 13d1d48..8fcef7a 100644 (file)
@@ -374,6 +374,8 @@ _SKIPPED_FILES_WITH_WARNING = [
 
     # WebKit*.h and JSC*.h files in, except those ending in Private.h are API headers, which do not follow WebKit coding style.
     re.compile(re.escape(os.path.join('Source', 'JavaScriptCore', 'API', 'glib') + os.path.sep) + r'JSC(?!.*Private\.h).*\.h$'),
+    re.compile(re.escape(os.path.join('Source', 'WebKit', 'UIProcess', 'API', 'gtk3') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
+    re.compile(re.escape(os.path.join('Source', 'WebKit', 'UIProcess', 'API', 'gtk4') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
     re.compile(re.escape(os.path.join('Source', 'WebKit', 'UIProcess', 'API', 'gtk') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
     re.compile(re.escape(os.path.join('Source', 'WebKit', 'UIProcess', 'API', 'wpe') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
     re.compile(re.escape(os.path.join('Source', 'WebKit', 'WebProcess', 'InjectedBundle', 'API', 'gtk') + os.path.sep) + r'WebKit(?!.*Private\.h).*\.h$'),
index 60dd9df..c539c06 100644 (file)
@@ -9,6 +9,7 @@ list(APPEND WebKitGLibAPITests_INCLUDE_DIRECTORIES
     ${DERIVED_SOURCES_JAVASCRIPCOREGTK_DIR}
     ${DERIVED_SOURCES_WEBKIT2GTK_DIR}
     ${FORWARDING_HEADERS_WEBKIT2GTK_DIR}
+    ${FORWARDING_HEADERS_WEBKIT2GTK_VERSIONED_DIR}
     ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}
 )