File webkit2gtk3-old-gtk.patch of Package webkit2gtk3.14791

Only in webkitgtk-2.28.0.gtk: CMakeLists.txt.orig
Only in webkitgtk-2.28.0.gtk: CMakeLists.txt.rej
diff -urp webkitgtk-2.28.0.cmake/Source/cmake/OptionsGTK.cmake webkitgtk-2.28.0.gtk/Source/cmake/OptionsGTK.cmake
--- webkitgtk-2.28.0.cmake/Source/cmake/OptionsGTK.cmake	2020-03-23 14:27:09.176026963 -0500
+++ webkitgtk-2.28.0.gtk/Source/cmake/OptionsGTK.cmake	2020-03-23 14:29:34.068801770 -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.0.cmake/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp webkitgtk-2.28.0.gtk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
--- webkitgtk-2.28.0.cmake/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp	2020-02-04 04:24:08.000000000 -0600
+++ webkitgtk-2.28.0.gtk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp	2020-03-19 15:59:04.827347037 -0500
@@ -140,6 +140,7 @@ void setScreenDPIObserverHandler(Functio
 FloatRect screenRect(Widget*)
 {
     GdkRectangle geometry;
+#if GTK_CHECK_VERSION(3, 22, 0)
     GdkDisplay* display = gdk_display_get_default();
     if (!display)
         return { };
@@ -149,6 +150,13 @@ FloatRect screenRect(Widget*)
         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);
 }
@@ -156,6 +164,7 @@ FloatRect screenRect(Widget*)
 FloatRect screenAvailableRect(Widget*)
 {
     GdkRectangle workArea;
+#if GTK_CHECK_VERSION(3, 22, 0)
     GdkDisplay* display = gdk_display_get_default();
     if (!display)
         return { };
@@ -165,6 +174,13 @@ FloatRect screenAvailableRect(Widget*)
         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.0.cmake/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp webkitgtk-2.28.0.gtk/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp
--- webkitgtk-2.28.0.cmake/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2020-02-04 04:24:08.000000000 -0600
+++ webkitgtk-2.28.0.gtk/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2020-03-19 15:59:04.827347037 -0500
@@ -253,9 +253,16 @@ void WebPopupMenuProxyGtk::showPopupMenu
         return;
 
     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);
 
openSUSE Build Service is sponsored by