From 5a5b0e90693b76684f24fe94e9563f23c7770967 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 8 Oct 2017 00:39:08 +0300 Subject: [PATCH] desktop sharing bug fix --- toxygen/calls.py | 3 +++ toxygen/menu.py | 2 +- toxygen/profile.py | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/toxygen/calls.py b/toxygen/calls.py index a16a79d..7b16e84 100644 --- a/toxygen/calls.py +++ b/toxygen/calls.py @@ -153,6 +153,9 @@ class AV: if state | TOXAV_FRIEND_CALL_STATE['ACCEPTING_V'] and call.out_video: self.start_video_thread() + def is_video_call(self, number): + return self._calls[number].in_video + # ----------------------------------------------------------------------------------------------------------------- # Threads # ----------------------------------------------------------------------------------------------------------------- diff --git a/toxygen/menu.py b/toxygen/menu.py index 0d640f4..5b3f6f1 100644 --- a/toxygen/menu.py +++ b/toxygen/menu.py @@ -816,7 +816,7 @@ class DesktopAreaSelectionWindow(RubberBandWindow): rect = self.rubberband.geometry() width, height = rect.width(), rect.height() if width >= 8 and height >= 8: - self.parent.save(rect.x(), rect.y(), width, height) + self.parent.save(rect.x(), rect.y(), width - (width % 4), height - (height % 4)) self.close() diff --git a/toxygen/profile.py b/toxygen/profile.py index d8bf085..59c0e69 100644 --- a/toxygen/profile.py +++ b/toxygen/profile.py @@ -1281,11 +1281,17 @@ class Profile(basecontact.BaseContact, Singleton): else: text = QtWidgets.QApplication.translate("incoming_call", "Call finished") self._screen.call_finished() + is_video = self._call.is_video_call(friend_number) self._call.finish_call(friend_number, by_friend) # finish or decline call if hasattr(self, '_call_widget'): self._call_widget[friend_number].close() del self._call_widget[friend_number] - threading.Timer(2.0, lambda: cv2.destroyWindow(str(friend_number))).start() + + def destroy_window(): + if is_video: + cv2.destroyWindow(str(friend_number)) + + threading.Timer(2.0, destroy_window).start() friend = self.get_friend_by_number(friend_number) friend.append_message(InfoMessage(text, time.time())) if friend_number == self.get_active_number():