File webkit2gtk3-old-gtk.patch of Package webkit2gtk3.15994
diff -urp webkitgtk-2.28.3.orig/Source/cmake/OptionsGTK.cmake webkitgtk-2.28.3/Source/cmake/OptionsGTK.cmake
--- webkitgtk-2.28.3.orig/Source/cmake/OptionsGTK.cmake 2020-07-15 10:59:41.633301911 -0500
+++ webkitgtk-2.28.3/Source/cmake/OptionsGTK.cmake 2020-07-15 11:00:08.217442258 -0500
@@ -22,8 +22,8 @@ find_package(Fontconfig 2.8.0 REQUIRED)
find_package(Freetype 2.4.2 REQUIRED)
find_package(LibGcrypt 1.6.0 REQUIRED)
find_package(GLIB 2.44.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
-find_package(GTK3 3.22.0 REQUIRED)
-find_package(GDK3 3.22.0 REQUIRED)
+find_package(GTK3 3.20.0 REQUIRED)
+find_package(GDK3 3.20.0 REQUIRED)
find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)
find_package(ICU REQUIRED)
find_package(JPEG REQUIRED)
diff -urp webkitgtk-2.28.3.orig/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp webkitgtk-2.28.3/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
--- webkitgtk-2.28.3.orig/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2020-07-08 04:27:52.000000000 -0500
+++ webkitgtk-2.28.3/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp 2020-07-15 11:01:45.081953675 -0500
@@ -137,6 +137,7 @@ void setScreenDPIObserverHandler(Functio
}
}
+#if GTK_CHECK_VERSION(3,22,0)
GdkMonitor* getCurrentScreenMonitor()
{
GdkDisplay* display = gdk_display_get_default();
@@ -149,17 +150,26 @@ GdkMonitor* getCurrentScreenMonitor()
return gdk_display_get_monitor_at_window(display, rootWindow);
}
+#endif
FloatRect screenRect(Widget*)
{
GdkRectangle geometry;
+#if GTK_CHECK_VERSION(3,22,0)
auto* monitor = getCurrentScreenMonitor();
if (!monitor)
return { };
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);
}
@@ -168,11 +178,19 @@ FloatRect screenAvailableRect(Widget*)
{
GdkRectangle workArea;
+#if GTK_CHECK_VERSION(3,22,0)
auto* monitor = getCurrentScreenMonitor();
if (!monitor)
return { };
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.28.3.orig/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp webkitgtk-2.28.3/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp
--- webkitgtk-2.28.3.orig/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp 2020-04-24 03:44:54.000000000 -0500
+++ webkitgtk-2.28.3/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp 2020-07-15 11:00:08.221442279 -0500
@@ -261,9 +261,16 @@ void WebPopupMenuProxyGtk::showPopupMenu
gtk_window_set_screen(GTK_WINDOW(m_popup), gtk_widget_get_screen(m_webView));
auto* display = gtk_widget_get_display(m_webView);
+#if GTK_CHECK_VERSION(3, 22, 0)
auto* monitor = gdk_display_get_monitor_at_window(display, gtk_widget_get_window(m_webView));
GdkRectangle area;
gdk_monitor_get_workarea(monitor, &area);
+#else
+ auto* screen = gtk_widget_get_screen(m_webView);
+ gint monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(m_webView));
+ GdkRectangle area;
+ gdk_screen_get_monitor_workarea(screen, monitor, &area);
+#endif
int width = std::min(rect.width(), area.width);
size_t itemCount = std::min<size_t>(items.size(), (area.height / 3) / itemHeight);