diff src/pixbuf-renderer.c @ 27:9c24765c2d3a

Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net> * image.c (image_options_set): Update PixbufRenderer parent window so that changing 'fit window to image' option works. * pan-view.c (pan_window_image_zoom_cb): Use same zoom text display as for main windows. * pixbuf-renderer.c: Fix (re-implement) check for maximized window state. Fix pr_source_tile_visible() calculation which was using the x axis where it should be y. Add redrawn return value to pr_zoom_clamp() and use that value in pr_zoom_sync() to pass pr_redraw correct args. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Sat, 02 Apr 2005 22:44:34 +0000
parents acd9885ebd78
children 8a8ec4b3e769
line wrap: on
line diff
--- a/src/pixbuf-renderer.c	Tue Mar 29 01:28:17 2005 +0000
+++ b/src/pixbuf-renderer.c	Sat Apr 02 22:44:34 2005 +0000
@@ -676,12 +676,15 @@
 
 static gint pr_parent_window_sizable(PixbufRenderer *pr)
 {
+	GdkWindowState state;
+
 	if (!pr->parent_window) return FALSE;
 	if (!pr->window_fit) return FALSE;
 	if (!GTK_WIDGET(pr)->window) return FALSE;
-#if 0
-	if (window_maximized(pr->top_window)) return FALSE;
-#endif
+
+	if (!pr->parent_window->window) return FALSE;
+	state = gdk_window_get_state(pr->parent_window->window);
+	if (state & GDK_WINDOW_STATE_MAXIMIZED) return FALSE;
 
 	return TRUE;
 }
@@ -1249,7 +1252,7 @@
 
 	return !((double)st->x * pr->scale > (double)x2 ||
 		 (double)(st->x + pr->source_tile_width) * pr->scale < (double)x1 ||
-		 (double)st->y * pr->scale > (double)x2 ||
+		 (double)st->y * pr->scale > (double)y2 ||
 		 (double)(st->y + pr->source_tile_height) * pr->scale < (double)y1);
 }
 
@@ -2430,7 +2433,9 @@
 	return (old_vw != pr->vis_width || old_vh != pr->vis_height);
 }
 
-static gint pr_zoom_clamp(PixbufRenderer *pr, gdouble zoom, gint force, gint new, gint invalidate)
+static gint pr_zoom_clamp(PixbufRenderer *pr, gdouble zoom,
+			  gint force, gint new, gint invalidate,
+			  gint *redrawn)
 {
 	gint w, h;
 	gdouble scale;
@@ -2521,6 +2526,7 @@
 		pr_tile_invalidate_all(pr);
 		pr_redraw(pr, TRUE);
 		}
+	if (redrawn) *redrawn = (invalidate || invalid);
 
 	return TRUE;
 }
@@ -2533,6 +2539,7 @@
 	gint old_cx, old_cy;
 	gint clamped;
 	gint sized;
+	gint redrawn = FALSE;
 
 	old_scale = pr->scale;
 	if (center_point)
@@ -2549,7 +2556,7 @@
 		old_cy = pr->y_scroll + pr->vis_height / 2;
 		}
 
-	if (!pr_zoom_clamp(pr, zoom, force, new, force)) return;
+	if (!pr_zoom_clamp(pr, zoom, force, new, force, &redrawn)) return;
 
 	clamped = pr_size_clamp(pr);
 	sized = pr_parent_window_resize(pr, pr->width, pr->height);
@@ -2600,7 +2607,7 @@
 	 * so redraw the window anyway :/
 	 */
 	if (sized || clamped) pr_border_clear(pr);
-	pr_redraw(pr, FALSE);
+	pr_redraw(pr, redrawn);
 
 	pr_zoom_signal(pr);
 	pr_update_signal(pr);
@@ -2613,7 +2620,7 @@
 	pr->window_width = new_width;
 	pr->window_height = new_height;
 
-	if (pr->zoom == 0.0) pr_zoom_clamp(pr, 0.0, TRUE, FALSE, FALSE);
+	if (pr->zoom == 0.0) pr_zoom_clamp(pr, 0.0, TRUE, FALSE, FALSE, NULL);
 
 	pr_size_clamp(pr);
 	pr_scroll_clamp(pr);