13#include "kddockwidgets/core/indicators/ClassicDropIndicatorOverlay.h"
14#include "kddockwidgets/core/Group.h"
16#include "core/Utils_p.h"
22#ifdef QT_X11EXTRAS_LIB
23#include <QtX11Extras/QX11Info>
26#define INDICATOR_WIDTH 40
27#define OUTTER_INDICATOR_MARGIN 10
37 if (qEnvironmentVariableIsSet(
"KDDW_NO_TRANSLUCENCY")
41#ifdef QT_X11EXTRAS_LIB
43 return QX11Info::isCompositingManagerRunning();
58 void setHovered(
bool hovered);
60 QString iconFileName(
bool active)
const;
64 bool m_hovered =
false;
75 name = QStringLiteral(
"center");
78 name = QStringLiteral(
"inner_left");
81 name = QStringLiteral(
"inner_right");
84 name = QStringLiteral(
"inner_bottom");
87 name = QStringLiteral(
"inner_top");
90 name = QStringLiteral(
"outter_left");
93 name = QStringLiteral(
"outter_bottom");
96 name = QStringLiteral(
"outter_right");
99 name = QStringLiteral(
"outter_top");
109 return name + suffix;
117 p.drawImage(rect(), m_imageActive, rect());
119 p.drawImage(rect(), m_image, rect());
122void Indicator::setHovered(
bool hovered)
124 if (hovered != m_hovered) {
130QString Indicator::iconName(
bool active)
const
135QString Indicator::iconFileName(
bool active)
const
139 ? QStringLiteral(
":/img/classic_indicators/%1.png").arg(name)
140 : QStringLiteral(
":/img/classic_indicators/opaque/%1.png").arg(name);
147 return isWayland() ? QtCommon::View_qt::asQWidget(classicIndicators_->
view()) :
nullptr;
157 , classicIndicators(classicIndicators_)
178 m_indicators << m_center << m_left << m_right << m_top << m_bottom << m_outterBottom
179 << m_outterTop << m_outterLeft << m_outterRight;
182Indicator *IndicatorWindow::indicatorForLocation(
DropLocation loc)
const
198 return m_outterBottom;
200 return m_outterRight;
214void IndicatorWindow::updateMask()
219 for (Indicator *indicator :
std::as_const(m_indicators)) {
220 if (indicator->isVisible())
236 for (Indicator *indicator : { m_left, m_right, m_bottom, m_top, m_outterTop, m_outterLeft,
237 m_outterRight, m_outterBottom, m_center })
245 Indicator *indicator = indicatorForLocation(loc);
246 return indicator->mapToGlobal(indicator->rect().center());
253 for (Indicator *indicator : std::as_const(m_indicators)) {
254 if (indicator->isVisible()) {
255 const bool hovered = indicator->rect().contains(indicator->mapFromGlobal(globalPos));
256 indicator->setHovered(hovered);
258 loc = indicator->m_dropLocation;
268 const int indicatorWidth = m_outterBottom->width();
269 const int halfIndicatorWidth = m_outterBottom->width() / 2;
272 m_outterBottom->move(r.
center().
x() - halfIndicatorWidth,
276 r.
center().
y() - halfIndicatorWidth);
281 -
QPoint(halfIndicatorWidth, halfIndicatorWidth));
322 , m_dropLocation(location)
330#include "ClassicIndicatorsWindow.moc"
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const const
void setObjectName(const QString &name)
QObject * parent() const const
QPoint center() const const
QPoint topLeft() const const
QRegion united(const QRegion &r) const const