From aea4e3823dc52618767ab7ebf0bce53696a4b80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Alam=C3=A4ki?= Date: Wed, 26 Apr 2017 10:36:53 +0300 Subject: Add INTEGRITY mkspec for ARMv8 Drive CX Change-Id: I038de7a0cc9e6046aec3fc930876d43263702e90 Reviewed-by: Oswald Buddenhagen Reviewed-by: Laszlo Agocs --- src/platformsupport/eglconvenience/qt_egl_p.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/eglconvenience/qt_egl_p.h b/src/platformsupport/eglconvenience/qt_egl_p.h index b1495c9f9d..e2c6b0ceb6 100644 --- a/src/platformsupport/eglconvenience/qt_egl_p.h +++ b/src/platformsupport/eglconvenience/qt_egl_p.h @@ -53,8 +53,10 @@ #ifdef QT_EGL_NO_X11 # define MESA_EGL_NO_X11_HEADERS // MESA -# define WIN_INTERFACE_CUSTOM // NV -#endif // QT_EGL_NO_X11 +# if !defined(Q_OS_INTEGRITY) +# define WIN_INTERFACE_CUSTOM // NV +# endif // Q_OS_INTEGRITY +#endif // QT_EGL_NO_X11 #ifdef QT_EGL_WAYLAND # define WAYLAND // NV -- cgit v1.2.3 From 2a0d96daa8a3aea72172340be1df1029ac38700d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 16 May 2017 14:59:28 +0200 Subject: Do not use FT_LOAD_TARGET_LCD when full hinting is requested In FreeType 2.8.0 FT_LOAD_TARGET_LCD is now a variant of FT_LOAD_TARGET_LIGHT instead of of FT_LOAD_TARGET_NORMAL. This means requesting it will get us light hinting. See https://sourceforge.net/projects/freetype/files/freetype2/2.8 We should just avoid using it all together since we request the LCD mode separately anyway with FT_RENDER_MODE later. Change-Id: I9ea2e39a6e9ba25ba11604a194e552fe4240a127 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 39b6814a57..64a0ef6fe8 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -967,15 +967,10 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, if (format == Format_Mono) { load_target = FT_LOAD_TARGET_MONO; } else if (format == Format_A32) { - if (subpixelType == Subpixel_RGB || subpixelType == Subpixel_BGR) { - if (default_hint_style == HintFull) - load_target = FT_LOAD_TARGET_LCD; + if (subpixelType == Subpixel_RGB || subpixelType == Subpixel_BGR) hsubpixel = true; - } else if (subpixelType == Subpixel_VRGB || subpixelType == Subpixel_VBGR) { - if (default_hint_style == HintFull) - load_target = FT_LOAD_TARGET_LCD_V; + else if (subpixelType == Subpixel_VRGB || subpixelType == Subpixel_VBGR) vfactor = 3; - } } else if (format == Format_ARGB) { #ifdef FT_LOAD_COLOR load_flags |= FT_LOAD_COLOR; -- cgit v1.2.3 From 88f30250eb15b520415658c6c32f48fda111b6bf Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Mon, 29 May 2017 12:23:08 +0300 Subject: Add USB HID device feature to INTEGRITY This change adds USB mouse handling support for INTEGRITY Change-Id: I8a2a51c8c3578898e90dd5bbb01f6aed6c64e2a4 Reviewed-by: Oswald Buddenhagen Reviewed-by: Timo Aarnipuro Reviewed-by: Nikola Velinov Reviewed-by: Rolland Dudemaine Reviewed-by: Lars Knoll Reviewed-by: Tero Alamaki --- src/platformsupport/input/input.pro | 4 + .../input/integrityhid/integrityhid.pri | 7 + .../input/integrityhid/qintegrityhidmanager.cpp | 263 +++++++++++++++++++++ .../input/integrityhid/qintegrityhidmanager.h | 69 ++++++ src/platformsupport/platformsupport.pro | 2 +- 5 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 src/platformsupport/input/integrityhid/integrityhid.pri create mode 100644 src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp create mode 100644 src/platformsupport/input/integrityhid/qintegrityhidmanager.h (limited to 'src/platformsupport') diff --git a/src/platformsupport/input/input.pro b/src/platformsupport/input/input.pro index f8ff4344cf..3d39210b9e 100644 --- a/src/platformsupport/input/input.pro +++ b/src/platformsupport/input/input.pro @@ -28,4 +28,8 @@ qtConfig(evdev)|qtConfig(libinput) { include($$PWD/shared/shared.pri) } +qtConfig(integrityhid) { + include($$PWD/integrityhid/integrityhid.pri) +} + load(qt_module) diff --git a/src/platformsupport/input/integrityhid/integrityhid.pri b/src/platformsupport/input/integrityhid/integrityhid.pri new file mode 100644 index 0000000000..0a6240c422 --- /dev/null +++ b/src/platformsupport/input/integrityhid/integrityhid.pri @@ -0,0 +1,7 @@ +HEADERS += \ + $$PWD/qintegrityhidmanager.h + +SOURCES += \ + $$PWD/qintegrityhidmanager.cpp + +QMAKE_USE_PRIVATE += integrityhid diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp new file mode 100644 index 0000000000..8089a6e38b --- /dev/null +++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp @@ -0,0 +1,263 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Green Hills Software +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qintegrityhidmanager.h" +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class IntNotifier +{ + static const Value ActivityPriority = 2; +protected: + Activity act; +public: + IntNotifier() + { + CheckSuccess(CreateActivity(CurrentTask(), ActivityPriority, false, (Value)this, &act)); + }; + ~IntNotifier() + { + CheckSuccess(CloseActivity(act)); + }; + virtual void process_event() = 0; + virtual void async_wait() = 0; +}; + +class HIDDeviceHandler : IntNotifier +{ +public: + HIDDeviceHandler(HIDDriver *hidd, HIDHandle hidh) + : driver(hidd), handle(hidh), currentPos(0, 0) { } + ~HIDDeviceHandler() + { + CheckSuccess(gh_hid_close(handle)); + }; + void process_event(void) Q_DECL_OVERRIDE; + void async_wait(void) Q_DECL_OVERRIDE; + HIDDriver *get_driver(void) { return driver; }; + HIDHandle get_handle(void) { return handle; }; +private: + HIDDriver *driver; + HIDHandle handle; + QPoint currentPos; + Qt::MouseButtons buttons; +}; + +class HIDDriverHandler : IntNotifier +{ +public: + HIDDriverHandler(HIDDriver *hidd) : IntNotifier(), driver(hidd) { } + ~HIDDriverHandler() + { + qDeleteAll(devices); + }; + void process_event(void) Q_DECL_OVERRIDE; + void async_wait(void) Q_DECL_OVERRIDE; + void find_devices(void); +private: + QHash devices; + HIDDriver *driver; +}; + +void HIDDriverHandler::process_event() +{ + find_devices(); +} + +void HIDDriverHandler::async_wait() +{ + gh_hid_wait_for_new_device(driver, act); +} + +void HIDDriverHandler::find_devices() +{ + Error err; + uintptr_t devicecontext; + uint32_t device_id; + HIDHandle handle; + HIDDeviceHandler *hidnot; + int deviceCount = 0; + + devicecontext = 0; + forever { + err = gh_hid_enum_devices(driver, &device_id, &devicecontext); + if (err == OperationNotImplemented) + break; + else if (err == Failure) + break; + if (!devices.contains(device_id)) { + err = gh_hid_init_device(driver, device_id, &handle); + if (err == Success) { + hidnot = new HIDDeviceHandler(driver, handle); + devices.insert(device_id, hidnot); + QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount( + QInputDeviceManager::DeviceTypePointer,++deviceCount); + hidnot->async_wait(); + } + } + } + if (err == OperationNotImplemented) { + /* fallback on legacy enumeration where we assume 0-based + * contiguous indexes */ + device_id = 0; + err = Success; + do { + if (!devices.contains(device_id)) { + err = gh_hid_init_device(driver, device_id, &handle); + if (err != Success) + break; + hidnot = new HIDDeviceHandler(driver, handle); + devices.insert(device_id, hidnot); + hidnot->async_wait(); + } + device_id++; + } while (err == Success); + } + + async_wait(); +} + + +void HIDDeviceHandler::process_event() +{ + HIDEvent event; + uint32_t num_events = 1; + + while (gh_hid_get_event(handle, &event, &num_events) == Success) { + if (event.type == HID_TYPE_AXIS) { + switch (event.index) { + case HID_AXIS_ABSX: + currentPos.setX(event.value); + break; + case HID_AXIS_ABSY: + currentPos.setY(event.value); + break; + case HID_AXIS_RELX: + currentPos.setX(currentPos.x() + event.value); + break; + case HID_AXIS_RELY: + currentPos.setY(currentPos.y() + event.value); + break; + default: + /* ignore the rest for now */ + break; + } + } else if (event.type == HID_TYPE_KEY) { + switch (event.index) { + case HID_BUTTON_LEFT: + if (event.value) + buttons |= Qt::LeftButton; + else + buttons &= ~Qt::LeftButton; + break; + case HID_BUTTON_MIDDLE: + if (event.value) + buttons |= Qt::MiddleButton; + else + buttons &= ~Qt::MiddleButton; + break; + case HID_BUTTON_RIGHT: + if (event.value) + buttons |= Qt::RightButton; + else + buttons &= ~Qt::RightButton; + break; + default: + /* ignore the rest for now */ + break; + } + } else if (event.type == HID_TYPE_SYNC) { + QWindowSystemInterface::handleMouseEvent(0, currentPos, currentPos, buttons, + QGuiApplication::keyboardModifiers()); + } else if (event.type == HID_TYPE_DISCONNECT) { + /* FIXME */ + } + } + async_wait(); +} + +void HIDDeviceHandler::async_wait() +{ + CheckSuccess(gh_hid_async_wait_for_event(handle, act)); +} + +void QIntegrityHIDManager::open_devices() +{ + HIDDriver *hidd; + uintptr_t context = 0; + HIDDriverHandler *hidnot; + + while (gh_hid_enum_drivers(&hidd, &context) == Success) { + hidnot = new HIDDriverHandler(hidd); + m_drivers.append(hidnot); + hidnot->find_devices(); + } +} + +void QIntegrityHIDManager::run() +{ + IntNotifier *notifier; + open_devices(); + /* main loop */ + forever { + WaitForActivity((Value *)¬ifier); + notifier->process_event(); + } +} + +QIntegrityHIDManager::QIntegrityHIDManager(const QString &key, const QString &spec, QObject *parent) + : QThread(parent) +{ + start(); +} + +QIntegrityHIDManager::~QIntegrityHIDManager() +{ + terminate(); + qDeleteAll(m_drivers); +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.h b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h new file mode 100644 index 0000000000..c8780b2dc2 --- /dev/null +++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Green Hills Software +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QINTEGRITYHIDMANAGER_P_H +#define QINTEGRITYHIDMANAGER_P_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class HIDDriverHandler; + +class QIntegrityHIDManager : public QThread +{ + Q_OBJECT +public: + QIntegrityHIDManager(const QString &key, const QString &specification, QObject *parent = 0); + ~QIntegrityHIDManager(); + + void run(void); +private: + void open_devices(void); + + QString m_spec; + QList m_drivers; + +}; + +QT_END_NAMESPACE + +#endif // QINTEGRITYHIDMANAGER_P_H diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index 7a97a12bae..7db6de78b4 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -10,7 +10,7 @@ SUBDIRS = \ qtConfig(freetype)|darwin|win32: \ SUBDIRS += fontdatabases -qtConfig(evdev)|qtConfig(tslib)|qtConfig(libinput) { +qtConfig(evdev)|qtConfig(tslib)|qtConfig(libinput)|qtConfig(integrityhid) { SUBDIRS += input input.depends += devicediscovery } -- cgit v1.2.3 From 61f67c12fa1e46894c50cd72983354f8c6834717 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 31 May 2017 09:02:39 +0200 Subject: winrt: Use styleHint as clue for fallbacks for font families Similar on how it is done for Windows desktop we also use the given style hint when building the list of fallbacks a font family. Change-Id: I71378581d07f20ebe5bf0bc757bba919cc70e118 Reviewed-by: Maurice Kalinowski --- .../fontdatabases/winrt/qwinrtfontdatabase.cpp | 28 +++++++++++++++++++--- .../fontdatabases/winrt/qwinrtfontdatabase_p.h | 2 ++ 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp index 2a95ca26a9..db58e49bb2 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp @@ -448,19 +448,41 @@ QFontEngine *QWinRTFontDatabase::fontEngine(const QFontDef &fontDef, void *handl return QFontEngineFT::create(fontDef, faceId, fontData); } +QString QWinRTFontDatabase::familyForStyleHint(QFont::StyleHint styleHint) +{ + switch (styleHint) { + case QFont::Times: + return QStringLiteral("Times New Roman"); + case QFont::Courier: + return QStringLiteral("Courier New"); + case QFont::Monospace: + return QStringLiteral("Courier New"); + case QFont::Cursive: + return QStringLiteral("Comic Sans MS"); + case QFont::Fantasy: + return QStringLiteral("Impact"); + case QFont::Decorative: + return QStringLiteral("Old English"); + case QFont::Helvetica: + return QStringLiteral("Segoe UI"); + case QFont::System: + default: + break; + } + return QStringLiteral("Segoe UI"); +} + QStringList QWinRTFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { Q_UNUSED(style) - Q_UNUSED(styleHint) Q_UNUSED(script) qCDebug(lcQpaFonts) << __FUNCTION__ << family; QStringList result; - if (family == QLatin1String("Helvetica")) - result.append(QStringLiteral("Arial")); + result.append(QWinRTFontDatabase::familyForStyleHint(styleHint)); result.append(QFreeTypeFontDatabase::fallbacksForFamily(family, style, styleHint, script)); return result; } diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h index 9a2bf00fab..c21f411fff 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h @@ -80,6 +80,8 @@ public: QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override; void releaseHandle(void *handle) override; + + static QString familyForStyleHint(QFont::StyleHint styleHint); private: QHash m_fonts; QHash m_fontFamilies; -- cgit v1.2.3