From b0c94641fcf85ed55976e894fea970331ae22892 Mon Sep 17 00:00:00 2001 From: bobufa Date: Wed, 8 Aug 2018 11:35:41 +0200 Subject: fix closing sidebar on click outside --- main/src/ui/unified_window.vala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'main/src/ui/unified_window.vala') diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala index 97ef7ed4..61a22085 100644 --- a/main/src/ui/unified_window.vala +++ b/main/src/ui/unified_window.vala @@ -70,8 +70,9 @@ public class UnifiedWindow : Gtk.Window { if (event.type == EventType.BUTTON_PRESS) { int dest_x, dest_y; bool ret = search_box.translate_coordinates(this, 0, 0, out dest_x, out dest_y); - print(@"ret $(ret) button-x $(event.button.x_root) !< dest_x $(dest_x)\n"); - if (ret && event.button.x_root < dest_x) { + int geometry_x, geometry_y, geometry_width, geometry_height; + this.get_window().get_geometry(out geometry_x, out geometry_y, out geometry_width, out geometry_height); + if (ret && event.button.x_root - geometry_x < dest_x || event.button.y_root - geometry_y < dest_y) { close_search(); } } else if (event.type == EventType.KEY_RELEASE) { -- cgit v1.2.3-70-g09d2