13#include "kddockwidgets/core/indicators/ClassicDropIndicatorOverlay.h"
14#include "kddockwidgets/core/Group.h"
15#include "kddockwidgets/ViewFactory.h"
16#include "kddockwidgets/Config.h"
18#include "core/Utils_p.h"
25#ifdef QT_X11EXTRAS_LIB
26#include <QtX11Extras/QX11Info>
29#define INDICATOR_WIDTH 40
30#define OUTTER_INDICATOR_MARGIN 10
40 if (qEnvironmentVariableIsSet(
"KDDW_NO_TRANSLUCENCY")
44#ifdef QT_X11EXTRAS_LIB
46 return QX11Info::isCompositingManagerRunning();
61 void setHovered(
bool hovered);
63 QString iconFileName(
bool active)
const;
67 bool m_hovered =
false;
78 name = QStringLiteral(
"center");
81 name = QStringLiteral(
"inner_left");
84 name = QStringLiteral(
"inner_right");
87 name = QStringLiteral(
"inner_bottom");
90 name = QStringLiteral(
"inner_top");
93 name = QStringLiteral(
"outter_left");
96 name = QStringLiteral(
"outter_bottom");
99 name = QStringLiteral(
"outter_right");
102 name = QStringLiteral(
"outter_top");
112 return name + suffix;
120 p.drawImage(rect(), m_imageActive, rect());
122 p.drawImage(rect(), m_image, rect());
125void Indicator::setHovered(
bool hovered)
127 if (hovered != m_hovered) {
133QString Indicator::iconName(
bool active)
const
138QString Indicator::iconFileName(
bool active)
const
144 ? QStringLiteral(
"%1/%2.png").
arg(path, name)
145 : QStringLiteral(
"%1/opaque/%2.png").
arg(path, name);
152 return isWayland() ? QtCommon::View_qt::asQWidget(classicIndicators_->
view()) :
nullptr;
162 , classicIndicators(classicIndicators_)
183 m_indicators << m_center << m_left << m_right << m_top << m_bottom << m_outterBottom
184 << m_outterTop << m_outterLeft << m_outterRight;
187Indicator *IndicatorWindow::indicatorForLocation(
DropLocation loc)
const
203 return m_outterBottom;
205 return m_outterRight;
219void IndicatorWindow::updateMask()
224 for (Indicator *indicator :
std::as_const(m_indicators)) {
225 if (indicator->isVisible())
241 for (Indicator *indicator : { m_left, m_right, m_bottom, m_top, m_outterTop, m_outterLeft,
242 m_outterRight, m_outterBottom, m_center })
250 Indicator *indicator = indicatorForLocation(loc);
251 return indicator->mapToGlobal(indicator->rect().center());
258 for (Indicator *indicator : std::as_const(m_indicators)) {
259 if (indicator->isVisible()) {
260 const bool hovered = indicator->rect().contains(indicator->mapFromGlobal(globalPos));
261 indicator->setHovered(hovered);
263 loc = indicator->m_dropLocation;
273 const int indicatorWidth = m_outterBottom->width();
274 const int halfIndicatorWidth = m_outterBottom->width() / 2;
277 m_outterBottom->move(r.
center().
x() - halfIndicatorWidth,
281 r.
center().
y() - halfIndicatorWidth);
286 -
QPoint(halfIndicatorWidth, halfIndicatorWidth));
327 , m_dropLocation(location)
335#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
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const