diff options
author | fiaxh <git@lightrise.org> | 2023-04-21 17:40:19 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2023-04-22 17:07:29 +0200 |
commit | 5815e757b710aa5d9f6be7c5310ab7a9f94820f6 (patch) | |
tree | dce526b46624808b2d28417c54a5f67292688aa6 /main/src/ui | |
parent | dbb8abc1178720020ca872361e23b2e941b874f4 (diff) | |
download | dino-5815e757b710aa5d9f6be7c5310ab7a9f94820f6.tar.gz dino-5815e757b710aa5d9f6be7c5310ab7a9f94820f6.zip |
Fix call window controlls hiding
Diffstat (limited to 'main/src/ui')
-rw-r--r-- | main/src/ui/call_window/call_window.vala | 22 |
1 files 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<string, ParticipantWidget> participant_widgets = new HashMap<string, ParticipantWidget>(); private ArrayList<string> participants = new ArrayList<string>(); + 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); |