Commit f32e8bde authored by Jim Nelson's avatar Jim Nelson

#1066: Fixed assertion triggered when using Ctrl+H to hide an item while the...

#1066: Fixed assertion triggered when using Ctrl+H to hide an item while the mouse was hovering over it.
parent b698ee1d
......@@ -286,6 +286,12 @@ public abstract class LayoutItem : ThumbnailView {
notify_view_altered();
}
public override void visibility_changed(bool visible) {
// if going from visible to hidden, unbrighten
if (!visible)
unbrighten();
}
}
public class CheckerboardLayout : Gtk.DrawingArea {
......
......@@ -551,6 +551,10 @@ public class DataView : DataObject {
}
public virtual void notify_view_altered() {
// impossible when not visible
if (!visible)
return;
ViewCollection vc = get_membership() as ViewCollection;
if (vc != null && vc.are_view_notifications_frozen())
return;
......@@ -562,6 +566,10 @@ public class DataView : DataObject {
}
public virtual void notify_geometry_altered() {
// impossible when not visible
if (!visible)
return;
ViewCollection vc = get_membership() as ViewCollection;
if (vc != null && vc.are_geometry_notifications_frozen())
return;
......
......@@ -637,6 +637,9 @@ public abstract class CheckerboardPage : Page {
layout.set_adjustments(get_hadjustment(), get_vadjustment());
add(viewport);
// need to monitor items going hidden when dealing with anchor/cursor/highlighted items
get_view().items_hidden += on_items_hidden;
}
public void init_item_context_menu(string path) {
......@@ -699,6 +702,21 @@ public abstract class CheckerboardPage : Page {
public LayoutItem? get_item_at_pixel(double x, double y) {
return layout.get_item_at_pixel(x, y);
}
private void on_items_hidden(Gee.Iterable<DataView> hidden) {
foreach (DataView view in hidden) {
LayoutItem item = (LayoutItem) view;
if (anchor == item)
anchor = null;
if (cursor == item)
cursor = null;
if (highlighted == item)
highlighted = null;
}
}
protected override bool key_press_event(Gdk.EventKey event) {
bool handled = true;
......
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