Use StartTranslucentPaint only on OpenGL widgets on macOS.

This commit is contained in:
John Preston 2020-01-29 18:54:25 +03:00
parent bbd35238da
commit 33ea14969e
7 changed files with 9 additions and 13 deletions

View file

@ -12,7 +12,7 @@ class QPaintEvent;
namespace Ui {
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) {

View file

@ -67,12 +67,12 @@ void ReInitOnTopPanel(not_null<QWidget*> panel) {
[platformPanel setCollectionBehavior:newBehavior];
}
void StartTranslucentPaint(QPainter &p, QPaintEvent *e) {
#ifdef OS_MAC_OLD
void StartTranslucentPaint(QPainter &p, gsl::span<const QRect> rects) {
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);
#endif // OS_MAC_OLD
}
void ShowOverAll(not_null<QWidget*> widget, bool canFocus) {

View file

@ -16,7 +16,7 @@ namespace Platform {
[[nodiscard]] bool IsApplicationActive();
[[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 DeInitOnTopPanel(not_null<QWidget*> panel);

View file

@ -30,6 +30,8 @@ void UpdateOverlayed(not_null<QWidget*> widget) {
}
void IgnoreAllActivation(not_null<QWidget*> widget) {
widget->createWinId();
const auto handle = reinterpret_cast<HWND>(widget->winId());
Assert(handle != nullptr);

View file

@ -27,7 +27,7 @@ inline void DeInitOnTopPanel(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) {

View file

@ -121,10 +121,6 @@ const std::vector<not_null<QAction*>> &PopupMenu::actions() const {
void PopupMenu::paintEvent(QPaintEvent *e) {
QPainter p(this);
if (_useTransparency) {
Platform::StartTranslucentPaint(p, e);
}
if (_a_show.animating()) {
if (auto opacity = _a_opacity.value(_hiding ? 0. : 1.)) {
_showAnimation->paintFrame(p, 0, 0, width(), _a_show.value(1.), opacity);

View file

@ -132,8 +132,6 @@ void Tooltip::paintEvent(QPaintEvent *e) {
Painter p(this);
if (_useTransparency) {
Platform::StartTranslucentPaint(p, e);
p.setPen(_st->textBorder);
p.setBrush(_st->textBg);
PainterHighQualityEnabler hq(p);