fix: ui call view

This patch fix the problems:
- exit full screen mode when call is finished
- clean up last video picture when call is finished
- hide call options if no mouse activity detected
- resize video to use full screen

Change-Id: I7544dd616e88e35cacf3ca8c60d65aedbfe14860
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
diff --git a/src/views/CallLayer.mm b/src/views/CallLayer.mm
index 444fe2f..f04a9eb 100644
--- a/src/views/CallLayer.mm
+++ b/src/views/CallLayer.mm
@@ -180,10 +180,21 @@
 
         GLint inScalingUniform = glGetUniformLocation(sProg, "in_Scaling");
 
-        if (ratio < 1.0)
-            glUniform2f(inScalingUniform, 1.0, ratio);
-        else
-            glUniform2f(inScalingUniform, 1.0/ratio, 1.0);
+        float multiplier = MAX(frameRatio, ratio);
+        if((viewRatio >= 1 && frameRatio >= 1) ||
+           (viewRatio < 1 && frameRatio < 1) ||
+           (ratio > 0.5 && ratio < 1.5) ) {
+            if (ratio > 1.0)
+                glUniform2f(inScalingUniform, 1.0, 1.0 * ratio);
+            else
+                glUniform2f(inScalingUniform, 1.0/ratio, 1.0);
+        } else {
+            if (ratio < 1.0)
+                glUniform2f(inScalingUniform, 1.0, 1.0 * ratio);
+            else
+                glUniform2f(inScalingUniform, 1.0/ratio, 1.0);
+
+        }
     }
     [currentFrameLk unlock];
 
diff --git a/src/views/CallView.mm b/src/views/CallView.mm
index c70338a..e0ebfc4 100644
--- a/src/views/CallView.mm
+++ b/src/views/CallView.mm
@@ -201,10 +201,10 @@
 
 - (void)mouseMoved:(NSEvent *)theEvent
 {
-    [NSObject cancelPreviousPerformRequestsWithTarget:self]; // cancel showContextualMenu
-    [self performSelector:@selector(mouseIdle:) withObject:theEvent afterDelay:3];
-    if (self.callDelegate)
-        [self.callDelegate mouseIsMoving:YES];
+        [NSObject cancelPreviousPerformRequestsWithTarget:self]; // cancel showContextualMenu
+        [self performSelector:@selector(mouseIdle:) withObject:theEvent afterDelay:3];
+        if (self.callDelegate && shouldAcceptInteractions)
+            [self.callDelegate mouseIsMoving:YES];
 }
 
 - (void) mouseIdle:(NSEvent *)theEvent
@@ -225,8 +225,9 @@
     else if([theEvent clickCount] == 2)
     {
         [NSObject cancelPreviousPerformRequestsWithTarget:self]; // cancel showContextualMenu
-        if(self.callDelegate)
+        if(self.callDelegate) {
             [self.callDelegate callShouldToggleFullScreen];
+        }
     }
 }