Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_backend.cpp
Show First 20 Lines • Show All 613 Lines • ▼ Show 20 Line(s) | 606 | { | |||
---|---|---|---|---|---|
614 | markCursorAsRendered(); | 614 | markCursorAsRendered(); | ||
615 | } | 615 | } | ||
616 | 616 | | |||
617 | void DrmBackend::updateCursor() | 617 | void DrmBackend::updateCursor() | ||
618 | { | 618 | { | ||
619 | if (usesSoftwareCursor()) { | 619 | if (usesSoftwareCursor()) { | ||
620 | return; | 620 | return; | ||
621 | } | 621 | } | ||
622 | if (isCursorHidden()) { | ||||
623 | return; | ||||
624 | } | ||||
622 | const QImage &cursorImage = softwareCursor(); | 625 | const QImage &cursorImage = softwareCursor(); | ||
623 | if (cursorImage.isNull()) { | 626 | if (cursorImage.isNull()) { | ||
624 | hideCursor(); | 627 | doHideCursor(); | ||
625 | return; | 628 | return; | ||
626 | } | 629 | } | ||
627 | QImage *c = m_cursor[m_cursorIndex]->image(); | 630 | QImage *c = m_cursor[m_cursorIndex]->image(); | ||
628 | c->fill(Qt::transparent); | 631 | c->fill(Qt::transparent); | ||
629 | QPainter p; | 632 | QPainter p; | ||
630 | p.begin(c); | 633 | p.begin(c); | ||
631 | p.drawImage(QPoint(0, 0), cursorImage); | 634 | p.drawImage(QPoint(0, 0), cursorImage); | ||
632 | p.end(); | 635 | p.end(); | ||
633 | 636 | | |||
634 | setCursor(); | 637 | setCursor(); | ||
635 | moveCursor(); | 638 | moveCursor(); | ||
636 | } | 639 | } | ||
637 | 640 | | |||
638 | void DrmBackend::hideCursor() | 641 | void DrmBackend::doShowCursor() | ||
642 | { | ||||
643 | updateCursor(); | ||||
644 | } | ||||
645 | | ||||
646 | void DrmBackend::doHideCursor() | ||||
639 | { | 647 | { | ||
640 | if (!m_cursorEnabled) { | 648 | if (!m_cursorEnabled) { | ||
641 | return; | 649 | return; | ||
642 | } | 650 | } | ||
643 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 651 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
644 | (*it)->hideCursor(); | 652 | (*it)->hideCursor(); | ||
645 | } | 653 | } | ||
646 | } | 654 | } | ||
647 | 655 | | |||
648 | void DrmBackend::moveCursor() | 656 | void DrmBackend::moveCursor() | ||
649 | { | 657 | { | ||
650 | const QPoint p = Cursor::pos() - softwareCursorHotspot(); | 658 | const QPoint p = Cursor::pos() - softwareCursorHotspot(); | ||
651 | if (!m_cursorEnabled) { | 659 | if (!m_cursorEnabled || isCursorHidden()) { | ||
652 | return; | 660 | return; | ||
653 | } | 661 | } | ||
654 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 662 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
655 | (*it)->moveCursor(p); | 663 | (*it)->moveCursor(p); | ||
656 | } | 664 | } | ||
657 | } | 665 | } | ||
658 | 666 | | |||
659 | QSize DrmBackend::size() const | 667 | QSize DrmBackend::size() const | ||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |