[Xfce4-commits] <ristretto:master> Add comments
Stephan Arts
noreply at xfce.org
Mon Aug 8 15:04:09 CEST 2011
Updating branch refs/heads/master
to 28e64d4b4847b4f1068e6eeb9f177282693b09f4 (commit)
from c1c9ec7cc7465d7c042ddbfe758446657553dc29 (commit)
commit 28e64d4b4847b4f1068e6eeb9f177282693b09f4
Author: Stephan Arts <stephan at xfce.org>
Date: Tue Jul 26 20:57:04 2011 +0200
Add comments
src/image_viewer.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/image_viewer.c b/src/image_viewer.c
index fff16a4..155e886 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -422,6 +422,7 @@ rstto_image_viewer_set_scroll_adjustments(RsttoImageViewer *viewer, GtkAdjustmen
return TRUE;
}
+
static void
rstto_image_viewer_paint (GtkWidget *widget)
{
@@ -450,9 +451,17 @@ rstto_image_viewer_paint (GtkWidget *widget)
/* required for transparent pixbufs... add double buffering to fix flickering*/
if(GTK_WIDGET_REALIZED(widget))
{
+
+ /*
+ * Create a buffer to draw on
+ */
GdkPixmap *buffer = gdk_pixmap_new(NULL, widget->allocation.width, widget->allocation.height, gdk_drawable_get_depth(widget->window));
GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(buffer));
+ /*
+ * Determine the background-color and draw the background.
+ */
+
if(gdk_window_get_state(gdk_window_get_toplevel(GTK_WIDGET(viewer)->window)) & GDK_WINDOW_STATE_FULLSCREEN)
{
bg_color = g_value_get_boxed (&val_bg_color_fs);
@@ -477,9 +486,15 @@ rstto_image_viewer_paint (GtkWidget *widget)
gdk_draw_rectangle(GDK_DRAWABLE(buffer), gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height);
- /* Check if there is a destination pixbuf */
+
+ /*
+ * Check if there is a source image
+ */
if(pixbuf)
{
+ /*
+ * Draw the image on the background
+ */
x1 = (widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2;
y1 = (widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2;
x2 = gdk_pixbuf_get_width(pixbuf);
@@ -505,7 +520,9 @@ rstto_image_viewer_paint (GtkWidget *widget)
}
else
{
- /* HACK HACK HACK HACK */
+ /*
+ * There is no image, draw the ristretto icon on the background
+ */
guint size = 0;
if ((GTK_WIDGET (viewer)->allocation.width) < (GTK_WIDGET (viewer)->allocation.height))
{
@@ -545,6 +562,10 @@ rstto_image_viewer_paint (GtkWidget *widget)
}
}
+ /*
+ * Draw the buffer on the window
+ */
+
gdk_draw_drawable(GDK_DRAWABLE(widget->window),
gdk_gc_new(widget->window),
buffer,
More information about the Xfce4-commits
mailing list