$OpenBSD: patch-src_ApvlvFile_cpp,v 1.2 2011/11/26 19:47:40 kili Exp $

Fixes for poppler-0.16 and poppler-0.18. The latter gyped from archlinux.

--- src/ApvlvFile.cpp.orig	Tue Apr 20 03:01:33 2010
+++ src/ApvlvFile.cpp	Thu Nov 17 19:36:01 2011
@@ -29,6 +29,10 @@
 #include "ApvlvUtil.hpp"
 #include "ApvlvView.hpp"
 
+#ifndef POPPLER_WITH_GDK
+#include "poppler-gdk.h"
+#endif
+
 #include <iostream>
 #include <fstream>
 
@@ -267,9 +271,9 @@ ApvlvPDF::ApvlvPDF (const char *filename, bool check):
 
   bool ApvlvPDF::pagetext (int pn, int x1, int y1, int x2, int y2, char **out)
   {
-    PopplerRectangle rect = { x1, y1, x2, y2 };
+    PopplerRectangle rect = { x1, y2, x2, y1 };
     PopplerPage *page = poppler_document_get_page (mDoc, pn);
-    *out = poppler_page_get_text (page, POPPLER_SELECTION_WORD, &rect);
+    *out = poppler_page_get_selected_text (page, POPPLER_SELECTION_WORD, &rect);
     if (*out != NULL)
       {
 	return true;
