Use StartTranslucentPaint only on OpenGL widgets on macOS.
This commit is contained in:
parent
bbd35238da
commit
33ea14969e
7 changed files with 9 additions and 13 deletions
|
|
@ -12,7 +12,7 @@ class QPaintEvent;
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
inline void StartTranslucentPaint(QPainter &p, QPaintEvent *e) {
|
inline void StartTranslucentPaint(QPainter &p, gsl::span<const QRect> rects) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void InitOnTopPanel(not_null<QWidget*> panel) {
|
inline void InitOnTopPanel(not_null<QWidget*> panel) {
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,12 @@ void ReInitOnTopPanel(not_null<QWidget*> panel) {
|
||||||
[platformPanel setCollectionBehavior:newBehavior];
|
[platformPanel setCollectionBehavior:newBehavior];
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartTranslucentPaint(QPainter &p, QPaintEvent *e) {
|
void StartTranslucentPaint(QPainter &p, gsl::span<const QRect> rects) {
|
||||||
#ifdef OS_MAC_OLD
|
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
p.fillRect(e->rect(), Qt::transparent);
|
for (const auto &r : rects) {
|
||||||
|
p.fillRect(r, Qt::transparent);
|
||||||
|
}
|
||||||
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||||
#endif // OS_MAC_OLD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowOverAll(not_null<QWidget*> widget, bool canFocus) {
|
void ShowOverAll(not_null<QWidget*> widget, bool canFocus) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Platform {
|
||||||
[[nodiscard]] bool IsApplicationActive();
|
[[nodiscard]] bool IsApplicationActive();
|
||||||
|
|
||||||
[[nodiscard]] bool TranslucentWindowsSupported(QPoint globalPosition);
|
[[nodiscard]] bool TranslucentWindowsSupported(QPoint globalPosition);
|
||||||
void StartTranslucentPaint(QPainter &p, QPaintEvent *e);
|
void StartTranslucentPaint(QPainter &p, gsl::span<const QRect> rects);
|
||||||
|
|
||||||
void InitOnTopPanel(not_null<QWidget*> panel);
|
void InitOnTopPanel(not_null<QWidget*> panel);
|
||||||
void DeInitOnTopPanel(not_null<QWidget*> panel);
|
void DeInitOnTopPanel(not_null<QWidget*> panel);
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ void UpdateOverlayed(not_null<QWidget*> widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IgnoreAllActivation(not_null<QWidget*> widget) {
|
void IgnoreAllActivation(not_null<QWidget*> widget) {
|
||||||
|
widget->createWinId();
|
||||||
|
|
||||||
const auto handle = reinterpret_cast<HWND>(widget->winId());
|
const auto handle = reinterpret_cast<HWND>(widget->winId());
|
||||||
Assert(handle != nullptr);
|
Assert(handle != nullptr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ inline void DeInitOnTopPanel(not_null<QWidget*> panel) {
|
||||||
inline void ReInitOnTopPanel(not_null<QWidget*> panel) {
|
inline void ReInitOnTopPanel(not_null<QWidget*> panel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void StartTranslucentPaint(QPainter &p, QPaintEvent *e) {
|
inline void StartTranslucentPaint(QPainter &p, gsl::span<const QRect> rects) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ShowOverAll(not_null<QWidget*> widget, bool canFocus) {
|
inline void ShowOverAll(not_null<QWidget*> widget, bool canFocus) {
|
||||||
|
|
|
||||||
|
|
@ -121,10 +121,6 @@ const std::vector<not_null<QAction*>> &PopupMenu::actions() const {
|
||||||
void PopupMenu::paintEvent(QPaintEvent *e) {
|
void PopupMenu::paintEvent(QPaintEvent *e) {
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
|
|
||||||
if (_useTransparency) {
|
|
||||||
Platform::StartTranslucentPaint(p, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_a_show.animating()) {
|
if (_a_show.animating()) {
|
||||||
if (auto opacity = _a_opacity.value(_hiding ? 0. : 1.)) {
|
if (auto opacity = _a_opacity.value(_hiding ? 0. : 1.)) {
|
||||||
_showAnimation->paintFrame(p, 0, 0, width(), _a_show.value(1.), opacity);
|
_showAnimation->paintFrame(p, 0, 0, width(), _a_show.value(1.), opacity);
|
||||||
|
|
|
||||||
|
|
@ -132,8 +132,6 @@ void Tooltip::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
|
|
||||||
if (_useTransparency) {
|
if (_useTransparency) {
|
||||||
Platform::StartTranslucentPaint(p, e);
|
|
||||||
|
|
||||||
p.setPen(_st->textBorder);
|
p.setPen(_st->textBorder);
|
||||||
p.setBrush(_st->textBg);
|
p.setBrush(_st->textBg);
|
||||||
PainterHighQualityEnabler hq(p);
|
PainterHighQualityEnabler hq(p);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue