[Goodies-commits] r3966 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Mon Feb 18 00:41:06 CET 2008


Author: stephan
Date: 2008-02-17 23:41:06 +0000 (Sun, 17 Feb 2008)
New Revision: 3966

Modified:
   ristretto/trunk/src/main_window.c
   ristretto/trunk/src/picture_viewer.c
Log:
Improve zoom-box
Improve behaviour when opening folders



Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c	2008-02-17 11:54:24 UTC (rev 3965)
+++ ristretto/trunk/src/main_window.c	2008-02-17 23:41:06 UTC (rev 3966)
@@ -1437,6 +1437,8 @@
                 }
                 g_free(path_name);
                 filename = g_dir_read_name(dir);
+                while (gtk_events_pending())
+                    gtk_main_iteration ();
             }
             rstto_navigator_jump_first(window->priv->navigator);
             gchar *uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
@@ -1489,6 +1491,8 @@
                     }
                     g_free(path_name);
                     filename = g_dir_read_name(dir);
+                    while (gtk_events_pending())
+                        gtk_main_iteration ();
                 }
                 rstto_navigator_jump_first(window->priv->navigator);
                 g_free(dir_path);
@@ -1911,6 +1915,5 @@
     else
     {
         gtk_widget_set_sensitive(widget, FALSE);
-
     }
 }

Modified: ristretto/trunk/src/picture_viewer.c
===================================================================
--- ristretto/trunk/src/picture_viewer.c	2008-02-17 11:54:24 UTC (rev 3965)
+++ ristretto/trunk/src/picture_viewer.c	2008-02-17 23:41:06 UTC (rev 3966)
@@ -150,7 +150,7 @@
                            GDK_BUTTON_RELEASE_MASK |
                            GDK_BUTTON1_MOTION_MASK);
 
-    viewer->priv->show_border = TRUE;
+    viewer->priv->show_border = FALSE;
 
     g_signal_connect(G_OBJECT(viewer), "scroll_event", G_CALLBACK(cb_rstto_picture_viewer_scroll_event), NULL);
     g_signal_connect(G_OBJECT(viewer), "button_press_event", G_CALLBACK(cb_rstto_picture_viewer_button_press_event), NULL);
@@ -348,35 +348,78 @@
             {
                 gdk_gc_set_foreground(gc,
                         &(widget->style->fg[GTK_STATE_SELECTED]));
-                gdouble x1, x2, y1, y2;
+                gdouble m_x1, m_x2, m_y1, m_y2;
 
                 if (viewer->priv->motion.x < viewer->priv->motion.current_x)
                 {
-                    x1 = viewer->priv->motion.x;
-                    x2 = viewer->priv->motion.current_x;
+                    m_x1 = viewer->priv->motion.x;
+                    m_x2 = viewer->priv->motion.current_x;
                 }
                 else
                 {
-                    x1 = viewer->priv->motion.current_x;
-                    x2 = viewer->priv->motion.x;
+                    m_x1 = viewer->priv->motion.current_x;
+                    m_x2 = viewer->priv->motion.x;
                 }
                 if (viewer->priv->motion.y < viewer->priv->motion.current_y)
                 {
-                    y1 = viewer->priv->motion.y;
-                    y2 = viewer->priv->motion.current_y;
+                    m_y1 = viewer->priv->motion.y;
+                    m_y2 = viewer->priv->motion.current_y;
                 }
                 else
                 {
-                    y1 = viewer->priv->motion.current_y;
-                    y2 = viewer->priv->motion.y;
+                    m_y1 = viewer->priv->motion.current_y;
+                    m_y2 = viewer->priv->motion.y;
                 }
+                if (m_y1 < y1)
+                    m_y1 = y1;
+                if (m_x1 < x1)
+                    m_x1 = x1;
+
+                if (m_x2 > x2 + x1)
+                    m_x2 = x2 + x1;
+                if (m_y2 > y2 + y1)
+                    m_y2 = y2 + y1;
+
+                if ((m_x2 - m_x1 >= 2) && (m_y2 - m_y1 >= 2))
+                {
+                    GdkPixbuf *sub = gdk_pixbuf_new_subpixbuf(pixbuf,
+                                                              m_x1-x1,
+                                                              m_y1-y1,
+                                                              m_x2-m_x1,
+                                                              m_y2-m_y1);
+                    if(sub)
+                    {
+                        sub = gdk_pixbuf_composite_color_simple(sub,
+                                                          m_x2-m_x1,
+                                                          m_y2-m_y1,
+                                                          GDK_INTERP_BILINEAR,
+                                                          200,
+                                                          200,
+                                                          widget->style->bg[GTK_STATE_SELECTED].pixel,
+                                                          widget->style->bg[GTK_STATE_SELECTED].pixel);
+
+                        gdk_draw_pixbuf(GDK_DRAWABLE(buffer),
+                                        gc,
+                                        sub,
+                                        0,0,
+                                        m_x1,
+                                        m_y1,
+                                        -1, -1,
+                                        GDK_RGB_DITHER_NONE,
+                                        0, 0);
+
+                        gdk_pixbuf_unref(sub);
+                        sub = NULL;
+                    }
+                }
+
                 gdk_draw_rectangle(GDK_DRAWABLE(buffer),
                                 gc,
                                 FALSE,
-                                x1,
-                                y1,
-                                x2 - x1,
-                                y2 - y1);
+                                m_x1,
+                                m_y1,
+                                m_x2 - m_x1,
+                                m_y2 - m_y1);
             }
 
             if(viewer->priv->show_border)




More information about the Goodies-commits mailing list