PDF Viewer: handle Ctrl+scroll for zooming
[claws.git] / src / plugins / pdf_viewer / poppler_viewer.c
index 33ab2d28745a68747521ea39b2af8b4c16d4ec2c..6b8b270172022e419288a5509ef00aa2d896234b 100644 (file)
@@ -31,6 +31,7 @@
 #include "gtk/inputdialog.h"
 #include "mimeview.h"
 #include "summaryview.h"
+#include "file-utils.h"
 #ifndef POPPLER_WITH_GDK
 #include "stdbool.h"
 #endif
@@ -90,7 +91,7 @@ static void pdf_viewer_show_controls(PdfViewer *viewer, gboolean show);
 static gboolean pdf_viewer_scroll_page(MimeViewer *_viewer, gboolean up);
 static void pdf_viewer_scroll_one_line(MimeViewer *_viewer, gboolean up);
 
-/** Claws-Mail Plugin functions*/
+/** Claws Mail Plugin functions */
 gint plugin_init(gchar **error);
 const gchar *plugin_name(void);
 const gchar *plugin_desc(void);
@@ -1106,6 +1107,16 @@ static gboolean pdf_viewer_scroll_cb(GtkWidget *widget, GdkEventScroll *event,
 
        in_scroll_cb = TRUE;
 
+       if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
+               if (event->direction == GDK_SCROLL_UP) {
+                       pdf_viewer_button_zoom_in_cb(NULL, viewer);
+               } else {
+                       pdf_viewer_button_zoom_out_cb(NULL, viewer);
+               }
+               in_scroll_cb = FALSE;
+               return TRUE;
+       }
+
        if (event->direction == GDK_SCROLL_UP &&
            gtk_adjustment_get_value(adj) == gtk_adjustment_get_lower(adj) &&
            cur_p > 1) {