|
|
|
|
@ -61,6 +61,10 @@ static QPoint mouseGlobalPos(const QMouseEvent* e) {
|
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool isWaylandPlatform() { |
|
|
|
|
return QGuiApplication::platformName() == QLatin1String("wayland"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Слайдер перемотки: клик по любому месту шкалы = прыжок к позиции (нативно через стиль). */ |
|
|
|
|
class SeekSliderStyle : public QProxyStyle { |
|
|
|
|
public: |
|
|
|
|
@ -309,7 +313,12 @@ void VideoPlayerWindow::mousePressEvent(QMouseEvent* e) {
|
|
|
|
|
} |
|
|
|
|
ResizeMode m = hitTestResize(e->pos()); |
|
|
|
|
if (m != ResizeNone) { |
|
|
|
|
beginResize(m, mouseGlobalPos(e)); |
|
|
|
|
if (isWaylandPlatform()) { |
|
|
|
|
/* Wayland: позицию окна задаёт композитор — только нативный resize тянет край */ |
|
|
|
|
if (windowHandle()) windowHandle()->startSystemResize(edgesForMode(m)); |
|
|
|
|
} else { |
|
|
|
|
beginResize(m, mouseGlobalPos(e)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (windowHandle()) windowHandle()->startSystemMove(); |
|
|
|
|
} |
|
|
|
|
@ -350,7 +359,11 @@ bool VideoPlayerWindow::eventFilter(QObject* obj, QEvent* ev) {
|
|
|
|
|
|
|
|
|
|
QPoint gp = mouseGlobalPos(me); |
|
|
|
|
if (t == QEvent::MouseButtonPress && me->button() == Qt::LeftButton) { |
|
|
|
|
beginResize(m, gp); |
|
|
|
|
if (isWaylandPlatform()) { |
|
|
|
|
if (windowHandle()) windowHandle()->startSystemResize(edgesForMode(m)); |
|
|
|
|
} else { |
|
|
|
|
beginResize(m, gp); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
if (t == QEvent::MouseMove && m_resizeMode != ResizeNone && (me->buttons() & Qt::LeftButton)) { |
|
|
|
|
@ -410,6 +423,20 @@ void VideoPlayerWindow::updateResizeCursor(const QPoint& pos) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Qt::Edges VideoPlayerWindow::edgesForMode(ResizeMode m) { |
|
|
|
|
switch (m) { |
|
|
|
|
case ResizeLeft: return Qt::LeftEdge; |
|
|
|
|
case ResizeRight: return Qt::RightEdge; |
|
|
|
|
case ResizeTop: return Qt::TopEdge; |
|
|
|
|
case ResizeBottom: return Qt::BottomEdge; |
|
|
|
|
case ResizeTopLeft: return Qt::TopEdge | Qt::LeftEdge; |
|
|
|
|
case ResizeTopRight: return Qt::TopEdge | Qt::RightEdge; |
|
|
|
|
case ResizeBottomLeft: return Qt::BottomEdge | Qt::LeftEdge; |
|
|
|
|
case ResizeBottomRight: return Qt::BottomEdge | Qt::RightEdge; |
|
|
|
|
default: return {}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void VideoPlayerWindow::beginResize(ResizeMode m, const QPoint& globalPos) { |
|
|
|
|
m_resizeMode = m; |
|
|
|
|
m_resizeStartGeom = geometry(); |
|
|
|
|
|