From 5815e757b710aa5d9f6be7c5310ab7a9f94820f6 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 21 Apr 2023 17:40:19 +0200 Subject: [PATCH] Fix call window controlls hiding --- main/src/ui/call_window/call_window.vala | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/main/src/ui/call_window/call_window.vala b/main/src/ui/call_window/call_window.vala index cf89d8e8..14b67449 100644 --- a/main/src/ui/call_window/call_window.vala +++ b/main/src/ui/call_window/call_window.vala @@ -22,7 +22,12 @@ namespace Dino.Ui { private HashMap participant_widgets = new HashMap(); private ArrayList participants = new ArrayList(); + private EventControllerFocus this_focus_events = new EventControllerFocus(); + private GestureClick this_gesture_events = new GestureClick() { touch_only=true, propagation_phase=Gtk.PropagationPhase.CAPTURE }; private EventControllerMotion this_motion_events = new EventControllerMotion(); + private double latest_motion_x = -1; + private double latest_motion_y = -1; + private const double MOTION_RELEVANCE_THRESHOLD = 2; private int own_video_width = 150; private int own_video_height = 100; @@ -54,9 +59,20 @@ namespace Dino.Ui { this.bind_property("controls-active", bottom_bar_revealer, "reveal-child", BindingFlags.SYNC_CREATE); ((Widget) this).add_controller(this_motion_events); - this_motion_events.motion.connect(reveal_control_elements); - this_motion_events.enter.connect(reveal_control_elements); - this_motion_events.leave.connect(reveal_control_elements); + this_motion_events.motion.connect((x, y) => { + if ((latest_motion_x - x).abs() <= MOTION_RELEVANCE_THRESHOLD && (latest_motion_y - y).abs() <= MOTION_RELEVANCE_THRESHOLD) return; + + latest_motion_x = x; + latest_motion_y = y; + reveal_control_elements(); + }); + + ((Widget) this).add_controller(this_focus_events); + this_focus_events.enter.connect(reveal_control_elements); + this_focus_events.leave.connect(reveal_control_elements); + + ((Widget) this).add_controller(this_gesture_events); + this_gesture_events.pressed.connect_after(reveal_control_elements); this.notify["default-width"].connect(reveal_control_elements); this.notify["default-height"].connect(reveal_control_elements);