File atril-gtk-3.20.patch of Package atril

--- a/configure.ac
+++ b/configure.ac
@@ -85,8 +85,8 @@ GLIB_GSETTINGS
 
 dnl Specify required versions of dependencies
 CAIRO_REQUIRED=1.10.0
-GLIB_REQUIRED=2.50.0
-GTK_REQUIRED=3.22.0
+GLIB_REQUIRED=2.48.0
+GTK_REQUIRED=3.20.0
 WEBKIT_REQUIRED=2.4.3
 LIBSECRET_REQUIRED=0.5
 LIBXML_REQUIRED=2.5.0
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -395,7 +395,11 @@ ev_document_misc_invert_pixbuf (GdkPixbu
 }
 
 gdouble
+#if GTK_CHECK_VERSION (3, 22, 0)
 ev_document_misc_get_screen_dpi (GdkScreen *screen, GdkMonitor *monitor)
+#else
+ev_document_misc_get_screen_dpi (GdkScreen *screen, int monitor)
+#endif
 {
 	gdouble dp, di;
 
@@ -403,8 +407,13 @@ ev_document_misc_get_screen_dpi (GdkScre
 	dp = hypot (WidthOfScreen (gdk_x11_screen_get_xscreen (screen)), HeightOfScreen (gdk_x11_screen_get_xscreen (screen)));
 
 	/*diagonal in inches*/
+#if GTK_CHECK_VERSION (3, 22, 0)
 	di = hypot (gdk_monitor_get_width_mm(monitor), gdk_monitor_get_height_mm (monitor)) / 25.4;
 	di /= gdk_monitor_get_scale_factor (monitor);
+#else
+	di = hypot (gdk_screen_get_width_mm (screen), gdk_screen_get_height_mm (screen)) / 25.4;
+	di /= gdk_screen_get_monitor_scale_factor (screen, monitor);
+#endif
 
 	return (dp / di);
 }
--- a/libdocument/ev-document-misc.h
+++ b/libdocument/ev-document-misc.h
@@ -58,7 +58,11 @@ cairo_surface_t *ev_document_misc_surfac
 void             ev_document_misc_invert_surface (cairo_surface_t *surface);
 void             ev_document_misc_invert_pixbuf  (GdkPixbuf       *pixbuf);
 
+#if GTK_CHECK_VERSION (3, 22, 0)
 gdouble          ev_document_misc_get_screen_dpi (GdkScreen *screen, GdkMonitor *monitor);
+#else
+gdouble          ev_document_misc_get_screen_dpi (GdkScreen *screen, int monitor);
+#endif
 
 gchar           *ev_document_misc_format_date (GTime utime);
 
--- a/libview/ev-annotation-window.c
+++ b/libview/ev-annotation-window.c
@@ -97,13 +97,20 @@ static gdouble
 get_screen_dpi (EvAnnotationWindow *window)
 {
 	GdkScreen  *screen;
+#if GTK_CHECK_VERSION (3, 22, 0)
 	GdkMonitor *monitor;
+#else
+	int         monitor;
+#endif
 	GdkDisplay *display;
 
 	screen = gtk_window_get_screen (GTK_WINDOW (window));
 	display = gdk_screen_get_display (screen);
+#if GTK_CHECK_VERSION (3, 22, 0)
 	monitor = gdk_display_get_primary_monitor (display);
-
+#else
+	monitor = gdk_screen_get_primary_monitor (screen);
+#endif
 	return ev_document_misc_get_screen_dpi (screen, monitor);
 }
 
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -497,7 +497,11 @@ is_dual_page (EvView   *view,
 	switch (view->page_layout) {
 	case EV_PAGE_LAYOUT_AUTOMATIC: {
 		GdkScreen    *screen;
+#if GTK_CHECK_VERSION (3, 22, 0)
 		GdkMonitor *monitor;
+#else
+		int         monitor;
+#endif
 		GdkDisplay *display;
 		double        scale;
 		double        doc_width;
@@ -506,7 +510,11 @@ is_dual_page (EvView   *view,
 
 		screen = gtk_widget_get_screen (GTK_WIDGET (view));
 		display = gdk_screen_get_display (screen);
+#if GTK_CHECK_VERSION (3, 22, 0)
 		monitor = gdk_display_get_primary_monitor (display);
+#else
+		monitor = gdk_screen_get_primary_monitor (screen);
+#endif
 		scale = ev_document_misc_get_screen_dpi (screen, monitor) / 72.0;
 
 		ev_document_get_max_page_size (view->document, &doc_width, &doc_height);
@@ -7128,7 +7136,11 @@ zoom_for_size_automatic (GdkScreen *scre
 			 int        target_width,
 			 int        target_height)
 {
+#if GTK_CHECK_VERSION (3, 22, 0)
 	GdkMonitor *monitor;
+#else
+	int         monitor;
+#endif
 	GdkDisplay *display;
 	double fit_width_scale;
 	double scale;
@@ -7144,7 +7156,11 @@ zoom_for_size_automatic (GdkScreen *scre
 		double actual_scale;
 
 		display = gdk_screen_get_display (screen);
+#if GTK_CHECK_VERSION (3, 22, 0)
 		monitor = gdk_display_get_primary_monitor (display);
+#else
+		monitor = gdk_screen_get_primary_monitor (screen);
+#endif
 		actual_scale = ev_document_misc_get_screen_dpi (screen, monitor) / 72.0;
 		scale = MIN (fit_width_scale, actual_scale);
 	}
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -1211,12 +1211,22 @@ init_presentation (GtkWidget *widget)
 {
 	EvViewPresentation *pview = EV_VIEW_PRESENTATION (widget);
 	GdkDisplay         *display = gtk_widget_get_display (widget);
+#if GTK_CHECK_VERSION (3, 22, 0)
 	GdkRectangle        monitor;
 	GdkMonitor         *monitor_num;
+#else
+	GdkScreen          *screen = gdk_display_get_default_screen (display);
+	GdkRectangle        monitor;
+	int                 monitor_num;
+#endif
 
+#if GTK_CHECK_VERSION (3, 22, 0)
 	monitor_num = gdk_display_get_monitor_at_window (display, gtk_widget_get_window (widget));
 	gdk_monitor_get_geometry (monitor_num, &monitor);
-
+#else
+	monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
+	gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+#endif
 	pview->monitor_width = monitor.width;
 	pview->monitor_height = monitor.height;
 
--- a/previewer/ev-previewer-window.c
+++ b/previewer/ev-previewer-window.c
@@ -71,12 +71,20 @@ static gdouble
 get_screen_dpi (EvPreviewerWindow *window)
 {
 	GdkScreen  *screen;
+#if GTK_CHECK_VERSION (3, 22, 0)
 	GdkMonitor *monitor;
+#else
+	int         monitor;
+#endif
 	GdkDisplay *display;
 
 	screen = gtk_window_get_screen (GTK_WINDOW (window));
 	display = gdk_screen_get_display (screen);
+#if GTK_CHECK_VERSION (3, 22, 0)
 	monitor = gdk_display_get_primary_monitor (display);
+#else
+	monitor = gdk_screen_get_primary_monitor (screen);
+#endif
 
 	return ev_document_misc_get_screen_dpi (screen, monitor);
 }
--- a/shell/ev-navigation-action-widget.c
+++ b/shell/ev-navigation-action-widget.c
@@ -131,18 +131,32 @@ menu_position_func (GtkMenu           *m
 	GtkTextDirection direction;
 	GdkWindow *gdk_window;
 	GdkRectangle monitor;
+#if GTK_CHECK_VERSION (3, 22, 0)
 	GdkMonitor *monitor_num;
+#else
+	int monitor_num;
+	GdkScreen *screen;
+#endif
 	GdkDisplay *display;
 
 	gtk_widget_get_preferred_size (GTK_WIDGET (button->menu), &menu_req, NULL);
 	direction = gtk_widget_get_direction (widget);
 	display = gtk_widget_get_display (GTK_WIDGET (menu));
+#if !GTK_CHECK_VERSION (3, 22, 0)
+	screen = gdk_display_get_default_screen (display);
+#endif
 
 	gdk_window = gtk_widget_get_window (widget);
+#if GTK_CHECK_VERSION (3, 22, 0)
 	monitor_num = gdk_display_get_monitor_at_window (display, gdk_window);
 	if (monitor_num == NULL)
 		monitor_num = gdk_display_get_monitor (display, 0);
 	gdk_monitor_get_geometry (monitor_num, &monitor);
+#else
+	monitor_num = gdk_screen_get_monitor_at_window (screen, gdk_window);
+	monitor_num = monitor_num > 0 ? monitor_num : 0;
+	gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+#endif
 
 	gdk_window_get_origin (gdk_window, x, y);
 	gtk_widget_get_allocation (widget, &allocation);
--- a/shell/ev-utils.c
+++ b/shell/ev-utils.c
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <glib/gi18n.h>
 
+#if GTK_CHECK_VERSION(3, 22, 0)
 static int
 _gtk_get_monitor_num (GdkMonitor *monitor)
 {
@@ -42,6 +43,7 @@ _gtk_get_monitor_num (GdkMonitor *monito
 
 	return -1;
 }
+#endif
 
 static void
 ev_gui_sanitise_popup_position (GtkMenu *menu,
@@ -50,7 +52,12 @@ ev_gui_sanitise_popup_position (GtkMenu
 				gint *y)
 {
 	GdkDisplay *display = gtk_widget_get_display (widget);
+#if GTK_CHECK_VERSION (3, 22, 0)
 	GdkMonitor *monitor_num;
+#else
+	GdkScreen  *screen = gdk_display_get_default_screen (display);
+	int         monitor_num;
+#endif
 	GdkRectangle monitor;
 	GtkRequisition req;
 
@@ -58,9 +65,15 @@ ev_gui_sanitise_popup_position (GtkMenu
 
 	gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
 
+#if GTK_CHECK_VERSION (3, 22, 0)
 	monitor_num = gdk_display_get_monitor_at_point (display, *x, *y);
 	gtk_menu_set_monitor (menu, _gtk_get_monitor_num (monitor_num));
 	gdk_monitor_get_geometry (monitor_num, &monitor);
+#else
+	monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
+	gtk_menu_set_monitor (menu, monitor_num);
+	gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+#endif
 
 	*x = CLAMP (*x, monitor.x, monitor.x + MAX (0, monitor.width - req.width));
 	*y = CLAMP (*y, monitor.y, monitor.y + MAX (0, monitor.height - req.height));
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -390,12 +390,20 @@ static gdouble
 get_screen_dpi (EvWindow *window)
 {
 	GdkScreen  *screen;
+#if GTK_CHECK_VERSION (3, 22, 0)
 	GdkMonitor *monitor;
+#else
+	int         monitor;
+#endif
 	GdkDisplay *display;
 
 	screen = gtk_window_get_screen (GTK_WINDOW (window));
 	display = gdk_screen_get_display (screen);
+#if GTK_CHECK_VERSION (3, 22, 0)
 	monitor = gdk_display_get_primary_monitor (display);
+#else
+	monitor = gdk_screen_get_primary_monitor (screen);
+#endif
 
 	return ev_document_misc_get_screen_dpi (screen, monitor);
 }
@@ -4917,10 +4925,17 @@ ev_window_cmd_help_contents (GtkAction *
 {
 	GError  *error = NULL;
 
+#if GTK_CHECK_VERSION (3, 22, 0)
 	gtk_show_uri_on_window (GTK_WINDOW (ev_window),
 		      EV_HELP,
 		      gtk_get_current_event_time (),
 		      &error);
+#else
+	gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (ev_window)),
+	              EV_HELP,
+	              gtk_get_current_event_time (),
+	              &error);
+#endif
 
 	if (error) {
 		ev_window_error_message (ev_window, error,
openSUSE Build Service is sponsored by