Commit 0dcf6b1f authored by Jim Nelson's avatar Jim Nelson

This fixes the problem with fullscreen occassionally not displaying the initial image.

parent e7f351d3
......@@ -12,8 +12,6 @@ public class FullscreenWindow : Gtk.Window {
set_screen(screen);
set_border_width(0);
photo_page.display(controller, start);
pin_button.set_label("Pin toolbar");
close_button.clicked += on_close;
......@@ -40,6 +38,8 @@ public class FullscreenWindow : Gtk.Window {
window.set_events(mask);
motion_notify_event += on_motion;
photo_page.display(controller, start);
}
private void on_close() {
......
......@@ -51,8 +51,7 @@ EXT_PKGS = \
vala-1.0 \
hal \
dbus-glib-1 \
unique-1.0 \
gnome-vfs-2.0
unique-1.0
PKGS = $(EXT_PKGS) $(LOCAL_PKGS)
......
......@@ -21,6 +21,7 @@ public class PhotoPage : Page {
{ "FileMenu", null, "_File", null, null, null },
{ "ViewMenu", null, "_View", null, null, null },
{ "ReturnToPage", null, "_Return to collection", "Escape", null, on_return_to_collection },
{ "PhotoMenu", null, "_Photo", null, null, null },
{ "PrevPhoto", Gtk.STOCK_GO_BACK, "_Previous Photo", null, "Previous Photo", on_previous_photo },
......@@ -105,15 +106,25 @@ public class PhotoPage : Page {
repaint(true);
}
private int lastWidth = 0;
private int lastHeight = 0;
private int lastWidth = -1;
private int lastHeight = -1;
private bool repaint(bool force = false) {
if (rotated == null)
return false;
int width = viewport.allocation.width - IMAGE_BORDER;
int height = viewport.allocation.height - IMAGE_BORDER;
if (width <= 0 || height <= 0)
if (width <= 0 || height <= 0) {
// reset these to force a repaint later
if (force) {
lastWidth = -1;
lastHeight = -1;
}
return false;
}
if (!force && width == lastWidth && height == lastHeight)
return false;
......@@ -124,7 +135,8 @@ public class PhotoPage : Page {
Dimensions viewDim = Dimensions(width, height);
Dimensions scaled = get_scaled_dimensions_for_view(rotatedDim, viewDim);
Gdk.Pixbuf pixbuf = rotated.scale_simple(scaled.width, scaled.height, DEFAULT_INTERP);
assert(pixbuf != null);
image.set_from_pixbuf(pixbuf);
return true;
......@@ -139,6 +151,10 @@ public class PhotoPage : Page {
return false;
}
private void on_return_to_collection() {
AppWindow.get_instance().switch_to_page(controller);
}
private bool on_expose(PhotoPage p, Gdk.EventExpose event) {
return repaint();
......
......@@ -6,6 +6,7 @@
</menu>
<menu name="ViewMenu" action="ViewMenu">
<menuitem name="ReturnToPage" action="ReturnToPage" />
<menuitem name="Fullscreen" action="CommonFullscreen" />
</menu>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment