mirror of https://github.com/procxx/kepka.git
Build fixed for Linux, checking for compositing manager running.
Backported QX11Info::isCompositingManagerRunning from Qt 5.7.
This commit is contained in:
parent
27ff8d4bf5
commit
bd2be4e0c1
|
@ -11896,6 +11896,52 @@ index 6fffa1e..cb1c9c1 100644
|
||||||
void destroyWindow();
|
void destroyWindow();
|
||||||
inline bool isDropSiteEnabled() const { return m_dropTarget != 0; }
|
inline bool isDropSiteEnabled() const { return m_dropTarget != 0; }
|
||||||
void setDropSiteEnabled(bool enabled);
|
void setDropSiteEnabled(bool enabled);
|
||||||
|
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
|
||||||
|
index 09e7ecf..c0f15a4 100644
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
|
||||||
|
@@ -79,7 +79,10 @@ static int resourceType(const QByteArray &key)
|
||||||
|
QByteArrayLiteral("rootwindow"),
|
||||||
|
QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingenabled"),
|
||||||
|
QByteArrayLiteral("nofonthinting"),
|
||||||
|
- QByteArrayLiteral("atspibus")
|
||||||
|
+ QByteArrayLiteral("atspibus"),
|
||||||
|
+
|
||||||
|
+ // Patch: Backport compositing manager check from Qt 5.7
|
||||||
|
+ QByteArrayLiteral("compositingenabled")
|
||||||
|
};
|
||||||
|
const QByteArray *end = names + sizeof(names) / sizeof(names[0]);
|
||||||
|
const QByteArray *result = std::find(names, end, key);
|
||||||
|
@@ -252,6 +255,13 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr
|
||||||
|
case RootWindow:
|
||||||
|
result = reinterpret_cast<void *>(xcbScreen->root());
|
||||||
|
break;
|
||||||
|
+
|
||||||
|
+ // Patch: Backport compositing manager check from Qt 5.7
|
||||||
|
+ case CompositingEnabled:
|
||||||
|
+ if (QXcbVirtualDesktop *vd = xcbScreen->virtualDesktop())
|
||||||
|
+ result = vd->compositingActive() ? this : Q_NULLPTR;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
|
||||||
|
index f88b710..6f818a5 100644
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
|
||||||
|
@@ -68,7 +68,10 @@ public:
|
||||||
|
ScreenSubpixelType,
|
||||||
|
ScreenAntialiasingEnabled,
|
||||||
|
NoFontHinting,
|
||||||
|
- AtspiBus
|
||||||
|
+ AtspiBus,
|
||||||
|
+
|
||||||
|
+ // Patch: Backport compositing manager check from Qt 5.7
|
||||||
|
+ CompositingEnabled
|
||||||
|
};
|
||||||
|
|
||||||
|
QXcbNativeInterface();
|
||||||
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
|
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
|
||||||
index bc2de89..aa8f8df 100644
|
index bc2de89..aa8f8df 100644
|
||||||
--- a/src/widgets/dialogs/qfiledialog.cpp
|
--- a/src/widgets/dialogs/qfiledialog.cpp
|
||||||
|
|
|
@ -61,7 +61,7 @@ void _trayIconActivate(GtkStatusIcon *status_icon, gpointer popup_menu) {
|
||||||
|
|
||||||
gboolean _trayIconResized(GtkStatusIcon *status_icon, gint size, gpointer popup_menu) {
|
gboolean _trayIconResized(GtkStatusIcon *status_icon, gint size, gpointer popup_menu) {
|
||||||
_trayIconSize = size;
|
_trayIconSize = size;
|
||||||
if (App::wnd()) App::wnd()->psUpdateCounter();
|
if (Global::started()) Notify::unreadCounterUpdated();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ static gboolean _trayIconCheck(gpointer/* pIn*/) {
|
||||||
cSetSupportTray(true);
|
cSetSupportTray(true);
|
||||||
if (App::wnd()) {
|
if (App::wnd()) {
|
||||||
App::wnd()->psUpdateWorkmode();
|
App::wnd()->psUpdateWorkmode();
|
||||||
App::wnd()->psUpdateCounter();
|
Notify::unreadCounterUpdated();
|
||||||
App::wnd()->updateTrayMenu();
|
App::wnd()->updateTrayMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ void MainWindow::psTrayMenuUpdated() {
|
||||||
void MainWindow::psSetupTrayIcon() {
|
void MainWindow::psSetupTrayIcon() {
|
||||||
if (noQtTrayIcon) {
|
if (noQtTrayIcon) {
|
||||||
if (!cSupportTray()) return;
|
if (!cSupportTray()) return;
|
||||||
psUpdateCounter();
|
updateIconCounters();
|
||||||
} else {
|
} else {
|
||||||
LOG(("Using Qt tray icon."));
|
LOG(("Using Qt tray icon."));
|
||||||
if (!trayIcon) {
|
if (!trayIcon) {
|
||||||
|
@ -266,7 +266,7 @@ void MainWindow::psSetupTrayIcon() {
|
||||||
|
|
||||||
App::wnd()->updateTrayMenu();
|
App::wnd()->updateTrayMenu();
|
||||||
}
|
}
|
||||||
psUpdateCounter();
|
updateIconCounters();
|
||||||
|
|
||||||
trayIcon->show();
|
trayIcon->show();
|
||||||
}
|
}
|
||||||
|
@ -315,12 +315,16 @@ void MainWindow::psUpdateIndicator() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::psUpdateCounter() {
|
void MainWindow::unreadCounterChangedHook() {
|
||||||
|
setWindowTitle(titleText());
|
||||||
|
updateIconCounters();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateIconCounters() {
|
||||||
setWindowIcon(wndIcon);
|
setWindowIcon(wndIcon);
|
||||||
|
|
||||||
int32 counter = App::histories().unreadBadge();
|
int32 counter = App::histories().unreadBadge();
|
||||||
|
|
||||||
setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram"));
|
|
||||||
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||||
if (_psUnityLauncherEntry) {
|
if (_psUnityLauncherEntry) {
|
||||||
if (counter > 0) {
|
if (counter > 0) {
|
||||||
|
|
|
@ -74,6 +74,7 @@ protected:
|
||||||
virtual void placeSmallCounter(QImage &img, int size, int count, const style::color &bg, const QPoint &shift, const style::color &color) = 0;
|
virtual void placeSmallCounter(QImage &img, int size, int count, const style::color &bg, const QPoint &shift, const style::color &color) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateIconCounters();
|
||||||
void psCreateTrayIcon();
|
void psCreateTrayIcon();
|
||||||
|
|
||||||
QTimer _psCheckStatusIconTimer;
|
QTimer _psCheckStatusIconTimer;
|
||||||
|
@ -81,6 +82,7 @@ private:
|
||||||
|
|
||||||
QTimer _psUpdateIndicatorTimer;
|
QTimer _psUpdateIndicatorTimer;
|
||||||
uint64 _psLastIndicatorUpdate = 0;
|
uint64 _psLastIndicatorUpdate = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
|
@ -36,6 +36,7 @@ void start();
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
void SetWatchingMediaKeys(bool watching);
|
void SetWatchingMediaKeys(bool watching);
|
||||||
|
bool TransparentWindowsSupported(QPoint globalPosition);
|
||||||
|
|
||||||
namespace ThirdParty {
|
namespace ThirdParty {
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
|
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -409,6 +411,31 @@ void finish() {
|
||||||
void SetWatchingMediaKeys(bool watching) {
|
void SetWatchingMediaKeys(bool watching) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TransparentWindowsSupported(QPoint globalPosition) {
|
||||||
|
if (auto app = static_cast<QGuiApplication*>(QCoreApplication::instance())) {
|
||||||
|
if (auto native = app->platformNativeInterface()) {
|
||||||
|
if (auto desktop = QApplication::desktop()) {
|
||||||
|
auto index = desktop->screenNumber(globalPosition);
|
||||||
|
auto screens = QGuiApplication::screens();
|
||||||
|
if (auto screen = (index >= 0 && index < screens.size()) ? screens[index] : QGuiApplication::primaryScreen()) {
|
||||||
|
if (native->nativeResourceForScreen(QByteArray("compositingEnabled"), screen)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static OrderedSet<int> WarnedAbout;
|
||||||
|
if (!WarnedAbout.contains(index)) {
|
||||||
|
WarnedAbout.insert(index);
|
||||||
|
LOG(("WARNING: Compositing is disabled for screen index %1 (for position %2,%3)").arg(index).arg(globalPosition.x()).arg(globalPosition.y()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG(("WARNING: Could not get screen for index %1 (for position %2,%3)").arg(index).arg(globalPosition.x()).arg(globalPosition.y()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ThirdParty {
|
namespace ThirdParty {
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
|
|
|
@ -405,6 +405,10 @@ void finish() {
|
||||||
objc_finish();
|
objc_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TransparentWindowsSupported(QPoint globalPosition) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ThirdParty {
|
namespace ThirdParty {
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
|
|
|
@ -732,6 +732,10 @@ void finish() {
|
||||||
void SetWatchingMediaKeys(bool watching) {
|
void SetWatchingMediaKeys(bool watching) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TransparentWindowsSupported(QPoint globalPosition) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ThirdParty {
|
namespace ThirdParty {
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
|
|
|
@ -68,7 +68,7 @@ void PopupMenu::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupMenu::handleCompositingUpdate() {
|
void PopupMenu::handleCompositingUpdate() {
|
||||||
_padding = _compositing ? _st.shadow.extend : style::margins(st::lineWidth, st::lineWidth, st::lineWidth, st::lineWidth);
|
_padding = _useTransaprency ? _st.shadow.extend : style::margins(st::lineWidth, st::lineWidth, st::lineWidth, st::lineWidth);
|
||||||
_menu->moveToLeft(_padding.left() + _st.scrollPadding.left(), _padding.top() + _st.scrollPadding.top());
|
_menu->moveToLeft(_padding.left() + _st.scrollPadding.left(), _padding.top() + _st.scrollPadding.top());
|
||||||
handleMenuResize();
|
handleMenuResize();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ void PopupMenu::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupMenu::paintBg(Painter &p) {
|
void PopupMenu::paintBg(Painter &p) {
|
||||||
if (_compositing) {
|
if (_useTransaprency) {
|
||||||
Shadow::paint(p, _inner, width(), _st.shadow);
|
Shadow::paint(p, _inner, width(), _st.shadow);
|
||||||
App::roundRect(p, _inner, _st.menu.itemBg, ImageRoundRadius::Small);
|
App::roundRect(p, _inner, _st.menu.itemBg, ImageRoundRadius::Small);
|
||||||
} else {
|
} else {
|
||||||
|
@ -307,7 +307,7 @@ void PopupMenu::prepareCache() {
|
||||||
|
|
||||||
void PopupMenu::startOpacityAnimation(bool hiding) {
|
void PopupMenu::startOpacityAnimation(bool hiding) {
|
||||||
_hiding = false;
|
_hiding = false;
|
||||||
if (!_compositing) {
|
if (!_useTransaprency) {
|
||||||
_a_opacity.finish();
|
_a_opacity.finish();
|
||||||
if (hiding) {
|
if (hiding) {
|
||||||
hideFinished();
|
hideFinished();
|
||||||
|
@ -334,7 +334,7 @@ void PopupMenu::showStarted() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupMenu::startShowAnimation() {
|
void PopupMenu::startShowAnimation() {
|
||||||
if (!_compositing) {
|
if (!_useTransaprency) {
|
||||||
_a_show.finish();
|
_a_show.finish();
|
||||||
update();
|
update();
|
||||||
return;
|
return;
|
||||||
|
@ -347,7 +347,7 @@ void PopupMenu::startShowAnimation() {
|
||||||
|
|
||||||
_showAnimation = std_::make_unique<PanelAnimation>(_st.animation, _origin);
|
_showAnimation = std_::make_unique<PanelAnimation>(_st.animation, _origin);
|
||||||
_showAnimation->setFinalImage(std_::move(cache), _inner);
|
_showAnimation->setFinalImage(std_::move(cache), _inner);
|
||||||
if (_compositing) {
|
if (_useTransaprency) {
|
||||||
auto corners = App::cornersMask(ImageRoundRadius::Small);
|
auto corners = App::cornersMask(ImageRoundRadius::Small);
|
||||||
_showAnimation->setCornerMasks(QImage(*corners[0]), QImage(*corners[1]), QImage(*corners[2]), QImage(*corners[3]));
|
_showAnimation->setCornerMasks(QImage(*corners[0]), QImage(*corners[1]), QImage(*corners[2]), QImage(*corners[3]));
|
||||||
} else {
|
} else {
|
||||||
|
@ -382,7 +382,7 @@ QImage PopupMenu::grabForPanelAnimation() {
|
||||||
result.fill(Qt::transparent);
|
result.fill(Qt::transparent);
|
||||||
{
|
{
|
||||||
Painter p(&result);
|
Painter p(&result);
|
||||||
if (_compositing) {
|
if (_useTransaprency) {
|
||||||
App::roundRect(p, _inner, _st.menu.itemBg, ImageRoundRadius::Small);
|
App::roundRect(p, _inner, _st.menu.itemBg, ImageRoundRadius::Small);
|
||||||
} else {
|
} else {
|
||||||
p.fillRect(_inner, _st.menu.itemBg);
|
p.fillRect(_inner, _st.menu.itemBg);
|
||||||
|
@ -410,11 +410,7 @@ void PopupMenu::showMenu(const QPoint &p, PopupMenu *parent, TriggeredSource sou
|
||||||
auto origin = PanelAnimation::Origin::TopLeft;
|
auto origin = PanelAnimation::Origin::TopLeft;
|
||||||
auto w = p - QPoint(0, _padding.top());
|
auto w = p - QPoint(0, _padding.top());
|
||||||
auto r = Sandbox::screenGeometry(p);
|
auto r = Sandbox::screenGeometry(p);
|
||||||
#ifdef Q_OS_LINUX
|
_useTransaprency = Platform::TransparentWindowsSupported(p);
|
||||||
_compositing = QX11Info::isCompositingManagerRunning(QApplication::desktop()->screenNumber(p));
|
|
||||||
#else // Q_OS_LINUX
|
|
||||||
_compositing = true;
|
|
||||||
#endif // Q_OS_LINUX
|
|
||||||
handleCompositingUpdate();
|
handleCompositingUpdate();
|
||||||
if (rtl()) {
|
if (rtl()) {
|
||||||
if (w.x() - width() < r.x() - _padding.left()) {
|
if (w.x() - width() < r.x() - _padding.left()) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ private:
|
||||||
std_::unique_ptr<PanelAnimation> _showAnimation;
|
std_::unique_ptr<PanelAnimation> _showAnimation;
|
||||||
FloatAnimation _a_show;
|
FloatAnimation _a_show;
|
||||||
|
|
||||||
bool _compositing = true;
|
bool _useTransaprency = true;
|
||||||
bool _hiding = false;
|
bool _hiding = false;
|
||||||
QPixmap _cache;
|
QPixmap _cache;
|
||||||
FloatAnimation _a_opacity;
|
FloatAnimation _a_opacity;
|
||||||
|
|
Loading…
Reference in New Issue