summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/core_gyp_generator.pro1
-rw-r--r--src/core/render_widget_host_view_qt.cpp24
-rw-r--r--src/core/type_conversion.cpp68
-rw-r--r--src/core/type_conversion.h2
4 files changed, 71 insertions, 24 deletions
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index 29798f3fe..f950c773b 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -80,6 +80,7 @@ SOURCES = \
resource_dispatcher_host_delegate_qt.cpp \
stream_video_node.cpp \
surface_factory_qt.cpp \
+ type_conversion.cpp \
url_request_context_getter_qt.cpp \
url_request_custom_job.cpp \
url_request_custom_job_delegate.cpp \
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index f8edcdfc9..5d4ac72cd 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -160,30 +160,6 @@ static inline bool compareTouchPoints(const QTouchEvent::TouchPoint &lhs, const
return lhs.state() < rhs.state();
}
-static inline int flagsFromModifiers(Qt::KeyboardModifiers modifiers)
-{
- int modifierFlags = ui::EF_NONE;
-#if defined(Q_OS_OSX)
- if (!qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
- if ((modifiers & Qt::ControlModifier) != 0)
- modifierFlags |= ui::EF_COMMAND_DOWN;
- if ((modifiers & Qt::MetaModifier) != 0)
- modifierFlags |= ui::EF_CONTROL_DOWN;
- } else
-#endif
- {
- if ((modifiers & Qt::ControlModifier) != 0)
- modifierFlags |= ui::EF_CONTROL_DOWN;
- if ((modifiers & Qt::MetaModifier) != 0)
- modifierFlags |= ui::EF_COMMAND_DOWN;
- }
- if ((modifiers & Qt::ShiftModifier) != 0)
- modifierFlags |= ui::EF_SHIFT_DOWN;
- if ((modifiers & Qt::AltModifier) != 0)
- modifierFlags |= ui::EF_ALT_DOWN;
- return modifierFlags;
-}
-
static uint32 s_eventId = 0;
class MotionEventQt : public ui::MotionEvent {
public:
diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp
new file mode 100644
index 000000000..64cc41689
--- /dev/null
+++ b/src/core/type_conversion.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "type_conversion.h"
+
+#include <ui/events/event_constants.h>
+#include <QtCore/qcoreapplication.h>
+
+namespace QtWebEngineCore {
+
+int flagsFromModifiers(Qt::KeyboardModifiers modifiers)
+{
+ int modifierFlags = ui::EF_NONE;
+#if defined(Q_OS_OSX)
+ if (!qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
+ if ((modifiers & Qt::ControlModifier) != 0)
+ modifierFlags |= ui::EF_COMMAND_DOWN;
+ if ((modifiers & Qt::MetaModifier) != 0)
+ modifierFlags |= ui::EF_CONTROL_DOWN;
+ } else
+#endif
+ {
+ if ((modifiers & Qt::ControlModifier) != 0)
+ modifierFlags |= ui::EF_CONTROL_DOWN;
+ if ((modifiers & Qt::MetaModifier) != 0)
+ modifierFlags |= ui::EF_COMMAND_DOWN;
+ }
+ if ((modifiers & Qt::ShiftModifier) != 0)
+ modifierFlags |= ui::EF_SHIFT_DOWN;
+ if ((modifiers & Qt::AltModifier) != 0)
+ modifierFlags |= ui::EF_ALT_DOWN;
+ return modifierFlags;
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index abc002ea5..cfab4d19a 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -232,6 +232,8 @@ inline std::vector<T> toVector(const QStringList &fileList)
return selectedFiles;
}
+int flagsFromModifiers(Qt::KeyboardModifiers modifiers);
+
} // namespace QtWebEngineCore
#endif // TYPE_CONVERSION_H