Fix ODR violation with MouseClick plugin
``` /var/tmp/portage/kde-plasma/kwin-6.0.49.9999/work/kwin-6.0.49.9999/src/input_event.h:21:7: error: type ‘struct MouseEvent’ violates the C++ One Definition Rule [-Werror=odr] 21 | class MouseEvent : public QMouseEvent | ^ /var/tmp/portage/kde-plasma/kwin-6.0.49.9999/work/kwin-6.0.49.9999/src/plugins/mouseclick/mouseclick.h:27:7: note: a type with different bases is defined in another translation unit 27 | class MouseEvent | ^ lto1: some warnings being treated as errors ``` Bug: https://bugs.gentoo.org/921558 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
956390005b
commit
53a61dfac0
2 changed files with 10 additions and 10 deletions
|
@ -139,7 +139,7 @@ void MouseClickEffect::postPaintScreen()
|
|||
repaint();
|
||||
}
|
||||
|
||||
float MouseClickEffect::computeRadius(const MouseEvent *click, int ring)
|
||||
float MouseClickEffect::computeRadius(const MouseClickMouseEvent *click, int ring)
|
||||
{
|
||||
float ringDistance = m_ringLife / (m_ringCount * 3);
|
||||
if (click->m_press) {
|
||||
|
@ -148,7 +148,7 @@ float MouseClickEffect::computeRadius(const MouseEvent *click, int ring)
|
|||
return ((m_ringLife - click->m_time - ringDistance * ring) / m_ringLife) * m_ringMaxSize;
|
||||
}
|
||||
|
||||
float MouseClickEffect::computeAlpha(const MouseEvent *click, int ring)
|
||||
float MouseClickEffect::computeAlpha(const MouseClickMouseEvent *click, int ring)
|
||||
{
|
||||
float ringDistance = m_ringLife / (m_ringCount * 3);
|
||||
return (m_ringLife - (float)click->m_time - ringDistance * (ring)) / m_ringLife;
|
||||
|
@ -162,16 +162,16 @@ void MouseClickEffect::slotMouseChanged(const QPointF &pos, const QPointF &,
|
|||
return;
|
||||
}
|
||||
|
||||
std::unique_ptr<MouseEvent> m;
|
||||
std::unique_ptr<MouseClickMouseEvent> m;
|
||||
int i = BUTTON_COUNT;
|
||||
while (--i >= 0) {
|
||||
MouseButton *b = m_buttons[i].get();
|
||||
if (isPressed(b->m_button, buttons, oldButtons)) {
|
||||
m = std::make_unique<MouseEvent>(i, pos.toPoint(), 0, createEffectFrame(pos.toPoint(), b->m_labelDown), true);
|
||||
m = std::make_unique<MouseClickMouseEvent>(i, pos.toPoint(), 0, createEffectFrame(pos.toPoint(), b->m_labelDown), true);
|
||||
break;
|
||||
} else if (isReleased(b->m_button, buttons, oldButtons) && (!b->m_isPressed || b->m_time > m_ringLife)) {
|
||||
// we might miss a press, thus also check !b->m_isPressed, bug #314762
|
||||
m = std::make_unique<MouseEvent>(i, pos.toPoint(), 0, createEffectFrame(pos.toPoint(), b->m_labelUp), false);
|
||||
m = std::make_unique<MouseClickMouseEvent>(i, pos.toPoint(), 0, createEffectFrame(pos.toPoint(), b->m_labelUp), false);
|
||||
break;
|
||||
}
|
||||
b->setPressed(b->m_button & buttons);
|
||||
|
|
|
@ -24,10 +24,10 @@ namespace KWin
|
|||
|
||||
class EffectFrame;
|
||||
|
||||
class MouseEvent
|
||||
class MouseClickMouseEvent
|
||||
{
|
||||
public:
|
||||
MouseEvent(int button, QPoint point, int time, std::unique_ptr<EffectFrame> &&frame, bool press)
|
||||
MouseClickMouseEvent(int button, QPoint point, int time, std::unique_ptr<EffectFrame> &&frame, bool press)
|
||||
: m_button(button)
|
||||
, m_pos(point)
|
||||
, m_time(time)
|
||||
|
@ -131,8 +131,8 @@ private:
|
|||
inline bool isReleased(Qt::MouseButtons button, Qt::MouseButtons buttons, Qt::MouseButtons oldButtons);
|
||||
inline bool isPressed(Qt::MouseButtons button, Qt::MouseButtons buttons, Qt::MouseButtons oldButtons);
|
||||
|
||||
inline float computeRadius(const MouseEvent *click, int ring);
|
||||
inline float computeAlpha(const MouseEvent *click, int ring);
|
||||
inline float computeRadius(const MouseClickMouseEvent *click, int ring);
|
||||
inline float computeAlpha(const MouseClickMouseEvent *click, int ring);
|
||||
|
||||
void repaint();
|
||||
|
||||
|
@ -150,7 +150,7 @@ private:
|
|||
QFont m_font;
|
||||
std::chrono::milliseconds m_lastPresentTime = std::chrono::milliseconds::zero();
|
||||
|
||||
std::deque<std::unique_ptr<MouseEvent>> m_clicks;
|
||||
std::deque<std::unique_ptr<MouseClickMouseEvent>> m_clicks;
|
||||
std::unique_ptr<MouseButton> m_buttons[BUTTON_COUNT];
|
||||
QHash<quint64, TabletToolEvent> m_tabletTools;
|
||||
|
||||
|
|
Loading…
Reference in a new issue