mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Use global Fn+F shortcut for toggle fullscreen on macOS.
This commit is contained in:
parent
eae2788f73
commit
152661dcea
11 changed files with 60 additions and 6 deletions
|
@ -734,6 +734,17 @@ bool Instance::minimizeCurrentActiveCall() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Instance::toggleFullScreenCurrentActiveCall() {
|
||||||
|
if (inCall() && _currentCallPanel->isActive()) {
|
||||||
|
_currentCallPanel->toggleFullScreen();
|
||||||
|
return true;
|
||||||
|
} else if (inGroupCall() && _currentGroupCallPanel->isActive()) {
|
||||||
|
_currentGroupCallPanel->toggleFullScreen();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Instance::closeCurrentActiveCall() {
|
bool Instance::closeCurrentActiveCall() {
|
||||||
if (inGroupCall() && _currentGroupCallPanel->isActive()) {
|
if (inGroupCall() && _currentGroupCallPanel->isActive()) {
|
||||||
_currentGroupCallPanel->close();
|
_currentGroupCallPanel->close();
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
not_null<Main::Session*> session) const;
|
not_null<Main::Session*> session) const;
|
||||||
bool activateCurrentCall(const QString &joinHash = QString());
|
bool activateCurrentCall(const QString &joinHash = QString());
|
||||||
bool minimizeCurrentActiveCall();
|
bool minimizeCurrentActiveCall();
|
||||||
|
bool toggleFullScreenCurrentActiveCall();
|
||||||
bool closeCurrentActiveCall();
|
bool closeCurrentActiveCall();
|
||||||
[[nodiscard]] auto getVideoCapture(
|
[[nodiscard]] auto getVideoCapture(
|
||||||
std::optional<QString> deviceId = std::nullopt,
|
std::optional<QString> deviceId = std::nullopt,
|
||||||
|
|
|
@ -128,6 +128,10 @@ void Panel::minimize() {
|
||||||
window()->setWindowState(window()->windowState() | Qt::WindowMinimized);
|
window()->setWindowState(window()->windowState() | Qt::WindowMinimized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::toggleFullScreen() {
|
||||||
|
toggleFullScreen(!window()->isFullScreen());
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::replaceCall(not_null<Call*> call) {
|
void Panel::replaceCall(not_null<Call*> call) {
|
||||||
reinitWithCall(call);
|
reinitWithCall(call);
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
[[nodiscard]] bool isActive() const;
|
[[nodiscard]] bool isActive() const;
|
||||||
void showAndActivate();
|
void showAndActivate();
|
||||||
void minimize();
|
void minimize();
|
||||||
|
void toggleFullScreen();
|
||||||
void replaceCall(not_null<Call*> call);
|
void replaceCall(not_null<Call*> call);
|
||||||
void closeBeforeDestroy();
|
void closeBeforeDestroy();
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,7 @@ void Panel::initControls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::toggleFullScreen() {
|
void Panel::toggleFullScreen() {
|
||||||
if (_fullScreenOrMaximized.current()) {
|
if (_fullScreenOrMaximized.current() || window()->isFullScreen()) {
|
||||||
window()->showNormal();
|
window()->showNormal();
|
||||||
} else {
|
} else {
|
||||||
window()->showFullScreen();
|
window()->showFullScreen();
|
||||||
|
|
|
@ -94,6 +94,7 @@ public:
|
||||||
void hideLayer(anim::type animated = anim::type::normal);
|
void hideLayer(anim::type animated = anim::type::normal);
|
||||||
|
|
||||||
void minimize();
|
void minimize();
|
||||||
|
void toggleFullScreen();
|
||||||
void close();
|
void close();
|
||||||
void showAndActivate();
|
void showAndActivate();
|
||||||
void closeBeforeDestroy();
|
void closeBeforeDestroy();
|
||||||
|
@ -133,7 +134,6 @@ private:
|
||||||
|
|
||||||
bool handleClose();
|
bool handleClose();
|
||||||
void startScheduledNow();
|
void startScheduledNow();
|
||||||
void toggleFullScreen();
|
|
||||||
void trackControls(bool track, bool force = false);
|
void trackControls(bool track, bool force = false);
|
||||||
void raiseControls();
|
void raiseControls();
|
||||||
void enlargeVideo();
|
void enlargeVideo();
|
||||||
|
|
|
@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "chat_helpers/emoji_keywords.h"
|
#include "chat_helpers/emoji_keywords.h"
|
||||||
#include "chat_helpers/stickers_emoji_image_loader.h"
|
#include "chat_helpers/stickers_emoji_image_loader.h"
|
||||||
#include "base/qt/qt_common_adapters.h"
|
#include "base/qt/qt_common_adapters.h"
|
||||||
|
#include "base/platform/base_platform_global_shortcuts.h"
|
||||||
#include "base/platform/base_platform_url_scheme.h"
|
#include "base/platform/base_platform_url_scheme.h"
|
||||||
#include "base/platform/base_platform_last_input.h"
|
#include "base/platform/base_platform_last_input.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
|
@ -618,7 +619,14 @@ bool Application::hideMediaView() {
|
||||||
|
|
||||||
bool Application::eventFilter(QObject *object, QEvent *e) {
|
bool Application::eventFilter(QObject *object, QEvent *e) {
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress: {
|
||||||
|
updateNonIdle();
|
||||||
|
const auto event = static_cast<QKeyEvent*>(e);
|
||||||
|
if (base::Platform::GlobalShortcuts::IsToggleFullScreenKey(event)
|
||||||
|
&& toggleActiveWindowFullScreen()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
case QEvent::TouchBegin:
|
case QEvent::TouchBegin:
|
||||||
case QEvent::Wheel: {
|
case QEvent::Wheel: {
|
||||||
|
@ -1513,7 +1521,9 @@ bool Application::minimizeActiveWindow() {
|
||||||
if (_mediaView && _mediaView->isActive()) {
|
if (_mediaView && _mediaView->isActive()) {
|
||||||
_mediaView->minimize();
|
_mediaView->minimize();
|
||||||
return true;
|
return true;
|
||||||
} else if (!calls().minimizeCurrentActiveCall()) {
|
} else if (calls().minimizeCurrentActiveCall()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
if (const auto window = activeWindow()) {
|
if (const auto window = activeWindow()) {
|
||||||
window->minimize();
|
window->minimize();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1522,6 +1532,25 @@ bool Application::minimizeActiveWindow() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::toggleActiveWindowFullScreen() {
|
||||||
|
if (_mediaView && _mediaView->isActive()) {
|
||||||
|
_mediaView->toggleFullScreen();
|
||||||
|
return true;
|
||||||
|
} else if (calls().toggleFullScreenCurrentActiveCall()) {
|
||||||
|
return true;
|
||||||
|
} else if (const auto window = activeWindow()) {
|
||||||
|
if constexpr (Platform::IsMac()) {
|
||||||
|
if (window->widget()->isFullScreen()) {
|
||||||
|
window->widget()->showNormal();
|
||||||
|
} else {
|
||||||
|
window->widget()->showFullScreen();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *Application::getFileDialogParent() {
|
QWidget *Application::getFileDialogParent() {
|
||||||
if (const auto view = _mediaView.get(); view && !view->isHidden()) {
|
if (const auto view = _mediaView.get(); view && !view->isHidden()) {
|
||||||
return view->widget();
|
return view->widget();
|
||||||
|
|
|
@ -182,6 +182,7 @@ public:
|
||||||
void windowActivated(not_null<Window::Controller*> window);
|
void windowActivated(not_null<Window::Controller*> window);
|
||||||
bool closeActiveWindow();
|
bool closeActiveWindow();
|
||||||
bool minimizeActiveWindow();
|
bool minimizeActiveWindow();
|
||||||
|
bool toggleActiveWindowFullScreen();
|
||||||
[[nodiscard]] QWidget *getFileDialogParent();
|
[[nodiscard]] QWidget *getFileDialogParent();
|
||||||
void notifyFileDialogShown(bool shown);
|
void notifyFileDialogShown(bool shown);
|
||||||
void checkSystemDarkMode();
|
void checkSystemDarkMode();
|
||||||
|
|
|
@ -1826,6 +1826,10 @@ void OverlayWidget::minimize() {
|
||||||
_helper->minimize(_window);
|
_helper->minimize(_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverlayWidget::toggleFullScreen() {
|
||||||
|
toggleFullScreen(!_fullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
void OverlayWidget::toggleFullScreen(bool fullscreen) {
|
void OverlayWidget::toggleFullScreen(bool fullscreen) {
|
||||||
_helper->clearState();
|
_helper->clearState();
|
||||||
_fullscreen = fullscreen;
|
_fullscreen = fullscreen;
|
||||||
|
@ -5170,10 +5174,12 @@ bool OverlayWidget::filterApplicationEvent(
|
||||||
const auto ctrl = event->modifiers().testFlag(Qt::ControlModifier);
|
const auto ctrl = event->modifiers().testFlag(Qt::ControlModifier);
|
||||||
if (key == Qt::Key_F && ctrl && _streamed) {
|
if (key == Qt::Key_F && ctrl && _streamed) {
|
||||||
playbackToggleFullScreen();
|
playbackToggleFullScreen();
|
||||||
|
return true;
|
||||||
} else if (key == Qt::Key_0 && ctrl) {
|
} else if (key == Qt::Key_0 && ctrl) {
|
||||||
zoomReset();
|
zoomReset();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
} else if (type == QEvent::MouseMove
|
} else if (type == QEvent::MouseMove
|
||||||
|| type == QEvent::MouseButtonPress
|
|| type == QEvent::MouseButtonPress
|
||||||
|| type == QEvent::MouseButtonRelease) {
|
|| type == QEvent::MouseButtonRelease) {
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
void activateControls();
|
void activateControls();
|
||||||
void close();
|
void close();
|
||||||
void minimize();
|
void minimize();
|
||||||
|
void toggleFullScreen();
|
||||||
void toggleFullScreen(bool fullscreen);
|
void toggleFullScreen(bool fullscreen);
|
||||||
|
|
||||||
void notifyFileDialogShown(bool shown);
|
void notifyFileDialogShown(bool shown);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7f129171548a3828693d7f79fbdb783464f31b97
|
Subproject commit 285527e3df689d291cae8a1923479da1b4d361d5
|
Loading…
Add table
Reference in a new issue