mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Replace fullscreen mask workaround with Qt one
This commit is contained in:
parent
3a9eb8463d
commit
a307e7a798
2 changed files with 14 additions and 27 deletions
|
@ -998,35 +998,15 @@ void OverlayWidget::updateGeometry(bool inMove) {
|
||||||
|
|
||||||
void OverlayWidget::updateGeometryToScreen(bool inMove) {
|
void OverlayWidget::updateGeometryToScreen(bool inMove) {
|
||||||
const auto available = _window->screen()->geometry();
|
const auto available = _window->screen()->geometry();
|
||||||
const auto openglWidget = _opengl
|
if (_window->geometry() == available) {
|
||||||
? static_cast<QOpenGLWidget*>(_widget.get())
|
|
||||||
: nullptr;
|
|
||||||
const auto possibleSizeHack = Platform::IsWindows() && openglWidget;
|
|
||||||
const auto useSizeHack = possibleSizeHack
|
|
||||||
&& (openglWidget->format().renderableType()
|
|
||||||
!= QSurfaceFormat::OpenGLES);
|
|
||||||
const auto use = useSizeHack
|
|
||||||
? available.marginsAdded({ 0, 0, 0, 1 })
|
|
||||||
: available;
|
|
||||||
const auto mask = useSizeHack
|
|
||||||
? QRegion(QRect(QPoint(), available.size()))
|
|
||||||
: QRegion();
|
|
||||||
if (inMove && use.contains(_window->geometry())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((_window->geometry() == use)
|
|
||||||
&& (!possibleSizeHack || _window->mask() == mask)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DEBUG_LOG(("Viewer Pos: Setting %1, %2, %3, %4")
|
DEBUG_LOG(("Viewer Pos: Setting %1, %2, %3, %4")
|
||||||
.arg(use.x())
|
.arg(available.x())
|
||||||
.arg(use.y())
|
.arg(available.y())
|
||||||
.arg(use.width())
|
.arg(available.width())
|
||||||
.arg(use.height()));
|
.arg(available.height()));
|
||||||
_window->setGeometry(use);
|
_window->setGeometry(available);
|
||||||
if (possibleSizeHack) {
|
|
||||||
_window->setMask(mask);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::updateControlsGeometry() {
|
void OverlayWidget::updateControlsGeometry() {
|
||||||
|
|
|
@ -19,8 +19,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "tray.h"
|
#include "tray.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
|
||||||
#include <QtCore/QAbstractNativeEventFilter>
|
#include <QtCore/QAbstractNativeEventFilter>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
|
|
||||||
#include <propvarutil.h>
|
#include <propvarutil.h>
|
||||||
#include <propkey.h>
|
#include <propkey.h>
|
||||||
|
@ -28,6 +28,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
void WindowsIntegration::init() {
|
void WindowsIntegration::init() {
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||||
|
using namespace QNativeInterface::Private;
|
||||||
|
const auto native = qApp->nativeInterface<QWindowsApplication>();
|
||||||
|
if (native) {
|
||||||
|
native->setHasBorderInFullScreenDefault(true);
|
||||||
|
}
|
||||||
|
#endif // Qt >= 6.5.0
|
||||||
QCoreApplication::instance()->installNativeEventFilter(this);
|
QCoreApplication::instance()->installNativeEventFilter(this);
|
||||||
_taskbarCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated");
|
_taskbarCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue