Toggle fullscreen by double click.

This commit is contained in:
John Preston 2020-08-12 20:58:24 +04:00
parent 537645c282
commit c93d3ae924
5 changed files with 92 additions and 24 deletions

View File

@ -268,59 +268,65 @@ callTitle: WindowTitle(defaultWindowTitle) {
fgActive: transparent; fgActive: transparent;
minimize: IconButton(windowTitleButton) { minimize: IconButton(windowTitleButton) {
icon: icon { icon: icon {
{ size(24px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_minimize", callStatusFg, point(4px, 4px) }, { "title_button_minimize", callStatusFg, point(4px, 4px) },
}; };
iconOver: icon { iconOver: icon {
{ size(24px, 21px), callBgButton },
{ size(24px, 21px), callMuteRipple }, { size(24px, 21px), callMuteRipple },
{ "title_button_minimize", callStatusFg, point(4px, 4px) }, { "title_button_minimize", callStatusFg, point(4px, 4px) },
}; };
} }
minimizeIconActive: icon { minimizeIconActive: icon {
{ size(24px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_minimize", callStatusFg, point(4px, 4px) }, { "title_button_minimize", callStatusFg, point(4px, 4px) },
}; };
minimizeIconActiveOver: icon { minimizeIconActiveOver: icon {
{ size(24px, 21px), callBgButton },
{ size(24px, 21px), callMuteRipple }, { size(24px, 21px), callMuteRipple },
{ "title_button_minimize", callStatusFg, point(4px, 4px) }, { "title_button_minimize", callStatusFg, point(4px, 4px) },
}; };
maximize: IconButton(windowTitleButton) { maximize: IconButton(windowTitleButton) {
icon: icon { icon: icon {
{ size(24px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_maximize", callStatusFg, point(4px, 4px) }, { "title_button_maximize", callStatusFg, point(4px, 4px) },
}; };
iconOver: icon { iconOver: icon {
{ size(24px, 21px), callBgButton },
{ size(24px, 21px), callMuteRipple }, { size(24px, 21px), callMuteRipple },
{ "title_button_maximize", callStatusFg, point(4px, 4px) }, { "title_button_maximize", callStatusFg, point(4px, 4px) },
}; };
} }
maximizeIconActive: icon { maximizeIconActive: icon {
{ size(24px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_maximize", callStatusFg, point(4px, 4px) }, { "title_button_maximize", callStatusFg, point(4px, 4px) },
}; };
maximizeIconActiveOver: icon { maximizeIconActiveOver: icon {
{ size(24px, 21px), callBgButton },
{ size(24px, 21px), callMuteRipple }, { size(24px, 21px), callMuteRipple },
{ "title_button_maximize", callStatusFg, point(4px, 4px) }, { "title_button_maximize", callStatusFg, point(4px, 4px) },
}; };
restoreIcon: icon { restoreIcon: icon {
{ size(24px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_restore", callStatusFg, point(4px, 4px) }, { "title_button_restore", callStatusFg, point(4px, 4px) },
}; };
restoreIconOver: icon { restoreIconOver: icon {
{ size(24px, 21px), callBgButton },
{ size(24px, 21px), callMuteRipple }, { size(24px, 21px), callMuteRipple },
{ "title_button_restore", callStatusFg, point(4px, 4px) }, { "title_button_restore", callStatusFg, point(4px, 4px) },
}; };
restoreIconActive: icon { restoreIconActive: icon {
{ size(24px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_restore", callStatusFg, point(4px, 4px) }, { "title_button_restore", callStatusFg, point(4px, 4px) },
}; };
restoreIconActiveOver: icon { restoreIconActiveOver: icon {
{ size(24px, 21px), callBgButton },
{ size(24px, 21px), callMuteRipple }, { size(24px, 21px), callMuteRipple },
{ "title_button_restore", callStatusFg, point(4px, 4px) }, { "title_button_restore", callStatusFg, point(4px, 4px) },
}; };
close: IconButton(windowTitleButtonClose) { close: IconButton(windowTitleButtonClose) {
icon: icon { icon: icon {
{ size(25px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_close", callStatusFg, point(5px, 4px) }, { "title_button_close", callStatusFg, point(5px, 4px) },
}; };
iconOver: icon { iconOver: icon {
@ -329,7 +335,7 @@ callTitle: WindowTitle(defaultWindowTitle) {
}; };
} }
closeIconActive: icon { closeIconActive: icon {
{ size(25px, 21px), callBgOpaque }, { size(24px, 21px), callBgButton },
{ "title_button_close", callStatusFg, point(5px, 4px) }, { "title_button_close", callStatusFg, point(5px, 4px) },
}; };
closeIconActiveOver: icon { closeIconActiveOver: icon {

View File

@ -43,6 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtWidgets/QDesktopWidget> #include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
#include <QtGui/QWindow>
namespace Calls { namespace Calls {
namespace { namespace {
@ -296,25 +297,59 @@ void Panel::initWindow() {
_window->setWindowIcon( _window->setWindowIcon(
QIcon(QPixmap::fromImage(Image::Empty()->original(), Qt::ColorOnly))); QIcon(QPixmap::fromImage(Image::Empty()->original(), Qt::ColorOnly)));
_window->setTitle(u" "_q); _window->setTitle(u" "_q);
_window->setTitleStyle(st::callTitle);
_window->events( _window->events(
) | rpl::start_with_next([=](not_null<QEvent*> e) { ) | rpl::start_with_next([=](not_null<QEvent*> e) {
if (e->type() == QEvent::Close) { if (e->type() == QEvent::Close) {
handleClose(); handleClose();
} else if (e->type() == QEvent::KeyPress) {
if ((static_cast<QKeyEvent*>(e.get())->key() == Qt::Key_Escape)
&& _window->isFullScreen()) {
_window->showNormal();
}
} }
}, _window->lifetime()); }, _window->lifetime());
_window->setBodyTitleArea([=](QPoint widgetPoint) { _window->setBodyTitleArea([=](QPoint widgetPoint) {
const auto buttonWidth = st::callCancel.button.width; const auto buttonWidth = st::callCancel.button.width;
const auto buttonsWidth = buttonWidth * 4; const auto buttonsWidth = buttonWidth * 4;
return !_fingerprintArea.contains(widgetPoint) const auto inControls = _fingerprintArea.contains(widgetPoint)
&& !QRect( || QRect(
(widget()->width() - buttonsWidth) / 2, (widget()->width() - buttonsWidth) / 2,
_answerHangupRedial->y(), _answerHangupRedial->y(),
buttonsWidth, buttonsWidth,
_answerHangupRedial->height()).contains(widgetPoint) _answerHangupRedial->height()).contains(widgetPoint)
&& !_outgoingVideoBubble->geometry().contains(widgetPoint); || (!_outgoingPreviewInBody
&& _outgoingVideoBubble->geometry().contains(widgetPoint));
using Flag = Ui::WindowTitleHitTestFlag;
return inControls
? Flag::None
: (Flag::Move | Flag::FullScreen);
}); });
#ifdef Q_OS_WIN
// On Windows we replace snap-to-top maximizing with fullscreen.
//
// We have to switch first to showNormal, so that showFullScreen
// will remember correct normal window geometry and next showNormal
// will show it instead of a moving maximized window.
//
// We have to do it in InvokeQueued, otherwise it still captures
// the maximized window geometry and saves it.
//
// I couldn't find a less glitchy way to do that *sigh*.
const auto object = _window->windowHandle();
const auto signal = &QWindow::windowStateChanged;
QObject::connect(object, signal, [=](Qt::WindowState state) {
if (state == Qt::WindowMaximized) {
InvokeQueued(object, [=] {
_window->showNormal();
_window->showFullScreen();
});
}
});
#endif // Q_OS_WIN
} }
void Panel::initWidget() { void Panel::initWidget() {
@ -444,7 +479,9 @@ void Panel::reinitWithCall(Call *call) {
stateChanged(state); stateChanged(state);
}, _callLifetime); }, _callLifetime);
_call->videoIncoming()->renderNextFrame( rpl::merge(
_call->videoIncoming()->renderNextFrame(),
_call->videoOutgoing()->renderNextFrame()
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
setIncomingShown(!_call->videoIncoming()->frame({}).isNull()); setIncomingShown(!_call->videoIncoming()->frame({}).isNull());
widget()->update(); widget()->update();
@ -503,7 +540,6 @@ void Panel::initGeometry() {
const auto initRect = QRect(0, 0, st::callWidth, st::callHeight); const auto initRect = QRect(0, 0, st::callWidth, st::callHeight);
_window->setGeometry(initRect.translated(center - initRect.center())); _window->setGeometry(initRect.translated(center - initRect.center()));
_window->setMinimumSize({ st::callWidthMin, st::callHeightMin }); _window->setMinimumSize({ st::callWidthMin, st::callHeightMin });
_window->setTitleStyle(st::callTitle);
_window->show(); _window->show();
updateControlsGeometry(); updateControlsGeometry();
} }

View File

@ -45,7 +45,11 @@ void VideoBubble::setup() {
_track->markFrameShown(); _track->markFrameShown();
} else { } else {
updateVisibility(); updateVisibility();
_content.update(); // We update whole parent widget in this case.
// In case we update only bubble without the parent incoming
// video frame we may get full parent of old frame with a
// rectangular piece of a new frame rendered with that update().
//_content.update();
} }
}, lifetime()); }, lifetime());
} }

View File

@ -53,15 +53,15 @@ if (NOT DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION)
platform/PlatformInterface.h platform/PlatformInterface.h
# Teleram Desktop # Android
platform/tdesktop/DesktopInterface.cpp platform/android/AndroidContext.cpp
platform/tdesktop/DesktopInterface.h platform/android/AndroidContext.h
platform/tdesktop/VideoCapturerInterfaceImpl.cpp platform/android/AndroidInterface.cpp
platform/tdesktop/VideoCapturerInterfaceImpl.h platform/android/AndroidInterface.h
platform/tdesktop/VideoCapturerTrackSource.cpp platform/android/VideoCameraCapturer.cpp
platform/tdesktop/VideoCapturerTrackSource.h platform/android/VideoCameraCapturer.h
platform/tdesktop/VideoCameraCapturer.cpp platform/android/VideoCapturerInterfaceImpl.cpp
platform/tdesktop/VideoCameraCapturer.h platform/android/VideoCapturerInterfaceImpl.h
# iOS / macOS # iOS / macOS
platform/darwin/DarwinInterface.h platform/darwin/DarwinInterface.h
@ -95,6 +95,17 @@ if (NOT DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION)
# POSIX # POSIX
# Teleram Desktop
platform/tdesktop/DesktopInterface.cpp
platform/tdesktop/DesktopInterface.h
platform/tdesktop/VideoCapturerInterfaceImpl.cpp
platform/tdesktop/VideoCapturerInterfaceImpl.h
platform/tdesktop/VideoCapturerTrackSource.cpp
platform/tdesktop/VideoCapturerTrackSource.h
platform/tdesktop/VideoCameraCapturer.cpp
platform/tdesktop/VideoCameraCapturer.h
# All
reference/InstanceImplReference.cpp reference/InstanceImplReference.cpp
reference/InstanceImplReference.h reference/InstanceImplReference.h
) )
@ -150,6 +161,17 @@ else()
) )
endif() endif()
remove_target_sources(lib_tgcalls ${tgcalls_loc}
platform/android/AndroidContext.cpp
platform/android/AndroidContext.h
platform/android/AndroidInterface.cpp
platform/android/AndroidInterface.h
platform/android/VideoCameraCapturer.cpp
platform/android/VideoCameraCapturer.h
platform/android/VideoCapturerInterfaceImpl.cpp
platform/android/VideoCapturerInterfaceImpl.h
)
target_include_directories(lib_tgcalls target_include_directories(lib_tgcalls
PUBLIC PUBLIC
${tgcalls_dir} ${tgcalls_dir}

@ -1 +1 @@
Subproject commit 608b25bd32d01e233df0d78ccb5fd97028a82ae9 Subproject commit 3d5108a8787305ba7949659105b7f7490363488e