Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
webkit2gtk3.26886
webkit2gtk3-old-gtk.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File webkit2gtk3-old-gtk.patch of Package webkit2gtk3.26886
diff -urp webkitgtk-2.38.0.orig/Source/cmake/OptionsGTK.cmake webkitgtk-2.38.0.gtk/Source/cmake/OptionsGTK.cmake --- webkitgtk-2.38.0.orig/Source/cmake/OptionsGTK.cmake 2022-10-11 10:22:19.121084723 -0500 +++ webkitgtk-2.38.0.gtk/Source/cmake/OptionsGTK.cmake 2022-10-11 10:24:12.061680852 -0500 @@ -145,11 +145,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GPU_PROCESS PRIVATE OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR PRIVATE ON) -WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATE PRIVATE ON) -WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATETIMELOCAL PRIVATE ON) -WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_MONTH PRIVATE ON) -WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_TIME PRIVATE ON) -WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_WEEK PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INTELLIGENT_TRACKING_PREVENTION PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYER_BASED_SVG_ENGINE PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_FORMATTING_CONTEXT PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES}) @@ -187,7 +182,7 @@ if (USE_GTK4) set(GTK_MINIMUM_VERSION 3.98.5) set(GTK_PC_NAME gtk4) else () - set(GTK_MINIMUM_VERSION 3.22.0) + set(GTK_MINIMUM_VERSION 3.20.10) set(GTK_PC_NAME gtk+-3.0) endif () find_package(GTK ${GTK_MINIMUM_VERSION} REQUIRED OPTIONAL_COMPONENTS unix-print) diff -urp webkitgtk-2.38.0.orig/Source/WebCore/Headers.cmake webkitgtk-2.38.0.gtk/Source/WebCore/Headers.cmake --- webkitgtk-2.38.0.orig/Source/WebCore/Headers.cmake 2022-10-11 10:22:19.133084787 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebCore/Headers.cmake 2022-10-11 10:24:12.061680852 -0500 @@ -1282,9 +1282,6 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS platform/DataListSuggestionsClient.h platform/DataOwnerType.h platform/DateComponents.h - platform/DateTimeChooser.h - platform/DateTimeChooserClient.h - platform/DateTimeChooserParameters.h platform/Decimal.h platform/DeferrableTask.h platform/DragData.h diff -urp webkitgtk-2.38.0.orig/Source/WebCore/loader/EmptyClients.cpp webkitgtk-2.38.0.gtk/Source/WebCore/loader/EmptyClients.cpp --- webkitgtk-2.38.0.orig/Source/WebCore/loader/EmptyClients.cpp 2022-09-14 06:58:10.476863000 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebCore/loader/EmptyClients.cpp 2022-10-11 10:24:12.061680852 -0500 @@ -94,10 +94,6 @@ #include "LegacyPreviewLoaderClient.h" #endif -#if ENABLE(DATE_AND_TIME_INPUT_TYPES) -#include "DateTimeChooser.h" -#endif - namespace WebCore { class UserMessageHandlerDescriptor; diff -urp webkitgtk-2.38.0.orig/Source/WebCore/platform/gtk/GtkUtilities.cpp webkitgtk-2.38.0.gtk/Source/WebCore/platform/gtk/GtkUtilities.cpp --- webkitgtk-2.38.0.orig/Source/WebCore/platform/gtk/GtkUtilities.cpp 2022-08-31 02:59:56.298519600 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebCore/platform/gtk/GtkUtilities.cpp 2022-10-11 10:24:12.061680852 -0500 @@ -191,22 +191,6 @@ GdkDragAction dragOperationToSingleGdkDr return static_cast<GdkDragAction>(0); } -void monitorWorkArea(GdkMonitor* monitor, GdkRectangle* area) -{ -#if USE(GTK4) -#if PLATFORM(X11) - if (GDK_IS_X11_MONITOR(monitor)) { - gdk_x11_monitor_get_workarea(monitor, area); - return; - } -#endif - - gdk_monitor_get_geometry(monitor, area); -#else - gdk_monitor_get_workarea(monitor, area); -#endif -} - bool shouldUseOverlayScrollbars() { #if !USE(GTK4) diff -urp webkitgtk-2.38.0.orig/Source/WebCore/platform/gtk/GtkUtilities.h webkitgtk-2.38.0.gtk/Source/WebCore/platform/gtk/GtkUtilities.h --- webkitgtk-2.38.0.orig/Source/WebCore/platform/gtk/GtkUtilities.h 2022-08-31 02:59:56.298519600 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebCore/platform/gtk/GtkUtilities.h 2022-10-11 10:24:12.065680873 -0500 @@ -55,8 +55,6 @@ WEBCORE_EXPORT OptionSet<DragOperation> WEBCORE_EXPORT GdkDragAction dragOperationToGdkDragActions(OptionSet<DragOperation>); WEBCORE_EXPORT GdkDragAction dragOperationToSingleGdkDragAction(OptionSet<DragOperation>); -void monitorWorkArea(GdkMonitor*, GdkRectangle*); - bool shouldUseOverlayScrollbars(); } // namespace WebCore diff -urp webkitgtk-2.38.0.orig/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp webkitgtk-2.38.0.gtk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp --- webkitgtk-2.38.0.orig/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2022-08-31 02:59:56.302519600 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2022-10-11 10:24:12.065680873 -0500 @@ -99,43 +99,21 @@ bool screenHasInvertedColors() double screenDPI() { static const double defaultDpi = 96; -#if !USE(GTK4) GdkScreen* screen = gdk_screen_get_default(); - if (screen) { - double dpi = gdk_screen_get_resolution(screen); - if (dpi != -1) - return dpi; - } -#endif + if (!screen) + return defaultDpi; - static GtkSettings* gtkSettings = gtk_settings_get_default(); - if (gtkSettings) { - int gtkXftDpi; - g_object_get(gtkSettings, "gtk-xft-dpi", >kXftDpi, nullptr); - return gtkXftDpi / 1024.0; - } + double dpi = gdk_screen_get_resolution(screen); + if (dpi != -1) + return dpi; static double cachedDpi = 0; if (cachedDpi) return cachedDpi; static const double millimetresPerInch = 25.4; - - GdkDisplay* display = gdk_display_get_default(); - if (!display) - return defaultDpi; -#if USE(GTK4) - GdkMonitor* monitor = GDK_MONITOR(g_list_model_get_item(gdk_display_get_monitors(display), 0)); -#else - GdkMonitor* monitor = gdk_display_get_monitor(display, 0); -#endif - if (!monitor) - return defaultDpi; - - GdkRectangle geometry; - gdk_monitor_get_geometry(monitor, &geometry); - double diagonalInPixels = std::hypot(geometry.width, geometry.height); - double diagonalInInches = std::hypot(gdk_monitor_get_width_mm(monitor), gdk_monitor_get_height_mm(monitor)) / millimetresPerInch; + double diagonalInPixels = std::hypot(gdk_screen_get_width(screen), gdk_screen_get_height(screen)); + double diagonalInInches = std::hypot(gdk_screen_get_width_mm(screen), gdk_screen_get_height_mm(screen)) / millimetresPerInch; cachedDpi = diagonalInPixels / diagonalInInches; return cachedDpi; @@ -175,6 +153,7 @@ void setScreenDPIObserverHandler(Functio } } +#if GTK_CHECK_VERSION(3,22,0) static GRefPtr<GdkMonitor> currentScreenMonitor() { GdkDisplay* display = gdk_display_get_default(); @@ -191,29 +170,47 @@ static GRefPtr<GdkMonitor> currentScreen return gdk_display_get_monitor_at_window(display, rootWindow); #endif } +#endif FloatRect screenRect(Widget*) { GdkRectangle geometry; - auto monitor = currentScreenMonitor(); +#if GTK_CHECK_VERSION(3,22,0) + auto* monitor = getCurrentScreenMonitor(); if (!monitor) return { }; - gdk_monitor_get_geometry(monitor.get(), &geometry); + gdk_monitor_get_geometry(monitor, &geometry); +#else + GdkScreen* screen = gdk_screen_get_default(); + if (!screen) + return { }; + + gdk_screen_get_monitor_geometry(screen, 0, &geometry); +#endif // !GTK_CHECK_VERSION(3, 22, 0) return FloatRect(geometry.x, geometry.y, geometry.width, geometry.height); } FloatRect screenAvailableRect(Widget*) { - auto monitor = currentScreenMonitor(); + GdkRectangle workArea; + +#if GTK_CHECK_VERSION(3,22,0) + auto* monitor = getCurrentScreenMonitor(); if (!monitor) return { }; - GdkRectangle workArea; - monitorWorkArea(monitor.get(), &workArea); + gdk_monitor_get_workarea(monitor, &workArea); +#else + GdkScreen* screen = gdk_screen_get_default(); + if (!screen) + return FloatRect(); + + gdk_screen_get_monitor_workarea(screen, 0, &workArea); +#endif // !GTK_CHECK_VERSION(3, 22, 0) return FloatRect(workArea.x, workArea.y, workArea.width, workArea.height); } diff -urp webkitgtk-2.38.0.orig/Source/WebCore/platform/ValidationBubble.h webkitgtk-2.38.0.gtk/Source/WebCore/platform/ValidationBubble.h --- webkitgtk-2.38.0.orig/Source/WebCore/platform/ValidationBubble.h 2022-08-31 02:59:56.154518800 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebCore/platform/ValidationBubble.h 2022-10-11 10:24:12.065680873 -0500 @@ -49,8 +49,6 @@ using PlatformView = NSView; #elif PLATFORM(IOS_FAMILY) OBJC_CLASS UIView; using PlatformView = UIView; -#elif PLATFORM(GTK) -using PlatformView = GtkWidget; #else using PlatformView = void; #endif @@ -63,18 +61,10 @@ public: double minimumFontSize { 0 }; }; -#if PLATFORM(GTK) - using ShouldNotifyFocusEventsCallback = Function<void(PlatformView*, bool shouldNotifyFocusEvents)>; - static Ref<ValidationBubble> create(PlatformView* view, const String& message, const Settings& settings, ShouldNotifyFocusEventsCallback&& callback) - { - return adoptRef(*new ValidationBubble(view, message, settings, WTFMove(callback))); - } -#else static Ref<ValidationBubble> create(PlatformView* view, const String& message, const Settings& settings) { return adoptRef(*new ValidationBubble(view, message, settings)); } -#endif WEBCORE_EXPORT ~ValidationBubble(); @@ -89,12 +79,7 @@ public: #endif private: -#if PLATFORM(GTK) - WEBCORE_EXPORT ValidationBubble(PlatformView*, const String& message, const Settings&, ShouldNotifyFocusEventsCallback&&); - void invalidate(); -#else WEBCORE_EXPORT ValidationBubble(PlatformView*, const String& message, const Settings&); -#endif PlatformView* m_view; String m_message; @@ -106,9 +91,6 @@ private: RetainPtr<WebValidationBubbleTapRecognizer> m_tapRecognizer; RetainPtr<WebValidationBubbleDelegate> m_popoverDelegate; WeakObjCPtr<UIViewController> m_presentingViewController; -#elif PLATFORM(GTK) - GtkWidget* m_popover { nullptr }; - ShouldNotifyFocusEventsCallback m_shouldNotifyFocusEventsCallback { nullptr }; #endif }; diff -urp webkitgtk-2.38.0.orig/Source/WebCore/SourcesGTK.txt webkitgtk-2.38.0.gtk/Source/WebCore/SourcesGTK.txt --- webkitgtk-2.38.0.orig/Source/WebCore/SourcesGTK.txt 2022-08-31 02:59:55.654515700 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebCore/SourcesGTK.txt 2022-10-11 10:24:12.065680873 -0500 @@ -122,7 +122,6 @@ platform/gtk/RenderThemeGadget.cpp platform/gtk/RenderThemeScrollbar.cpp platform/gtk/ScrollbarThemeGtk.cpp platform/gtk/SelectionData.cpp -platform/gtk/ValidationBubbleGtk.cpp platform/gtk/WidgetGtk.cpp platform/text/Hyphenation.cpp diff -urp webkitgtk-2.38.0.orig/Source/WebKit/SourcesGTK.txt webkitgtk-2.38.0.gtk/Source/WebKit/SourcesGTK.txt --- webkitgtk-2.38.0.orig/Source/WebKit/SourcesGTK.txt 2022-10-11 10:22:19.157084913 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/SourcesGTK.txt 2022-10-11 10:24:12.065680873 -0500 @@ -278,7 +278,6 @@ UIProcess/gtk/AcceleratedBackingStoreX11 UIProcess/gtk/Clipboard.cpp UIProcess/gtk/ClipboardGtk3.cpp @no-unify UIProcess/gtk/ClipboardGtk4.cpp @no-unify -UIProcess/gtk/WebDateTimePickerGtk.cpp UIProcess/gtk/GtkSettingsManager.cpp UIProcess/gtk/HardwareAccelerationManager.cpp UIProcess/gtk/KeyBindingTranslator.cpp @@ -437,7 +436,6 @@ WebProcess/Inspector/gtk/WebInspectorUIG WebProcess/MediaCache/WebMediaKeyStorageManager.cpp -WebProcess/WebCoreSupport/WebValidationMessageClient.cpp WebProcess/Plugins/Netscape/unix/NetscapePluginUnix.cpp @no-unify WebProcess/Plugins/Netscape/unix/PluginProxyUnix.cpp @no-unify diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp 2022-08-31 02:59:56.890523200 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/C/gtk/WKView.cpp 2022-10-11 10:24:12.065680873 -0500 @@ -68,8 +68,3 @@ bool WKViewCompleteBackSwipeForTesting(W { return webkitWebViewBaseCompleteBackSwipeForTesting(toImpl(viewRef)); } - -GVariant* WKViewContentsOfUserInterfaceItem(WKViewRef viewRef, const char* userInterfaceItem) -{ - return webkitWebViewBaseContentsOfUserInterfaceItem(toImpl(viewRef), userInterfaceItem); -} diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h 2022-08-31 02:59:56.890523200 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/C/gtk/WKViewPrivate.h 2022-10-11 10:24:12.065680873 -0500 @@ -42,8 +42,6 @@ WK_EXPORT bool WKViewBeginBackSwipeForTe WK_EXPORT bool WKViewCompleteBackSwipeForTesting(WKViewRef viewRef); -WK_EXPORT GVariant* WKViewContentsOfUserInterfaceItem(WKViewRef viewRef, const char* userInterfaceItem); - #ifdef __cplusplus } #endif diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2022-08-31 02:59:56.950523400 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2022-10-11 10:24:12.065680873 -0500 @@ -51,16 +51,11 @@ #include <WebCore/GtkUtilities.h> #include <WebCore/NotImplemented.h> #include <WebCore/RefPtrCairo.h> -#include <WebCore/ValidationBubble.h> #include <wtf/Compiler.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> #include <wtf/unix/UnixFileDescriptor.h> -#if ENABLE(DATE_AND_TIME_INPUT_TYPES) -#include "WebDateTimePickerGtk.h" -#endif - namespace WebKit { using namespace WebCore; @@ -281,13 +276,6 @@ RefPtr<WebColorPicker> PageClientImpl::c return WebColorPickerGtk::create(*page, color, rect); } -#if ENABLE(DATE_AND_TIME_INPUT_TYPES) -RefPtr<WebDateTimePicker> PageClientImpl::createDateTimePicker(WebPageProxy& page) -{ - return WebDateTimePickerGtk::create(page); -} -#endif - #if ENABLE(DATALIST_ELEMENT) RefPtr<WebDataListSuggestionsDropdown> PageClientImpl::createDataListSuggestionsDropdown(WebPageProxy& page) { @@ -295,13 +283,6 @@ RefPtr<WebDataListSuggestionsDropdown> P } #endif -Ref<ValidationBubble> PageClientImpl::createValidationBubble(const String& message, const ValidationBubble::Settings& settings) -{ - return ValidationBubble::create(m_viewWidget, message, settings, [](GtkWidget* webView, bool shouldNotifyFocusEvents) { - webkitWebViewBaseSetShouldNotifyFocusEvents(WEBKIT_WEB_VIEW_BASE(webView), shouldNotifyFocusEvents); - }); -} - void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { webkitWebViewBaseEnterAcceleratedCompositingMode(WEBKIT_WEB_VIEW_BASE(m_viewWidget), layerTreeContext); diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2022-08-31 02:59:56.954523600 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2022-10-11 10:24:12.065680873 -0500 @@ -95,13 +95,9 @@ private: #if ENABLE(INPUT_TYPE_COLOR) RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&, Vector<WebCore::Color>&&) override; #endif -#if ENABLE(DATE_AND_TIME_INPUT_TYPES) - RefPtr<WebDateTimePicker> createDateTimePicker(WebPageProxy&) override; -#endif #if ENABLE(DATALIST_ELEMENT) RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) override; #endif - Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final; void selectionDidChange() override; RefPtr<ViewSnapshot> takeViewSnapshot(std::optional<WebCore::IntRect>&&) override; #if ENABLE(DRAG_SUPPORT) diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp 2022-09-14 06:58:10.572863600 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp 2022-10-12 11:33:31.483797917 -0500 @@ -374,7 +374,10 @@ static void webkitPrintOperationPrintPag priv->attachment = data->releaseAttachment(); GUniqueOutPtr<GError> jobError; - gtk_print_job_set_source_fd(priv->printJob.get(), priv->attachment.fd().value(), &jobError.outPtr()); + char buf[20]; + sprintf (buf, "%d", priv->attachment.fd().value()); + String filename = "/proc/self/fd/"_s + String::fromLatin1(buf); + gtk_print_job_set_source_file(priv->printJob.get(), filename.utf8().data(), &jobError.outPtr()); if (jobError) { webkitPrintOperationFailed(printOperation.get(), GUniquePtr<GError> { g_error_new_literal(WEBKIT_PRINT_ERROR, WEBKIT_PRINT_ERROR_GENERAL, jobError->message) }); webkitPrintOperationFinished(printOperation.get()); diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2022-09-14 06:58:10.576863500 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2022-10-11 10:24:12.065680873 -0500 @@ -1660,28 +1660,6 @@ bool webkitWebViewBaseCompleteBackSwipeF return FALSE; } -GVariant* webkitWebViewBaseContentsOfUserInterfaceItem(WebKitWebViewBase* webViewBase, const char* userInterfaceItem) -{ - if (g_strcmp0(userInterfaceItem, "validationBubble")) - return nullptr; - - WebPageProxy* page = webViewBase->priv->pageProxy.get(); - auto* validationBubble = page->validationBubble(); - String message = validationBubble ? validationBubble->message() : emptyString(); - double fontSize = validationBubble ? validationBubble->fontSize() : 0; - - GVariantBuilder subBuilder; - g_variant_builder_init(&subBuilder, G_VARIANT_TYPE_VARDICT); - g_variant_builder_add(&subBuilder, "{sv}", "message", g_variant_new_string(message.utf8().data())); - g_variant_builder_add(&subBuilder, "{sv}", "fontSize", g_variant_new_double(fontSize)); - - GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT); - g_variant_builder_add(&builder, "{sv}", userInterfaceItem, g_variant_builder_end(&subBuilder)); - - return g_variant_builder_end(&builder); -} - static gboolean webkitWebViewBaseQueryTooltip(GtkWidget* widget, gint /* x */, gint /* y */, gboolean keyboardMode, GtkTooltip* tooltip) { WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv; diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2022-08-31 02:59:56.958523500 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2022-10-11 10:24:12.065680873 -0500 @@ -96,8 +96,6 @@ WebKit::ViewGestureController* webkitWeb bool webkitWebViewBaseBeginBackSwipeForTesting(WebKitWebViewBase*); bool webkitWebViewBaseCompleteBackSwipeForTesting(WebKitWebViewBase*); -GVariant* webkitWebViewBaseContentsOfUserInterfaceItem(WebKitWebViewBase*, const char* userInterfaceItem); - void webkitWebViewBaseDidStartProvisionalLoadForMainFrame(WebKitWebViewBase*); void webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame(WebKitWebViewBase*); void webkitWebViewBaseDidFinishNavigation(WebKitWebViewBase*, API::Navigation*); diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2022-09-08 06:51:52.753483500 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp 2022-10-11 10:24:12.065680873 -0500 @@ -96,24 +96,21 @@ static GtkWidget* createMenuWidget(GtkWi return widget; } -static void popupMenuWidget(GtkWidget* widget, const GdkEvent* triggerEvent, const GdkRectangle& target) +void WebContextMenuProxyGtk::menuPositionFunction(GtkMenu* menu, gint* x, gint* y, gboolean* pushIn, WebContextMenuProxyGtk* popupMenu) { - GUniquePtr<GdkEvent> keyEvent; - auto* window = gtk_widget_get_window(gtk_menu_get_attach_widget(GTK_MENU(widget))); - if (!triggerEvent) { - // When the context menu is requested using the keyboard, there is no - // triggerEvent: use a fake event for the “Menu” key being released. - keyEvent.reset(gdk_event_new(GDK_KEY_RELEASE)); - gdk_event_set_device(keyEvent.get(), gdk_seat_get_keyboard(gdk_display_get_default_seat(gdk_window_get_display(window)))); - auto* event = reinterpret_cast<GdkEventKey*>(keyEvent.get()); - event->window = window; - // Take a ref of the GdkWindow when creating the GdkEvent, since the event will unref it on destroy. - g_object_ref(window); - event->time = GDK_CURRENT_TIME; - event->keyval = GDK_KEY_Menu; - triggerEvent = keyEvent.get(); - }; - gtk_menu_popup_at_rect(GTK_MENU(widget), window, &target, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, triggerEvent); + GtkRequisition menuSize; + gtk_widget_get_preferred_size(GTK_WIDGET(menu), &menuSize, 0); + + GdkScreen* screen = gtk_widget_get_screen(popupMenu->m_webView); + *x = popupMenu->m_popupPosition.x(); + if ((*x + menuSize.width) >= gdk_screen_get_width(screen)) + *x -= menuSize.width; + + *y = popupMenu->m_popupPosition.y(); + if ((*y + menuSize.height) >= gdk_screen_get_height(screen)) + *y -= menuSize.height; + + *pushIn = FALSE; } static inline void popdownMenuWidget(GtkWidget* widget) @@ -271,8 +268,8 @@ void WebContextMenuProxyGtk::showContext NativeWebMouseEvent* mouseEvent = page()->currentlyProcessedMouseDownEvent(); const GdkEvent* event = mouseEvent ? mouseEvent->nativeEvent() : nullptr; - const GdkRectangle rect = { m_context.menuLocation().x(), m_context.menuLocation().y(), 1, 1 }; - popupMenuWidget(m_menu, event, rect); + m_popupPosition = convertWidgetPointToScreenPoint(m_webView, m_context.menuLocation()); + gtk_menu_popup(GTK_MENU(m_menu), nullptr, nullptr, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, event ? event->button.button : 3, event ? event->button.time : GDK_CURRENT_TIME); } WebContextMenuProxyGtk::WebContextMenuProxyGtk(GtkWidget* webView, WebPageProxy& page, ContextMenuContextData&& context, const UserData& userData) diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.h webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.h --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.h 2022-08-31 02:59:57.038524000 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.h 2022-10-11 10:24:12.065680873 -0500 @@ -62,9 +62,11 @@ private: GRefPtr<GMenu> buildMenu(const Vector<WebContextMenuItemGlib>&); void populate(const Vector<Ref<WebContextMenuItem>>&); Vector<WebContextMenuItemGlib> populateSubMenu(const WebContextMenuItemData&); + static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, WebContextMenuProxyGtk*); GtkWidget* m_webView; GtkWidget* m_menu; + WebCore::IntPoint m_popupPosition; HashMap<unsigned long, void*> m_signalHandlers; GRefPtr<GSimpleActionGroup> m_actionGroup { adoptGRef(g_simple_action_group_new()) }; }; diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp 2022-10-11 10:22:19.165084955 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp 2022-10-11 10:24:12.065680873 -0500 @@ -145,12 +145,6 @@ void WebPageProxy::showEmojiPicker(const webkitWebViewBaseShowEmojiChooser(WEBKIT_WEB_VIEW_BASE(viewWidget()), caretRect, WTFMove(completionHandler)); } -void WebPageProxy::showValidationMessage(const WebCore::IntRect& anchorClientRect, const String& message) -{ - m_validationBubble = pageClient().createValidationBubble(message, { m_preferences->minimumFontSize() }); - m_validationBubble->showRelativeTo(anchorClientRect); -} - void WebPageProxy::sendMessageToWebViewWithReply(UserMessage&& message, CompletionHandler<void(UserMessage&&)>&& completionHandler) { if (!WEBKIT_IS_WEB_VIEW(viewWidget())) { diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp 2022-09-14 06:58:10.592863800 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp 2022-10-11 10:24:12.069680895 -0500 @@ -313,14 +313,10 @@ void WebPopupMenuProxyGtk::showPopupMenu gtk_window_set_screen(GTK_WINDOW(m_popup), gtk_widget_get_screen(m_webView)); #endif - auto* display = gtk_widget_get_display(m_webView); -#if USE(GTK4) - auto* monitor = gdk_display_get_monitor_at_surface(display, gtk_native_get_surface(gtk_widget_get_native(m_webView))); -#else - auto* monitor = gdk_display_get_monitor_at_window(display, gtk_widget_get_window(m_webView)); -#endif + auto display = gtk_widget_get_display(m_webView); + GdkScreen* screen = gdk_screen_get_default(); GdkRectangle area; - monitorWorkArea(monitor, &area); + gdk_screen_get_monitor_workarea(screen, 0, &area); int width = std::min(rect.width(), area.width); size_t itemCount = std::min<size_t>(items.size(), (area.height / 3) / itemHeight); diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/PageClient.h webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/PageClient.h --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/PageClient.h 2022-10-11 10:22:19.165084955 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/PageClient.h 2022-10-11 10:24:12.069680895 -0500 @@ -389,7 +389,7 @@ public: virtual RefPtr<WebDateTimePicker> createDateTimePicker(WebPageProxy&) = 0; #endif -#if PLATFORM(COCOA) || PLATFORM(GTK) +#if PLATFORM(COCOA) virtual Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) = 0; #endif diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/WebPageProxy.cpp webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/WebPageProxy.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/WebPageProxy.cpp 2022-10-11 10:22:19.169084976 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/WebPageProxy.cpp 2022-10-11 10:24:12.069680895 -0500 @@ -10388,7 +10388,7 @@ void WebPageProxy::setUserInterfaceLayou void WebPageProxy::hideValidationMessage() { -#if PLATFORM(COCOA) || PLATFORM(GTK) +#if PLATFORM(COCOA) m_validationBubble = nullptr; #endif } diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/WebPageProxy.h webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/WebPageProxy.h --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/WebPageProxy.h 2022-10-11 10:22:19.173084998 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/WebPageProxy.h 2022-10-11 10:24:12.069680895 -0500 @@ -1674,7 +1674,7 @@ public: // Form validation messages. void showValidationMessage(const WebCore::IntRect& anchorClientRect, const String& message); void hideValidationMessage(); -#if PLATFORM(COCOA) || PLATFORM(GTK) +#if PLATFORM(COCOA) WebCore::ValidationBubble* validationBubble() const { return m_validationBubble.get(); } // For testing. #endif @@ -3030,7 +3030,7 @@ private: #if ENABLE(DATE_AND_TIME_INPUT_TYPES) RefPtr<WebDateTimePicker> m_dateTimePicker; #endif -#if PLATFORM(COCOA) || PLATFORM(GTK) +#if PLATFORM(COCOA) RefPtr<WebCore::ValidationBubble> m_validationBubble; #endif diff -urp webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/WebPageProxy.messages.in webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/WebPageProxy.messages.in --- webkitgtk-2.38.0.orig/Source/WebKit/UIProcess/WebPageProxy.messages.in 2022-10-11 10:22:19.173084998 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2022-10-11 10:24:12.069680895 -0500 @@ -61,7 +61,7 @@ messages -> WebPageProxy { AccessibilityScreenToRootView(WebCore::IntPoint screenPoint) -> (WebCore::IntPoint windowPoint) Synchronous RootViewToAccessibilityScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame) Synchronous -#if PLATFORM(COCOA) || PLATFORM(GTK) +#if PLATFORM(COCOA) ShowValidationMessage(WebCore::IntRect anchorRect, String message) HideValidationMessage() #endif diff -urp webkitgtk-2.38.0.orig/Source/WebKit/WebProcess/WebPage/WebPage.cpp webkitgtk-2.38.0.gtk/Source/WebKit/WebProcess/WebPage/WebPage.cpp --- webkitgtk-2.38.0.orig/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-10-11 10:22:19.189085081 -0500 +++ webkitgtk-2.38.0.gtk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2022-10-11 10:24:12.073680916 -0500 @@ -634,7 +634,7 @@ WebPage::WebPage(PageIdentifier pageID, pageConfiguration.speechSynthesisClient = makeUnique<WebSpeechSynthesisClient>(*this); #endif -#if PLATFORM(COCOA) || PLATFORM(GTK) +#if PLATFORM(COCOA) pageConfiguration.validationMessageClient = makeUnique<WebValidationMessageClient>(*this); #endif diff -urp webkitgtk-2.38.0.orig/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml webkitgtk-2.38.0.gtk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml --- webkitgtk-2.38.0.orig/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-10-11 10:22:19.193085103 -0500 +++ webkitgtk-2.38.0.gtk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-10-11 10:24:12.073680916 -0500 @@ -250,7 +250,7 @@ DateTimeInputsEditableComponentsEnabled: WebKitLegacy: default: false WebKit: - "PLATFORM(MAC) || PLATFORM(GTK)": true + "PLATFORM(MAC)": true default: false WebCore: default: false diff -urp webkitgtk-2.38.0.orig/Source/WTF/wtf/Platform.h webkitgtk-2.38.0.gtk/Source/WTF/wtf/Platform.h --- webkitgtk-2.38.0.orig/Source/WTF/wtf/Platform.h 2022-08-31 02:59:55.350514000 -0500 +++ webkitgtk-2.38.0.gtk/Source/WTF/wtf/Platform.h 2022-10-11 10:24:12.073680916 -0500 @@ -87,7 +87,7 @@ #if USE(GTK4) #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_4_0 #else -#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_22 +#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_20 #endif #endif diff -urp webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/BrowserDownloadsBar.c webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/BrowserDownloadsBar.c --- webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/BrowserDownloadsBar.c 2022-08-31 02:59:57.426526300 -0500 +++ webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/BrowserDownloadsBar.c 2022-10-11 10:24:12.073680916 -0500 @@ -116,7 +116,7 @@ static void actionButtonClicked(GtkButto return; } - gtk_show_uri_on_window(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(browserDownload))), + gtk_show_uri(gtk_widget_get_screen(GTK_WIDGET(browserDownload)), webkit_download_get_destination(browserDownload->download), gtk_get_current_event_time(), NULL); gtk_widget_destroy(GTK_WIDGET(browserDownload)); diff -urp webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/BrowserSearchBox.c webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/BrowserSearchBox.c --- webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/BrowserSearchBox.c 2022-08-31 02:59:57.426526300 -0500 +++ webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/BrowserSearchBox.c 2022-10-11 10:24:12.073680916 -0500 @@ -34,7 +34,7 @@ struct _BrowserSearchBox { GtkWidget *prevButton; GtkWidget *nextButton; GActionGroup *actionGroup; - GMenu *optionsMenu; + GtkWidget *optionsMenu; GtkWidget *optionsPopover; GtkWidget *caseCheckButton; GtkWidget *begginigWordCheckButton; @@ -65,23 +65,12 @@ static void doSearch(BrowserSearchBox *s gtk_entry_set_icon_from_icon_name(entry, GTK_ENTRY_ICON_SECONDARY, "edit-clear-symbolic"); WebKitFindOptions options = WEBKIT_FIND_OPTIONS_WRAP_AROUND; - GAction *action = g_action_map_lookup_action(G_ACTION_MAP(searchBox->actionGroup), "case-sensitive"); - GVariant *state = g_action_get_state(action); - if (!g_variant_get_boolean(state)) + if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(searchBox->caseCheckButton))) options |= WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE; - g_variant_unref(state); - - action = g_action_map_lookup_action(G_ACTION_MAP(searchBox->actionGroup), "beginning-word"); - state = g_action_get_state(action); - if (g_variant_get_boolean(state)) + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(searchBox->begginigWordCheckButton))) options |= WEBKIT_FIND_OPTIONS_AT_WORD_STARTS; - g_variant_unref(state); - - action = g_action_map_lookup_action(G_ACTION_MAP(searchBox->actionGroup), "capital-as-beginning-word"); - state = g_action_get_state(action); - if (g_variant_get_boolean(state)) + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(searchBox->capitalAsBegginigWordCheckButton))) options |= WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START; - g_variant_unref(state); #if GTK_CHECK_VERSION(3, 98, 5) const gchar *text = gtk_editable_get_text(GTK_EDITABLE(entry)); @@ -103,23 +92,10 @@ static void searchPrevious(BrowserSearch static void searchEntryMenuIconPressedCallback(BrowserSearchBox *searchBox, GtkEntryIconPosition iconPosition, GdkEvent *event) { - if (iconPosition != GTK_ENTRY_ICON_PRIMARY) - return; - -#if GTK_CHECK_VERSION(3, 98, 5) - GtkWidget *popover = gtk_popover_menu_new_from_model(G_MENU_MODEL(searchBox->optionsMenu)); - gtk_widget_set_parent(popover, GTK_WIDGET(searchBox)); -#else - GtkWidget *popover = gtk_popover_menu_new(); - gtk_popover_bind_model(GTK_POPOVER(popover), G_MENU_MODEL(searchBox->optionsMenu), NULL); - gtk_popover_set_relative_to(GTK_POPOVER(popover), searchBox->entry); -#endif - searchBox->optionsPopover = popover; - GdkRectangle rect; - gtk_entry_get_icon_area(GTK_ENTRY(searchBox->entry), GTK_ENTRY_ICON_PRIMARY, &rect); - gtk_popover_set_pointing_to(GTK_POPOVER(popover), &rect); - gtk_popover_set_position(GTK_POPOVER(popover), GTK_POS_BOTTOM); - gtk_popover_popup(GTK_POPOVER(popover)); + if (iconPosition == GTK_ENTRY_ICON_PRIMARY) { + GdkEventButton *eventButton = (GdkEventButton *)event; + gtk_menu_popup(GTK_MENU(searchBox->optionsMenu), NULL, NULL, NULL, NULL, eventButton->button, eventButton->time); + } } static void searchEntryClearIconReleasedCallback(BrowserSearchBox *searchBox, GtkEntryIconPosition iconPosition) @@ -154,10 +130,9 @@ static void searchNextButtonCallback(GSi searchNext(BROWSER_SEARCH_BOX(userData)); } -static void searchMenuCheckButtonToggledCallback(GSimpleAction *action, GVariant *state, gpointer userData) +static void searchMenuCheckButtonToggledCallback(BrowserSearchBox *searchBox) { - g_simple_action_set_state(action, state); - doSearch(BROWSER_SEARCH_BOX(userData)); + doSearch(searchBox); } static void findControllerFailedToFindTextCallback(BrowserSearchBox *searchBox) @@ -173,9 +148,6 @@ static void findControllerFoundTextCallb static const GActionEntry actions[] = { { "next", searchNextButtonCallback, NULL, NULL, NULL, { 0 } }, { "previous", searchPreviousButtonCallback, NULL, NULL, NULL, { 0 } }, - { "case-sensitive", NULL, NULL, "false", searchMenuCheckButtonToggledCallback, { 0 } }, - { "beginning-word", NULL, NULL, "false", searchMenuCheckButtonToggledCallback, { 0 } }, - { "capital-as-beginning-word", NULL, NULL, "false", searchMenuCheckButtonToggledCallback, { 0 } } }; static void browser_search_box_init(BrowserSearchBox *searchBox) @@ -249,15 +221,24 @@ static void browser_search_box_init(Brow gtk_widget_show(searchBox->nextButton); #endif - searchBox->optionsMenu = g_menu_new(); - g_menu_append(searchBox->optionsMenu, "Ca_se sensitive", "find.case-sensitive"); - g_menu_append(searchBox->optionsMenu, "Only at the _beginning of words", "find.beginning-word"); - g_menu_append(searchBox->optionsMenu, "Capital _always as beginning of word", "find.capital-as-beginning-word"); + searchBox->optionsMenu = g_object_ref_sink(gtk_menu_new()); + searchBox->caseCheckButton = gtk_check_menu_item_new_with_mnemonic("Ca_se sensitive"); + gtk_container_add(GTK_CONTAINER(searchBox->optionsMenu), searchBox->caseCheckButton); + + searchBox->begginigWordCheckButton = gtk_check_menu_item_new_with_mnemonic("Only at the _beginning of words"); + gtk_container_add(GTK_CONTAINER(searchBox->optionsMenu), searchBox->begginigWordCheckButton); + searchBox->capitalAsBegginigWordCheckButton = gtk_check_menu_item_new_with_mnemonic("Capital _always as beginning of word"); + gtk_container_add(GTK_CONTAINER(searchBox->optionsMenu), searchBox->capitalAsBegginigWordCheckButton); g_signal_connect_swapped(searchBox->entry, "icon-press", G_CALLBACK(searchEntryMenuIconPressedCallback), searchBox); g_signal_connect_swapped(searchBox->entry, "icon-release", G_CALLBACK(searchEntryClearIconReleasedCallback), searchBox); g_signal_connect_after(searchBox->entry, "changed", G_CALLBACK(searchEntryChangedCallback), searchBox); g_signal_connect_swapped(searchBox->entry, "activate", G_CALLBACK(searchEntryActivatedCallback), searchBox); + g_signal_connect_swapped(searchBox->caseCheckButton, "toggled", G_CALLBACK(searchMenuCheckButtonToggledCallback), searchBox); + g_signal_connect_swapped(searchBox->begginigWordCheckButton, "toggled", G_CALLBACK(searchMenuCheckButtonToggledCallback), searchBox); + g_signal_connect_swapped(searchBox->capitalAsBegginigWordCheckButton, "toggled", G_CALLBACK(searchMenuCheckButtonToggledCallback), searchBox); + + gtk_widget_show_all(searchBox->optionsMenu); } static void browserSearchBoxFinalize(GObject *gObject) diff -urp webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/BrowserWindow.c webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/BrowserWindow.c --- webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/BrowserWindow.c 2022-08-31 02:59:57.426526300 -0500 +++ webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/BrowserWindow.c 2022-10-11 10:24:12.073680916 -0500 @@ -92,6 +92,11 @@ static void browserWindowSetStatusText(B browser_tab_set_status_text(window->activeTab, text); } +static void resetStatusText(GtkWidget *widget, BrowserWindow *window) +{ + browserWindowSetStatusText(window, NULL); +} + static void activateUriEntryCallback(BrowserWindow *window) { browser_window_load_uri(window, @@ -199,9 +204,15 @@ static void downloadStarted(WebKitWebCon #endif } -static void browserWindowHistoryItemActivated(BrowserWindow *window, GVariant *parameter, GAction *action) +static void browserWindowHistoryItemSelected(BrowserWindow *window, GtkMenuItem *menuItem) +{ + WebKitBackForwardListItem *item = g_object_get_data(G_OBJECT(menuItem), "back-forward-list-item"); + browserWindowSetStatusText(window, item ? webkit_back_forward_list_item_get_uri(item) : NULL); +} + +static void browserWindowHistoryItemActivated(BrowserWindow *window, GtkMenuItem *menuItem) { - WebKitBackForwardListItem *item = g_object_get_data(G_OBJECT(action), "back-forward-list-item"); + WebKitBackForwardListItem *item = g_object_get_data(G_OBJECT(menuItem), "back-forward-list-item"); if (!item) return; @@ -209,15 +220,13 @@ static void browserWindowHistoryItemActi webkit_web_view_go_to_back_forward_list_item(webView, item); } -static void browserWindowCreateBackForwardMenu(BrowserWindow *window, GList *list, gboolean isBack) +static GtkWidget *browserWindowCreateBackForwardMenu(BrowserWindow *window, GList *list) { if (!list) - return; + return NULL; - static guint64 actionId = 0; + GtkWidget *menu = gtk_menu_new(); - GSimpleActionGroup *actionGroup = g_simple_action_group_new(); - GMenu *menu = g_menu_new(); GList *listItem; for (listItem = list; listItem; listItem = g_list_next(listItem)) { WebKitBackForwardListItem *item = (WebKitBackForwardListItem *)listItem->data; @@ -247,42 +256,19 @@ static void browserWindowCreateBackForwa #endif #undef MAX_TITLE - char *actionName = g_strdup_printf("action-%lu", ++actionId); - GSimpleAction *action = g_simple_action_new(actionName, NULL); - g_object_set_data_full(G_OBJECT(action), "back-forward-list-item", g_object_ref(item), g_object_unref); - g_signal_connect_swapped(action, "activate", G_CALLBACK(browserWindowHistoryItemActivated), window); - g_action_map_add_action(G_ACTION_MAP(actionGroup), G_ACTION(action)); - g_object_unref(action); - - char *detailedActionName = g_strdup_printf("%s.%s", isBack ? "bf-back" : "bf-forward", actionName); - GMenuItem *menuItem = g_menu_item_new(displayTitle, detailedActionName); - g_menu_append_item(menu, menuItem); - g_object_unref(menuItem); + GtkWidget *menuItem = gtk_menu_item_new_with_label(title); + g_object_set_data_full(G_OBJECT(menuItem), "back-forward-list-item", g_object_ref(item), g_object_unref); + g_signal_connect_swapped(menuItem, "select", G_CALLBACK(browserWindowHistoryItemSelected), window); + g_signal_connect_swapped(menuItem, "activate", G_CALLBACK(browserWindowHistoryItemActivated), window); + + gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), menuItem); + gtk_widget_show(menuItem); g_free(displayTitle); - g_free(detailedActionName); - g_free(actionName); } -#if GTK_CHECK_VERSION(3, 98, 5) - GtkWidget *popover = gtk_popover_menu_new_from_model(G_MENU_MODEL(menu)); -#else - GtkWidget *popover = gtk_popover_menu_new(); - gtk_popover_bind_model(GTK_POPOVER(popover), G_MENU_MODEL(menu), NULL); -#endif - g_object_unref(menu); - gtk_widget_insert_action_group(popover, isBack ? "bf-back" : "bf-forward", G_ACTION_GROUP(actionGroup)); - g_object_unref(actionGroup); - - GtkWidget *button = isBack ? window->backItem : window->forwardItem; -#if GTK_CHECK_VERSION(3, 98, 5) - g_object_set_data_full(G_OBJECT(button), "history-popover", popover, (GDestroyNotify)gtk_widget_unparent); - gtk_widget_set_parent(popover, button); -#else - gtk_popover_set_relative_to(GTK_POPOVER(popover), button); - g_object_set_data(G_OBJECT(button), "history-popover", popover); -#endif - gtk_popover_set_position(GTK_POPOVER(popover), GTK_POS_BOTTOM); + g_signal_connect(menu, "hide", G_CALLBACK(resetStatusText), window); + return menu; } static void browserWindowUpdateNavigationMenu(BrowserWindow *window, WebKitBackForwardList *backForwardlist) @@ -294,43 +280,16 @@ static void browserWindowUpdateNavigatio g_simple_action_set_enabled(G_SIMPLE_ACTION(action), webkit_web_view_can_go_forward(webView)); GList *list = g_list_reverse(webkit_back_forward_list_get_back_list_with_limit(backForwardlist, 10)); - browserWindowCreateBackForwardMenu(window, list, TRUE); + gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(window->backItem), + browserWindowCreateBackForwardMenu(window, list)); g_list_free(list); list = webkit_back_forward_list_get_forward_list_with_limit(backForwardlist, 10); - browserWindowCreateBackForwardMenu(window, list, FALSE); + gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(window->forwardItem), + browserWindowCreateBackForwardMenu(window, list)); g_list_free(list); } -#if GTK_CHECK_VERSION(3, 98, 5) -static void navigationButtonPressed(GtkGestureClick *gesture, guint clickCount, double x, double y) -{ - GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence(GTK_GESTURE_SINGLE(gesture)); - gtk_gesture_set_sequence_state(GTK_GESTURE(gesture), sequence, GTK_EVENT_SEQUENCE_CLAIMED); - - GtkWidget *button = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)); - GtkWidget *popover = g_object_get_data(G_OBJECT(button), "history-popover"); - if (popover) - gtk_popover_popup(GTK_POPOVER(popover)); -} -#else -static gboolean navigationButtonPressCallback(GtkButton *button, GdkEvent *event, BrowserWindow *window) -{ - guint eventButton; - gdk_event_get_button(event, &eventButton); - if (eventButton != GDK_BUTTON_SECONDARY) - return GDK_EVENT_PROPAGATE; - - GtkWidget *popover = g_object_get_data(G_OBJECT(button), "history-popover"); - if (!popover) - return GDK_EVENT_PROPAGATE; - - gtk_popover_popup(GTK_POPOVER(popover)); - - return GDK_EVENT_STOP; -} -#endif - static void browserWindowSaveSession(BrowserWindow *window) { if (!window->sessionFile) @@ -539,12 +498,6 @@ static gboolean browserWindowCanZoomOut( return zoomLevel > minimumZoomLevel; } -static gboolean browserWindowCanZoomDefault(BrowserWindow *window) -{ - WebKitWebView *webView = browser_tab_get_web_view(window->activeTab); - return webkit_web_view_get_zoom_level(webView) != 1.0; -} - static gboolean browserWindowZoomIn(BrowserWindow *window) { if (browserWindowCanZoomIn(window)) { @@ -598,8 +551,6 @@ static void browserWindowUpdateZoomActio g_simple_action_set_enabled(G_SIMPLE_ACTION(action), browserWindowCanZoomIn(window)); action = g_action_map_lookup_action(G_ACTION_MAP(window), "zoom-out"); g_simple_action_set_enabled(G_SIMPLE_ACTION(action), browserWindowCanZoomOut(window)); - action = g_action_map_lookup_action(G_ACTION_MAP(window), "zoom-default"); - g_simple_action_set_enabled(G_SIMPLE_ACTION(action), browserWindowCanZoomDefault(window)); } static void webViewZoomLevelChanged(GObject *object, GParamSpec *paramSpec, BrowserWindow *window) @@ -721,8 +672,6 @@ static void webViewIsLoadingChanged(WebK #if GTK_CHECK_VERSION(3, 98, 5) gtk_button_set_icon_name(GTK_BUTTON(window->reloadOrStopButton), isLoading ? "process-stop-symbolic" : "view-refresh-symbolic"); #else - GtkWidget *image = gtk_button_get_image(GTK_BUTTON(window->reloadOrStopButton)); - g_object_set(image, "icon-name", isLoading ? "process-stop-symbolic" : "view-refresh-symbolic", NULL); #endif } @@ -993,54 +942,17 @@ static void browserWindowDispose(GObject G_OBJECT_CLASS(browser_window_parent_class)->dispose(gObject); } -typedef enum { - TOOLBAR_BUTTON_NORMAL, - TOOLBAR_BUTTON_TOGGLE, - TOOLBAR_BUTTON_MENU -} ToolbarButtonType; - -static GtkWidget *addToolbarButton(GtkWidget *box, ToolbarButtonType type, const char *iconName, const char *actionName) -{ - GtkWidget *button; - switch (type) { - case TOOLBAR_BUTTON_NORMAL: -#if GTK_CHECK_VERSION(3, 98, 5) - button = gtk_button_new_from_icon_name(iconName); -#else - button = gtk_button_new_from_icon_name(iconName, GTK_ICON_SIZE_MENU); -#endif - break; - case TOOLBAR_BUTTON_TOGGLE: - button = gtk_toggle_button_new(); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_button_set_icon_name(GTK_BUTTON(button), iconName); -#else - gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_MENU)); -#endif - break; - case TOOLBAR_BUTTON_MENU: - button = gtk_menu_button_new(); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_menu_button_set_icon_name(GTK_MENU_BUTTON(button), iconName); -#else - gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_MENU)); -#endif - - break; - } - - gtk_widget_set_focus_on_click(button, FALSE); - if (actionName) - gtk_actionable_set_action_name(GTK_ACTIONABLE(button), actionName); - -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(box), button); -#else - gtk_container_add(GTK_CONTAINER(box), button); - gtk_widget_show(button); -#endif - - return button; +static GtkWidget * +browserWindowSetupEditorToolbarItem(BrowserWindow* window, GtkWidget* toolbar, GType type, const char* label, const char* namedIcon, const char* actionName) +{ + GtkWidget *item = g_object_new(type, "icon-name", namedIcon, NULL); + if (type == GTK_TYPE_MENU_TOOL_BUTTON) + gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(item), 0); + gtk_actionable_set_action_name(GTK_ACTIONABLE(item), actionName); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), label); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1); + gtk_widget_show(item); + return item; } static const GActionEntry editActions[] = { @@ -1064,137 +976,91 @@ static const GActionEntry editActions[] static void browserWindowSetupEditorToolbar(BrowserWindow *window) { - GtkWidget *toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); + GtkWidget *toolbar = gtk_toolbar_new(); window->editToolbar = toolbar; - gtk_widget_set_margin_top(toolbar, 2); - gtk_widget_set_margin_bottom(toolbar, 2); - gtk_widget_set_margin_start(toolbar, 2); - gtk_widget_set_margin_end(toolbar, 2); + gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL); + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); GSimpleActionGroup *actionGroup = g_simple_action_group_new(); window->editActionGroup = G_ACTION_GROUP(actionGroup); g_action_map_add_action_entries(G_ACTION_MAP(actionGroup), editActions, G_N_ELEMENTS(editActions), window); gtk_widget_insert_action_group(toolbar, "edit", G_ACTION_GROUP(actionGroup)); - GtkWidget *groupBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(groupBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(groupBox), GTK_STYLE_CLASS_LINKED); -#endif - addToolbarButton(groupBox, TOOLBAR_BUTTON_TOGGLE, "format-text-bold-symbolic", "edit.Bold"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_TOGGLE, "format-text-italic-symbolic", "edit.Italic"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_TOGGLE, "format-text-underline-symbolic", "edit.Underline"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_TOGGLE, "format-text-strikethrough-symbolic", "edit.Strikethrough"); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), groupBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), groupBox, FALSE, FALSE, 0); - gtk_widget_show(groupBox); -#endif - - groupBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(groupBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(groupBox), GTK_STYLE_CLASS_LINKED); -#endif - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "edit-cut-symbolic", "edit.Cut"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "edit-copy-symbolic", "edit.Copy"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "edit-paste-symbolic", "edit.Paste"); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), groupBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), groupBox, FALSE, FALSE, 0); - gtk_widget_show(groupBox); -#endif - - groupBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(groupBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(groupBox), GTK_STYLE_CLASS_LINKED); -#endif - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "edit-undo-symbolic", "edit.Undo"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "edit-redo-symbolic", "edit.Redo"); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), groupBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), groupBox, FALSE, FALSE, 0); - gtk_widget_show(groupBox); -#endif - - groupBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(groupBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(groupBox), GTK_STYLE_CLASS_LINKED); -#endif - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "format-justify-left-symbolic", "edit.JustifyLeft"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "format-justify-center-symbolic", "edit.JustifyCenter"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "format-justify-right-symbolic", "edit.JustifyRight"); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), groupBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), groupBox, FALSE, FALSE, 0); - gtk_widget_show(groupBox); -#endif - - groupBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(groupBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(groupBox), GTK_STYLE_CLASS_LINKED); -#endif - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "format-indent-more-symbolic", "edit.Indent"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "format-indent-less-symbolic", "edit.Outdent"); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), groupBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), groupBox, FALSE, FALSE, 0); - gtk_widget_show(groupBox); -#endif - - groupBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(groupBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(groupBox), GTK_STYLE_CLASS_LINKED); -#endif - /* Not the best icons for these, but we don't have insert list icons in GTK. */ - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "media-record-symbolic", "edit.InsertUnorderedList"); - addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "zoom-original-symbolic", "edit.InsertOrderedList"); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), groupBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), groupBox, FALSE, FALSE, 0); - gtk_widget_show(groupBox); -#endif - - groupBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(groupBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(groupBox), GTK_STYLE_CLASS_LINKED); -#endif - GtkWidget *button = addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "insert-image-symbolic", NULL); - g_signal_connect(button, "clicked", G_CALLBACK(insertImageCommandCallback), window); - button = addToolbarButton(groupBox, TOOLBAR_BUTTON_NORMAL, "insert-link-symbolic", NULL); - g_signal_connect(button, "clicked", G_CALLBACK(insertLinkCommandCallback), window); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), groupBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), groupBox, FALSE, FALSE, 0); - gtk_widget_show(groupBox); -#endif + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOGGLE_TOOL_BUTTON, "Bold", "format-text-bold", "edit.Bold"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOGGLE_TOOL_BUTTON, "Italic", "format-text-italic", "edit.Italic"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOGGLE_TOOL_BUTTON, "Underline", "format-text-underline", "edit.Underline"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOGGLE_TOOL_BUTTON, "Strikethrough", "format-text-strikethrough", "edit.Strikethrough"); + + GtkToolItem *item = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, WEBKIT_EDITING_COMMAND_CUT, "edit-cut", "edit.Cut"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, WEBKIT_EDITING_COMMAND_COPY, "edit-copy", "edit.Copy"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, WEBKIT_EDITING_COMMAND_PASTE, "edit-paste", "edit.Paste"); + + item = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, WEBKIT_EDITING_COMMAND_UNDO, "edit-undo", "edit.Undo"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, WEBKIT_EDITING_COMMAND_REDO, "edit-redo", "edit.Redo"); + + item = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + item = gtk_radio_tool_button_new(NULL); + GSList *justifyRadioGroup = gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(item)); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "format-justify-left"); + gtk_actionable_set_action_name(GTK_ACTIONABLE(item), "edit.JustifyLeft"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), "Justify Left"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + item = gtk_radio_tool_button_new(justifyRadioGroup); + justifyRadioGroup = gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(item)); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "format-justify-center"); + gtk_actionable_set_action_name(GTK_ACTIONABLE(item), "edit.JustifyCenter"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), "Justify Center"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + item = gtk_radio_tool_button_new(justifyRadioGroup); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "format-justify-right"); + gtk_actionable_set_action_name(GTK_ACTIONABLE(item), "edit.JustifyRight"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), "Justify Right"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + item = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Indent", "format-indent-more", "edit.Indent"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Outdent", "format-indent-less", "edit.Outdent"); + + item = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + item = gtk_tool_button_new(NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "insert-image"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), "Insert Image"); + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(insertImageCommandCallback), window); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); + + item = gtk_tool_button_new(NULL, NULL); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "insert-link"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), "Insert Link"); + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(insertLinkCommandCallback), window); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_insert_child_after(GTK_BOX(window->mainBox), toolbar, window->toolbar); -#else 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) @@ -1263,50 +1129,6 @@ static void browserWindowTabAddedOrRemov gtk_notebook_set_show_tabs(GTK_NOTEBOOK(window->notebook), gtk_notebook_get_n_pages(notebook) > 1); } -static void browserWindowBuildPopoverMenu(BrowserWindow *window, GtkWidget *parent) -{ - GMenu *menu = g_menu_new(); - GMenu *section = g_menu_new(); - GMenuItem *item = g_menu_item_new("Zoom Out", "win.zoom-out"); - g_menu_item_set_attribute(item, "verb-icon", "s", "zoom-out-symbolic"); - g_menu_append_item(section, item); - g_object_unref(item); - - item = g_menu_item_new("Zoom Original", "win.zoom-default"); - g_menu_item_set_attribute(item, "verb-icon", "s", "zoom-original-symbolic"); - g_menu_append_item(section, item); - g_object_unref(item); - - item = g_menu_item_new("Zoom In", "win.zoom-in"); - g_menu_item_set_attribute(item, "verb-icon", "s", "zoom-in-symbolic"); - g_menu_append_item(section, item); - g_object_unref(item); - - GMenuItem *sectionItem = g_menu_item_new_section(NULL, G_MENU_MODEL(section)); - g_menu_item_set_attribute(sectionItem, "display-hint", "s", "horizontal-buttons"); - g_menu_append_item(menu, sectionItem); - g_object_unref(sectionItem); - g_object_unref(section); - - section = g_menu_new(); - g_menu_insert(section, -1, "_New Private Window", "win.open-private-window"); - g_menu_insert(section, -1, "_Print…", "win.print"); - g_menu_insert(section, -1, "Prefere_nces…", "win.preferences"); - g_menu_insert(section, -1, "_Quit", "win.quit"); - g_menu_append_section(menu, NULL, G_MENU_MODEL(section)); - g_object_unref(section); - -#if GTK_CHECK_VERSION(3, 98, 5) - GtkWidget *popover = gtk_popover_menu_new_from_model(G_MENU_MODEL(menu)); -#else - GtkWidget *popover = gtk_popover_menu_new(); - gtk_popover_bind_model(GTK_POPOVER(popover), G_MENU_MODEL(menu), NULL); -#endif - g_object_unref(menu); - - gtk_menu_button_set_popover(GTK_MENU_BUTTON(parent), popover); -} - static const GActionEntry actions[] = { { "reload", reloadPage, NULL, NULL, NULL, { 0 } }, { "reload-no-cache", reloadPageIgnoringCache, NULL, NULL, NULL, { 0 } }, @@ -1340,63 +1162,41 @@ static void browser_window_init(BrowserW g_action_map_add_action_entries(G_ACTION_MAP(window), actions, G_N_ELEMENTS(actions), window); - GtkWidget *toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); + GtkWidget *toolbar = gtk_toolbar_new(); window->toolbar = toolbar; - gtk_widget_set_margin_top(toolbar, 2); - gtk_widget_set_margin_bottom(toolbar, 2); - gtk_widget_set_margin_start(toolbar, 2); - gtk_widget_set_margin_end(toolbar, 2); - - GtkWidget *navigationBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_widget_add_css_class(navigationBox, "linked"); -#else - gtk_style_context_add_class(gtk_widget_get_style_context(navigationBox), GTK_STYLE_CLASS_LINKED); -#endif - - window->backItem = addToolbarButton(navigationBox, TOOLBAR_BUTTON_NORMAL, "go-previous-symbolic", "win.go-back"); - window->forwardItem = addToolbarButton(navigationBox, TOOLBAR_BUTTON_NORMAL, "go-next-symbolic", "win.go-forward"); -#if GTK_CHECK_VERSION(3, 98, 5) - GtkGesture *gesture = gtk_gesture_click_new(); - gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), GDK_BUTTON_SECONDARY); - g_signal_connect(gesture, "pressed", G_CALLBACK(navigationButtonPressed), NULL); - gtk_widget_add_controller(window->backItem, GTK_EVENT_CONTROLLER(gesture)); - - gesture = gtk_gesture_click_new(); - gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), GDK_BUTTON_SECONDARY); - g_signal_connect(gesture, "pressed", G_CALLBACK(navigationButtonPressed), NULL); - gtk_widget_add_controller(window->forwardItem, GTK_EVENT_CONTROLLER(gesture)); -#else - g_signal_connect(window->backItem, "button-press-event", G_CALLBACK(navigationButtonPressCallback), window); - g_signal_connect(window->forwardItem, "button-press-event", G_CALLBACK(navigationButtonPressCallback), window); -#endif -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), navigationBox); -#else - gtk_box_pack_start(GTK_BOX(toolbar), navigationBox, FALSE, FALSE, 0); - gtk_widget_show(navigationBox); -#endif + gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL); + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); - addToolbarButton(toolbar, TOOLBAR_BUTTON_NORMAL, "go-home-symbolic", "win.load-homepage"); - addToolbarButton(toolbar, TOOLBAR_BUTTON_NORMAL, "tab-new-symbolic", "win.new-tab"); + window->backItem = browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_MENU_TOOL_BUTTON, "Back", "go-previous", "win.go-back"); + window->forwardItem = browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_MENU_TOOL_BUTTON, "Forward", "go-next", "win.go-forward"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Preferences", "preferences-system", "win.preferences"); + + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Zoom Out", "zoom-out", "win.zoom-out"); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Zoom In", "zoom-in", "win.zoom-in"); + + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Find", "edit-find", "win.find"); + + GtkToolItem *item = gtk_tool_button_new(gtk_image_new_from_icon_name("tab-new", GTK_ICON_SIZE_SMALL_TOOLBAR), NULL); + gtk_actionable_set_action_name(GTK_ACTIONABLE(item), "win.new-tab"); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(item), "New Tab"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show_all(GTK_WIDGET(item)); + browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Home", "go-home", "win.load-homepage"); + item = gtk_tool_item_new(); + gtk_tool_item_set_expand(item, TRUE); window->uriEntry = gtk_entry_new(); gtk_widget_set_halign(window->uriEntry, GTK_ALIGN_FILL); gtk_widget_set_hexpand(window->uriEntry, TRUE); 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); updateUriEntryIcon(window); -#if GTK_CHECK_VERSION(3, 98, 5) - gtk_box_append(GTK_BOX(toolbar), window->uriEntry); -#else - gtk_container_add(GTK_CONTAINER(toolbar), window->uriEntry); + gtk_container_add(GTK_CONTAINER(item), window->uriEntry); gtk_widget_show(window->uriEntry); -#endif + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); + gtk_widget_show(GTK_WIDGET(item)); - window->reloadOrStopButton = addToolbarButton(toolbar, TOOLBAR_BUTTON_NORMAL, "view-refresh-symbolic", "win.reload-stop"); - addToolbarButton(toolbar, TOOLBAR_BUTTON_NORMAL, "edit-find-symbolic", "win.find"); - GtkWidget *button = addToolbarButton(toolbar, TOOLBAR_BUTTON_MENU, "open-menu-symbolic", NULL); - browserWindowBuildPopoverMenu(window, button); + window->reloadOrStopButton = browserWindowSetupEditorToolbarItem(window, toolbar, GTK_TYPE_TOOL_BUTTON, "Reload", "view-refresh", "win-reload-stop"); GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); window->mainBox = vbox; diff -urp webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/CMakeLists.txt webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/CMakeLists.txt --- webkitgtk-2.38.0.orig/Tools/MiniBrowser/gtk/CMakeLists.txt 2022-08-31 02:59:57.426526300 -0500 +++ webkitgtk-2.38.0.gtk/Tools/MiniBrowser/gtk/CMakeLists.txt 2022-10-11 10:24:12.073680916 -0500 @@ -62,7 +62,7 @@ add_custom_command( if (USE_GTK4) set(MiniBrowser_PRIVATE_DEFINITIONS GDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_0) else () - set(MiniBrowser_PRIVATE_DEFINITIONS GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_22) + set(MiniBrowser_PRIVATE_DEFINITIONS GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_20) endif () if (DEVELOPER_MODE)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor