From 566dc060676b41e1e58a446b7dcc4159e242fee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 23 Sep 2014 09:36:45 +0200 Subject: Imported Upstream version 0.20.0 --- src/Page.vala | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'src/Page.vala') diff --git a/src/Page.vala b/src/Page.vala index fd69431..807a926 100644 --- a/src/Page.vala +++ b/src/Page.vala @@ -1448,6 +1448,11 @@ public abstract class CheckerboardPage : Page { handled = false; break; + case "space": + Marker marker = get_view().mark(layout.get_cursor()); + get_view().toggle_marked(marker); + break; + default: handled = false; break; @@ -1528,6 +1533,7 @@ public abstract class CheckerboardPage : Page { cursor = item; break; } + layout.set_cursor(item); } else { // user clicked on "dead" area; only unselect if control is not pressed // do we want similar behavior for shift as well? @@ -1777,11 +1783,13 @@ public abstract class CheckerboardPage : Page { cursor = item; - get_view().unselect_all(); + if (!get_ctrl_pressed()) { + get_view().unselect_all(); + Marker marker = get_view().mark(item); + get_view().select_marked(marker); + } + layout.set_cursor(item); - Marker marker = get_view().mark(item); - get_view().select_marked(marker); - // if item is in any way out of view, scroll to it Gtk.Adjustment vadj = get_vadjustment(); if (get_adjustment_relation(vadj, item.allocation.y) == AdjustmentRelation.IN_RANGE @@ -1806,14 +1814,20 @@ public abstract class CheckerboardPage : Page { if (get_view().get_count() == 0) return; - // if nothing is selected, simply select the first and exit - if (get_view().get_selected_count() == 0 || cursor == null) { + // if there is no better starting point, simply select the first and exit + // The right half of the or is related to Bug #732334, the cursor might be non-null and still not contained in + // the view, if the user dragged a full screen Photo off screen + if (cursor == null && layout.get_cursor() == null || cursor != null && !get_view().contains(cursor)) { CheckerboardItem item = layout.get_item_at_coordinate(0, 0); cursor_to_item(item); anchor = item; return; } + + if (cursor == null) { + cursor = layout.get_cursor() as CheckerboardItem; + } // move the cursor relative to the "first" item CheckerboardItem? item = layout.get_item_relative_to(cursor, point); @@ -1931,12 +1945,6 @@ public abstract class SinglePhotoPage : Page { add(viewport); - // We used to disable GTK double buffering here. We've had to reenable it - // due to this bug: http://redmine.yorba.org/issues/4775 . - // - // all painting happens in pixmap, and is sent to the window wholesale in on_canvas_expose - // canvas.set_double_buffered(false); - canvas.add_events(Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.STRUCTURE_MASK | Gdk.EventMask.SUBSTRUCTURE_MASK); @@ -2004,7 +2012,6 @@ public abstract class SinglePhotoPage : Page { protected void on_interactive_zoom(ZoomState interactive_zoom_state) { assert(is_zoom_supported()); - Cairo.Context canvas_ctx = Gdk.cairo_create(canvas.get_window()); set_source_color_from_string(pixmap_ctx, "#000"); pixmap_ctx.paint(); @@ -2014,13 +2021,11 @@ public abstract class SinglePhotoPage : Page { render_zoomed_to_pixmap(interactive_zoom_state); zoom_high_quality = old_quality_setting; - canvas_ctx.set_source_surface(pixmap, 0, 0); - canvas_ctx.paint(); + canvas.queue_draw(); } protected void on_interactive_pan(ZoomState interactive_zoom_state) { assert(is_zoom_supported()); - Cairo.Context canvas_ctx = Gdk.cairo_create(canvas.get_window()); set_source_color_from_string(pixmap_ctx, "#000"); pixmap_ctx.paint(); @@ -2030,8 +2035,7 @@ public abstract class SinglePhotoPage : Page { render_zoomed_to_pixmap(interactive_zoom_state); zoom_high_quality = old_quality_setting; - canvas_ctx.set_source_surface(pixmap, 0, 0); - canvas_ctx.paint(); + canvas.queue_draw(); } protected virtual bool is_zoom_supported() { -- cgit v1.2.3