gqview: Use motion hints for smooth panning. Sanitize rc file parser. Fixed gimp...
authorStanislav Brabec <utx@penguin.cz>
Wed, 29 Jul 2009 18:16:16 +0000 (18:16 +0000)
committerutx@penguin.cz <utx@penguin.cz>
Wed, 29 Jul 2009 18:16:16 +0000 (18:16 +0000)
recipes/gqview/gqview-2.1.5/gqview-gimp.patch [new file with mode: 0644]
recipes/gqview/gqview-2.1.5/gqview-motion-hint.patch [new file with mode: 0644]
recipes/gqview/gqview-2.1.5/gqview-rc-quotes.patch [new file with mode: 0644]
recipes/gqview/gqview_2.1.5.bb

diff --git a/recipes/gqview/gqview-2.1.5/gqview-gimp.patch b/recipes/gqview/gqview-2.1.5/gqview-gimp.patch
new file mode 100644 (file)
index 0000000..50cb89d
--- /dev/null
@@ -0,0 +1,11 @@
+--- src/editors.c
++++ src/editors.c
+@@ -47,7 +47,7 @@
+ static gchar *editor_slot_defaults[] = {
+-      N_("The Gimp"), "gimp-remote -n %f",
++      N_("The Gimp"), "gimp %f",
+       N_("XV"), "xv %f",
+       N_("Xpaint"), "xpaint %f",
+       NULL, NULL,
diff --git a/recipes/gqview/gqview-2.1.5/gqview-motion-hint.patch b/recipes/gqview/gqview-2.1.5/gqview-motion-hint.patch
new file mode 100644 (file)
index 0000000..6904c04
--- /dev/null
@@ -0,0 +1,48 @@
+Use motion hints for smooth panning of image on slow machines.
+================================================================================
+--- src/pixbuf-renderer.c
++++ src/pixbuf-renderer.c
+@@ -2968,6 +2968,13 @@
+       PixbufRenderer *pr;
+       gint accel;
++      /* This is a hack, but work far the best, at least for single pointer systems.
++       * See http://bugzilla.gnome.org/show_bug.cgi?id=587714 for more. */
++      gint x, y;
++      gdk_window_get_pointer (bevent->window, &x, &y, NULL);
++      bevent->x = x;
++      bevent->y = y;
++
+       pr = PIXBUF_RENDERER(widget);
+       if (pr->scroller_id != -1)
+@@ -3003,6 +3010,11 @@
+       pr->drag_last_x = bevent->x;
+       pr->drag_last_y = bevent->y;
++      /* This is recommended by the GTK+ documentation, but does not work properly.
++       * Use deprecated way until GTK+ gets a solution for correct motion hint handling:
++       * http://bugzilla.gnome.org/show_bug.cgi?id=587714
++       */
++      /* gdk_event_request_motions (bevent); */
+       return FALSE;
+ }
+@@ -3023,7 +3035,7 @@
+                       pr->drag_last_y = bevent->y;
+                       pr->drag_moved = 0;
+                       gdk_pointer_grab(widget->window, FALSE,
+-                                       GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
++                                       GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_RELEASE_MASK,
+                                        NULL, NULL, bevent->time);
+                       gtk_grab_add(widget);
+                       break;
+@@ -3119,7 +3131,7 @@
+       g_signal_connect(G_OBJECT(pr), "leave_notify_event",
+                        G_CALLBACK(pr_mouse_leave_cb), pr);
+-      gtk_widget_set_events(GTK_WIDGET(pr), GDK_POINTER_MOTION_MASK |
++      gtk_widget_set_events(GTK_WIDGET(pr), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
+                                             GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK |
+                                             GDK_LEAVE_NOTIFY_MASK);
diff --git a/recipes/gqview/gqview-2.1.5/gqview-rc-quotes.patch b/recipes/gqview/gqview-2.1.5/gqview-rc-quotes.patch
new file mode 100644 (file)
index 0000000..9e8f94f
--- /dev/null
@@ -0,0 +1,26 @@
+--- src/rcfile.c
++++ src/rcfile.c
+@@ -390,7 +390,7 @@
+       gchar option[1024];
+       gchar value[1024];
+       gchar value_all[1024];
+-      gint c,l,i;
++      gint c,l,i,inside_quotes;
+       rc_path = g_strconcat(homedir(), "/", GQVIEW_RC_DIR, "/", RC_FILE_NAME, NULL);
+@@ -416,7 +416,13 @@
+               while ((s_buf[c] == ' ' || s_buf[c] == 8) && c < l) c++;
+               s_buf_ptr = s_buf + c;
+               strncpy(value_all, s_buf_ptr, sizeof(value_all));
+-              while (s_buf[c] != 8 && s_buf[c] != ' ' && s_buf[c] != '\n' && c < l) c++;
++              inside_quotes = 0;
++              while (s_buf[c] != 8 && ( s_buf[c] != ' ' || inside_quotes) && s_buf[c] != '\n' && c < l)
++                      {
++                      /* this is an ugly hack, which does not sanitize value inside quotes */
++                      if (s_buf[c] == '"') inside_quotes = !inside_quotes;
++                      c++;
++                      }
+               s_buf[c] = '\0';
+               strncpy(option, s_buf, sizeof(option));
+               strncpy(value, s_buf_ptr, sizeof(value));
index 60f74c4..5fb5659 100644 (file)
@@ -4,9 +4,12 @@ DEPENDS = "gtk+"
 LICENSE = "GPL"
 HOMEPAGE = "http://gqview.sourceforge.net/"
 RRECOMMENDS = "gdk-pixbuf-loader-jpeg gdk-pixbuf-loader-png gdk-pixbuf-loader-gif"
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/gqview/gqview-2.1.5.tar.gz \
-          file://include-path-fix.patch;patch=1"
+          file://include-path-fix.patch;patch=1 \
+          file://gqview-rc-quotes.patch;patch=1;pnum=0 \
+          file://gqview-motion-hint.patch;patch=1;pnum=0 \
+          file://gqview-gimp.patch;patch=1;pnum=0"
 
 inherit autotools