197
197
int x, y, cx, cy, depth;
200
if (event.window != tree.get_bin_window ())
200
if (event.window != tree.get_bin_window ()) {
201
201
return ClickZone.INVALID;
203
204
x = (int)event.x;
204
205
y = (int)event.y;
207
/* Determine whether there whitespace at this point. Note: this function returns false when the
208
* position is on the edge of the cell, even though this appears to be blank. We
209
* deal with this below. */
210
var is_blank = tree.is_blank_at_pos ((int)event.x, (int)event.y, null, null, null, null);
206
212
tree.get_path_at_pos ((int)event.x, (int)event.y, out p, out c, out cx, out cy);
208
214
depth = p != null ? p.get_depth () : 0;
216
/* Determine whether on edge of cell and designate as blank */
218
tree.get_cell_area (p, c, out area);
219
int height = area.height;
221
is_blank = is_blank || cy < 5 || cy > height - 5;
209
223
/* Do not allow rubberbanding to start except on a row in tree view */
210
zone = (p != null ? ClickZone.BLANK_PATH : ClickZone.INVALID);
224
zone = (p != null && is_blank ? ClickZone.BLANK_PATH : ClickZone.INVALID);
212
226
if (p != null && c != null && c == name_column) {
213
int? x_offset = null, width = null;
216
tree.get_cell_area (p, c, out area);
219
227
int orig_x = area.x + ICON_XPAD;
221
229
if (x > orig_x) { /* y must be in range */
226
234
zone = ClickZone.HELPER;
227
235
} else if (on_icon) {
228
236
zone = ClickZone.ICON;
230
c.cell_get_position (name_renderer, out x_offset, out width);
231
int expander_width = ICON_XPAD;
232
if (tree.show_expanders) {
233
var expander_val = GLib.Value (typeof (int));
234
tree.style_get_property ("expander-size", ref expander_val);
235
int expander_size = expander_val.get_int () + tree.get_level_indentation () + 3;
236
expander_width += expander_size * (depth) + zoom_level;
238
orig_x = expander_width + x_offset;
239
if (right_margin_unselects_all && cx >= orig_x + width - 6)
240
zone = ClickZone.INVALID; /* Cause unselect all to occur on right margin */
242
zone = ClickZone.NAME;
237
} else if (!is_blank) {
238
zone = ClickZone.NAME;
246
241
zone = ClickZone.EXPANDER;
249
protected override bool handle_secondary_button_click (Gdk.EventButton event) {
250
/* In Column and List Views show background menu on all white space to allow
251
* creation of new folder when view full. */
252
if (click_zone == ClickZone.BLANK_PATH) {
255
return base.handle_secondary_button_click (event);
254
258
protected override void scroll_to_cell (Gtk.TreePath? path, bool scroll_to_top) {
255
259
if (tree == null || path == null || slot == null || /* slot should not be null but see lp:1595438 */
256
260
slot.directory.permission_denied || slot.directory.is_empty ()) {