[redirect to blfs-dev]

Hi Lauri and thanks for the report,

On Mon, Jan 25, at 12:23 Lauri Kasanen wrote:

> Hi
> 
> The latest ver of Epdfview, also in the book, has two bugs: mouse wheel 
> scrolling is gone, and when trying to open a non-existent file it claims it 
> is encrypted.
> 
> Both of these have been fixed in SVN, and Debian has them in pure patch form 
> as well. 
> 
> I think those two patches would be useful in the book.

Mouse wheel scrolling:
changeset:
http://trac.emma-soft.com/epdfview/changeset/329
ticket: 
http://trac.emma-soft.com/epdfview/ticket/118

Not existing file:
changeset:
http://trac.emma-soft.com/epdfview/changeset/339
ticket:
http://trac.emma-soft.com/epdfview/ticket/116

Both patches are attached for testing.

I have to say that I can't get both of those bugs, having the following
versions:

poppler-0.12.3
gtk-2.18.5
glib-2.22.4

Slightly different versions than the ones that are in the book.

Without applying the epdfview-1.7-fix_nonexisting-1.patch, the text box
in the epdfview window, reported:

Failed to load document
'null.pdf'.
No error.

By applying the patch I get:

Failed to load document 'null.pdf'.
The PDF file is damaged and can't be repaired.

Both versions (with and without the patch) dumps in the console:
Error: Couldn't open file 'null.pdf': No such file or directory.

As for the scroll wheel behavior, I am getting the same behavior (with
or without applying the patch).
I could use the mouse wheel to scroll within the document, and while I
was pressing CTRL and using the mouse wheel, I could zoom in and zoom out,
and this is I believe the desired behavior.

Please try the patches and also post the versions that you are using, as
I can upload them to the repository and apply them later in the Book.

Regards.
diff -Naur epdfview-0.1.7.orig/src/PDFDocument.cxx 
epdfview-0.1.7/src/PDFDocument.cxx
--- epdfview-0.1.7.orig/src/PDFDocument.cxx     2009-02-28 23:00:35.000000000 
+0200
+++ epdfview-0.1.7/src/PDFDocument.cxx  2010-01-25 12:46:59.133636329 +0200
@@ -246,23 +246,25 @@
     // Check if the document couldn't be opened successfully and why.
     if ( NULL == newDocument )
     {
-        // Poppler's glib wrapper passes the Poppler error code unless the
-        // error is that the file is encrypted. We want to set our own
-        // error code in this case.
         DocumentError errorCode = DocumentErrorNone;
-        if ( POPPLER_ERROR == loadError->domain )
+        switch ( loadError->code )
         {
-            errorCode = DocumentErrorEncrypted;
-        }
-        else
-        {
-            // OK, the glib's wrapper don't pass the error code directly
-            // from Poppler. Instead returns G_FILE_ERROR_FAILED and a
-            // non translated string.
-            // Maybe I'm wrong (very probable) but that's a wrong way.
-            // So I'm reading the error code from the error string...
-            sscanf (loadError->message, "Failed to load document (error %d)",
-                    (gint *)&errorCode);
+            case POPPLER_ERROR_OPEN_FILE:
+            case POPPLER_ERROR_INVALID:
+                errorCode = DocumentErrorOpenFile;
+                break;
+
+            case POPPLER_ERROR_BAD_CATALOG:
+                errorCode = DocumentErrorBadCatalog;
+                break;
+
+            case POPPLER_ERROR_DAMAGED:
+                errorCode = DocumentErrorDamaged;
+                break;
+
+            case POPPLER_ERROR_ENCRYPTED:
+                errorCode = DocumentErrorEncrypted;
+                break;
         }
         g_error_free (loadError);
         // Get our error message.
diff -Naur epdfview-0.1.7.orig/src/gtk/MainView.cxx 
epdfview-0.1.7/src/gtk/MainView.cxx
--- epdfview-0.1.7.orig/src/gtk/MainView.cxx    2009-02-28 23:00:55.000000000 
+0200
+++ epdfview-0.1.7/src/gtk/MainView.cxx 2010-01-25 12:29:10.626636450 +0200
@@ -77,7 +77,7 @@
 static void main_window_zoom_out_cb (GtkWidget *, gpointer);
 static void main_window_zoom_width_cb (GtkToggleAction *, gpointer);
 static void main_window_set_page_mode (GtkRadioAction *, GtkRadioAction *, 
gpointer);
-static void main_window_page_scrolled_cb (GtkWidget *widget, GdkEventScroll 
*event, gpointer data);
+static gboolean main_window_page_scrolled_cb (GtkWidget *widget, 
GdkEventScroll *event, gpointer data);
 
 #if defined (HAVE_CUPS)
 static void main_window_print_cb (GtkWidget *, gpointer);
@@ -1479,18 +1479,25 @@
     pter->setPageMode (mode);
 }
 
-void 
+gboolean 
 main_window_page_scrolled_cb (GtkWidget *widget, GdkEventScroll *event, 
gpointer data)
 {
     g_assert ( NULL != data && "The data parameter is NULL.");
 
     MainPter *pter = (MainPter *)data;
     // Only zoom when the CTRL-Button is down...
-    if ( !(event->state & GDK_CONTROL_MASK) ) return;
-    if ( event->direction == GDK_SCROLL_UP ) {
-        pter->zoomInActivated ();
-    } else if ( event->direction == GDK_SCROLL_DOWN ) {
-        pter->zoomOutActivated ();
+    if ( GDK_CONTROL_MASK == (event->state & GDK_CONTROL_MASK) )
+    {
+        if ( event->direction == GDK_SCROLL_UP )
+        {
+            pter->zoomInActivated ();
+        }
+        else if ( event->direction == GDK_SCROLL_DOWN )
+        {
+            pter->zoomOutActivated ();
+        }
+        return TRUE;
     }
+    return FALSE;
 }
 
diff -Naur epdfview-0.1.7.orig/src/gtk/PageView.cxx 
epdfview-0.1.7/src/gtk/PageView.cxx
--- epdfview-0.1.7.orig/src/gtk/PageView.cxx    2009-02-28 23:00:35.000000000 
+0200
+++ epdfview-0.1.7/src/gtk/PageView.cxx 2010-01-25 12:29:10.626636450 +0200
@@ -527,13 +527,6 @@
 {
     g_assert ( NULL != data && "The data parameter is NULL.");
 
-    // don't scroll when the CRTL-Button is down, because then the page should
-    // actually be zoomed and not scrolled. Zooming is handelt by the MainView
-    // class.
-    if ( event->state & GDK_CONTROL_MASK )
-    {
-        return FALSE;
-    }
     PagePter *pter = (PagePter *)data;
     GtkAdjustment *adjustment = 
         gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (widget));
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page
  • Re: [BLFS-SUP] Epdfview 0.1.7 Agathoklis D. Hatzimanikas

Reply via email to