Explorar o código

tools: select corresponding row if user clicked outside selection. Also do not show popup if user clicked on empty space.

Daniele Bartolini %!s(int64=5) %!d(string=hai) anos
pai
achega
e8b664ecf9
Modificáronse 1 ficheiros con 15 adicións e 0 borrados
  1. 15 0
      tools/level_editor/level_tree_view.vala

+ 15 - 0
tools/level_editor/level_tree_view.vala

@@ -139,6 +139,21 @@ public class LevelTreeView : Gtk.Box
 	{
 		if (ev.button == Gdk.BUTTON_SECONDARY)
 		{
+			Gtk.TreePath path;
+			Gtk.TreeViewColumn column;
+			if (_tree_view.get_path_at_pos((int)ev.x, (int)ev.y, out path, out column, null, null))
+			{
+				if (!_tree_selection.path_is_selected(path))
+				{
+					_tree_selection.unselect_all();
+					_tree_selection.select_path(path);
+				}
+			}
+			else // Clicked on empty space.
+			{
+				return Gdk.EVENT_PROPAGATE;
+			}
+
 			Gtk.Menu menu = new Gtk.Menu();
 			Gtk.MenuItem mi;