| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 3 | 3 |
| 4 This library is free software; you can redistribute it and/or | 4 This library is free software; you can redistribute it and/or |
| 5 modify it under the terms of the GNU Library General Public | 5 modify it under the terms of the GNU Library General Public |
| 6 License as published by the Free Software Foundation; either | 6 License as published by the Free Software Foundation; either |
| 7 version 2 of the License, or (at your option) any later version. | 7 version 2 of the License, or (at your option) any later version. |
| 8 | 8 |
| 9 This library is distributed in the hope that it will be useful, | 9 This library is distributed in the hope that it will be useful, |
| 10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 | 31 |
| 32 PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e) | 32 PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e) |
| 33 #ifdef QT_NO_WHEELEVENT | 33 #ifdef QT_NO_WHEELEVENT |
| 34 { | 34 { |
| 35 Q_UNUSED(e); | 35 Q_UNUSED(e); |
| 36 } | 36 } |
| 37 #else | 37 #else |
| 38 : m_position(e->pos()) | 38 : m_position(e->pos()) |
| 39 , m_globalPosition(e->globalPos()) | 39 , m_globalPosition(e->globalPos()) |
| 40 #ifdef QT_MAC_USE_COCOA | |
| 41 , m_granularity(ScrollByPixelWheelEvent) | 40 , m_granularity(ScrollByPixelWheelEvent) |
| 42 #else | |
| 43 , m_granularity(ScrollByLineWheelEvent) | |
| 44 #endif | |
| 45 , m_isAccepted(false) | 41 , m_isAccepted(false) |
| 46 , m_shiftKey(e->modifiers() & Qt::ShiftModifier) | 42 , m_shiftKey(e->modifiers() & Qt::ShiftModifier) |
| 47 , m_ctrlKey(e->modifiers() & Qt::ControlModifier) | 43 , m_ctrlKey(e->modifiers() & Qt::ControlModifier) |
| 48 , m_altKey(e->modifiers() & Qt::AltModifier) | 44 , m_altKey(e->modifiers() & Qt::AltModifier) |
| 49 , m_metaKey(e->modifiers() & Qt::MetaModifier) | 45 , m_metaKey(e->modifiers() & Qt::MetaModifier) |
| 50 { | 46 { |
| 51 if (e->orientation() == Qt::Horizontal) { | 47 if (e->orientation() == Qt::Horizontal) { |
| 52 m_deltaX = (e->delta() / 120); | 48 m_deltaX = (e->delta() / 120); |
| 53 m_deltaY = 0; | 49 m_deltaY = 0; |
| 54 } else { | 50 } else { |
| 55 m_deltaX = 0; | 51 m_deltaX = 0; |
| 56 m_deltaY = (e->delta() / 120); | 52 m_deltaY = (e->delta() / 120); |
| 57 } | 53 } |
| 58 | 54 |
| 59 m_deltaX *= QApplication::wheelScrollLines(); | |
| 60 // use the same single scroll step as QTextEdit (in | 55 // use the same single scroll step as QTextEdit (in |
| 61 // QTextEditPrivate::init [h,v]bar->setSingleStep ) | 56 // QTextEditPrivate::init [h,v]bar->setSingleStep ) |
| 62 // and divide by the default WebKit scroll step to | |
| 63 // get the Qt mouse wheel scroll behavior | |
| 64 static const float cDefaultQtScrollStep = 20.f; | 57 static const float cDefaultQtScrollStep = 20.f; |
| 65 m_deltaY *= QApplication::wheelScrollLines() * | 58 m_deltaX *= QApplication::wheelScrollLines() * cDefaultQtScrollStep; |
| 66 (cDefaultQtScrollStep / cMouseWheelPixelsPerLineStep); | 59 m_deltaY *= QApplication::wheelScrollLines() * cDefaultQtScrollStep; |
| 67 } | 60 } |
| 68 #endif // QT_NO_WHEELEVENT | 61 #endif // QT_NO_WHEELEVENT |
| 69 | 62 |
| 70 } // namespace WebCore | 63 } // namespace WebCore |
| OLD | NEW |