diff options
Diffstat (limited to 'src/plugins/platforms')
143 files changed, 2855 insertions, 520 deletions
diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index c6e46ac28d..eed2ad7dc5 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 5ea61c5e4c..a42c877fc6 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index fc84905374..b91831bad8 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index a91be37786..adaabc3c15 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index b011a39f09..2c71d07256 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm index 9e9bb19556..2c240c2570 100644 --- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm +++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 5805475e3f..a90db00d42 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaclipboard.mm b/src/plugins/platforms/cocoa/qcocoaclipboard.mm index f8ebc3591b..f908aba028 100644 --- a/src/plugins/platforms/cocoa/qcocoaclipboard.mm +++ b/src/plugins/platforms/cocoa/qcocoaclipboard.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 72723a3fb3..8843e009a2 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index 749fe908b7..06e957cd86 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 3e321e1446..a80b32a0b8 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 7f92a899c3..52b2e23345 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index e378b9cef7..903da2498c 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 61303c7514..933034bb6f 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 8c0300ecbb..e89bc662b7 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index c148b29f1c..ac43ee6d31 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoainputcontext.mm b/src/plugins/platforms/cocoa/qcocoainputcontext.mm index 5bde2a0f82..0eafae1f2d 100644 --- a/src/plugins/platforms/cocoa/qcocoainputcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoainputcontext.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index b5f1045ef0..d3071be636 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaintrospection.mm b/src/plugins/platforms/cocoa/qcocoaintrospection.mm index 8bbbc886b7..c8e7d9d39e 100644 --- a/src/plugins/platforms/cocoa/qcocoaintrospection.mm +++ b/src/plugins/platforms/cocoa/qcocoaintrospection.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm index 3b901ececb..c2d206fb45 100644 --- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm +++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm index b9a8c90b87..c3d117ac11 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoamimetypes.mm b/src/plugins/platforms/cocoa/qcocoamimetypes.mm index 0b9e13a370..5c88bb75cb 100644 --- a/src/plugins/platforms/cocoa/qcocoamimetypes.mm +++ b/src/plugins/platforms/cocoa/qcocoamimetypes.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index cf8820acfc..cd885796f5 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm index 5a6c8c171e..602d0fb4bd 100644 --- a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm +++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPrintSupport module of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoaservices.mm b/src/plugins/platforms/cocoa/qcocoaservices.mm index e1a0ba1fcf..6f3f6c4e1d 100644 --- a/src/plugins/platforms/cocoa/qcocoaservices.mm +++ b/src/plugins/platforms/cocoa/qcocoaservices.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index 1d00bbb481..4ef9000d67 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index 1904a43276..000a47c7b4 100755 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> ** Contact: http://www.qt.io/licensing/ ** diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 7b2f1ee3af..11749e14de 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index bbf487c309..64e599ae08 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index b550e1a79f..3d88a8d5df 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac.mm b/src/plugins/platforms/cocoa/qmultitouch_mac.mm index fd59c1f27a..6e7ebcc37c 100644 --- a/src/plugins/platforms/cocoa/qmultitouch_mac.mm +++ b/src/plugins/platforms/cocoa/qmultitouch_mac.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index aa36a5d909..5625d19ed7 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 0bf3440247..93f0817aad 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 13a968f302..015274cac7 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index 16eb281a2f..1131fb5fc6 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index ecc00bc20a..348b537691 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.cpp index 618846f8ba..cd92c49ff1 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.h index 7d92b84c8a..68bc72a03f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmscursor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp index b377f08575..30fcf8143f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.h index f73c15caa4..29a1332c9a 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.cpp index 2ac2030dc7..4598f21d92 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.h index ec877e3279..9a160d2570 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsmain.cpp index bae330a772..64a0bedb2c 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsmain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsmain.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp index 53b6e88c8c..45287ae36e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h index e2b52b8942..cc2d6942d6 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp index cb21d1f8d1..64069e7dbc 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the qmake spec of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp index 719d34f8a6..7d1007e7ef 100644 --- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp index 1adfb4bc67..0c07aa64be 100644 --- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h index efdc009f04..9b8eaacd51 100644 --- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h +++ b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/haiku/haiku.json b/src/plugins/platforms/haiku/haiku.json new file mode 100644 index 0000000000..cfc06df640 --- /dev/null +++ b/src/plugins/platforms/haiku/haiku.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "haiku" ] +} diff --git a/src/plugins/platforms/haiku/haiku.pro b/src/plugins/platforms/haiku/haiku.pro new file mode 100644 index 0000000000..87f31997a3 --- /dev/null +++ b/src/plugins/platforms/haiku/haiku.pro @@ -0,0 +1,42 @@ +TARGET = qhaiku +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QHaikuIntegrationPlugin +load(qt_plugin) + +QT += platformsupport-private core-private gui-private + +SOURCES = \ + main.cpp \ + qhaikuapplication.cpp \ + qhaikubuffer.cpp \ + qhaikuclipboard.cpp \ + qhaikucursor.cpp \ + qhaikuintegration.cpp \ + qhaikukeymapper.cpp \ + qhaikurasterbackingstore.cpp \ + qhaikurasterwindow.cpp \ + qhaikuscreen.cpp \ + qhaikuservices.cpp \ + qhaikuutils.cpp \ + qhaikuwindow.cpp + +HEADERS = \ + main.h \ + qhaikuapplication.h \ + qhaikubuffer.h \ + qhaikuclipboard.h \ + qhaikucursor.h \ + qhaikuintegration.h \ + qhaikukeymapper.h \ + qhaikurasterbackingstore.h \ + qhaikurasterwindow.h \ + qhaikuscreen.h \ + qhaikuservices.h \ + qhaikuutils.h \ + qhaikuwindow.h + +LIBS += -lbe + +OTHER_FILES += haiku.json + +include (../../../platformsupport/fontdatabases/fontdatabases.pri) diff --git a/src/plugins/platforms/haiku/main.cpp b/src/plugins/platforms/haiku/main.cpp new file mode 100644 index 0000000000..2892a2d292 --- /dev/null +++ b/src/plugins/platforms/haiku/main.cpp @@ -0,0 +1,47 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "main.h" +#include "qhaikuintegration.h" + +QT_BEGIN_NAMESPACE + +QPlatformIntegration *QHaikuIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + if (!system.compare(QLatin1String("haiku"), Qt::CaseInsensitive)) + return new QHaikuIntegration(paramList); + + return Q_NULLPTR; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/main.h b/src/plugins/platforms/haiku/main.h new file mode 100644 index 0000000000..fbf0bee527 --- /dev/null +++ b/src/plugins/platforms/haiku/main.h @@ -0,0 +1,47 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qpa/qplatformintegrationplugin.h> + +QT_BEGIN_NAMESPACE + +class QHaikuIntegrationPlugin : public QPlatformIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "haiku.json") + +public: + QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikuapplication.cpp b/src/plugins/platforms/haiku/qhaikuapplication.cpp new file mode 100644 index 0000000000..0ee2628c5b --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuapplication.cpp @@ -0,0 +1,71 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikuapplication.h" + +#include <QCoreApplication> +#include <QFileOpenEvent> + +#include <Entry.h> +#include <Path.h> + +QHaikuApplication::QHaikuApplication(const char *signature) + : BApplication(signature) +{ +} + +bool QHaikuApplication::QuitRequested() +{ + QEvent quitEvent(QEvent::Quit); + QCoreApplication::sendEvent(QCoreApplication::instance(), &quitEvent); + return true; +} + +void QHaikuApplication::RefsReceived(BMessage* message) +{ + uint32 type; + int32 count; + + const status_t status = message->GetInfo("refs", &type, &count); + if (status == B_OK && type == B_REF_TYPE) { + entry_ref ref; + for (int32 i = 0; i < count; ++i) { + if (message->FindRef("refs", i, &ref) == B_OK) { + const BPath path(&ref); + QCoreApplication::postEvent(QCoreApplication::instance(), new QFileOpenEvent(QFile::decodeName(path.Path()))); + } + } + } + + BApplication::RefsReceived(message); +} diff --git a/src/plugins/platforms/haiku/qhaikuapplication.h b/src/plugins/platforms/haiku/qhaikuapplication.h new file mode 100644 index 0000000000..51148a54df --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuapplication.h @@ -0,0 +1,50 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUAPPLICATION_H +#define QHAIKUAPPLICATION_H + +#include <qglobal.h> + +#include <Application.h> + +class QHaikuApplication : public BApplication +{ +public: + explicit QHaikuApplication(const char *signature); + + bool QuitRequested() Q_DECL_OVERRIDE; + void RefsReceived(BMessage* message) Q_DECL_OVERRIDE; +}; + +#endif diff --git a/src/plugins/platforms/haiku/qhaikubuffer.cpp b/src/plugins/platforms/haiku/qhaikubuffer.cpp new file mode 100644 index 0000000000..160fa559d0 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikubuffer.cpp @@ -0,0 +1,73 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikubuffer.h" + +#include <Bitmap.h> +#include <Rect.h> + +QT_BEGIN_NAMESPACE + +QHaikuBuffer::QHaikuBuffer() + : m_buffer(Q_NULLPTR) +{ +} + +QHaikuBuffer::QHaikuBuffer(BBitmap *buffer) + : m_buffer(buffer) +{ + // wrap buffer in an image + m_image = QImage(static_cast<uchar*>(m_buffer->Bits()), m_buffer->Bounds().right, m_buffer->Bounds().bottom, m_buffer->BytesPerRow(), QImage::Format_RGB32); +} + +BBitmap* QHaikuBuffer::nativeBuffer() const +{ + return m_buffer; +} + +const QImage *QHaikuBuffer::image() const +{ + return (m_buffer != Q_NULLPTR) ? &m_image : Q_NULLPTR; +} + +QImage *QHaikuBuffer::image() +{ + return (m_buffer != Q_NULLPTR) ? &m_image : Q_NULLPTR; +} + +QRect QHaikuBuffer::rect() const +{ + return m_image.rect(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikubuffer.h b/src/plugins/platforms/haiku/qhaikubuffer.h new file mode 100644 index 0000000000..f45aca7306 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikubuffer.h @@ -0,0 +1,62 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUBUFFER_H +#define QHAIKUBUFFER_H + +#include <QtGui/QImage> + +class BBitmap; + +QT_BEGIN_NAMESPACE + +class QHaikuBuffer +{ +public: + QHaikuBuffer(); + QHaikuBuffer(BBitmap *buffer); + + BBitmap* nativeBuffer() const; + const QImage *image() const; + QImage *image(); + + QRect rect() const; + +private: + BBitmap *m_buffer; + QImage m_image; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikuclipboard.cpp b/src/plugins/platforms/haiku/qhaikuclipboard.cpp new file mode 100644 index 0000000000..f3aa9dc36e --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuclipboard.cpp @@ -0,0 +1,140 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if !defined(QT_NO_CLIPBOARD) + +#include "qhaikuclipboard.h" + +#include <QMimeData> +#include <QThread> + +#include <Clipboard.h> + +QHaikuClipboard::QHaikuClipboard() +{ + if (be_clipboard) + be_clipboard->StartWatching(BMessenger(this)); +} + +QHaikuClipboard::~QHaikuClipboard() +{ + if (be_clipboard) + be_clipboard->StopWatching(BMessenger(this)); +} + +QMimeData *QHaikuClipboard::mimeData(QClipboard::Mode mode) +{ + QMimeData *mimeData = new QMimeData(); + + if (mode != QClipboard::Clipboard) + return mimeData; + + if (!be_clipboard->Lock()) + return mimeData; + + const BMessage *clipboard = be_clipboard->Data(); + if (clipboard) { + char *name = Q_NULLPTR; + uint32 type = 0; + int32 count = 0; + + for (int i = 0; clipboard->GetInfo(B_MIME_TYPE, i, &name, &type, &count) == B_OK; i++) { + const void *data = Q_NULLPTR; + int32 dataLen = 0; + + const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen); + if (dataLen && (status == B_OK)) { + const QString format = QString::fromLatin1(name); + if (format == QStringLiteral("text/plain")) { + mimeData->setText(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen)); + } else if (format == QStringLiteral("text/html")) { + mimeData->setHtml(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen)); + } else { + mimeData->setData(format, QByteArray(reinterpret_cast<const char*>(data), dataLen)); + } + } + } + } + + be_clipboard->Unlock(); + + return mimeData; +} + +void QHaikuClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) +{ + if (mode != QClipboard::Clipboard) + return; + + if (!be_clipboard->Lock()) + return; + + be_clipboard->Clear(); + if (mimeData) { + BMessage *clipboard = be_clipboard->Data(); + if (clipboard) { + const QStringList formats = mimeData->formats(); + Q_FOREACH (const QString &format, formats) { + const QByteArray data = mimeData->data(format).data(); + clipboard->AddData(format.toUtf8(), B_MIME_TYPE, data, data.count()); + } + } + } + + if (be_clipboard->Commit() != B_OK) + qWarning("Unable to store mime data on clipboard"); + + be_clipboard->Unlock(); +} + +bool QHaikuClipboard::supportsMode(QClipboard::Mode mode) const +{ + return (mode == QClipboard::Clipboard); +} + +bool QHaikuClipboard::ownsMode(QClipboard::Mode mode) const +{ + Q_UNUSED(mode); + + return false; +} + +void QHaikuClipboard::MessageReceived(BMessage* message) +{ + if (message->what == B_CLIPBOARD_CHANGED) + emitChanged(QClipboard::Clipboard); + + BHandler::MessageReceived(message); +} + +#endif diff --git a/src/plugins/platforms/haiku/qhaikuclipboard.h b/src/plugins/platforms/haiku/qhaikuclipboard.h new file mode 100644 index 0000000000..0dc2bfdd3b --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuclipboard.h @@ -0,0 +1,64 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUCLIPBOARD_H +#define QHAIKUCLIPBOARD_H + +#if !defined(QT_NO_CLIPBOARD) + +#include <qpa/qplatformclipboard.h> + +#include <Handler.h> + +QT_BEGIN_NAMESPACE + +class QHaikuClipboard : public QPlatformClipboard, public BHandler +{ +public: + QHaikuClipboard(); + ~QHaikuClipboard(); + + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; + void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; + bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + + // override from BHandler to catch change notifications from Haiku clipboard + void MessageReceived(BMessage* message) Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif + +#endif diff --git a/src/plugins/platforms/haiku/qhaikucursor.cpp b/src/plugins/platforms/haiku/qhaikucursor.cpp new file mode 100644 index 0000000000..7ac677f597 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikucursor.cpp @@ -0,0 +1,92 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikucursor.h" + +#include "qhaikurasterwindow.h" + +#include <Cursor.h> + +QHaikuCursor::QHaikuCursor() +{ + m_cursorIds.insert(Qt::ArrowCursor, B_CURSOR_ID_SYSTEM_DEFAULT); + m_cursorIds.insert(Qt::UpArrowCursor, B_CURSOR_ID_RESIZE_NORTH); + m_cursorIds.insert(Qt::CrossCursor, B_CURSOR_ID_CROSS_HAIR); + m_cursorIds.insert(Qt::WaitCursor, B_CURSOR_ID_PROGRESS); + m_cursorIds.insert(Qt::IBeamCursor, B_CURSOR_ID_I_BEAM); + m_cursorIds.insert(Qt::SizeVerCursor, B_CURSOR_ID_RESIZE_NORTH_SOUTH); + m_cursorIds.insert(Qt::SizeHorCursor, B_CURSOR_ID_RESIZE_EAST_WEST); + m_cursorIds.insert(Qt::SizeBDiagCursor, B_CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST); + m_cursorIds.insert(Qt::SizeFDiagCursor, B_CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST); + m_cursorIds.insert(Qt::SizeAllCursor, B_CURSOR_ID_MOVE); + m_cursorIds.insert(Qt::BlankCursor, B_CURSOR_ID_NO_CURSOR); + m_cursorIds.insert(Qt::SplitVCursor, B_CURSOR_ID_RESIZE_NORTH_SOUTH); + m_cursorIds.insert(Qt::SplitHCursor, B_CURSOR_ID_RESIZE_EAST_WEST); + m_cursorIds.insert(Qt::PointingHandCursor, B_CURSOR_ID_FOLLOW_LINK); + m_cursorIds.insert(Qt::ForbiddenCursor, B_CURSOR_ID_NOT_ALLOWED); + m_cursorIds.insert(Qt::OpenHandCursor, B_CURSOR_ID_GRAB); + m_cursorIds.insert(Qt::ClosedHandCursor, B_CURSOR_ID_GRABBING); + m_cursorIds.insert(Qt::WhatsThisCursor, B_CURSOR_ID_HELP); + m_cursorIds.insert(Qt::BusyCursor, B_CURSOR_ID_PROGRESS); +} + +#ifndef QT_NO_CURSOR +void QHaikuCursor::changeCursor(QCursor *windowCursor, QWindow *window) +{ + if (!window) + return; + + BWindow *haikuWindow = reinterpret_cast<BWindow*>(window->winId()); + + // We expect that every BWindow has exactly one BView as child, + // so we can use CurrentFocus to retrieve it and call SetViewCursor + // to change the cursor for the whole window. + if (!windowCursor) { + BView *view = haikuWindow->CurrentFocus(); + if (view) { + view->SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); + } + } else { + const Qt::CursorShape shape = windowCursor->shape(); + if (!m_cursors.contains(shape)) + m_cursors.insert(shape, new BCursor(m_cursorIds.value(shape))); + + BView *view = haikuWindow->CurrentFocus(); + if (view) { + view->LockLooper(); + view->SetViewCursor(m_cursors.value(shape)); + view->UnlockLooper(); + } + } +} +#endif diff --git a/src/plugins/platforms/haiku/qhaikucursor.h b/src/plugins/platforms/haiku/qhaikucursor.h new file mode 100644 index 0000000000..61450b84b9 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikucursor.h @@ -0,0 +1,59 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUCURSOR_H +#define QHAIKUCURSOR_H + +#include <qpa/qplatformcursor.h> + +#include <Cursor.h> + +QT_BEGIN_NAMESPACE + +class QHaikuCursor : public QPlatformCursor +{ +public: + QHaikuCursor(); + +#ifndef QT_NO_CURSOR + void changeCursor(QCursor *windowCursor, QWindow *window) Q_DECL_OVERRIDE; +#endif + +private: + QHash<Qt::CursorShape, BCursorID> m_cursorIds; + QHash<Qt::CursorShape, BCursor*> m_cursors; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikuintegration.cpp b/src/plugins/platforms/haiku/qhaikuintegration.cpp new file mode 100644 index 0000000000..715a965adb --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuintegration.cpp @@ -0,0 +1,133 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikuintegration.h" + +#include "qhaikuapplication.h" +#include "qhaikuclipboard.h" +#include "qhaikurasterbackingstore.h" +#include "qhaikurasterwindow.h" +#include "qhaikuscreen.h" +#include "qhaikuservices.h" + +#include <QCoreApplication> +#include <QFileInfo> +#include <qpa/qplatformwindow.h> +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> + +#include <Application.h> + +QT_BEGIN_NAMESPACE + +static long int startApplicationThread(void *data) +{ + QHaikuApplication *app = static_cast<QHaikuApplication*>(data); + app->LockLooper(); + return app->Run(); +} + +QHaikuIntegration::QHaikuIntegration(const QStringList ¶meters) + : m_clipboard(new QHaikuClipboard) +{ + Q_UNUSED(parameters); + + const QString signature = QStringLiteral("application/x-vnd.Qt.%1").arg(QFileInfo(QCoreApplication::applicationFilePath()).fileName()); + + QHaikuApplication *app = new QHaikuApplication(signature.toLocal8Bit()); + be_app = app; + + const thread_id applicationThreadId = spawn_thread(startApplicationThread, "app_thread", 1, static_cast<void*>(app)); + resume_thread(applicationThreadId); + app->UnlockLooper(); + + m_screen = new QHaikuScreen; + + m_services = new QHaikuServices; + + // notify system about available screen + screenAdded(m_screen); +} + +QHaikuIntegration::~QHaikuIntegration() +{ + destroyScreen(m_screen); + m_screen = Q_NULLPTR; + + delete m_services; + m_services = Q_NULLPTR; + + delete m_clipboard; + m_clipboard = Q_NULLPTR; + + be_app->LockLooper(); + be_app->Quit(); +} + +bool QHaikuIntegration::hasCapability(QPlatformIntegration::Capability capability) const +{ + return QPlatformIntegration::hasCapability(capability); +} + +QPlatformFontDatabase *QHaikuIntegration::fontDatabase() const +{ + return QPlatformIntegration::fontDatabase(); +} + +QPlatformServices *QHaikuIntegration::services() const +{ + return m_services; +} + +QPlatformClipboard *QHaikuIntegration::clipboard() const +{ + return m_clipboard; +} + +QPlatformWindow *QHaikuIntegration::createPlatformWindow(QWindow *window) const +{ + QPlatformWindow *platformWindow = new QHaikuRasterWindow(window); + platformWindow->requestActivateWindow(); + return platformWindow; +} + +QPlatformBackingStore *QHaikuIntegration::createPlatformBackingStore(QWindow *window) const +{ + return new QHaikuRasterBackingStore(window); +} + +QAbstractEventDispatcher *QHaikuIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikuintegration.h b/src/plugins/platforms/haiku/qhaikuintegration.h new file mode 100644 index 0000000000..feb48b2bdf --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuintegration.h @@ -0,0 +1,72 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUINTEGRATION_H +#define QHAIKUINTEGRATION_H + +#include <qpa/qplatformintegration.h> + +QT_BEGIN_NAMESPACE + +class QHaikuClipboard; +class QHaikuScreen; +class QHaikuServices; + +class QHaikuIntegration : public QPlatformIntegration +{ +public: + explicit QHaikuIntegration(const QStringList ¶mList); + ~QHaikuIntegration(); + + bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; + + QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; + + QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QPlatformServices *services() const Q_DECL_OVERRIDE; + +#ifndef QT_NO_CLIPBOARD + QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; +#endif + +private: + QHaikuClipboard *m_clipboard; + QHaikuScreen *m_screen; + QHaikuServices *m_services; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikukeymapper.cpp b/src/plugins/platforms/haiku/qhaikukeymapper.cpp new file mode 100644 index 0000000000..7d148ae307 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikukeymapper.cpp @@ -0,0 +1,180 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikukeymapper.h" + +QT_BEGIN_NAMESPACE + +uint32 Haiku_ScanCodes[] = { + Qt::Key_Escape, 0x01, + Qt::Key_F1, 0x02, + Qt::Key_F2, 0x03, + Qt::Key_F3, 0x04, + Qt::Key_F4, 0x05, + Qt::Key_F5, 0x06, + Qt::Key_F6, 0x07, + Qt::Key_F7, 0x08, + Qt::Key_F8, 0x09, + Qt::Key_F9, 0x0A, + Qt::Key_F10, 0x0B, + Qt::Key_F11, 0x0C, + Qt::Key_F12, 0x0D, + Qt::Key_Print, 0x0E, + Qt::Key_Pause, 0x22, + Qt::Key_AsciiTilde, 0x11, + Qt::Key_1, 0x12, + Qt::Key_2, 0x13, + Qt::Key_3, 0x14, + Qt::Key_4, 0x15, + Qt::Key_5, 0x16, + Qt::Key_6, 0x17, + Qt::Key_7, 0x18, + Qt::Key_8, 0x19, + Qt::Key_9, 0x1A, + Qt::Key_0, 0x1B, + Qt::Key_Minus, 0x1C, + Qt::Key_Plus, 0x1D, + Qt::Key_Backspace, 0x1E, + Qt::Key_Insert, 0x1F, + Qt::Key_Home, 0x20, + Qt::Key_PageUp, 0x21, + Qt::Key_Slash, 0x23, + Qt::Key_Asterisk, 0x24, + Qt::Key_Minus, 0x25, + Qt::Key_Tab, 0x26, + Qt::Key_Q, 0x27, + Qt::Key_W, 0x28, + Qt::Key_E, 0x29, + Qt::Key_R, 0x2A, + Qt::Key_T, 0x2B, + Qt::Key_Y, 0x2C, + Qt::Key_U, 0x2D, + Qt::Key_I, 0x2E, + Qt::Key_O, 0x2F, + Qt::Key_P, 0x30, + Qt::Key_BracketLeft, 0x31, + Qt::Key_BracketRight, 0x32, + Qt::Key_Backslash, 0x33, + Qt::Key_Delete, 0x34, + Qt::Key_End, 0x35, + Qt::Key_PageDown, 0x36, + Qt::Key_Home, 0x37, // numpad + Qt::Key_Up, 0x38, // numpad + Qt::Key_PageUp, 0x39, // numpad + Qt::Key_Plus, 0x3A, // numpad + Qt::Key_A, 0x3C, + Qt::Key_S, 0x3D, + Qt::Key_D, 0x3E, + Qt::Key_F, 0x3F, + Qt::Key_G, 0x40, + Qt::Key_H, 0x41, + Qt::Key_J, 0x42, + Qt::Key_K, 0x43, + Qt::Key_L, 0x44, + Qt::Key_Colon, 0x45, + Qt::Key_QuoteDbl, 0x46, + Qt::Key_Return, 0x47, + Qt::Key_Left, 0x48, // numpad + Qt::Key_5, 0x49, // numpad ??? + Qt::Key_Right, 0x4A, // numpad + Qt::Key_Z, 0x4C, + Qt::Key_X, 0x4D, + Qt::Key_C, 0x4E, + Qt::Key_V, 0x4F, + Qt::Key_B, 0x50, + Qt::Key_N, 0x51, + Qt::Key_M, 0x51, + Qt::Key_Less, 0x52, + Qt::Key_Greater, 0x54, + Qt::Key_Question, 0x55, + Qt::Key_Up, 0x57, // cursor + Qt::Key_End, 0x58, // numpad + Qt::Key_Down, 0x59, // numpad + Qt::Key_PageDown, 0x5A, // numpad + Qt::Key_Enter, 0x5B, // numpad + Qt::Key_Space, 0x5E, + Qt::Key_Left, 0x61, // cursor + Qt::Key_Down, 0x62, // cursor + Qt::Key_Right, 0x63, // cursor + Qt::Key_Insert, 0x64, // cursor + Qt::Key_Delete, 0x65, // numpad + 0, 0x00 +}; + +uint32 Haiku_ScanCodes_Numlock[] = { + Qt::Key_7, 0x37, + Qt::Key_8, 0x38, + Qt::Key_9, 0x39, + Qt::Key_Plus, 0x3A, + Qt::Key_4, 0x48, + Qt::Key_5, 0x49, + Qt::Key_6, 0x4A, + Qt::Key_1, 0x58, + Qt::Key_2, 0x59, + Qt::Key_3, 0x5A, + Qt::Key_Enter, 0x5B, + Qt::Key_Comma, 0x65, + 0, 0x00 +}; + +uint32 QHaikuKeyMapper::translateKeyCode(uint32 key, bool numlockActive) +{ + uint32 code = 0; + int i = 0; + + if (numlockActive) { + while (Haiku_ScanCodes_Numlock[i]) { + if (key == Haiku_ScanCodes_Numlock[i + 1]) { + code = Haiku_ScanCodes_Numlock[i]; + break; + } + i += 2; + } + + if (code > 0) + return code; + } + + i = 0; + while (Haiku_ScanCodes[i]) { + if (key == Haiku_ScanCodes[i + 1]) { + code = Haiku_ScanCodes[i]; + break; + } + i += 2; + } + + return code; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikukeymapper.h b/src/plugins/platforms/haiku/qhaikukeymapper.h new file mode 100644 index 0000000000..dba56e1a64 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikukeymapper.h @@ -0,0 +1,53 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUKEYMAPPER_H +#define QHAIKUKEYMAPPER_H + +#include <qnamespace.h> + +#include <InterfaceDefs.h> + +QT_BEGIN_NAMESPACE + +class QHaikuKeyMapper +{ +public: + QHaikuKeyMapper(); + + static uint32 translateKeyCode(uint32 key, bool numlockActive); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp b/src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp new file mode 100644 index 0000000000..caede56b1f --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp @@ -0,0 +1,92 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikurasterbackingstore.h" +#include "qhaikurasterwindow.h" + +#include <Bitmap.h> +#include <View.h> + +QT_BEGIN_NAMESPACE + +QHaikuRasterBackingStore::QHaikuRasterBackingStore(QWindow *window) + : QPlatformBackingStore(window) + , m_bitmap(Q_NULLPTR) +{ +} + +QHaikuRasterBackingStore::~QHaikuRasterBackingStore() +{ + delete m_bitmap; + m_bitmap = Q_NULLPTR; +} + +QPaintDevice *QHaikuRasterBackingStore::paintDevice() +{ + if (!m_bufferSize.isEmpty() && m_bitmap) + return m_buffer.image(); + + return Q_NULLPTR; +} + +void QHaikuRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(region); + Q_UNUSED(offset); + + if (!window) + return; + + QHaikuRasterWindow *targetWindow = static_cast<QHaikuRasterWindow*>(window->handle()); + + BView *view = targetWindow->nativeViewHandle(); + + view->LockLooper(); + view->DrawBitmap(m_bitmap); + view->UnlockLooper(); +} + +void QHaikuRasterBackingStore::resize(const QSize &size, const QRegion &staticContents) +{ + Q_UNUSED(staticContents); + + if (m_bufferSize == size) + return; + + delete m_bitmap; + m_bitmap = new BBitmap(BRect(0, 0, size.width(), size.height()), B_RGB32, false, true); + m_buffer = QHaikuBuffer(m_bitmap); + m_bufferSize = size; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikurasterbackingstore.h b/src/plugins/platforms/haiku/qhaikurasterbackingstore.h new file mode 100644 index 0000000000..641664fb23 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikurasterbackingstore.h @@ -0,0 +1,64 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKURASTERWINDOWSURFACE_H +#define QHAIKURASTERWINDOWSURFACE_H + +#include <qpa/qplatformbackingstore.h> + +#include "qhaikubuffer.h" + +QT_BEGIN_NAMESPACE + +class BBitmap; +class QHaikuRasterWindow; + +class QHaikuRasterBackingStore : public QPlatformBackingStore +{ +public: + explicit QHaikuRasterBackingStore(QWindow *window); + ~QHaikuRasterBackingStore(); + + QPaintDevice *paintDevice() Q_DECL_OVERRIDE; + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; + void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; + +private: + BBitmap *m_bitmap; + QHaikuBuffer m_buffer; + QSize m_bufferSize; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikurasterwindow.cpp b/src/plugins/platforms/haiku/qhaikurasterwindow.cpp new file mode 100644 index 0000000000..659700f269 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikurasterwindow.cpp @@ -0,0 +1,270 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikurasterwindow.h" + +#include "qhaikukeymapper.h" + +#include <View.h> +#include <Window.h> + +#include <qpa/qwindowsysteminterface.h> + +QT_BEGIN_NAMESPACE + +Q_DECLARE_METATYPE(QEvent::Type) +Q_DECLARE_METATYPE(Qt::MouseButtons) +Q_DECLARE_METATYPE(Qt::MouseEventSource) +Q_DECLARE_METATYPE(Qt::KeyboardModifiers) +Q_DECLARE_METATYPE(Qt::Orientation) + +HaikuViewProxy::HaikuViewProxy(BWindow *window, QObject *parent) + : QObject(parent) + , BView(BRect(0, 0, window->Bounds().right, window->Bounds().bottom), 0, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS) +{ +} + +void HaikuViewProxy::MessageReceived(BMessage *message) +{ + switch (message->what) { + case B_MOUSE_WHEEL_CHANGED: + { + float deltaX = 0; + if (message->FindFloat("be:wheel_delta_x", &deltaX) != B_OK) + deltaX = 0; + + float deltaY = 0; + if (message->FindFloat("be:wheel_delta_y", &deltaY) != B_OK) + deltaY = 0; + + if (deltaX != 0 || deltaY != 0) { + BPoint localPos; + uint32 keyState = 0; + GetMouse(&localPos, &keyState); + const Qt::KeyboardModifiers keyboardModifiers = keyStateToModifiers(modifiers()); + + const BPoint globalPos = ConvertToScreen(localPos); + const QPoint globalPosition = QPoint(globalPos.x, globalPos.y); + const QPoint localPosition = QPoint(localPos.x, localPos.y); + + if (deltaX != 0) + Q_EMIT wheelEvent(localPosition, globalPosition, (deltaX * -120), Qt::Horizontal, keyboardModifiers); + + if (deltaY != 0) + Q_EMIT wheelEvent(localPosition, globalPosition, (deltaY * -120), Qt::Vertical, keyboardModifiers); + } + break; + } + default: + BView::MessageReceived(message); + break; + } + +} + +void HaikuViewProxy::Draw(BRect updateRect) +{ + BView::Draw(updateRect); + + Q_EMIT drawRequest(QRect(updateRect.left, updateRect.top, updateRect.Width(), updateRect.Height())); +} + +void HaikuViewProxy::MouseDown(BPoint localPos) +{ + BPoint dummyPos; + uint32 keyState = 0; + GetMouse(&dummyPos, &keyState); + + const Qt::MouseButtons mouseButtons = keyStateToMouseButtons(keyState); + const Qt::KeyboardModifiers keyboardModifiers = keyStateToModifiers(modifiers()); + const Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; + + const BPoint globalPos = ConvertToScreen(localPos); + const QPoint globalPosition = QPoint(globalPos.x, globalPos.y); + const QPoint localPosition = QPoint(localPos.x, localPos.y); + + Q_EMIT mouseEvent(localPosition, globalPosition, mouseButtons, keyboardModifiers, source); +} + +void HaikuViewProxy::MouseUp(BPoint localPos) +{ + BPoint dummyPos; + uint32 keyState = 0; + GetMouse(&dummyPos, &keyState); + + const Qt::MouseButtons mouseButtons = keyStateToMouseButtons(keyState); + const Qt::KeyboardModifiers keyboardModifiers = keyStateToModifiers(modifiers()); + const Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; + + const BPoint globalPos = ConvertToScreen(localPos); + const QPoint globalPosition = QPoint(globalPos.x, globalPos.y); + const QPoint localPosition = QPoint(localPos.x, localPos.y); + + Q_EMIT mouseEvent(localPosition, globalPosition, mouseButtons, keyboardModifiers, source); +} + +void HaikuViewProxy::MouseMoved(BPoint pos, uint32 code, const BMessage *dragMessage) +{ + switch (code) { + case B_INSIDE_VIEW: + { + BPoint dummyPos; + uint32 keyState = 0; + GetMouse(&dummyPos, &keyState); + + const Qt::MouseButtons mouseButtons = keyStateToMouseButtons(keyState); + const Qt::KeyboardModifiers keyboardModifiers = keyStateToModifiers(modifiers()); + const Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; + + const BPoint globalPos = ConvertToScreen(pos); + const QPoint globalPosition = QPoint(globalPos.x, globalPos.y); + const QPoint localPosition = QPoint(pos.x, pos.y); + + Q_EMIT mouseEvent(localPosition, globalPosition, mouseButtons, keyboardModifiers, source); + } + break; + case B_ENTERED_VIEW: + Q_EMIT enteredView(); + break; + case B_EXITED_VIEW: + Q_EMIT exitedView(); + break; + } + + BView::MouseMoved(pos, code, dragMessage); +} + +void HaikuViewProxy::KeyDown(const char*, int32) +{ + handleKeyEvent(QEvent::KeyPress, Window()->CurrentMessage()); +} + +void HaikuViewProxy::KeyUp(const char*, int32) +{ + handleKeyEvent(QEvent::KeyRelease, Window()->CurrentMessage()); +} + +Qt::MouseButtons HaikuViewProxy::keyStateToMouseButtons(uint32 keyState) const +{ + Qt::MouseButtons mouseButtons(Qt::NoButton); + if (keyState & B_PRIMARY_MOUSE_BUTTON) + mouseButtons |= Qt::LeftButton; + if (keyState & B_SECONDARY_MOUSE_BUTTON) + mouseButtons |= Qt::RightButton; + if (keyState & B_TERTIARY_MOUSE_BUTTON) + mouseButtons |= Qt::MiddleButton; + + return mouseButtons; +} + +Qt::KeyboardModifiers HaikuViewProxy::keyStateToModifiers(uint32 keyState) const +{ + Qt::KeyboardModifiers modifiers(Qt::NoModifier); + + if (keyState & B_SHIFT_KEY) + modifiers |= Qt::ShiftModifier; + if (keyState & B_CONTROL_KEY) + modifiers |= Qt::AltModifier; + if (keyState & B_COMMAND_KEY) + modifiers |= Qt::ControlModifier; + + return modifiers; +} + +void HaikuViewProxy::handleKeyEvent(QEvent::Type type, BMessage *message) +{ + int32 key = 0; + uint32 code = 0; + const char *bytes = Q_NULLPTR; + QString text; + + if (message) { + if (message->FindString("bytes", &bytes) == B_OK) { + text = QString::fromLocal8Bit(bytes, strlen(bytes)); + } + + if (message->FindInt32("key", &key) == B_OK) { + code = QHaikuKeyMapper::translateKeyCode(key, (modifiers() & B_NUM_LOCK)); + } + } + + const Qt::KeyboardModifiers keyboardModifiers = keyStateToModifiers(modifiers()); + + Q_EMIT keyEvent(type, code, keyboardModifiers, text); +} + + +QHaikuRasterWindow::QHaikuRasterWindow(QWindow *window) + : QHaikuWindow(window) +{ + qRegisterMetaType<QEvent::Type>(); + qRegisterMetaType<Qt::MouseButtons>(); + qRegisterMetaType<Qt::MouseEventSource>(); + qRegisterMetaType<Qt::KeyboardModifiers>(); + qRegisterMetaType<Qt::Orientation>(); + + HaikuViewProxy *haikuView = new HaikuViewProxy(m_window); + connect(haikuView, SIGNAL(mouseEvent(QPoint,QPoint,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::MouseEventSource)), + this, SLOT(haikuMouseEvent(QPoint,QPoint,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::MouseEventSource))); + connect(haikuView, SIGNAL(wheelEvent(QPoint,QPoint,int,Qt::Orientation,Qt::KeyboardModifiers)), + this, SLOT(haikuWheelEvent(QPoint,QPoint,int,Qt::Orientation,Qt::KeyboardModifiers))); + connect(haikuView, SIGNAL(keyEvent(QEvent::Type,int,Qt::KeyboardModifiers,QString)), + this, SLOT(haikuKeyEvent(QEvent::Type,int,Qt::KeyboardModifiers,QString))); + connect(haikuView, SIGNAL(enteredView()), this, SLOT(haikuEnteredView())); + connect(haikuView, SIGNAL(exitedView()), this, SLOT(haikuExitedView())); + connect(haikuView, SIGNAL(drawRequest(QRect)), this, SLOT(haikuDrawRequest(QRect))); + + m_view = haikuView; + + m_window->LockLooper(); + m_window->AddChild(m_view); + m_view->MakeFocus(); + m_window->UnlockLooper(); +} + +QHaikuRasterWindow::~QHaikuRasterWindow() +{ + m_window->LockLooper(); + m_view->RemoveSelf(); + m_window->UnlockLooper(); + + delete m_view; + m_view = Q_NULLPTR; +} + +BView* QHaikuRasterWindow::nativeViewHandle() const +{ + return m_view; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikurasterwindow.h b/src/plugins/platforms/haiku/qhaikurasterwindow.h new file mode 100644 index 0000000000..feacc44478 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikurasterwindow.h @@ -0,0 +1,88 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKURASTERWINDOW_H +#define QHAIKURASTERWINDOW_H + +#include "qhaikuwindow.h" + +#include <View.h> + +QT_BEGIN_NAMESPACE + +class HaikuViewProxy : public QObject, public BView +{ + Q_OBJECT + +public: + explicit HaikuViewProxy(BWindow *window, QObject *parent = Q_NULLPTR); + + void MessageReceived(BMessage *message) Q_DECL_OVERRIDE; + void Draw(BRect updateRect) Q_DECL_OVERRIDE; + void MouseDown(BPoint pos) Q_DECL_OVERRIDE; + void MouseUp(BPoint pos) Q_DECL_OVERRIDE; + void MouseMoved(BPoint pos, uint32 code, const BMessage *dragMessage) Q_DECL_OVERRIDE; + void KeyDown(const char *bytes, int32 numBytes) Q_DECL_OVERRIDE; + void KeyUp(const char *bytes, int32 numBytes) Q_DECL_OVERRIDE; + +Q_SIGNALS: + void mouseEvent(const QPoint &localPosition, const QPoint &globalPosition, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source); + void wheelEvent(const QPoint &localPosition, const QPoint &globalPosition, int delta, Qt::Orientation orientation, Qt::KeyboardModifiers modifiers); + void keyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text); + void enteredView(); + void exitedView(); + void drawRequest(const QRect &rect); + +private: + Qt::MouseButtons keyStateToMouseButtons(uint32 keyState) const; + Qt::KeyboardModifiers keyStateToModifiers(uint32 keyState) const; + void handleKeyEvent(QEvent::Type type, BMessage *message); +}; + +class QHaikuRasterWindow : public QHaikuWindow +{ + Q_OBJECT + +public: + explicit QHaikuRasterWindow(QWindow *window); + ~QHaikuRasterWindow(); + + BView* nativeViewHandle() const; + +private: + HaikuViewProxy *m_view; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikuscreen.cpp b/src/plugins/platforms/haiku/qhaikuscreen.cpp new file mode 100644 index 0000000000..c21bfc4c93 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuscreen.cpp @@ -0,0 +1,137 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikuscreen.h" + +#include "qhaikucursor.h" +#include "qhaikuutils.h" + +#include <qpa/qwindowsysteminterface.h> + +#include <Bitmap.h> +#include <Screen.h> +#include <Window.h> + +QHaikuScreen::QHaikuScreen() + : m_screen(new BScreen(B_MAIN_SCREEN_ID)) + , m_cursor(new QHaikuCursor) +{ + Q_ASSERT(m_screen->IsValid()); +} + +QHaikuScreen::~QHaikuScreen() +{ + delete m_cursor; + m_cursor = Q_NULLPTR; + + delete m_screen; + m_screen = Q_NULLPTR; +} + +QPixmap QHaikuScreen::grabWindow(WId winId, int x, int y, int width, int height) const +{ + if (width == 0 || height == 0) + return QPixmap(); + + BScreen screen(Q_NULLPTR); + BBitmap *bitmap = Q_NULLPTR; + screen.GetBitmap(&bitmap); + + const BRect frame = (winId ? ((BWindow*)winId)->Frame() : screen.Frame()); + + const int absoluteX = frame.left + x; + const int absoluteY = frame.top + y; + + if (width < 0) + width = frame.Width() - x; + if (height < 0) + height = frame.Height() - y; + + const QImage::Format format = QHaikuUtils::colorSpaceToImageFormat(bitmap->ColorSpace()); + + // get image of complete screen + QImage image((uchar*)bitmap->Bits(), screen.Frame().Width() + 1, screen.Frame().Height() + 1, bitmap->BytesPerRow(), format); + + // extract the area of the requested window + QRect grabRect(absoluteX, absoluteY, width, height); + image = image.copy(grabRect); + + delete bitmap; + + return QPixmap::fromImage(image); +} + +QRect QHaikuScreen::geometry() const +{ + const BRect frame = m_screen->Frame(); + return QRect(frame.left, frame.top, frame.right - frame.left, frame.bottom - frame.top); +} + +int QHaikuScreen::depth() const +{ + switch (format()) { + case QImage::Format_Invalid: + return 0; + break; + case QImage::Format_MonoLSB: + return 1; + break; + case QImage::Format_Indexed8: + return 8; + break; + case QImage::Format_RGB16: + case QImage::Format_RGB555: + return 16; + break; + case QImage::Format_RGB888: + return 24; + break; + case QImage::Format_RGB32: + case QImage::Format_ARGB32: + default: + return 32; + break; + } +} + +QImage::Format QHaikuScreen::format() const +{ + return QHaikuUtils::colorSpaceToImageFormat(m_screen->ColorSpace()); +} + +QPlatformCursor *QHaikuScreen::cursor() const +{ + return m_cursor; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikuscreen.h b/src/plugins/platforms/haiku/qhaikuscreen.h new file mode 100644 index 0000000000..50729d5760 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuscreen.h @@ -0,0 +1,66 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUSCREEN_H +#define QHAIKUSCREEN_H + +#include <qpa/qplatformscreen.h> + +class BScreen; +class QHaikuCursor; + +QT_BEGIN_NAMESPACE + +class QHaikuScreen : public QPlatformScreen +{ +public: + QHaikuScreen(); + ~QHaikuScreen(); + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE; + + QRect geometry() const Q_DECL_OVERRIDE; + int depth() const Q_DECL_OVERRIDE; + QImage::Format format() const Q_DECL_OVERRIDE; + + QPlatformCursor *cursor() const Q_DECL_OVERRIDE; + +private: + BScreen *m_screen; + + QHaikuCursor *m_cursor; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikuservices.cpp b/src/plugins/platforms/haiku/qhaikuservices.cpp new file mode 100644 index 0000000000..2c07686b56 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuservices.cpp @@ -0,0 +1,82 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikuservices.h" + +#include <QFile> +#include <QMimeDatabase> +#include <QString> +#include <QUrl> + +#include <Roster.h> + +QT_BEGIN_NAMESPACE + +bool QHaikuServices::openUrl(const QUrl &url) +{ + const QMimeDatabase mimeDatabase; + + const QMimeType mimeType = mimeDatabase.mimeTypeForUrl(url); + if (!mimeType.isValid()) + return false; + + const QByteArray mimeTypeName = mimeType.name().toLatin1(); + QByteArray urlData = url.toString().toLocal8Bit(); + char *rawUrlData = urlData.data(); + + if (be_roster->Launch(mimeTypeName.constData(), 1, &rawUrlData) != B_OK) + return false; + + return true; +} + +bool QHaikuServices::openDocument(const QUrl &url) +{ + const QByteArray localPath = QFile::encodeName(url.toLocalFile()); + + entry_ref ref; + if (get_ref_for_path(localPath.constData(), &ref) != B_OK) + return false; + + if (be_roster->Launch(&ref) != B_OK) + return false; + + return true; +} + +QByteArray QHaikuServices::desktopEnvironment() const +{ + return QByteArray("Haiku"); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikuservices.h b/src/plugins/platforms/haiku/qhaikuservices.h new file mode 100644 index 0000000000..d38b4481de --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuservices.h @@ -0,0 +1,52 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUSERVICES_H +#define QHAIKUSERVICES_H + +#include <qpa/qplatformservices.h> + +QT_BEGIN_NAMESPACE + +class QHaikuServices : public QPlatformServices +{ +public: + bool openUrl(const QUrl &url) Q_DECL_OVERRIDE; + bool openDocument(const QUrl &url) Q_DECL_OVERRIDE; + + QByteArray desktopEnvironment() const Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikuutils.cpp b/src/plugins/platforms/haiku/qhaikuutils.cpp new file mode 100644 index 0000000000..f634034864 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuutils.cpp @@ -0,0 +1,110 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikuutils.h" + +color_space QHaikuUtils::imageFormatToColorSpace(QImage::Format format) +{ + color_space colorSpace = B_NO_COLOR_SPACE; + switch (format) { + case QImage::Format_Invalid: + colorSpace = B_NO_COLOR_SPACE; + break; + case QImage::Format_MonoLSB: + colorSpace = B_GRAY1; + break; + case QImage::Format_Indexed8: + colorSpace = B_CMAP8; + break; + case QImage::Format_RGB32: + colorSpace = B_RGB32; + break; + case QImage::Format_ARGB32: + colorSpace = B_RGBA32; + break; + case QImage::Format_RGB16: + colorSpace = B_RGB16; + break; + case QImage::Format_RGB555: + colorSpace = B_RGB15; + break; + case QImage::Format_RGB888: + colorSpace = B_RGB24; + break; + default: + qWarning("Cannot convert image format %d to color space", format); + Q_ASSERT(false); + break; + } + + return colorSpace; +} + +QImage::Format QHaikuUtils::colorSpaceToImageFormat(color_space colorSpace) +{ + QImage::Format format = QImage::Format_Invalid; + switch (colorSpace) { + case B_NO_COLOR_SPACE: + format = QImage::Format_Invalid; + break; + case B_GRAY1: + format = QImage::Format_MonoLSB; + break; + case B_CMAP8: + format = QImage::Format_Indexed8; + break; + case B_RGB32: + format = QImage::Format_RGB32; + break; + case B_RGBA32: + format = QImage::Format_ARGB32; + break; + case B_RGB16: + format = QImage::Format_RGB16; + break; + case B_RGB15: + format = QImage::Format_RGB555; + break; + case B_RGB24: + format = QImage::Format_RGB888; + break; + default: + qWarning("Cannot convert color space %d to image format", colorSpace); + Q_ASSERT(false); + break; + } + + return format; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikuutils.h b/src/plugins/platforms/haiku/qhaikuutils.h new file mode 100644 index 0000000000..a0d129fcbf --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuutils.h @@ -0,0 +1,51 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUUTILS_H +#define QHAIKUUTILS_H + +#include <QImage> + +#include <GraphicsDefs.h> + +QT_BEGIN_NAMESPACE + +namespace QHaikuUtils +{ + color_space imageFormatToColorSpace(QImage::Format format); + QImage::Format colorSpaceToImageFormat(color_space colorSpace); +} + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/haiku/qhaikuwindow.cpp b/src/plugins/platforms/haiku/qhaikuwindow.cpp new file mode 100644 index 0000000000..5768e1cb40 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuwindow.cpp @@ -0,0 +1,388 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhaikuwindow.h" + +#include "private/qguiapplication_p.h" + +#include <QCoreApplication> +#include <QThread> +#include <QWindow> +#include <qpa/qwindowsysteminterface.h> + +#include <Rect.h> +#include <Window.h> + +QT_BEGIN_NAMESPACE + +enum { + DefaultWindowWidth = 160, + DefaultWindowHeight = 160 +}; + +HaikuWindowProxy::HaikuWindowProxy(QWindow *window, const QRect &rect, QObject *parent) + : QObject(parent) + , BWindow(BRect(rect.x(), rect.y(), rect.right() - 1, rect.bottom() - 1), + window->title().toUtf8(), B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 0) + , m_qtCalledZoom(false) + , m_zoomInProgress(false) +{ +} + +void HaikuWindowProxy::FrameMoved(BPoint pos) +{ + Q_EMIT moved(QPoint(pos.x, pos.y)); +} + +void HaikuWindowProxy::FrameResized(float width, float height) +{ + Q_EMIT resized(QSize(static_cast<int>(width), static_cast<int>(height)), m_zoomInProgress); + + m_zoomInProgress = false; +} + +void HaikuWindowProxy::WindowActivated(bool activated) +{ + Q_EMIT windowActivated(activated); +} + +void HaikuWindowProxy::Minimize(bool minimize) +{ + BWindow::Minimize(minimize); + + Q_EMIT minimized(minimize); +} + +void HaikuWindowProxy::Zoom(BPoint pos, float width, float height) +{ + m_zoomInProgress = true; + BWindow::Zoom(pos, width, height); + + // Only notify about Zoom invocations from the Haiku windowing system + if (!m_qtCalledZoom) + Q_EMIT zoomed(); +} + +bool HaikuWindowProxy::QuitRequested() +{ + Q_EMIT quitRequested(); + + // Return false to prevent Haiku windowing system to clean up + // the BWindow and BView instances. We will do that ourself when + // Qt invokes the dtor of QHaikuWindow + return false; +} + +void HaikuWindowProxy::zoomByQt() +{ + m_qtCalledZoom = true; + BWindow::Zoom(); + m_qtCalledZoom = false; +} + +QHaikuWindow::QHaikuWindow(QWindow *window) + : QPlatformWindow(window) + , m_window(Q_NULLPTR) + , m_windowState(Qt::WindowNoState) +{ + const QRect rect = initialGeometry(window, window->geometry(), DefaultWindowWidth, DefaultWindowHeight); + + HaikuWindowProxy *haikuWindow = new HaikuWindowProxy(window, rect, Q_NULLPTR); + connect(haikuWindow, SIGNAL(moved(QPoint)), SLOT(haikuWindowMoved(QPoint))); + connect(haikuWindow, SIGNAL(resized(QSize,bool)), SLOT(haikuWindowResized(QSize,bool))); + connect(haikuWindow, SIGNAL(windowActivated(bool)), SLOT(haikuWindowActivated(bool))); + connect(haikuWindow, SIGNAL(minimized(bool)), SLOT(haikuWindowMinimized(bool))); + connect(haikuWindow, SIGNAL(zoomed()), SLOT(haikuWindowZoomed())); + connect(haikuWindow, SIGNAL(quitRequested()), SLOT(haikuWindowQuitRequested()), Qt::BlockingQueuedConnection); + + m_window = haikuWindow; + + if (!m_window) + qFatal("QHaikuWindow: failed to create window"); + + setWindowFlags(window->flags()); +} + +QHaikuWindow::~QHaikuWindow() +{ + m_window->LockLooper(); + m_window->Quit(); + + m_window = Q_NULLPTR; +} + +void QHaikuWindow::setGeometry(const QRect &rect) +{ + QPlatformWindow::setGeometry(rect); + + m_window->MoveTo(rect.x(), rect.y()); + m_window->ResizeTo(rect.width(), rect.height()); +} + +QMargins QHaikuWindow::frameMargins() const +{ + const BRect decoratorFrame = m_window->DecoratorFrame(); + const BRect frame = m_window->Frame(); + + return QMargins(frame.left - decoratorFrame.left, + frame.top - decoratorFrame.top, + decoratorFrame.right - frame.right, + decoratorFrame.bottom - frame.bottom); +} + +void QHaikuWindow::setVisible(bool visible) +{ + if (visible) { + m_window->Show(); + } else { + m_window->Hide(); + } + + window()->requestActivate(); + + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); +} + +bool QHaikuWindow::isExposed() const +{ + return !m_window->IsHidden(); +} + +bool QHaikuWindow::isActive() const +{ + return m_window->IsActive(); +} + +WId QHaikuWindow::winId() const +{ + return (WId)static_cast<BWindow*>(m_window); +} + +BWindow* QHaikuWindow::nativeHandle() const +{ + return m_window; +} + +void QHaikuWindow::requestActivateWindow() +{ + m_window->Activate(true); +} + +void QHaikuWindow::setWindowState(Qt::WindowState state) +{ + if (m_windowState == state) + return; + + const Qt::WindowState oldState = m_windowState; + + m_windowState = state; + + if (m_windowState == Qt::WindowMaximized) { + m_window->zoomByQt(); + } else if (m_windowState == Qt::WindowMinimized) { + m_window->Minimize(true); + } else if (m_windowState == Qt::WindowNoState) { + if (oldState == Qt::WindowMaximized) + m_window->zoomByQt(); // undo zoom + + if (oldState == Qt::WindowMinimized) + m_window->Minimize(false); // undo minimize + } +} + +void QHaikuWindow::setWindowFlags(Qt::WindowFlags flags) +{ + const Qt::WindowType type = static_cast<Qt::WindowType>(static_cast<int>(flags & Qt::WindowType_Mask)); + + const bool isPopup = (type == Qt::Popup); + const bool isSplashScreen = (type == Qt::SplashScreen); + const bool isDialog = ((type == Qt::Dialog) || (type == Qt::Sheet) || (type == Qt::MSWindowsFixedSizeDialogHint)); + const bool isTool = ((type == Qt::Tool) || (type == Qt::Drawer)); + const bool isToolTip = (type == Qt::ToolTip); + + window_look wlook = B_TITLED_WINDOW_LOOK; + window_feel wfeel = B_NORMAL_WINDOW_FEEL; + uint32 wflag = (B_NO_WORKSPACE_ACTIVATION | B_NOT_ANCHORED_ON_ACTIVATE); + + if (isTool) { + wlook = B_FLOATING_WINDOW_LOOK; + wflag |= B_WILL_ACCEPT_FIRST_CLICK; + } + + if (isSplashScreen) { + wlook = B_NO_BORDER_WINDOW_LOOK; + } + + if (isPopup) { + wlook = B_NO_BORDER_WINDOW_LOOK; + wflag |= (B_WILL_ACCEPT_FIRST_CLICK | B_AVOID_FRONT | B_AVOID_FOCUS); + flags |= Qt::WindowStaysOnTopHint; + } + + if (isDialog) { + if (window()->modality() == Qt::WindowModal) + wfeel = B_MODAL_SUBSET_WINDOW_FEEL; + else if (window()->modality() == Qt::ApplicationModal) + wfeel = B_MODAL_APP_WINDOW_FEEL; + } + + if (isToolTip) { + wlook = B_NO_BORDER_WINDOW_LOOK; + wflag |= (B_WILL_ACCEPT_FIRST_CLICK | B_AVOID_FOCUS); + flags |= Qt::WindowStaysOnTopHint; + } + + if (flags & Qt::FramelessWindowHint) + wlook = B_NO_BORDER_WINDOW_LOOK; + + if (flags & Qt::MSWindowsFixedSizeDialogHint) + wflag |= (B_NOT_RESIZABLE | B_NOT_ZOOMABLE); + + if (flags & Qt::CustomizeWindowHint) { + if (!(flags & Qt::WindowMinimizeButtonHint)) + wflag |= B_NOT_MINIMIZABLE; + if (!(flags & Qt::WindowMaximizeButtonHint)) + wflag |= B_NOT_ZOOMABLE; + if (!(flags & Qt::WindowCloseButtonHint)) + wflag |= B_NOT_CLOSABLE; + } + + if (flags & Qt::WindowStaysOnTopHint) + wfeel = B_FLOATING_ALL_WINDOW_FEEL; + + m_window->SetLook(wlook); + m_window->SetFeel(wfeel); + m_window->SetFlags(wflag); +} + +void QHaikuWindow::setWindowTitle(const QString &title) +{ + m_window->SetTitle(title.toLocal8Bit().constData()); +} + +void QHaikuWindow::propagateSizeHints() +{ + m_window->SetSizeLimits(window()->minimumSize().width(), + window()->maximumSize().width(), + window()->minimumSize().height(), + window()->maximumSize().height()); + + m_window->SetZoomLimits(window()->maximumSize().width(), + window()->maximumSize().height()); +} + +void QHaikuWindow::haikuWindowMoved(const QPoint &pos) +{ + const QRect newGeometry(pos, geometry().size()); + + QPlatformWindow::setGeometry(newGeometry); + QWindowSystemInterface::setSynchronousWindowsSystemEvents(true); + QWindowSystemInterface::handleGeometryChange(window(), newGeometry); + QWindowSystemInterface::handleExposeEvent(window(), newGeometry); + QWindowSystemInterface::setSynchronousWindowsSystemEvents(false); +} + +void QHaikuWindow::haikuWindowResized(const QSize &size, bool zoomInProgress) +{ + const QRect newGeometry(geometry().topLeft(), size); + + QPlatformWindow::setGeometry(newGeometry); + QWindowSystemInterface::setSynchronousWindowsSystemEvents(true); + QWindowSystemInterface::handleGeometryChange(window(), newGeometry); + QWindowSystemInterface::handleExposeEvent(window(), newGeometry); + QWindowSystemInterface::setSynchronousWindowsSystemEvents(false); + + if ((m_windowState == Qt::WindowMaximized) && !zoomInProgress) { + // the user has resized the window while maximized -> reset maximized flag + m_windowState = Qt::WindowNoState; + + QWindowSystemInterface::handleWindowStateChanged(window(), m_windowState); + } +} + +void QHaikuWindow::haikuWindowActivated(bool activated) +{ + QWindowSystemInterface::handleWindowActivated(activated ? window() : Q_NULLPTR); +} + +void QHaikuWindow::haikuWindowMinimized(bool minimize) +{ + m_windowState = (minimize ? Qt::WindowMinimized : Qt::WindowNoState); + + QWindowSystemInterface::handleWindowStateChanged(window(), m_windowState); +} + +void QHaikuWindow::haikuWindowZoomed() +{ + m_windowState = (m_windowState == Qt::WindowMaximized ? Qt::WindowNoState : Qt::WindowMaximized); + + QWindowSystemInterface::handleWindowStateChanged(window(), m_windowState); +} + +void QHaikuWindow::haikuWindowQuitRequested() +{ + QWindowSystemInterface::handleCloseEvent(window()); +} + +void QHaikuWindow::haikuMouseEvent(const QPoint &localPosition, const QPoint &globalPosition, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source) +{ + QWindowSystemInterface::handleMouseEvent(window(), localPosition, globalPosition, + buttons, modifiers, source); +} + +void QHaikuWindow::haikuWheelEvent(const QPoint &localPosition, const QPoint &globalPosition, int delta, Qt::Orientation orientation, Qt::KeyboardModifiers modifiers) +{ + QWindowSystemInterface::handleWheelEvent(window(), localPosition, globalPosition, delta, orientation, modifiers); +} + +void QHaikuWindow::haikuKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text) +{ + QWindowSystemInterface::handleKeyEvent(window(), type, key, modifiers, text); +} + +void QHaikuWindow::haikuEnteredView() +{ + QWindowSystemInterface::handleEnterEvent(window()); +} + +void QHaikuWindow::haikuExitedView() +{ + QWindowSystemInterface::handleLeaveEvent(window()); +} + +void QHaikuWindow::haikuDrawRequest(const QRect &rect) +{ + QWindowSystemInterface::handleExposeEvent(window(), QRegion(rect)); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/haiku/qhaikuwindow.h b/src/plugins/platforms/haiku/qhaikuwindow.h new file mode 100644 index 0000000000..a8035e7814 --- /dev/null +++ b/src/plugins/platforms/haiku/qhaikuwindow.h @@ -0,0 +1,122 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QHAIKUWINDOW_H +#define QHAIKUWINDOW_H + +#include <qpa/qplatformwindow.h> + +#include <Window.h> + +QT_BEGIN_NAMESPACE + +class HaikuWindowProxy : public QObject, public BWindow +{ + Q_OBJECT + +public: + explicit HaikuWindowProxy(QWindow *window, const QRect &rect, QObject *parent = Q_NULLPTR); + + void FrameMoved(BPoint pos) Q_DECL_OVERRIDE; + void FrameResized(float width, float height) Q_DECL_OVERRIDE; + void WindowActivated(bool activated) Q_DECL_OVERRIDE; + void Minimize(bool minimize) Q_DECL_OVERRIDE; + void Zoom(BPoint pos, float width, float height) Q_DECL_OVERRIDE; + bool QuitRequested() Q_DECL_OVERRIDE; + + void zoomByQt(); + +Q_SIGNALS: + void moved(const QPoint &pos); + void resized(const QSize &size, bool zoomInProgress); + void windowActivated(bool activated); + void minimized(bool minimize); + void zoomed(); + void quitRequested(); + +private: + bool m_qtCalledZoom; + bool m_zoomInProgress; +}; + +class QHaikuWindow : public QObject, public QPlatformWindow +{ + Q_OBJECT + +public: + explicit QHaikuWindow(QWindow *window); + virtual ~QHaikuWindow(); + + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; + QMargins frameMargins() const Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; + + bool isExposed() const Q_DECL_OVERRIDE; + bool isActive() const Q_DECL_OVERRIDE; + + WId winId() const Q_DECL_OVERRIDE; + BWindow* nativeHandle() const; + + void requestActivateWindow() Q_DECL_OVERRIDE; + void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; + + void setWindowTitle(const QString &title) Q_DECL_OVERRIDE; + + void propagateSizeHints() Q_DECL_OVERRIDE; + +protected: + HaikuWindowProxy *m_window; + +private Q_SLOTS: + void haikuWindowMoved(const QPoint &pos); + void haikuWindowResized(const QSize &size, bool zoomInProgress); + void haikuWindowActivated(bool activated); + void haikuWindowMinimized(bool minimize); + void haikuWindowZoomed(); + void haikuWindowQuitRequested(); + + void haikuMouseEvent(const QPoint &localPosition, const QPoint &globalPosition, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source); + void haikuWheelEvent(const QPoint &localPosition, const QPoint &globalPosition, int delta, Qt::Orientation orientation, Qt::KeyboardModifiers modifiers); + void haikuKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text); + void haikuEnteredView(); + void haikuExitedView(); + void haikuDrawRequest(const QRect &rect); + +private: + Qt::WindowState m_windowState; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index 1090482f20..41fe712f60 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index 32392671ee..74092d02ce 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm index bd81b44b6b..92799f80c1 100644 --- a/src/plugins/platforms/ios/qiosapplicationstate.mm +++ b/src/plugins/platforms/ios/qiosapplicationstate.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm index f9623c5660..acec95b0d3 100644 --- a/src/plugins/platforms/ios/qiosbackingstore.mm +++ b/src/plugins/platforms/ios/qiosbackingstore.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm index 0666c4efe7..192ee67689 100644 --- a/src/plugins/platforms/ios/qiosclipboard.mm +++ b/src/plugins/platforms/ios/qiosclipboard.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index 9c0f4d9306..c7541fc51b 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index 87f658608a..f4567f36f4 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index 8360df0d7f..ef24abbfd9 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 0a62dc9b13..22847b0612 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 0dea043409..33328e0490 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h index f18af65fd5..f65a90fb40 100644 --- a/src/plugins/platforms/ios/qiosmenu.h +++ b/src/plugins/platforms/ios/qiosmenu.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm index bdab23f59a..40f0082b9d 100644 --- a/src/plugins/platforms/ios/qiosmenu.mm +++ b/src/plugins/platforms/ios/qiosmenu.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosplatformaccessibility.mm b/src/plugins/platforms/ios/qiosplatformaccessibility.mm index 5124d8ebd8..bfe91df7bd 100644 --- a/src/plugins/platforms/ios/qiosplatformaccessibility.mm +++ b/src/plugins/platforms/ios/qiosplatformaccessibility.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index de1d8a29c7..324133074b 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosservices.mm b/src/plugins/platforms/ios/qiosservices.mm index de59b20a92..cd5ff425cd 100644 --- a/src/plugins/platforms/ios/qiosservices.mm +++ b/src/plugins/platforms/ios/qiosservices.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiostextresponder.h b/src/plugins/platforms/ios/qiostextresponder.h index f87559ccec..4cb8a9c815 100644 --- a/src/plugins/platforms/ios/qiostextresponder.h +++ b/src/plugins/platforms/ios/qiostextresponder.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index bafab3db67..f0cb021da0 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm index 29cd897b71..edeabf66dc 100644 --- a/src/plugins/platforms/ios/qiostheme.mm +++ b/src/plugins/platforms/ios/qiostheme.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index db55562a8a..02c3a2d28d 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index be8efdc79e..fd04ecf474 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/quiaccessibilityelement.mm b/src/plugins/platforms/ios/quiaccessibilityelement.mm index c983655c51..2cecfc1126 100644 --- a/src/plugins/platforms/ios/quiaccessibilityelement.mm +++ b/src/plugins/platforms/ios/quiaccessibilityelement.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index 22d406cbdc..9470d1844e 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/quiview_accessibility.mm b/src/plugins/platforms/ios/quiview_accessibility.mm index 739aaea769..496ee7605e 100644 --- a/src/plugins/platforms/ios/quiview_accessibility.mm +++ b/src/plugins/platforms/ios/quiview_accessibility.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 4e1b7e3026..22d443733e 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -36,3 +36,7 @@ contains(QT_CONFIG, directfb) { } contains(QT_CONFIG, linuxfb): SUBDIRS += linuxfb + +haiku { + SUBDIRS += haiku +} diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index b5c6b48931..95a8e44cb8 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -105,17 +105,13 @@ CONFIG(blackberry) { LIBS += -lbps } -CONFIG(blackberry-playbook) { - SOURCES += qqnxfiledialoghelper_playbook.cpp -} else { - CONFIG(blackberry) { - SOURCES += qqnxfiledialoghelper_bb10.cpp \ - qqnxfilepicker.cpp \ - qqnxnavigatorcover.cpp - - HEADERS += qqnxfilepicker.h \ - qqnxnavigatorcover.h - } +CONFIG(blackberry) { + SOURCES += qqnxfiledialoghelper_bb10.cpp \ + qqnxfilepicker.cpp \ + qqnxnavigatorcover.cpp + + HEADERS += qqnxfilepicker.h \ + qqnxnavigatorcover.h } CONFIG(qqnx_pps) { diff --git a/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp index f4258017e3..3950681c5e 100644 --- a/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp +++ b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp @@ -119,24 +119,6 @@ void QQnxBpsEventFilter::unregisterForScreenEvents(QQnxScreen *screen) qWarning("QQNX: failed to unregister for screen events on screen %p", screen->nativeContext()); } -#if defined(Q_OS_BLACKBERRY_TABLET) -void QQnxBpsEventFilter::registerForDialogEvents(QQnxFileDialogHelper *dialog) -{ - if (dialog_request_events(0) != BPS_SUCCESS) - qWarning("QQNX: failed to register for dialog events"); - dialog_instance_t nativeDialog = dialog->nativeDialog(); - if (!m_dialogMapper.contains(nativeDialog)) - m_dialogMapper.insert(nativeDialog, dialog); -} - -void QQnxBpsEventFilter::unregisterForDialogEvents(QQnxFileDialogHelper *dialog) -{ - int count = m_dialogMapper.remove(dialog->nativeDialog()); - if (count == 0) - qWarning("QQNX: attempting to unregister dialog that was not registered"); -} -#endif // Q_OS_BLACKBERRY_TABLET - bool QQnxBpsEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) { Q_UNUSED(eventType); @@ -155,15 +137,6 @@ bool QQnxBpsEventFilter::nativeEventFilter(const QByteArray &eventType, void *me return m_screenEventHandler->handleEvent(screenEvent); } -#if defined(Q_OS_BLACKBERRY_TABLET) - if (eventDomain == dialog_get_domain()) { - dialog_instance_t nativeDialog = dialog_event_get_dialog_instance(event); - QQnxFileDialogHelper *dialog = m_dialogMapper.value(nativeDialog, 0); - if (dialog) - return dialog->handleEvent(event); - } -#endif - if (eventDomain == navigator_get_domain()) return handleNavigatorEvent(event); @@ -218,14 +191,8 @@ bool QQnxBpsEventFilter::handleNavigatorEvent(bps_event_t *event) break; case NAVIGATOR_WINDOW_THUMBNAIL: m_navigatorEventHandler->handleWindowGroupStateChanged(id, Qt::WindowMinimized); -#if defined(Q_OS_BLACKBERRY_TABLET) - m_navigatorEventHandler->handleWindowGroupActivated(id); -#endif break; case NAVIGATOR_WINDOW_INVISIBLE: -#if defined(Q_OS_BLACKBERRY_TABLET) - m_navigatorEventHandler->handleWindowGroupDeactivated(id); -#endif break; } diff --git a/src/plugins/platforms/qnx/qqnxbpseventfilter.h b/src/plugins/platforms/qnx/qqnxbpseventfilter.h index 4fe28e909f..f1d67848e8 100644 --- a/src/plugins/platforms/qnx/qqnxbpseventfilter.h +++ b/src/plugins/platforms/qnx/qqnxbpseventfilter.h @@ -65,11 +65,6 @@ public: void registerForScreenEvents(QQnxScreen *screen); void unregisterForScreenEvents(QQnxScreen *screen); -#ifdef Q_OS_BLACKBERRY_TABLET - void registerForDialogEvents(QQnxFileDialogHelper *dialog); - void unregisterForDialogEvents(QQnxFileDialogHelper *dialog); -#endif - private: bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h index 4c8a4fbd50..76cceafcfe 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h @@ -41,13 +41,7 @@ QT_BEGIN_NAMESPACE class QQnxIntegration; -#if defined(Q_OS_BLACKBERRY_TABLET) -#include <bps/dialog.h> -#define NativeDialogPtr dialog_instance_t -#else class QQnxFilePicker; -#define NativeDialogPtr QQnxFilePicker * -#endif class QQnxFileDialogHelper : public QPlatformFileDialogHelper { @@ -56,10 +50,6 @@ public: explicit QQnxFileDialogHelper(const QQnxIntegration *); ~QQnxFileDialogHelper(); -#if defined(Q_OS_BLACKBERRY_TABLET) - bool handleEvent(bps_event_t *event); -#endif - void exec(); bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent); @@ -74,29 +64,22 @@ public: void selectNameFilter(const QString &filter); QString selectedNameFilter() const; - NativeDialogPtr nativeDialog() const { return m_dialog; } + QQnxFilePicker *nativeDialog() const { return m_dialog; } Q_SIGNALS: void dialogClosed(); private Q_SLOTS: -#if !defined(Q_OS_BLACKBERRY_TABLET) void emitSignals(); -#endif private: void setNameFilter(const QString &filter); void setNameFilters(const QStringList &filters); const QQnxIntegration *m_integration; - NativeDialogPtr m_dialog; + QQnxFilePicker *m_dialog; QFileDialogOptions::AcceptMode m_acceptMode; QString m_selectedFilter; - -#if defined(Q_OS_BLACKBERRY_TABLET) - QPlatformDialogHelper::DialogCode m_result; - QList<QUrl> m_paths; -#endif }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper_playbook.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper_playbook.cpp deleted file mode 100644 index 699ca97527..0000000000 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper_playbook.cpp +++ /dev/null @@ -1,312 +0,0 @@ -/*************************************************************************** -** -** Copyright (C) 2012 Research In Motion -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qqnxfiledialoghelper.h" - -#include "qqnxbpseventfilter.h" -#include "qqnxscreen.h" -#include "qqnxintegration.h" - -#include <QDebug> -#include <QEventLoop> -#include <QScreen> -#include <QTimer> -#include <QWindow> - -#if defined(QQNXFILEDIALOGHELPER_DEBUG) -#define qFileDialogHelperDebug qDebug -#else -#define qFileDialogHelperDebug QT_NO_QDEBUG_MACRO -#endif - -QT_BEGIN_NAMESPACE - -QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration) - : QPlatformFileDialogHelper(), - m_integration(integration), - m_dialog(0), - m_acceptMode(QFileDialogOptions::AcceptOpen), - m_selectedFilter(), - m_result(QPlatformDialogHelper::Rejected), - m_paths() -{ -} - -QQnxFileDialogHelper::~QQnxFileDialogHelper() -{ - if (m_dialog) - dialog_destroy(m_dialog); -} - -bool QQnxFileDialogHelper::handleEvent(bps_event_t *event) -{ - qFileDialogHelperDebug() << Q_FUNC_INFO; - - // Check dialog event response type (OK vs CANCEL) - // CANCEL => index = 0 - // OK => index = 1 - int index = dialog_event_get_selected_index(event); - qFileDialogHelperDebug() << "Index =" << index; - if (index == 1) { - m_result = QPlatformDialogHelper::Accepted; - - if (m_acceptMode == QFileDialogOptions::AcceptOpen) { - // File open dialog - - // ###TODO Check that this actually gets multiple paths and cleans up properly - char **filePaths = 0; - int pathCount = 0; - int result = dialog_event_get_filebrowse_filepaths(event, &filePaths, &pathCount); - if (result != BPS_SUCCESS) { - qWarning() << "Could not get paths from native file dialog"; - return false; - } - - for (int i = 0; i < pathCount; ++i) { - QString path = QFile::decodeName(filePaths[i]); - m_paths.append(QUrl::fromLocalFile(path)); - qFileDialogHelperDebug() << "path =" << path; - } - - bps_free(filePaths); - } else { - // File save dialog - const char *filePath = dialog_event_get_filesave_filepath(event); - QString path = QFile::decodeName(filePath); - qFileDialogHelperDebug() << "path =" << path; - m_paths.append(QUrl::fromLocalFile(path)); - } - } else { // Cancel - m_result = QPlatformDialogHelper::Rejected; - } - - Q_EMIT dialogClosed(); - - return true; -} - -void QQnxFileDialogHelper::exec() -{ - qFileDialogHelperDebug() << Q_FUNC_INFO; - - // Clear any previous results - m_paths.clear(); - - QEventLoop loop; - connect(this, SIGNAL(dialogClosed()), &loop, SLOT(quit())); - loop.exec(); - - if (m_result == QPlatformDialogHelper::Accepted) - Q_EMIT accept(); - else - Q_EMIT reject(); -} - -bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) -{ - Q_UNUSED(flags); - qFileDialogHelperDebug() << Q_FUNC_INFO; - - QQnxBpsEventFilter *eventFilter = m_integration->bpsEventFilter(); - // We *really* need the bps event filter ;) - if (!eventFilter) - return false; - - // Native dialogs can only handle application modal use cases so far - if (modality != Qt::ApplicationModal) - return false; - - // Tear down any existing dialog and start again as dialog mode may have changed - if (m_dialog) { - dialog_destroy(m_dialog); - m_dialog = 0; - } - - // Create dialog - const QSharedPointer<QFileDialogOptions> &opts = options(); - if (opts->acceptMode() == QFileDialogOptions::AcceptOpen) { - if (dialog_create_filebrowse(&m_dialog) != BPS_SUCCESS) { - qWarning("dialog_create_filebrowse failed"); - return false; - } - - // Select one or many files? - bool multiSelect = (opts->fileMode() == QFileDialogOptions::ExistingFiles); - dialog_set_filebrowse_multiselect(m_dialog, multiSelect); - - // Set the actual list of extensions - if (!opts->nameFilters().isEmpty()) { - qFileDialogHelperDebug() << "nameFilters =" << opts->nameFilters(); - setNameFilter(opts->nameFilters().first()); - } else { - QString defaultNameFilter = QStringLiteral("*.*"); - setNameFilter(defaultNameFilter); - } - } else { - if (dialog_create_filesave(&m_dialog) != BPS_SUCCESS) { - qWarning("dialog_create_filesave failed"); - return false; - } - - // Maybe pre-select a filename - if (!opts->initiallySelectedFiles().isEmpty()) { - QString fileName = opts->initiallySelectedFiles().first().toLocalFile(); - dialog_set_filesave_filename(m_dialog, QFile::encodeName(fileName).constData()); - } - - // Add OK and Cancel buttons. We add the buttons in the order "CANCEL" followed by "OK - // such that they have indices matching the buttons on the file open dialog which - // is automatically populated with buttons. - if (dialog_add_button(m_dialog, tr("CANCEL").toLocal8Bit().constData(), true, 0, true) != BPS_SUCCESS) { - qWarning("dialog_add_button failed"); - return false; - } - - if (dialog_add_button(m_dialog, tr("OK").toLocal8Bit().constData(), true, 0, true) != BPS_SUCCESS) { - qWarning("dialog_add_button failed"); - return false; - } - } - - // Cache the accept mode so we know which functions to use to get the results back - m_acceptMode = opts->acceptMode(); - - // Set the libscreen window group and common properties - - QQnxScreen *nativeScreen = parent ? static_cast<QQnxScreen *>(parent->screen()->handle()) : - m_integration->primaryDisplay(); - Q_ASSERT(nativeScreen); - dialog_set_group_id(m_dialog, nativeScreen->windowGroupName()); - dialog_set_title_text(m_dialog, opts->windowTitle().toLocal8Bit().constData()); - - // Register ourselves for dialog domain events from bps - eventFilter->registerForDialogEvents(this); - - // Show the dialog - dialog_show(m_dialog); - - return true; -} - -void QQnxFileDialogHelper::hide() -{ - qFileDialogHelperDebug() << Q_FUNC_INFO; - if (!m_dialog) - return; - dialog_cancel(m_dialog); -} - -bool QQnxFileDialogHelper::defaultNameFilterDisables() const -{ - qFileDialogHelperDebug() << Q_FUNC_INFO; - return false; -} - -void QQnxFileDialogHelper::setDirectory(const QUrl &directory) -{ - qFileDialogHelperDebug() << Q_FUNC_INFO << "directory =" << directory; - // No native API for setting the directory(!). The best we can do is to - // set it as the file name but even then only with a file save dialog. - if (m_dialog && m_acceptMode == QFileDialogOptions::AcceptSave) - dialog_set_filesave_filename(m_dialog, QFile::encodeName(directory.toLocalFile()).constData()); -} - -QUrl QQnxFileDialogHelper::directory() const -{ - qFileDialogHelperDebug() << Q_FUNC_INFO; - return m_paths.first(); -} - -void QQnxFileDialogHelper::selectFile(const QUrl &fileName) -{ - qFileDialogHelperDebug() << Q_FUNC_INFO << "filename =" << fileName; - if (m_dialog && m_acceptMode == QFileDialogOptions::AcceptSave) - dialog_set_filesave_filename(m_dialog, QFile::encodeName(fileName.toLocalFile()).constData()); -} - -QList<QUrl> QQnxFileDialogHelper::selectedFiles() const -{ - qFileDialogHelperDebug() << Q_FUNC_INFO; - return m_paths; -} - -void QQnxFileDialogHelper::setFilter() -{ - // No native api to support setting a filter from QDir::Filters - qFileDialogHelperDebug() << Q_FUNC_INFO; -} - -void QQnxFileDialogHelper::selectNameFilter(const QString &filter) -{ - qFileDialogHelperDebug() << Q_FUNC_INFO << "filter =" << filter; - setNameFilter(filter); -} - -QString QQnxFileDialogHelper::selectedNameFilter() const -{ - // For now there is no way for the user to change the selected filter - // so this just reflects what the developer has set programmatically. - qFileDialogHelperDebug() << Q_FUNC_INFO; - return m_selectedFilter; -} - -void QQnxFileDialogHelper::setNameFilter(const QString &filter) -{ - qFileDialogHelperDebug() << Q_FUNC_INFO << "filter =" << filter; - setNameFilters(QPlatformFileDialogHelper::cleanFilterList(filter)); -} - -void QQnxFileDialogHelper::setNameFilters(const QStringList &filters) -{ - qFileDialogHelperDebug() << Q_FUNC_INFO << "filters =" << filters; - - Q_ASSERT(!filters.isEmpty()); - - char **globs = new char*[filters.size()]; - for (int i = 0; i < filters.size(); ++i) { - QByteArray glob = filters.at(i).toLocal8Bit(); - globs[i] = new char[glob.length()]; - strcpy(globs[i], glob.constData()); - } - - // Set the filters - dialog_set_filebrowse_filter(m_dialog, const_cast<const char**>(globs), filters.size()); - m_selectedFilter = filters.first(); - - // Cleanup - for (int i = 0; i < filters.size(); ++i) - delete[] globs[i]; - delete[] globs; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.cpp b/src/plugins/platforms/qnx/qqnxfilepicker.cpp index cce7c44823..96ca531899 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.cpp +++ b/src/plugins/platforms/qnx/qqnxfilepicker.cpp @@ -127,13 +127,7 @@ void QQnxFilePicker::open() map[QStringLiteral("Filter")] = m_filters.join(QLatin1Char(';')); QByteArray ppsData; -#if defined(Q_OS_BLACKBERRY_TABLET) - QJsonDocument document; - document.setObject(QJsonObject::fromVariantMap(map)); - ppsData = document.toJson(QJsonDocument::Compact); -#else ppsData = QPpsObject::encode(map); -#endif errorCode = navigator_invoke_invocation_set_data(m_invocationHandle, ppsData.constData(), ppsData.size()); if (errorCode != BPS_SUCCESS) { diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 7b7de01c82..85c7a91dec 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -585,7 +585,7 @@ void QQnxScreen::addWindow(QQnxWindow *window) m_childWindows.push_back(window); updateHierarchy(); } else { -#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) +#if defined(Q_OS_BLACKBERRY) m_coverWindow = window; #endif } diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp index 68be0c98cf..3d749b486d 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp @@ -38,7 +38,7 @@ #include <bps/event.h> #include <bps/locale.h> #include <bps/virtualkeyboard.h> -#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) +#if defined(Q_OS_BLACKBERRY) #include <bbndk.h> #endif @@ -118,21 +118,17 @@ virtualkeyboard_layout_t QQnxVirtualKeyboardBps::keyboardLayout() const return VIRTUALKEYBOARD_LAYOUT_WEB; case NumPunc: return VIRTUALKEYBOARD_LAYOUT_NUM_PUNC; -#ifndef Q_OS_BLACKBERRY_TABLET case Number: return VIRTUALKEYBOARD_LAYOUT_NUMBER; -#endif case Symbol: return VIRTUALKEYBOARD_LAYOUT_SYMBOL; case Phone: return VIRTUALKEYBOARD_LAYOUT_PHONE; case Pin: return VIRTUALKEYBOARD_LAYOUT_PIN; -#ifndef Q_OS_BLACKBERRY_TABLET case Password: return VIRTUALKEYBOARD_LAYOUT_PASSWORD; -#endif -#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) +#if defined(Q_OS_BLACKBERRY) #if BBNDK_VERSION_AT_LEAST(10, 2, 1) case Alphanumeric: return VIRTUALKEYBOARD_LAYOUT_ALPHANUMERIC; diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 19e6991a68..3f92bcbc01 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -48,9 +48,7 @@ #include <QtCore/QDebug> #if defined(Q_OS_BLACKBERRY) -#if !defined(Q_OS_BLACKBERRY_TABLET) #include "qqnxnavigatorcover.h" -#endif #include <sys/pps.h> #include <bps/navigator.h> #endif @@ -635,7 +633,7 @@ QQnxWindow *QQnxWindow::findWindow(screen_window_t windowHandle) void QQnxWindow::minimize() { -#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) +#if defined(Q_OS_BLACKBERRY) qWindowDebug() << Q_FUNC_INFO; pps_encoder_t encoder; @@ -689,7 +687,7 @@ void QQnxWindow::initWindow() setScreen(platformScreen); if (window()->type() == Qt::CoverWindow) { -#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) +#if defined(Q_OS_BLACKBERRY) if (platformScreen->rootWindow()) { screen_set_window_property_pv(m_screen->rootWindow()->nativeHandle(), SCREEN_PROPERTY_ALTERNATE_WINDOW, (void**)&m_window); diff --git a/src/plugins/platforms/windows/qwindowsscaling.h b/src/plugins/platforms/windows/qwindowsscaling.h index 02489f0a13..39e554bbe2 100644 --- a/src/plugins/platforms/windows/qwindowsscaling.h +++ b/src/plugins/platforms/windows/qwindowsscaling.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp index a08054d032..6cd99c38ef 100644 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp +++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h index e1315d646c..13abf6e2b8 100644 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h +++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.cpp b/src/plugins/platforms/winrt/qwinrtfileengine.cpp index 664002a085..f4e307eb07 100644 --- a/src/plugins/platforms/winrt/qwinrtfileengine.cpp +++ b/src/plugins/platforms/winrt/qwinrtfileengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.h b/src/plugins/platforms/winrt/qwinrtfileengine.h index ef698dc4f2..30357759fb 100644 --- a/src/plugins/platforms/winrt/qwinrtfileengine.h +++ b/src/plugins/platforms/winrt/qwinrtfileengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.cpp index a454a8a048..75237ad268 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h index de2bf6113f..c71c668f31 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp index efa5c87ad5..10411e72e2 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h index 272e01988a..466488c8de 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h index fe7daec068..f9a25cc12a 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationplugin.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp index 19b3fc0bc3..8416be66fb 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.h b/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.h index bc18eaec1d..b562109e12 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.h +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h index 8790451789..9b903d8212 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h index 1d651a428d..ec59cbc7c9 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp index 16d32b3235..a456317801 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h index 1f7fd4fc94..3f7134c1a1 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglmain.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglmain.cpp index e34057a22c..72b471be67 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglmain.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglmain.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp index 1187733b23..891f187238 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h index 2e9be95300..92a48fc144 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp index 9e5b67438c..a26280b399 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h index cce39eaf7b..dfb32332bc 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index cb56f67282..ce72cb64d0 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h index 8aa3dbb983..4366d07b42 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxmain.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxmain.cpp index d814892660..9d2fb54e5a 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxmain.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxmain.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp index d416b5ee1a..045185e40c 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h index 88a3fa26ce..d671bc1995 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp index b866a321c2..99b2337395 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h index 6155c46632..9ff67ff94f 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 17600839e7..e3d9766a4b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -404,11 +404,15 @@ public: void xi2Select(xcb_window_t window); #endif #ifdef XCB_USE_XINPUT21 - bool isUsingXInput21() { return m_xi2Enabled && m_xi2Minor >= 1; } + bool isUsingXInput21() const { return m_xi2Enabled && m_xi2Minor >= 1; } #else - bool isUsingXInput21() { return false; } + bool isUsingXInput21() const { return false; } +#endif +#ifdef XCB_USE_XINPUT22 + bool isUsingXInput22() const { return m_xi2Enabled && m_xi2Minor >= 2; } +#else + bool isUsingXInput22() const { return false; } #endif - void sync(); @@ -657,7 +661,7 @@ cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, #else #define Q_XCB_CALL(x) x #define Q_XCB_CALL2(x, connection) x -#define Q_XCB_NOOP(c) +#define Q_XCB_NOOP(c) (void)c; #endif QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index c63a9c88bc..f225518cb9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -274,21 +274,23 @@ void QXcbConnection::xi2Select(xcb_window_t window) unsigned char *xiBitMask = reinterpret_cast<unsigned char *>(&bitMask); #ifdef XCB_USE_XINPUT22 - bitMask |= XI_TouchBeginMask; - bitMask |= XI_TouchUpdateMask; - bitMask |= XI_TouchEndMask; - XIEventMask mask; - mask.mask_len = sizeof(bitMask); - mask.mask = xiBitMask; - if (!m_touchDevices.isEmpty()) { - mask.deviceid = XIAllMasterDevices; - Status result = XISelectEvents(xDisplay, window, &mask, 1); - // If we select for touch events on the master pointer, XInput2 - // will not synthesize mouse events. This means Qt must do it, - // which is also preferable, since Qt can control better when - // to do so. - if (m_xi2Minor >= 2 && result == Success) - has_touch_without_mouse_emulation = true; + if (isUsingXInput22()) { + bitMask |= XI_TouchBeginMask; + bitMask |= XI_TouchUpdateMask; + bitMask |= XI_TouchEndMask; + XIEventMask mask; + mask.mask_len = sizeof(bitMask); + mask.mask = xiBitMask; + if (!m_touchDevices.isEmpty()) { + mask.deviceid = XIAllMasterDevices; + Status result = XISelectEvents(xDisplay, window, &mask, 1); + // If we select for touch events on the master pointer, XInput2 + // will not synthesize mouse events. This means Qt must do it, + // which is also preferable, since Qt can control better when + // to do so. + if (result == Success) + has_touch_without_mouse_emulation = true; + } } #endif // XCB_USE_XINPUT22 diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 791f91e054..2e9ba0e8c5 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -170,7 +170,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char qDebug() << "QXcbIntegration: Connecting to additional display: " << parameters.at(i) << parameters.at(i+1); #endif QString display = parameters.at(i) + QLatin1Char(':') + parameters.at(i+1); - m_connections << new QXcbConnection(m_nativeInterface.data(), display.toLatin1().constData()); + m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, display.toLatin1().constData()); } m_fontDatabase.reset(new QGenericUnixFontDatabase()); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 95db0c56c1..5f322108a5 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -86,8 +86,7 @@ static int resourceType(const QByteArray &key) QXcbNativeInterface::QXcbNativeInterface() : m_genericEventFilterType(QByteArrayLiteral("xcb_generic_event_t")), m_sysTraySelectionAtom(XCB_ATOM_NONE), - m_systrayVisualId(XCB_NONE), - m_dbusTrayConnection(Q_NULLPTR) + m_systrayVisualId(XCB_NONE) { } diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 388d774853..64da388258 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -121,7 +121,6 @@ private: xcb_atom_t m_sysTraySelectionAtom; xcb_visualid_t m_systrayVisualId; - QDBusMenuConnection *m_dbusTrayConnection; static QXcbScreen *qPlatformScreenForWindow(QWindow *window); |