Change type of opacity to qreal

The rest of code assumes that it's qreal.
This commit is contained in:
Vlad Zahorodnii 2021-02-05 23:56:17 +02:00
parent e117caa3eb
commit 7995112550
6 changed files with 15 additions and 15 deletions

View file

@ -149,12 +149,12 @@ NET::WindowType InternalClient::windowType(bool direct, int supported_types) con
return m_windowType;
}
double InternalClient::opacity() const
qreal InternalClient::opacity() const
{
return m_opacity;
}
void InternalClient::setOpacity(double opacity)
void InternalClient::setOpacity(qreal opacity)
{
if (m_opacity == opacity) {
return;

View file

@ -35,8 +35,8 @@ public:
QSize maxSize() const override;
QRect transparentRect() const override;
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
double opacity() const override;
void setOpacity(double opacity) override;
qreal opacity() const override;
void setOpacity(qreal opacity) override;
void killWindow() override;
bool isPopupWindow() const override;
QByteArray windowRole() const override;
@ -88,7 +88,7 @@ private:
QWindow *m_internalWindow = nullptr;
QString m_captionNormal;
QString m_captionSuffix;
double m_opacity = 1.0;
qreal m_opacity = 1.0;
NET::WindowType m_windowType = NET::Normal;
Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
bool m_userNoBorder = false;

View file

@ -247,7 +247,7 @@ bool Toplevel::resourceMatch(const Toplevel *c1, const Toplevel *c2)
return c1->resourceClass() == c2->resourceClass();
}
double Toplevel::opacity() const
qreal Toplevel::opacity() const
{
if (!info) {
return 1.0;
@ -257,13 +257,13 @@ double Toplevel::opacity() const
return info->opacity() * 1.0 / 0xffffffff;
}
void Toplevel::setOpacity(double new_opacity)
void Toplevel::setOpacity(qreal new_opacity)
{
if (!info) {
return;
}
double old_opacity = opacity();
qreal old_opacity = opacity();
new_opacity = qBound(0.0, new_opacity, 1.0);
if (old_opacity == new_opacity)
return;

View file

@ -448,8 +448,8 @@ public:
xcb_visualid_t visual() const;
bool shape() const;
QRegion inputShape() const;
virtual void setOpacity(double opacity);
virtual double opacity() const;
virtual void setOpacity(qreal opacity);
virtual qreal opacity() const;
int depth() const;
bool hasAlpha() const;
virtual bool setupCompositing();

View file

@ -107,12 +107,12 @@ bool WaylandClient::isLocalhost() const
return true;
}
double WaylandClient::opacity() const
qreal WaylandClient::opacity() const
{
return m_opacity;
}
void WaylandClient::setOpacity(double opacity)
void WaylandClient::setOpacity(qreal opacity)
{
const qreal newOpacity = qBound(0.0, opacity, 1.0);
if (newOpacity == m_opacity) {

View file

@ -34,8 +34,8 @@ public:
pid_t pid() const override;
bool isLockScreen() const override;
bool isLocalhost() const override;
double opacity() const override;
void setOpacity(double opacity) override;
qreal opacity() const override;
void setOpacity(qreal opacity) override;
AbstractClient *findModal(bool allow_itself = false) override;
void resizeWithChecks(const QSize &size, ForceGeometry_t force = NormalGeometrySet) override;
void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet) override;
@ -81,7 +81,7 @@ private:
QString m_captionNormal;
QString m_captionSuffix;
double m_opacity = 1.0;
qreal m_opacity = 1.0;
QRect m_requestedFrameGeometry;
QRect m_bufferGeometry;
QRect m_requestedClientGeometry;