From e43a2219fb1c230439a550ef6a3866de55352018 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 11 Jan 2016 16:06:01 +0100 Subject: Send proper key codes for KeyEvents to WebKit. A few KeyEvents to key code mappings were incorrect or missing. Fix them. Change-Id: I74087768fddd467993f04ed8b4c2dc6345d20e8a Task-number: QTBUG-50354 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_event_factory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 1a58ae385..1306f6f3b 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -264,9 +264,10 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) case Qt::Key_Help: return VK_HELP; // (2F) HELP key case Qt::Key_0: - case Qt::Key_ParenLeft: + case Qt::Key_ParenRight: return VK_0; // (30) 0) key case Qt::Key_1: + case Qt::Key_Exclam: return VK_1; // (31) 1 ! key case Qt::Key_2: case Qt::Key_At: @@ -290,7 +291,7 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) case Qt::Key_Asterisk: return VK_8; // (38) 8 key '*' case Qt::Key_9: - case Qt::Key_ParenRight: + case Qt::Key_ParenLeft: return VK_9; // (39) 9 key '(' case Qt::Key_A: return VK_A; // (41) A key case 'a': case 'A': return 0x41; @@ -428,6 +429,7 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) case Qt::Key_BraceRight: return VK_OEM_6; // case ']': case '}': return 0xDD; // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key + case Qt::Key_Apostrophe: case Qt::Key_QuoteDbl: return VK_OEM_7; // case '\'': case '"': return 0xDE; // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. -- cgit v1.2.3 From 532a69c6fea4963c0ea1011270949fa92035a780 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 12 Jan 2016 13:38:12 +0100 Subject: Update key code mappings using QtWebkit mappings as reference. Copy additional key code mappings from PlatformKeyboardEventQt.cpp. Also add a mapping for missing numeric keypad equals key. Change-Id: Ia6c4413795293be84bcd8ea9d981d8cdfb94509b Task-number: QTBUG-50401 Reviewed-by: Joerg Bornemann --- src/core/web_event_factory.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 1306f6f3b..2e6fde214 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -109,6 +109,8 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) return VK_DECIMAL; // (6E) Decimal key case Qt::Key_Slash: return VK_DIVIDE; // (6F) Divide key + case Qt::Key_Equal: + return VK_OEM_PLUS; // (BB) Equal key case Qt::Key_PageUp: return VK_PRIOR; // (21) PAGE UP key case Qt::Key_PageDown: @@ -376,13 +378,22 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key - // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key - // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key - // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key - // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key - // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key - // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key - // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key + + case Qt::Key_VolumeMute: + return VK_VOLUME_MUTE; // (AD) Windows 2000/XP: Volume Mute key + case Qt::Key_VolumeDown: + return VK_VOLUME_DOWN; // (AE) Windows 2000/XP: Volume Down key + case Qt::Key_VolumeUp: + return VK_VOLUME_UP; // (AF) Windows 2000/XP: Volume Up key + case Qt::Key_MediaNext: + return VK_MEDIA_NEXT_TRACK; // (B0) Windows 2000/XP: Next Track key + case Qt::Key_MediaPrevious: + return VK_MEDIA_PREV_TRACK; // (B1) Windows 2000/XP: Previous Track key + case Qt::Key_MediaStop: + return VK_MEDIA_STOP; // (B2) Windows 2000/XP: Stop Media key + case Qt::Key_MediaTogglePlayPause: + return VK_MEDIA_PLAY_PAUSE; // (B3) Windows 2000/XP: Play/Pause Media key + // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key @@ -434,6 +445,12 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) return VK_OEM_7; // case '\'': case '"': return 0xDE; // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard + + case Qt::Key_AudioRewind: + return 0xE3; // (E3) Android/GoogleTV: Rewind media key (Windows: VK_ICO_HELP Help key on 1984 Olivetti M24 deluxe keyboard) + case Qt::Key_AudioForward: + return 0xE4; // (E4) Android/GoogleTV: Fast forward media key (Windows: VK_ICO_00 '00' key on 1984 Olivetti M24 deluxe keyboard) + // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP // VK_ATTN (F6) Attn key -- cgit v1.2.3 From f32f4af43c207072e6bb175b9e63e0d3ebc2cc1d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 13 Jan 2016 11:48:34 +0100 Subject: Update license header for qwebenginepage.cpp to LGPLv3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This amends commit 3b4eec9b. Change-Id: I19e8a295fa7e64ff83c26b6965097bd0ae3cbf73 Reviewed-by: Michael BrĂ¼ning --- src/webenginewidgets/api/qwebenginepage.cpp | 56 ++++++++++++++++++----------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 61feec244..c89f73724 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1,24 +1,38 @@ -/* - Copyright (C) 2015 The Qt Company Ltd. - Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies) - Copyright (C) 2007 Staikos Computing Services Inc. - Copyright (C) 2007 Apple Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ +/**************************************************************************** +** +** Copyright (C) 2016 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 "qwebenginepage.h" #include "qwebenginepage_p.h" -- cgit v1.2.3