├── .tag ├── AUTHORS.md ├── LICENSE.GPLv2 ├── LICENSE.GPLv3 ├── LICENSE.LGPLv3 ├── README.md ├── data └── protocols │ └── wayland │ └── fullscreen-shell-unstable-v1.xml ├── src ├── deployment.qbs ├── eglfsxkb │ ├── eglfsxkb.cpp │ ├── eglfsxkb.h │ └── eglfsxkb.qbs ├── libinput │ ├── libinput.qbs │ ├── libinputgesture.cpp │ ├── libinputgesture.h │ ├── libinputhandler.cpp │ ├── libinputhandler.h │ ├── libinputhandler_p.h │ ├── libinputkeyboard.cpp │ ├── libinputkeyboard.h │ ├── libinputkeyboard_p.h │ ├── libinputpointer.cpp │ ├── libinputpointer.h │ ├── libinputtouch.cpp │ ├── libinputtouch.h │ ├── lirilibinputglobal.h │ ├── logging.cpp │ └── logging_p.h ├── libs.qbs ├── platformheaders │ ├── lirieglfsfunctions.cpp │ ├── lirieglfsfunctions.h │ ├── liriplatformheadersglobal.h │ └── platformheaders.qbs ├── platformsupport │ ├── edid │ │ ├── edid.qbs │ │ ├── qedidparser.cpp │ │ ├── qedidparser_p.h │ │ └── qedidvendortable_p.h │ └── kmsconvenience │ │ ├── kmsconvenience.qbs │ │ ├── qkmsdevice.cpp │ │ └── qkmsdevice_p.h └── plugins │ ├── platforms │ └── eglfs │ │ ├── api │ │ ├── libinputmanager.cpp │ │ ├── libinputmanager_p.h │ │ ├── qeglfscontext.cpp │ │ ├── qeglfscontext_p.h │ │ ├── qeglfscursor.cpp │ │ ├── qeglfscursor_p.h │ │ ├── qeglfsdeviceintegration.cpp │ │ ├── qeglfsdeviceintegration_p.h │ │ ├── qeglfsglobal_p.h │ │ ├── qeglfshooks.cpp │ │ ├── qeglfshooks_p.h │ │ ├── qeglfsintegration.cpp │ │ ├── qeglfsintegration_p.h │ │ ├── qeglfslogindhandler.cpp │ │ ├── qeglfslogindhandler_p.h │ │ ├── qeglfsoffscreenwindow.cpp │ │ ├── qeglfsoffscreenwindow_p.h │ │ ├── qeglfsscreen.cpp │ │ ├── qeglfsscreen_p.h │ │ ├── qeglfswindow.cpp │ │ ├── qeglfswindow_p.h │ │ ├── vthandler.cpp │ │ ├── vthandler.h │ │ └── vthandler_p.h │ │ ├── cursor-atlas.png │ │ ├── cursor.json │ │ ├── cursor.qrc │ │ ├── deviceintegration │ │ ├── eglfs_kms │ │ │ ├── eglfs_kms.json │ │ │ ├── eglfs_kms.qbs │ │ │ ├── qeglfskmsgbmcursor.cpp │ │ │ ├── qeglfskmsgbmcursor.h │ │ │ ├── qeglfskmsgbmdevice.cpp │ │ │ ├── qeglfskmsgbmdevice.h │ │ │ ├── qeglfskmsgbmintegration.cpp │ │ │ ├── qeglfskmsgbmintegration.h │ │ │ ├── qeglfskmsgbmmain.cpp │ │ │ ├── qeglfskmsgbmscreen.cpp │ │ │ ├── qeglfskmsgbmscreen.h │ │ │ ├── qeglfskmsgbmwindow.cpp │ │ │ └── qeglfskmsgbmwindow.h │ │ ├── eglfs_kms_egldevice │ │ │ ├── eglfs_kms_egldevice.json │ │ │ ├── eglfs_kms_egldevice.qbs │ │ │ ├── qeglfskmsegldevice.cpp │ │ │ ├── qeglfskmsegldevice.h │ │ │ ├── qeglfskmsegldeviceintegration.cpp │ │ │ ├── qeglfskmsegldeviceintegration.h │ │ │ ├── qeglfskmsegldevicemain.cpp │ │ │ ├── qeglfskmsegldevicescreen.cpp │ │ │ └── qeglfskmsegldevicescreen.h │ │ └── eglfs_kms_support │ │ │ ├── eglfs_kms_support.qbs │ │ │ ├── qeglfskmsdevice.cpp │ │ │ ├── qeglfskmsdevice.h │ │ │ ├── qeglfskmsintegration.cpp │ │ │ ├── qeglfskmsintegration.h │ │ │ ├── qeglfskmsscreen.cpp │ │ │ └── qeglfskmsscreen.h │ │ ├── eglfs-plugin.qbs │ │ ├── eglfs.qbs │ │ ├── eglfsdeviceintegration.qbs │ │ ├── liri.json │ │ └── qeglfsmain.cpp │ ├── plugins.qbs │ └── shellintegrations │ └── fullscreen-shell │ ├── fullscreen-shell.json │ ├── fullscreen-shell.qbs │ ├── fullscreenshellintegration.cpp │ ├── fullscreenshellintegration.h │ ├── fullscreenshellsurface.cpp │ ├── fullscreenshellsurface.h │ └── main.cpp ├── tests └── manual │ ├── libinput │ ├── libinput.qbs │ └── tst_libinput.cpp │ └── manual.qbs └── wayland.qbs /.tag: -------------------------------------------------------------------------------- 1 | c382e327205577c9e7d3bbe052b29e332382fe6c 2 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | Liri Wayland 2 | ============ 3 | 4 | # Core Developers 5 | 6 | * Pier Luigi Fiorini 7 | 8 | # Contributors 9 | 10 | You can see the list of contributors to this code base, 11 | and the number of their commits with: 12 | 13 | ```sh 14 | git shortlog -s -e -n 15 | ``` 16 | -------------------------------------------------------------------------------- /src/deployment.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | Project { 4 | name: "Deployment" 5 | 6 | InstallPackage { 7 | name: "liri-wayland-artifacts" 8 | targetName: name 9 | builtByDefault: false 10 | 11 | archiver.type: "tar" 12 | archiver.outputDirectory: project.buildDirectory 13 | 14 | Depends { name: "fullscreen-shell"; required: false } 15 | Depends { name: "LiriEglFSDeviceIntegration"; required: false } 16 | Depends { name: "LiriEglFSDeviceIntegration-qbs"; required: false } 17 | Depends { name: "LiriLibInput"; required: false } 18 | Depends { name: "LiriLibInput-pkgconfig"; required: false } 19 | Depends { name: "LiriLibInput-qbs"; required: false } 20 | Depends { name: "LiriPlatformHeaders"; required: false } 21 | Depends { name: "LiriPlatformHeaders-qbs"; required: false } 22 | Depends { name: "lirieglfs"; required: false } 23 | Depends { name: "eglfs-kms-egldevice-integration"; required: false } 24 | Depends { name: "eglfs-kms-integration"; required: false } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/eglfsxkb/eglfsxkb.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:LGPL$ 10 | * 11 | * This file may be used under the terms of the GNU Lesser General Public 12 | * License version 2.1 or later as published by the Free Software Foundation 13 | * and appearing in the file LICENSE.LGPLv21 included in the packaging of 14 | * this file. Please review the following information to ensure the 15 | * GNU Lesser General Public License version 2.1 requirements will be 16 | * met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 17 | * 18 | * Alternatively, this file may be used under the terms of the GNU General 19 | * Public License version 2.0 or later as published by the Free Software 20 | * Foundation and appearing in the file LICENSE.GPLv2 included in the 21 | * packaging of this file. Please review the following information to ensure 22 | * the GNU General Public License version 2.0 requirements will be 23 | * met: http://www.gnu.org/licenses/gpl-2.0.html. 24 | * 25 | * $END_LICENSE$ 26 | ***************************************************************************/ 27 | 28 | #ifndef LIRI_EGLFSXKB_H 29 | #define LIRI_EGLFSXKB_H 30 | 31 | #include 32 | 33 | #include 34 | 35 | namespace Liri { 36 | 37 | namespace Platform { 38 | 39 | class EglFSXkb 40 | { 41 | public: 42 | static int keysymToQtKey(xkb_keysym_t keysym); 43 | static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text); 44 | static Qt::KeyboardModifiers modifiers(xkb_state *state); 45 | }; 46 | 47 | } // namespace Platform 48 | 49 | } // namespace Liri 50 | 51 | #endif // LIRI_EGLFSXKB_H 52 | -------------------------------------------------------------------------------- /src/eglfsxkb/eglfsxkb.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | StaticLibrary { 4 | name: "eglfsxkb" 5 | targetName: "eglfsxkb" 6 | 7 | Depends { name: "cpp" } 8 | Depends { name: "Qt.core"; versionAtLeast: project.minimumQtVersion } 9 | Depends { name: "xkbcommon" } 10 | 11 | condition: { 12 | if (!xkbcommon.found) { 13 | console.error("xkbcommon is required to build " + targetName); 14 | return false; 15 | } 16 | 17 | return true; 18 | } 19 | 20 | files: ["*.cpp", "*.h"] 21 | 22 | Export { 23 | Depends { name: "cpp" } 24 | Depends { name: "Qt.core" } 25 | Depends { name: "xkbcommon" } 26 | 27 | cpp.includePaths: base.concat([product.sourceDirectory]) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/libinput/libinput.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | import LiriUtils 3 | 4 | LiriModuleProject { 5 | name: moduleName 6 | moduleName: "LiriLibInput" 7 | description: "Qt API for libinput" 8 | createPkgConfig: false 9 | createCMake: false 10 | conditionFunction: (function() { 11 | if (!libinput.found) { 12 | console.error("libinput is required to build " + targetName); 13 | return false; 14 | } 15 | 16 | return true; 17 | }) 18 | 19 | resolvedProperties: ({ 20 | Depends: [{ name: LiriUtils.quote("Qt.core") }, 21 | { name: LiriUtils.quote("Qt.core-private") }, 22 | { name: LiriUtils.quote("Qt.gui") }, 23 | { name: LiriUtils.quote("Qt.gui-private") }, 24 | { name: LiriUtils.quote("libinput") }, 25 | { name: LiriUtils.quote("Qt5Udev") }, 26 | { name: LiriUtils.quote("LiriLogind") }, 27 | { name: LiriUtils.quote("Qt.service_support-private") }, 28 | { name: LiriUtils.quote("Qt.theme_support-private") }, 29 | { name: LiriUtils.quote("Qt.eventdispatcher_support-private") }], 30 | }) 31 | 32 | LiriHeaders { 33 | name: project.headersName 34 | sync.module: project.moduleName 35 | sync.classNames: ({ 36 | "libinputgesture.h": ["LibInputGestore"], 37 | "libinputhandler.h": ["LibInputHandler"], 38 | "libinputkeyboard.h": ["LibInputKeyboard"], 39 | "libinputpointer.h": ["LibInputPointer"], 40 | "libinputtouch.h": ["LibInputTouch"], 41 | }) 42 | 43 | Group { 44 | name: "Headers" 45 | files: "**/*.h" 46 | fileTags: ["hpp_syncable"] 47 | } 48 | } 49 | 50 | LiriPrivateModule { 51 | targetName: project.targetName 52 | 53 | Depends { name: project.headersName } 54 | Depends { 55 | name: "Qt" 56 | submodules: ["core", "core-private", "gui", "gui-private"] 57 | versionAtLeast: project.minimumQtVersion 58 | } 59 | Depends { name: "libinput" } 60 | Depends { name: "Qt5Udev" } 61 | Depends { name: "LiriLogind" } 62 | Depends { name: "eglfsxkb" } 63 | 64 | cpp.defines: base.concat([ 65 | 'LIRIWAYLAND_VERSION="' + project.version + '"', 66 | "LIRI_BUILD_LIRILIBINPUT_LIB", 67 | "LIRILIBINPUT_STATIC_LIB" 68 | ]) 69 | 70 | files: ["*.cpp", "*.h"] 71 | 72 | Export { 73 | Depends { name: "cpp" } 74 | Depends { name: project.headersName } 75 | Depends { name: "Qt"; submodules: ["core", "core-private", "gui", "gui-private"] } 76 | Depends { name: "libinput" } 77 | Depends { name: "Qt5Udev" } 78 | Depends { name: "LiriLogind" } 79 | 80 | cpp.defines: project.defines 81 | cpp.includePaths: product.sourceDirectory 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/libinput/libinputgesture.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:LGPLv3+$ 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | * 24 | * $END_LICENSE$ 25 | ***************************************************************************/ 26 | 27 | #include 28 | #include 29 | 30 | #include "libinputhandler.h" 31 | #include "libinputgesture.h" 32 | 33 | #include 34 | 35 | namespace Liri { 36 | 37 | namespace Platform { 38 | 39 | LibInputGesture::LibInputGesture(LibInputHandler *handler) 40 | { 41 | Q_UNUSED(handler); 42 | } 43 | 44 | void LibInputGesture::handlePinchBegin(libinput_event_gesture *event) 45 | { 46 | const quint64 timestamp = libinput_event_gesture_get_time_usec(event); 47 | QPointF pos(0, 0); 48 | 49 | #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) 50 | QWindowSystemInterface::handleGestureEvent( 51 | nullptr, nullptr, timestamp, Qt::BeginNativeGesture, 52 | pos, pos); 53 | #else 54 | QWindowSystemInterface::handleGestureEvent( 55 | nullptr, timestamp, Qt::BeginNativeGesture, 56 | pos, pos); 57 | #endif 58 | } 59 | 60 | void LibInputGesture::handlePinchEnd(libinput_event_gesture *event) 61 | { 62 | const quint64 timestamp = libinput_event_gesture_get_time_usec(event); 63 | QPointF pos(0, 0); 64 | 65 | #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) 66 | QWindowSystemInterface::handleGestureEvent( 67 | nullptr, nullptr, timestamp, Qt::EndNativeGesture, 68 | pos, pos); 69 | #else 70 | QWindowSystemInterface::handleGestureEvent( 71 | nullptr, timestamp, Qt::EndNativeGesture, 72 | pos, pos); 73 | #endif 74 | } 75 | 76 | void LibInputGesture::handlePinchUpdate(libinput_event_gesture *event) 77 | { 78 | const quint64 timestamp = libinput_event_gesture_get_time_usec(event); 79 | const double scale = libinput_event_gesture_get_scale(event); 80 | const double angle = libinput_event_gesture_get_angle_delta(event); 81 | QPointF pos(libinput_event_gesture_get_dx(event), 82 | libinput_event_gesture_get_dy(event)); 83 | 84 | #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) 85 | QWindowSystemInterface::handleGestureEventWithRealValue( 86 | nullptr, nullptr, timestamp, Qt::ZoomNativeGesture, 87 | scale, pos, pos); 88 | if (angle != 0.0) 89 | QWindowSystemInterface::handleGestureEventWithRealValue( 90 | nullptr, nullptr, timestamp, Qt::RotateNativeGesture, 91 | angle, pos, pos); 92 | #else 93 | QWindowSystemInterface::handleGestureEventWithRealValue( 94 | nullptr, timestamp, Qt::ZoomNativeGesture, 95 | scale, pos, pos); 96 | if (angle != 0.0) 97 | QWindowSystemInterface::handleGestureEventWithRealValue( 98 | nullptr, timestamp, Qt::RotateNativeGesture, 99 | angle, pos, pos); 100 | #endif 101 | } 102 | 103 | void LibInputGesture::handleSwipeBegin(libinput_event_gesture *event) 104 | { 105 | const quint64 timestamp = libinput_event_gesture_get_time_usec(event); 106 | QPointF pos(0, 0); 107 | 108 | #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) 109 | QWindowSystemInterface::handleGestureEvent( 110 | nullptr, nullptr, timestamp, Qt::BeginNativeGesture, 111 | pos, pos); 112 | #else 113 | QWindowSystemInterface::handleGestureEvent( 114 | nullptr, timestamp, Qt::BeginNativeGesture, 115 | pos, pos); 116 | #endif 117 | } 118 | 119 | void LibInputGesture::handleSwipeEnd(libinput_event_gesture *event) 120 | { 121 | const quint64 timestamp = libinput_event_gesture_get_time_usec(event); 122 | QPointF pos(0, 0); 123 | 124 | #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) 125 | QWindowSystemInterface::handleGestureEvent( 126 | nullptr, nullptr, timestamp, Qt::EndNativeGesture, 127 | pos, pos); 128 | #else 129 | QWindowSystemInterface::handleGestureEvent( 130 | nullptr, timestamp, Qt::EndNativeGesture, 131 | pos, pos); 132 | #endif 133 | } 134 | 135 | void LibInputGesture::handleSwipeUpdate(libinput_event_gesture *event) 136 | { 137 | const quint64 timestamp = libinput_event_gesture_get_time_usec(event); 138 | QPointF pos(libinput_event_gesture_get_dx(event), 139 | libinput_event_gesture_get_dy(event)); 140 | 141 | #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) 142 | QWindowSystemInterface::handleGestureEvent( 143 | nullptr, nullptr, timestamp, Qt::SwipeNativeGesture, 144 | pos, pos); 145 | #else 146 | QWindowSystemInterface::handleGestureEvent( 147 | nullptr, timestamp, Qt::SwipeNativeGesture, 148 | pos, pos); 149 | #endif 150 | } 151 | 152 | } // namespace Platform 153 | 154 | } // namespace Liri 155 | -------------------------------------------------------------------------------- /src/libinput/libinputgesture.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:LGPLv3+$ 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | * 24 | * $END_LICENSE$ 25 | ***************************************************************************/ 26 | 27 | #ifndef LIRI_LIBINPUTGESTURE_H 28 | #define LIRI_LIBINPUTGESTURE_H 29 | 30 | #include 31 | 32 | struct libinput_event_gesture; 33 | 34 | namespace Liri { 35 | 36 | namespace Platform { 37 | 38 | class LibInputHandler; 39 | 40 | class LIRILIBINPUT_EXPORT LibInputGesture 41 | { 42 | public: 43 | LibInputGesture(LibInputHandler *handler); 44 | 45 | void handlePinchBegin(libinput_event_gesture *event); 46 | void handlePinchEnd(libinput_event_gesture *event); 47 | void handlePinchUpdate(libinput_event_gesture *event); 48 | 49 | void handleSwipeBegin(libinput_event_gesture *event); 50 | void handleSwipeEnd(libinput_event_gesture *event); 51 | void handleSwipeUpdate(libinput_event_gesture *event); 52 | }; 53 | 54 | } // namespace Platform 55 | 56 | } // namespace Liri 57 | 58 | #endif // LIRI_LIBINPUTGESTURE_H 59 | -------------------------------------------------------------------------------- /src/libinput/libinputhandler.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:LGPLv3+$ 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | * 24 | * $END_LICENSE$ 25 | ***************************************************************************/ 26 | 27 | #ifndef LIRI_LIBINPUTHANDLER_H 28 | #define LIRI_LIBINPUTHANDLER_H 29 | 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | class QTouchDevice; 36 | 37 | namespace Liri { 38 | 39 | namespace Platform { 40 | 41 | class LibInputHandlerPrivate; 42 | 43 | struct LIRILIBINPUT_EXPORT LibInputKeyEvent 44 | { 45 | int key; 46 | Qt::KeyboardModifiers modifiers; 47 | quint32 nativeScanCode; 48 | quint32 nativeVirtualKey; 49 | quint32 nativeModifiers; 50 | QString text; 51 | bool autoRepeat; 52 | ushort repeatCount; 53 | }; 54 | 55 | struct LIRILIBINPUT_EXPORT LibInputMouseEvent 56 | { 57 | QPoint pos; 58 | Qt::MouseButtons buttons; 59 | Qt::KeyboardModifiers modifiers; 60 | int wheelDelta; 61 | Qt::Orientation wheelOrientation; 62 | }; 63 | 64 | struct LIRILIBINPUT_EXPORT LibInputTouchEvent 65 | { 66 | QTouchDevice *device; 67 | QList touchPoints; 68 | Qt::KeyboardModifiers modifiers; 69 | }; 70 | 71 | class LIRILIBINPUT_EXPORT LibInputHandler : public QObject 72 | { 73 | Q_OBJECT 74 | Q_PROPERTY(bool suspended READ isSuspended NOTIFY suspendedChanged) 75 | Q_DECLARE_PRIVATE(LibInputHandler) 76 | public: 77 | enum CapabilityFlag { 78 | Pointer = 0x01, 79 | Keyboard = 0x02, 80 | Touch = 0x04, 81 | Gesture = 0x08 82 | }; 83 | Q_DECLARE_FLAGS(Capabilities, CapabilityFlag) 84 | 85 | LibInputHandler(QObject *parent = 0); 86 | 87 | LibInputHandler::Capabilities capabilities() const; 88 | 89 | void setPointerPosition(const QPoint &pos); 90 | 91 | bool isSuspended() const; 92 | 93 | public Q_SLOTS: 94 | void suspend(); 95 | void resume(); 96 | 97 | Q_SIGNALS: 98 | void ready(); 99 | void capabilitiesChanged(); 100 | void suspendedChanged(bool); 101 | 102 | void keyboardCountChanged(int count); 103 | void pointerCountChanged(int count); 104 | void touchCountChanged(int count); 105 | void gestureCountChanged(int count); 106 | 107 | void touchDeviceRegistered(QTouchDevice *td); 108 | void touchDeviceUnregistered(QTouchDevice *td); 109 | 110 | void keyPressed(const LibInputKeyEvent &event); 111 | void keyReleased(const LibInputKeyEvent &event); 112 | 113 | void mousePressed(const LibInputMouseEvent &event); 114 | void mouseReleased(const LibInputMouseEvent &event); 115 | void mouseMoved(const LibInputMouseEvent &event); 116 | void mouseWheel(const LibInputMouseEvent &event); 117 | 118 | void touchEvent(const LibInputTouchEvent &event); 119 | void touchCancel(const LibInputTouchEvent &event); 120 | 121 | private Q_SLOTS: 122 | void handleEvents(); 123 | }; 124 | 125 | Q_DECLARE_OPERATORS_FOR_FLAGS(LibInputHandler::Capabilities) 126 | 127 | } // namespace Platform 128 | 129 | } // namespace Liri 130 | 131 | #endif // LIRI_LIBINPUTHANDLER_H 132 | -------------------------------------------------------------------------------- /src/libinput/libinputhandler_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:LGPLv3+$ 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | * 24 | * $END_LICENSE$ 25 | ***************************************************************************/ 26 | 27 | #ifndef LIRI_LIBINPUTHANDLER_P_H 28 | #define LIRI_LIBINPUTHANDLER_P_H 29 | 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Liri LibInput API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | namespace Liri { 55 | 56 | namespace Platform { 57 | 58 | class LIRILIBINPUT_EXPORT LibInputHandlerPrivate : public QObjectPrivate 59 | { 60 | Q_DECLARE_PUBLIC(LibInputHandler) 61 | public: 62 | LibInputHandlerPrivate(); 63 | ~LibInputHandlerPrivate(); 64 | 65 | void setup(); 66 | void initialize(); 67 | 68 | static void logHandler(libinput *handle, libinput_log_priority priority, 69 | const char *format, va_list args); 70 | 71 | static int restrictedOpenCallback(const char *path, int flags, void *user_data); 72 | static void restrictedCloseCallback(int fd, void *user_data); 73 | 74 | bool initialized; 75 | 76 | QtUdev::Udev *udev; 77 | libinput *li; 78 | 79 | LibInputKeyboard *keyboard; 80 | int keyboardCount; 81 | 82 | LibInputPointer *pointer; 83 | int pointerCount; 84 | 85 | LibInputTouch *touch; 86 | int touchCount; 87 | 88 | LibInputGesture *gesture; 89 | int gestureCount; 90 | 91 | bool suspended; 92 | 93 | static const struct libinput_interface liInterface; 94 | 95 | private: 96 | int restrictedOpen(const char *path, int flags); 97 | void restrictedClose(int fd); 98 | }; 99 | 100 | } // namespace Platform 101 | 102 | } // namespace Liri 103 | 104 | #endif // LIRI_LIBINPUTHANDLER_P_H 105 | -------------------------------------------------------------------------------- /src/libinput/libinputkeyboard.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:QTLGPL$ 10 | * 11 | * GNU Lesser General Public License Usage 12 | * This file may be used under the terms of the GNU Lesser General 13 | * Public License version 3 as published by the Free Software 14 | * Foundation and appearing in the file LICENSE.LGPLv3 included in the 15 | * packaging of this file. Please review the following information to 16 | * ensure the GNU Lesser General Public License version 3 requirements 17 | * will be met: https://www.gnu.org/licenses/lgpl.html. 18 | * 19 | * GNU General Public License Usage 20 | * Alternatively, this file may be used under the terms of the GNU 21 | * General Public License version 2.0 or (at your option) the GNU General 22 | * Public license version 3 or any later version approved by the KDE Free 23 | * Qt Foundation. The licenses are as published by the Free Software 24 | * Foundation and appearing in the file LICENSE.GPLv2 and LICENSE.GPLv3 25 | * included in the packaging of this file. Please review the following 26 | * information to ensure the GNU General Public License requirements will 27 | * be met: https://www.gnu.org/licenses/gpl-2.0.html and 28 | * https://www.gnu.org/licenses/gpl-3.0.html. 29 | * 30 | * $END_LICENSE$ 31 | ***************************************************************************/ 32 | 33 | #ifndef LIRI_LIBINPUTKEYBOARD_H 34 | #define LIRI_LIBINPUTKEYBOARD_H 35 | 36 | #include 37 | 38 | #include 39 | 40 | struct libinput_event_keyboard; 41 | 42 | namespace Liri { 43 | 44 | namespace Platform { 45 | 46 | class LibInputHandler; 47 | class LibInputKeyboardPrivate; 48 | 49 | class LIRILIBINPUT_EXPORT LibInputKeyboard : public QObject 50 | { 51 | Q_OBJECT 52 | Q_DECLARE_PRIVATE(LibInputKeyboard) 53 | public: 54 | explicit LibInputKeyboard(LibInputHandler *handler, QObject *parent = 0); 55 | 56 | void handleKey(libinput_event_keyboard *event); 57 | 58 | private Q_SLOTS: 59 | void handleRepeat(); 60 | }; 61 | 62 | } // namespace Platform 63 | 64 | } // namespace Liri 65 | 66 | #endif // LIRI_LIBINPUTKEYBOARD_H 67 | -------------------------------------------------------------------------------- /src/libinput/libinputkeyboard_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * Copyright (C) 2016 The Qt Company Ltd. 6 | * 7 | * Author(s): 8 | * Pier Luigi Fiorini 9 | * 10 | * $BEGIN_LICENSE:QTLGPL$ 11 | * 12 | * GNU Lesser General Public License Usage 13 | * This file may be used under the terms of the GNU Lesser General 14 | * Public License version 3 as published by the Free Software 15 | * Foundation and appearing in the file LICENSE.LGPLv3 included in the 16 | * packaging of this file. Please review the following information to 17 | * ensure the GNU Lesser General Public License version 3 requirements 18 | * will be met: https://www.gnu.org/licenses/lgpl.html. 19 | * 20 | * GNU General Public License Usage 21 | * Alternatively, this file may be used under the terms of the GNU 22 | * General Public License version 2.0 or (at your option) the GNU General 23 | * Public license version 3 or any later version approved by the KDE Free 24 | * Qt Foundation. The licenses are as published by the Free Software 25 | * Foundation and appearing in the file LICENSE.GPLv2 and LICENSE.GPLv3 26 | * included in the packaging of this file. Please review the following 27 | * information to ensure the GNU General Public License requirements will 28 | * be met: https://www.gnu.org/licenses/gpl-2.0.html and 29 | * https://www.gnu.org/licenses/gpl-3.0.html. 30 | * 31 | * $END_LICENSE$ 32 | ***************************************************************************/ 33 | 34 | #ifndef LIRI_LIBINPUTKEYBOARD_P_H 35 | #define LIRI_LIBINPUTKEYBOARD_P_H 36 | 37 | #include 38 | 39 | #include "eglfsxkb.h" 40 | #include "libinputhandler.h" 41 | #include "libinputkeyboard.h" 42 | 43 | #include 44 | 45 | // 46 | // W A R N I N G 47 | // ------------- 48 | // 49 | // This file is not part of the Liri LibInput API. It exists purely as an 50 | // implementation detail. This header file may change from version to 51 | // version without notice, or even be removed. 52 | // 53 | // We mean it. 54 | // 55 | 56 | namespace Liri { 57 | 58 | namespace Platform { 59 | 60 | class LIRILIBINPUT_EXPORT LibInputKeyboardPrivate : public QObjectPrivate 61 | { 62 | Q_DECLARE_PUBLIC(LibInputKeyboard) 63 | public: 64 | LibInputKeyboardPrivate(LibInputHandler *h); 65 | ~LibInputKeyboardPrivate(); 66 | 67 | LibInputHandler *handler; 68 | 69 | xkb_context *context; 70 | xkb_keymap *keymap; 71 | xkb_state *state; 72 | xkb_mod_index_t modifiers[4]; 73 | 74 | QTimer repeatTimer; 75 | quint32 repeatRate; 76 | quint32 repeatDelay; 77 | struct { 78 | int key; 79 | Qt::KeyboardModifiers modifiers; 80 | quint32 nativeScanCode; 81 | quint32 nativeVirtualKey; 82 | quint32 nativeModifiers; 83 | QString text; 84 | ushort repeatCount; 85 | } repeatData; 86 | }; 87 | 88 | } // namespace Platform 89 | 90 | } // namespace Liri 91 | 92 | #endif // LIRI_LIBINPUTKEYBOARD_P_H 93 | -------------------------------------------------------------------------------- /src/libinput/libinputpointer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:QTLGPL$ 10 | * 11 | * GNU Lesser General Public License Usage 12 | * This file may be used under the terms of the GNU Lesser General 13 | * Public License version 3 as published by the Free Software 14 | * Foundation and appearing in the file LICENSE.LGPLv3 included in the 15 | * packaging of this file. Please review the following information to 16 | * ensure the GNU Lesser General Public License version 3 requirements 17 | * will be met: https://www.gnu.org/licenses/lgpl.html. 18 | * 19 | * GNU General Public License Usage 20 | * Alternatively, this file may be used under the terms of the GNU 21 | * General Public License version 2.0 or (at your option) the GNU General 22 | * Public license version 3 or any later version approved by the KDE Free 23 | * Qt Foundation. The licenses are as published by the Free Software 24 | * Foundation and appearing in the file LICENSE.GPLv2 and LICENSE.GPLv3 25 | * included in the packaging of this file. Please review the following 26 | * information to ensure the GNU General Public License requirements will 27 | * be met: https://www.gnu.org/licenses/gpl-2.0.html and 28 | * https://www.gnu.org/licenses/gpl-3.0.html. 29 | * 30 | * $END_LICENSE$ 31 | ***************************************************************************/ 32 | 33 | #ifndef LIRI_LIBINPUTPOINTER_H 34 | #define LIRI_LIBINPUTPOINTER_H 35 | 36 | #include 37 | 38 | #include 39 | 40 | struct libinput_event_pointer; 41 | 42 | namespace Liri { 43 | 44 | namespace Platform { 45 | 46 | class LibInputHandler; 47 | 48 | class LIRILIBINPUT_EXPORT LibInputPointer 49 | { 50 | public: 51 | LibInputPointer(LibInputHandler *handler); 52 | 53 | void setPosition(const QPoint &pos); 54 | 55 | void handleButton(libinput_event_pointer *e); 56 | void handleMotion(libinput_event_pointer *e); 57 | void handleAbsoluteMotion(libinput_event_pointer *e); 58 | void handleAxis(libinput_event_pointer *e); 59 | 60 | private: 61 | LibInputHandler *m_handler; 62 | QPoint m_pt; 63 | Qt::MouseButtons m_buttons; 64 | 65 | void processMotion(const QPoint &pos); 66 | }; 67 | 68 | } // namespace Platform 69 | 70 | } // namespace Liri 71 | 72 | #endif // LIRI_LIBINPUTPOINTER_H 73 | -------------------------------------------------------------------------------- /src/libinput/libinputtouch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:QTLGPL$ 10 | * 11 | * GNU Lesser General Public License Usage 12 | * This file may be used under the terms of the GNU Lesser General 13 | * Public License version 3 as published by the Free Software 14 | * Foundation and appearing in the file LICENSE.LGPLv3 included in the 15 | * packaging of this file. Please review the following information to 16 | * ensure the GNU Lesser General Public License version 3 requirements 17 | * will be met: https://www.gnu.org/licenses/lgpl.html. 18 | * 19 | * GNU General Public License Usage 20 | * Alternatively, this file may be used under the terms of the GNU 21 | * General Public License version 2.0 or (at your option) the GNU General 22 | * Public license version 3 or any later version approved by the KDE Free 23 | * Qt Foundation. The licenses are as published by the Free Software 24 | * Foundation and appearing in the file LICENSE.GPLv2 and LICENSE.GPLv3 25 | * included in the packaging of this file. Please review the following 26 | * information to ensure the GNU General Public License requirements will 27 | * be met: https://www.gnu.org/licenses/gpl-2.0.html and 28 | * https://www.gnu.org/licenses/gpl-3.0.html. 29 | * 30 | * $END_LICENSE$ 31 | ***************************************************************************/ 32 | 33 | #ifndef LIRI_LIBINPUTTOUCH_H 34 | #define LIRI_LIBINPUTTOUCH_H 35 | 36 | #include 37 | 38 | struct libinput_device; 39 | struct libinput_event_touch; 40 | 41 | class QTouchDevice; 42 | 43 | namespace Liri { 44 | 45 | namespace Platform { 46 | 47 | class LibInputHandler; 48 | class LibInputTouchPrivate; 49 | 50 | class LIRILIBINPUT_EXPORT LibInputTouch 51 | { 52 | Q_DECLARE_PRIVATE(LibInputTouch) 53 | public: 54 | LibInputTouch(LibInputHandler *handler); 55 | ~LibInputTouch(); 56 | 57 | QTouchDevice *registerDevice(libinput_device *device); 58 | void unregisterDevice(libinput_device *device, QTouchDevice **td); 59 | 60 | void handleTouchUp(libinput_event_touch *event); 61 | void handleTouchDown(libinput_event_touch *event); 62 | void handleTouchMotion(libinput_event_touch *event); 63 | void handleTouchCancel(libinput_event_touch *event); 64 | void handleTouchFrame(libinput_event_touch *event); 65 | 66 | private: 67 | LibInputTouchPrivate *const d_ptr; 68 | }; 69 | 70 | } // namespace Platform 71 | 72 | } // namespace Liri 73 | 74 | #endif // LIRI_LIBINPUTTOUCH_H 75 | -------------------------------------------------------------------------------- /src/libinput/lirilibinputglobal.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #ifndef LIRI_LIBINPUTGLOBAL_H 25 | #define LIRI_LIBINPUTGLOBAL_H 26 | 27 | #include 28 | 29 | #if defined(LIRILIBINPUT_STATIC_LIB) 30 | # define LIRILIBINPUT_EXPORT 31 | #else 32 | # if defined(LIRI_BUILD_LIRILIBINPUT_LIB) 33 | # define LIRILIBINPUT_EXPORT Q_DECL_EXPORT 34 | # else 35 | # define LIRILIBINPUT_EXPORT Q_DECL_IMPORT 36 | # endif 37 | # define LIRILIBINPUT_NO_EXPORT Q_DECL_HIDDEN 38 | #endif 39 | 40 | #endif // LIRI_LIBINPUTGLOBAL_H 41 | -------------------------------------------------------------------------------- /src/libinput/logging.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:LGPLv3+$ 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | * 24 | * $END_LICENSE$ 25 | ***************************************************************************/ 26 | 27 | #include "logging_p.h" 28 | 29 | Q_LOGGING_CATEGORY(lcInput, "liri.qpa.input") 30 | -------------------------------------------------------------------------------- /src/libinput/logging_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2015-2016 Pier Luigi Fiorini 5 | * 6 | * Author(s): 7 | * Pier Luigi Fiorini 8 | * 9 | * $BEGIN_LICENSE:LGPLv3+$ 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | * 24 | * $END_LICENSE$ 25 | ***************************************************************************/ 26 | 27 | #ifndef LIRI_LIBINPUT_LOGGING_P_H 28 | #define LIRI_LIBINPUT_LOGGING_P_H 29 | 30 | #include 31 | 32 | Q_DECLARE_LOGGING_CATEGORY(lcInput) 33 | 34 | #endif // LIRI_LIBINPUT_LOGGING_P_H 35 | -------------------------------------------------------------------------------- /src/libs.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | Project { 4 | name: "Libraries" 5 | 6 | references: [ 7 | "eglfsxkb/eglfsxkb.qbs", 8 | "libinput/libinput.qbs", 9 | "platformheaders/platformheaders.qbs", 10 | "platformsupport/edid/edid.qbs", 11 | "platformsupport/kmsconvenience/kmsconvenience.qbs", 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/platformheaders/lirieglfsfunctions.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #include 25 | 26 | #include "lirieglfsfunctions.h" 27 | 28 | namespace Liri { 29 | 30 | namespace Platform { 31 | 32 | QByteArray EglFSFunctions::getPowerStateIdentifier() 33 | { 34 | return QByteArrayLiteral("LiriEglFSGetPowerState"); 35 | } 36 | 37 | EglFSFunctions::PowerState EglFSFunctions::getPowerState(QScreen *screen) 38 | { 39 | GetPowerStateType func = reinterpret_cast(QGuiApplication::platformFunction(getPowerStateIdentifier())); 40 | if (func) 41 | return func(screen); 42 | return PowerStateOn; 43 | } 44 | 45 | QByteArray EglFSFunctions::setPowerStateIdentifier() 46 | { 47 | return QByteArrayLiteral("LiriEglFSSetPowerState"); 48 | } 49 | 50 | void EglFSFunctions::setPowerState(QScreen *screen, PowerState state) 51 | { 52 | SetPowerStateType func = reinterpret_cast(QGuiApplication::platformFunction(setPowerStateIdentifier())); 53 | if (func) 54 | func(screen, state); 55 | } 56 | 57 | QByteArray EglFSFunctions::setScreenPositionIdentifier() 58 | { 59 | return QByteArrayLiteral("LiriEglFSSetScreenPosition"); 60 | } 61 | 62 | void EglFSFunctions::setScreenPosition(QScreen *screen, const QPoint &pos) 63 | { 64 | SetScreenPositionType func = reinterpret_cast(QGuiApplication::platformFunction(setScreenPositionIdentifier())); 65 | if (func) 66 | func(screen, pos); 67 | } 68 | 69 | QByteArray EglFSFunctions::setScreenModeIdentifier() 70 | { 71 | return QByteArrayLiteral("LiriEglFSSetScreenMode"); 72 | } 73 | 74 | void EglFSFunctions::setScreenMode(QScreen *screen, int modexIndex) 75 | { 76 | SetScreenModeType func = reinterpret_cast(QGuiApplication::platformFunction(setScreenModeIdentifier())); 77 | if (func) 78 | func(screen, modexIndex); 79 | } 80 | 81 | QByteArray EglFSFunctions::setScreenScaleFactorIdentifier() 82 | { 83 | return QByteArrayLiteral("LiriEglFSSetScreenScaleFactor"); 84 | } 85 | 86 | void EglFSFunctions::setScreenScaleFactor(QScreen *screen, qreal factor) 87 | { 88 | SetScreenScaleFactorType func = reinterpret_cast(QGuiApplication::platformFunction(setScreenScaleFactorIdentifier())); 89 | if (func) 90 | func(screen, factor); 91 | } 92 | 93 | QByteArray EglFSFunctions::enableScreenCaptureIdentifier() 94 | { 95 | return QByteArrayLiteral("LiriEglFSEnableScreenCapture"); 96 | } 97 | 98 | void EglFSFunctions::enableScreenCapture(QScreen *screen) 99 | { 100 | EnableScreenCaptureType func = reinterpret_cast(QGuiApplication::platformFunction(enableScreenCaptureIdentifier())); 101 | if (func) 102 | func(screen); 103 | } 104 | 105 | QByteArray EglFSFunctions::disableScreenCaptureIdentifier() 106 | { 107 | return QByteArrayLiteral("LiriEglFSDisableStreaming"); 108 | } 109 | 110 | void EglFSFunctions::disableScreenCapture(QScreen *screen) 111 | { 112 | DisableScreenCaptureType func = reinterpret_cast(QGuiApplication::platformFunction(disableScreenCaptureIdentifier())); 113 | if (func) 114 | func(screen); 115 | } 116 | 117 | /* 118 | * Screen capture 119 | */ 120 | 121 | QEvent::Type FrameCaptureEvent::eventType = QEvent::None; 122 | 123 | FrameCaptureEvent::FrameCaptureEvent(const QImage &image) 124 | : QEvent(registeredType()) 125 | , capture(image) 126 | { 127 | } 128 | 129 | QEvent::Type FrameCaptureEvent::registeredType() 130 | { 131 | if (eventType == QEvent::None) { 132 | int generatedType = QEvent::registerEventType(); 133 | eventType = static_cast(generatedType); 134 | } 135 | 136 | return eventType; 137 | } 138 | 139 | } // namespace Platform 140 | 141 | } // namespace Liri 142 | -------------------------------------------------------------------------------- /src/platformheaders/lirieglfsfunctions.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #ifndef LIRIELGFSFUNCTIONS_H 25 | #define LIRIELGFSFUNCTIONS_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | namespace Liri { 34 | 35 | namespace Platform { 36 | 37 | class LIRIPLATFORMHEADERS_EXPORT EglFSFunctions 38 | { 39 | public: 40 | enum PowerState { 41 | PowerStateOn, 42 | PowerStateStandby, 43 | PowerStateSuspend, 44 | PowerStateOff 45 | }; 46 | 47 | typedef PowerState (*GetPowerStateType)(QScreen *screen); 48 | static QByteArray getPowerStateIdentifier(); 49 | static PowerState getPowerState(QScreen *screen); 50 | 51 | typedef void (*SetPowerStateType)(QScreen *screen, PowerState state); 52 | static QByteArray setPowerStateIdentifier(); 53 | static void setPowerState(QScreen *screen, PowerState state); 54 | 55 | /// 56 | 57 | typedef void (*SetScreenPositionType)(QScreen *screen, const QPoint &pos); 58 | static QByteArray setScreenPositionIdentifier(); 59 | static void setScreenPosition(QScreen *screen, const QPoint &pos); 60 | 61 | typedef void (*SetScreenModeType)(QScreen *screen, int modeIndex); 62 | static QByteArray setScreenModeIdentifier(); 63 | static void setScreenMode(QScreen *screen, int modexIndex); 64 | 65 | typedef void (*SetScreenScaleFactorType)(QScreen *screen, qreal factor); 66 | static QByteArray setScreenScaleFactorIdentifier(); 67 | static void setScreenScaleFactor(QScreen *screen, qreal factor); 68 | 69 | /// 70 | 71 | typedef void (*EnableScreenCaptureType)(QScreen *screen); 72 | static QByteArray enableScreenCaptureIdentifier(); 73 | static void enableScreenCapture(QScreen *screen); 74 | 75 | typedef void (*DisableScreenCaptureType)(QScreen *screen); 76 | static QByteArray disableScreenCaptureIdentifier(); 77 | static void disableScreenCapture(QScreen *screen); 78 | }; 79 | 80 | class LIRIPLATFORMHEADERS_EXPORT FrameCaptureEvent : public QEvent 81 | { 82 | public: 83 | FrameCaptureEvent(const QImage &image); 84 | 85 | QImage capture; 86 | 87 | static QEvent::Type eventType; 88 | 89 | static QEvent::Type registeredType(); 90 | }; 91 | 92 | } // namespace Platform 93 | 94 | } // namespace Liri 95 | 96 | #endif // LIRIEGLFSFUNCTIONS_H 97 | -------------------------------------------------------------------------------- /src/platformheaders/liriplatformheadersglobal.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #ifndef LIRIPLATFORMHEADERSGLOBAL_H 25 | #define LIRIPLATFORMHEADERSGLOBAL_H 26 | 27 | #include 28 | 29 | #if defined(LIRI_BUILD_PLATFORMHEADERS) 30 | # define LIRIPLATFORMHEADERS_EXPORT Q_DECL_EXPORT 31 | #else 32 | # define LIRIPLATFORMHEADERS_EXPORT Q_DECL_IMPORT 33 | #endif 34 | #define LIRIPLATFORMHEADERS_NO_EXPORT Q_DECL_HIDDEN 35 | 36 | 37 | #endif // LIRIPLATFORMHEADERSGLOBAL_H 38 | -------------------------------------------------------------------------------- /src/platformheaders/platformheaders.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | import qbs.FileInfo 3 | import LiriUtils 4 | 5 | LiriModuleProject { 6 | id: root 7 | 8 | name: "LiriPlatformHeaders" 9 | moduleName: "LiriPlatformHeaders" 10 | createPkgConfig: false 11 | createCMake: false 12 | 13 | resolvedProperties: ({ 14 | Depends: [{ name: LiriUtils.quote("Qt.gui") }], 15 | }) 16 | 17 | LiriHeaders { 18 | name: root.headersName 19 | sync.module: root.moduleName 20 | 21 | Group { 22 | name: "Headers" 23 | files: [ 24 | "lirieglfsfunctions.h", 25 | "liriplatformheadersglobal.h", 26 | ] 27 | fileTags: ["hpp_syncable"] 28 | } 29 | } 30 | 31 | LiriModule { 32 | name: root.moduleName 33 | targetName: root.targetName 34 | version: "0.0.0" 35 | 36 | Depends { name: root.headersName } 37 | Depends { 38 | name: "Qt" 39 | submodules: [ "gui" ] 40 | versionAtLeast: project.minimumQtVersion 41 | } 42 | 43 | cpp.defines: base.concat(["LIRI_BUILD_PLATFORMHEADERS"]) 44 | 45 | files: [ 46 | "lirieglfsfunctions.cpp", 47 | ] 48 | 49 | Group { 50 | qbs.install: true 51 | qbs.installDir: FileInfo.joinPaths(lirideployment.includeDir, root.moduleName, project.version, root.moduleName, "private") 52 | fileTagsFilter: ["hpp_private"] 53 | } 54 | 55 | Export { 56 | Depends { name: "cpp" } 57 | Depends { name: root.headersName } 58 | Depends { 59 | name: "Qt" 60 | submodules: [ "gui" ] 61 | versionAtLeast: project.minimumQtVersion 62 | } 63 | 64 | cpp.includePaths: base.concat([product.buildDirectory]) 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/platformsupport/edid/edid.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | import LiriUtils 3 | 4 | LiriModuleProject { 5 | name: "LiriEdidSupport" 6 | moduleName: "LiriEdidSupport" 7 | description: "EDID parser for EGL device integration" 8 | createPkgConfig: false 9 | createCMake: false 10 | 11 | resolvedProperties: ({ 12 | Depends: [{ name: LiriUtils.quote("Qt.core-private") }], 13 | }) 14 | 15 | LiriHeaders { 16 | Group { 17 | name: "Headers" 18 | files: "**/*.h" 19 | fileTags: ["hpp_syncable"] 20 | } 21 | } 22 | 23 | LiriPrivateModule { 24 | targetName: project.targetName 25 | 26 | Depends { name: project.headersName } 27 | Depends { name: "Qt.core-private" } 28 | 29 | cpp.defines: base.concat([ 30 | 'LIRIWAYLAND_VERSION="' + project.version + '"', 31 | ]) 32 | 33 | files: ["*.cpp", "*.h"] 34 | 35 | Export { 36 | Depends { name: "cpp" } 37 | Depends { name: project.headersName } 38 | Depends { name: "Qt.core-private" } 39 | 40 | cpp.defines: project.defines 41 | cpp.includePaths: product.sourceDirectory 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/platformsupport/edid/qedidparser_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2018 Pier Luigi Fiorini 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEDIDPARSER_P_H 41 | #define QEDIDPARSER_P_H 42 | 43 | #include 44 | #include 45 | 46 | // 47 | // W A R N I N G 48 | // ------------- 49 | // 50 | // This file is not part of the Qt API. It exists purely as an 51 | // implementation detail. This header file may change from version to 52 | // version without notice, or even be removed. 53 | // 54 | 55 | QT_BEGIN_NAMESPACE 56 | 57 | class QEdidParser 58 | { 59 | public: 60 | QEdidParser(); 61 | 62 | bool parse(const QByteArray &blob); 63 | 64 | QString identifier; 65 | QString manufacturer; 66 | QString model; 67 | QString serialNumber; 68 | QSizeF physicalSize; 69 | 70 | private: 71 | QMap m_vendorCache; 72 | 73 | QString parseEdidString(const quint8 *data); 74 | }; 75 | 76 | QT_END_NAMESPACE 77 | 78 | #endif // QEDIDPARSER_P_H 79 | -------------------------------------------------------------------------------- /src/platformsupport/kmsconvenience/kmsconvenience.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | import LiriUtils 3 | 4 | LiriModuleProject { 5 | name: moduleName 6 | moduleName: "LiriKmsSupport" 7 | description: "KMS shared code" 8 | createPkgConfig: false 9 | createCMake: false 10 | conditionFunction: (function() { 11 | if (!libdrm.found) { 12 | console.error("libdrm is required to build " + targetName); 13 | return false; 14 | } 15 | 16 | return true; 17 | }) 18 | 19 | resolvedProperties: ({ 20 | Depends: [{ name: LiriUtils.quote("Qt.core-private") }, 21 | { name: LiriUtils.quote("Qt.gui-private") }, 22 | { name: LiriUtils.quote("libdrm") }], 23 | }) 24 | 25 | LiriHeaders { 26 | Group { 27 | name: "Headers" 28 | files: "**/*.h" 29 | fileTags: ["hpp_syncable"] 30 | } 31 | } 32 | 33 | LiriPrivateModule { 34 | targetName: project.targetName 35 | 36 | Depends { name: project.headersName } 37 | Depends { name: "Qt"; submodules: ["core-private", "gui-private"] } 38 | Depends { name: "libdrm" } 39 | 40 | cpp.defines: base.concat([ 41 | 'LIRIWAYLAND_VERSION="' + project.version + '"', 42 | ]) 43 | 44 | files: ["*.cpp", "*.h"] 45 | 46 | Export { 47 | Depends { name: "cpp" } 48 | Depends { name: project.headersName } 49 | Depends { name: "Qt"; submodules: ["core-private", "gui-private"] } 50 | Depends { name: "libdrm" } 51 | 52 | cpp.defines: project.defines 53 | cpp.includePaths: product.sourceDirectory 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/libinputmanager.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #include 25 | #include 26 | 27 | #include "libinputhandler.h" 28 | #include "libinputmanager_p.h" 29 | 30 | namespace Liri { 31 | 32 | namespace Platform { 33 | 34 | LibInputManager::LibInputManager(QObject *parent) 35 | : QObject(parent) 36 | , m_handler(new LibInputHandler(this)) 37 | { 38 | QInputDeviceManager *inputManager = 39 | QGuiApplicationPrivate::inputDeviceManager(); 40 | QInputDeviceManagerPrivate *inputManagerPriv 41 | = QInputDeviceManagerPrivate::get(inputManager); 42 | 43 | // Tell QPA about input devices 44 | connect(m_handler, &LibInputHandler::keyboardCountChanged, this, 45 | [inputManagerPriv](int count) { 46 | inputManagerPriv->setDeviceCount(QInputDeviceManager::DeviceTypeKeyboard, 47 | count); 48 | }); 49 | connect(m_handler, &LibInputHandler::pointerCountChanged, this, 50 | [inputManagerPriv](int count) { 51 | inputManagerPriv->setDeviceCount(QInputDeviceManager::DeviceTypePointer, 52 | count); 53 | }); 54 | connect(m_handler, &LibInputHandler::touchCountChanged, this, 55 | [inputManagerPriv](int count) { 56 | inputManagerPriv->setDeviceCount(QInputDeviceManager::DeviceTypeTouch, 57 | count); 58 | }); 59 | connect(m_handler, &LibInputHandler::touchDeviceRegistered, this, 60 | [](QTouchDevice *td) { 61 | QWindowSystemInterface::registerTouchDevice(td); 62 | }); 63 | 64 | // Events 65 | connect(m_handler, &LibInputHandler::keyPressed, this, 66 | [](const LibInputKeyEvent &e) { 67 | QWindowSystemInterface::handleExtendedKeyEvent( 68 | nullptr, QKeyEvent::KeyPress, e.key, 69 | e.modifiers, e.nativeScanCode, 70 | e.nativeVirtualKey, e.nativeModifiers, 71 | e.text, e.autoRepeat, e.repeatCount); 72 | }); 73 | connect(m_handler, &LibInputHandler::keyReleased, this, 74 | [](const LibInputKeyEvent &e) { 75 | QWindowSystemInterface::handleExtendedKeyEvent( 76 | nullptr, QKeyEvent::KeyRelease, e.key, 77 | e.modifiers, e.nativeScanCode, 78 | e.nativeVirtualKey, e.nativeModifiers, 79 | e.text, e.autoRepeat, e.repeatCount); 80 | }); 81 | connect(m_handler, &LibInputHandler::mousePressed, this, 82 | [](const LibInputMouseEvent &e) { 83 | QWindowSystemInterface::handleMouseEvent( 84 | nullptr, e.pos, e.pos, e.buttons, 85 | e.modifiers); 86 | }); 87 | connect(m_handler, &LibInputHandler::mouseReleased, this, 88 | [](const LibInputMouseEvent &e) { 89 | QWindowSystemInterface::handleMouseEvent( 90 | nullptr, e.pos, e.pos, e.buttons, 91 | e.modifiers); 92 | }); 93 | connect(m_handler, &LibInputHandler::mouseMoved, this, 94 | [](const LibInputMouseEvent &e) { 95 | QWindowSystemInterface::handleMouseEvent( 96 | nullptr, e.pos, e.pos, e.buttons, 97 | e.modifiers); 98 | }); 99 | connect(m_handler, &LibInputHandler::mouseWheel, this, 100 | [](const LibInputMouseEvent &e) { 101 | QWindowSystemInterface::handleWheelEvent( 102 | nullptr, e.pos, e.pos, 103 | e.wheelDelta, e.wheelOrientation, 104 | e.modifiers); 105 | }); 106 | connect(m_handler, &LibInputHandler::touchEvent, this, 107 | [](const LibInputTouchEvent &e) { 108 | QWindowSystemInterface::handleTouchEvent( 109 | nullptr, e.device, e.touchPoints, 110 | e.modifiers); 111 | }); 112 | connect(m_handler, &LibInputHandler::touchCancel, this, 113 | [](const LibInputTouchEvent &e) { 114 | QWindowSystemInterface::handleTouchCancelEvent( 115 | nullptr, e.device, e.modifiers); 116 | }); 117 | 118 | // Change pointer coordinates when requested by QPA 119 | connect(inputManager, &QInputDeviceManager::cursorPositionChangeRequested, this, 120 | [this](const QPoint &pos) { 121 | m_handler->setPointerPosition(pos); 122 | }); 123 | } 124 | 125 | LibInputHandler *LibInputManager::handler() const 126 | { 127 | return m_handler; 128 | } 129 | 130 | } // namespace Platform 131 | 132 | } // namespace Liri 133 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/libinputmanager_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #ifndef LIRI_LIBINPUTMANAGER_P_H 25 | #define LIRI_LIBINPUTMANAGER_P_H 26 | 27 | #include 28 | 29 | // 30 | // W A R N I N G 31 | // ------------- 32 | // 33 | // This file is not part of the Liri LibInput API. It exists purely as an 34 | // implementation detail. This header file may change from version to 35 | // version without notice, or even be removed. 36 | // 37 | // We mean it. 38 | // 39 | 40 | namespace Liri { 41 | 42 | namespace Platform { 43 | 44 | class LibInputHandler; 45 | 46 | class LibInputManager : public QObject 47 | { 48 | Q_OBJECT 49 | public: 50 | explicit LibInputManager(QObject *parent = nullptr); 51 | 52 | LibInputHandler *handler() const; 53 | 54 | private: 55 | LibInputHandler *m_handler; 56 | }; 57 | 58 | } // namespace Platform 59 | 60 | } // namespace Liri 61 | 62 | #endif // LIRI_LIBINPUTMANAGER_P_H 63 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfscontext.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qeglfsglobal_p.h" 41 | #include 42 | #include 43 | #include 44 | 45 | #include "qeglfscontext_p.h" 46 | #include "qeglfswindow_p.h" 47 | #include "qeglfshooks_p.h" 48 | #include "qeglfscursor_p.h" 49 | 50 | QT_BEGIN_NAMESPACE 51 | 52 | QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, 53 | EGLConfig *config, const QVariant &nativeHandle) 54 | : QEGLPlatformContext(format, share, display, config, nativeHandle, 55 | qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags(0) : QEGLPlatformContext::NoSurfaceless), 56 | m_tempWindow(0) 57 | { 58 | } 59 | 60 | EGLSurface QEglFSContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) 61 | { 62 | if (surface->surface()->surfaceClass() == QSurface::Window) 63 | return static_cast(surface)->surface(); 64 | else 65 | return static_cast(surface)->pbuffer(); 66 | } 67 | 68 | EGLSurface QEglFSContext::createTemporaryOffscreenSurface() 69 | { 70 | if (qt_egl_device_integration()->supportsPBuffers()) 71 | return QEGLPlatformContext::createTemporaryOffscreenSurface(); 72 | 73 | if (!m_tempWindow) { 74 | m_tempWindow = qt_egl_device_integration()->createNativeOffscreenWindow(format()); 75 | if (!m_tempWindow) { 76 | qWarning("QEglFSContext: Failed to create temporary native window"); 77 | return EGL_NO_SURFACE; 78 | } 79 | } 80 | EGLConfig config = q_configFromGLFormat(eglDisplay(), format()); 81 | return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, 0); 82 | } 83 | 84 | void QEglFSContext::destroyTemporaryOffscreenSurface(EGLSurface surface) 85 | { 86 | if (qt_egl_device_integration()->supportsPBuffers()) { 87 | QEGLPlatformContext::destroyTemporaryOffscreenSurface(surface); 88 | } else { 89 | eglDestroySurface(eglDisplay(), surface); 90 | qt_egl_device_integration()->destroyNativeWindow(m_tempWindow); 91 | m_tempWindow = 0; 92 | } 93 | } 94 | 95 | void QEglFSContext::runGLChecks() 96 | { 97 | // Note that even though there is an EGL context current here, 98 | // QOpenGLContext and QOpenGLFunctions are not yet usable at this stage. 99 | const char *renderer = reinterpret_cast(glGetString(GL_RENDERER)); 100 | // Be nice and warn about a common source of confusion. 101 | if (renderer && strstr(renderer, "llvmpipe")) 102 | qWarning("Running on a software rasterizer (LLVMpipe), expect limited performance."); 103 | } 104 | 105 | void QEglFSContext::swapBuffers(QPlatformSurface *surface) 106 | { 107 | // draw the cursor 108 | if (surface->surface()->surfaceClass() == QSurface::Window) { 109 | QPlatformWindow *window = static_cast(surface); 110 | if (QEglFSCursor *cursor = qobject_cast(window->screen()->cursor())) 111 | cursor->paintOnScreen(); 112 | } 113 | 114 | qt_egl_device_integration()->waitForVSync(surface); 115 | QEGLPlatformContext::swapBuffers(surface); 116 | qt_egl_device_integration()->presentBuffer(surface); 117 | } 118 | 119 | QT_END_NAMESPACE 120 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfscontext_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSCONTEXT_H 41 | #define QEGLFSCONTEXT_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include 56 | #include 57 | 58 | QT_BEGIN_NAMESPACE 59 | 60 | class Q_EGLFS_EXPORT QEglFSContext : public QEGLPlatformContext 61 | { 62 | public: 63 | QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, 64 | EGLConfig *config, const QVariant &nativeHandle); 65 | EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; 66 | EGLSurface createTemporaryOffscreenSurface() override; 67 | void destroyTemporaryOffscreenSurface(EGLSurface surface) override; 68 | void runGLChecks() override; 69 | void swapBuffers(QPlatformSurface *surface) override; 70 | 71 | private: 72 | EGLNativeWindowType m_tempWindow; 73 | }; 74 | 75 | QT_END_NAMESPACE 76 | 77 | #endif // QEGLFSCONTEXT_H 78 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfscursor_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSCURSOR_H 41 | #define QEGLFSCURSOR_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | 61 | QT_BEGIN_NAMESPACE 62 | 63 | class QOpenGLShaderProgram; 64 | class QEglFSCursor; 65 | class QEglFSScreen; 66 | 67 | class QEglFSCursorDeviceListener : public QObject 68 | { 69 | Q_OBJECT 70 | 71 | public: 72 | QEglFSCursorDeviceListener(QEglFSCursor *cursor) : m_cursor(cursor) { } 73 | bool hasMouse() const; 74 | 75 | public slots: 76 | void onDeviceListChanged(QInputDeviceManager::DeviceType type); 77 | 78 | private: 79 | QEglFSCursor *m_cursor; 80 | }; 81 | 82 | #if QT_CONFIG(opengl) 83 | 84 | class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor 85 | , protected QOpenGLFunctions 86 | { 87 | Q_OBJECT 88 | public: 89 | QEglFSCursor(QPlatformScreen *screen); 90 | ~QEglFSCursor(); 91 | 92 | #ifndef QT_NO_CURSOR 93 | void changeCursor(QCursor *cursor, QWindow *widget) override; 94 | #endif 95 | void pointerEvent(const QMouseEvent &event) override; 96 | QPoint pos() const override; 97 | void setPos(const QPoint &pos) override; 98 | 99 | QRect cursorRect() const; 100 | void paintOnScreen(); 101 | void resetResources(); 102 | 103 | void updateMouseStatus(); 104 | 105 | private: 106 | bool event(QEvent *e) override; 107 | #ifndef QT_NO_CURSOR 108 | bool setCurrentCursor(QCursor *cursor); 109 | #endif 110 | void draw(const QRectF &rect); 111 | void update(const QRect &rect, bool allScreens); 112 | void createShaderPrograms(); 113 | void createCursorTexture(uint *texture, const QImage &image); 114 | void initCursorAtlas(); 115 | 116 | // current cursor information 117 | struct Cursor { 118 | Cursor() : shape(Qt::BlankCursor), customCursorPending(false), customCursorKey(0), useCustomCursor(false) { } 119 | Qt::CursorShape shape; 120 | QRectF textureRect; // normalized rect inside texture 121 | QSize size; // size of the cursor 122 | QPoint hotSpot; 123 | QImage customCursorImage; 124 | QPoint pos; // current cursor position 125 | bool customCursorPending; 126 | qint64 customCursorKey; 127 | bool useCustomCursor; 128 | } m_cursor; 129 | 130 | // cursor atlas information 131 | struct CursorAtlas { 132 | CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { } 133 | int cursorsPerRow; 134 | int width, height; // width and height of the atlas 135 | int cursorWidth, cursorHeight; // width and height of cursors inside the atlas 136 | QList hotSpots; 137 | QImage image; // valid until it's uploaded 138 | } m_cursorAtlas; 139 | 140 | bool m_visible; 141 | QEglFSScreen *m_screen; 142 | QPlatformScreen *m_activeScreen; 143 | QEglFSCursorDeviceListener *m_deviceListener; 144 | bool m_updateRequested; 145 | QMatrix4x4 m_rotationMatrix; 146 | 147 | struct GraphicsContextData { 148 | GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0), 149 | customCursorTexture(0), atlasTexture(0), customCursorKey(0) { } 150 | QOpenGLShaderProgram *program; 151 | int textureEntry; 152 | int matEntry; 153 | uint customCursorTexture; 154 | uint atlasTexture; 155 | qint64 customCursorKey; 156 | }; 157 | QHash m_gfx; 158 | }; 159 | #endif // QT_CONFIG(opengl) 160 | 161 | QT_END_NAMESPACE 162 | 163 | #endif // QEGLFSCURSOR_H 164 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSDEVICEINTEGRATION_H 41 | #define QEGLFSDEVICEINTEGRATION_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | 61 | QT_BEGIN_NAMESPACE 62 | 63 | class QPlatformSurface; 64 | class QEglFSWindow; 65 | 66 | #define QEglFSDeviceIntegrationFactoryInterface_iid "io.liri.qpa.egl.EglFSDeviceIntegrationFactoryInterface.1.0" 67 | 68 | class Q_EGLFS_EXPORT QEglFSDeviceIntegration 69 | { 70 | public: 71 | virtual ~QEglFSDeviceIntegration() { } 72 | 73 | virtual void platformInit(); 74 | virtual void platformDestroy(); 75 | virtual EGLNativeDisplayType platformDisplay() const; 76 | virtual EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay); 77 | virtual bool usesDefaultScreen(); 78 | virtual void screenInit(); 79 | virtual void screenDestroy(); 80 | virtual QSizeF physicalScreenSize() const; 81 | virtual QSize screenSize() const; 82 | virtual QDpi logicalDpi() const; 83 | virtual qreal pixelDensity() const; 84 | virtual Qt::ScreenOrientation nativeOrientation() const; 85 | virtual Qt::ScreenOrientation orientation() const; 86 | virtual int screenDepth() const; 87 | virtual QImage::Format screenFormat() const; 88 | virtual qreal refreshRate() const; 89 | virtual QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const; 90 | virtual EGLint surfaceType() const; 91 | virtual QEglFSWindow *createWindow(QWindow *window) const; 92 | virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow, 93 | const QSize &size, 94 | const QSurfaceFormat &format); 95 | virtual EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format); 96 | virtual void destroyNativeWindow(EGLNativeWindowType window); 97 | virtual bool hasCapability(QPlatformIntegration::Capability cap) const; 98 | virtual QPlatformCursor *createCursor(QPlatformScreen *screen) const; 99 | virtual bool filterConfig(EGLDisplay display, EGLConfig config) const; 100 | virtual void waitForVSync(QPlatformSurface *surface) const; 101 | virtual void presentBuffer(QPlatformSurface *surface); 102 | virtual QByteArray fbDeviceName() const; 103 | virtual int framebufferIndex() const; 104 | virtual bool supportsPBuffers() const; 105 | virtual bool supportsSurfacelessContexts() const; 106 | virtual QFunctionPointer platformFunction(const QByteArray &function) const; 107 | virtual void *nativeResourceForIntegration(const QByteArray &name); 108 | 109 | virtual void *wlDisplay() const; 110 | 111 | static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format); 112 | }; 113 | 114 | class Q_EGLFS_EXPORT QEglFSDeviceIntegrationPlugin : public QObject 115 | { 116 | Q_OBJECT 117 | 118 | public: 119 | virtual QEglFSDeviceIntegration *create() = 0; 120 | 121 | // the pattern expected by qLoadPlugin calls for a QString argument. 122 | // we don't need it, so don't bother subclasses with it: 123 | QEglFSDeviceIntegration *create(const QString &) { return create(); } 124 | }; 125 | 126 | class Q_EGLFS_EXPORT QEglFSDeviceIntegrationFactory 127 | { 128 | public: 129 | static QStringList keys(const QString &pluginPath = QString()); 130 | static QEglFSDeviceIntegration *create(const QString &name, const QString &platformPluginPath = QString()); 131 | }; 132 | 133 | QT_END_NAMESPACE 134 | 135 | #endif // QEGLDEVICEINTEGRATION_H 136 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfsglobal_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSGLOBAL_H 41 | #define QEGLFSGLOBAL_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include 55 | 56 | #include 57 | 58 | QT_BEGIN_NAMESPACE 59 | 60 | #ifdef QT_BUILD_EGL_DEVICE_LIB 61 | #define Q_EGLFS_EXPORT Q_DECL_EXPORT 62 | #else 63 | #define Q_EGLFS_EXPORT Q_DECL_IMPORT 64 | #endif 65 | 66 | #undef Status 67 | #undef None 68 | #undef Bool 69 | #undef CursorShape 70 | #undef KeyPress 71 | #undef KeyRelease 72 | #undef FocusIn 73 | #undef FocusOut 74 | #undef FontChange 75 | #undef Expose 76 | #undef Unsorted 77 | 78 | QT_END_NAMESPACE 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfshooks.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the qmake spec of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qeglfshooks_p.h" 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | Q_DECLARE_LOGGING_CATEGORY(qLcEglDevDebug) 46 | 47 | #ifdef EGLFS_PLATFORM_HOOKS 48 | 49 | QEglFSDeviceIntegration *qt_egl_device_integration() 50 | { 51 | extern QEglFSHooks *platformHooks; 52 | return platformHooks; 53 | } 54 | 55 | #else 56 | 57 | class DeviceIntegration 58 | { 59 | public: 60 | DeviceIntegration(); 61 | ~DeviceIntegration() { delete m_integration; } 62 | QEglFSDeviceIntegration *integration() { return m_integration; } 63 | private: 64 | QEglFSDeviceIntegration *m_integration; 65 | }; 66 | 67 | Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration) 68 | 69 | DeviceIntegration::DeviceIntegration() 70 | : m_integration(nullptr) 71 | { 72 | QStringList pluginKeys = QEglFSDeviceIntegrationFactory::keys(); 73 | if (!pluginKeys.isEmpty()) { 74 | // Some built-in logic: Prioritize either X11 or KMS/DRM. 75 | if (qEnvironmentVariableIsSet("DISPLAY")) { 76 | const QString x11key = QStringLiteral("eglfs_x11"); 77 | if (pluginKeys.contains(x11key)) { 78 | pluginKeys.removeOne(x11key); 79 | pluginKeys.prepend(x11key); 80 | } 81 | } else { 82 | const QString kmskey = QStringLiteral("eglfs_kms"); 83 | if (pluginKeys.contains(kmskey)) { 84 | pluginKeys.removeOne(kmskey); 85 | pluginKeys.prepend(kmskey); 86 | } 87 | } 88 | 89 | QByteArray requested; 90 | 91 | // The environment variable can override everything. 92 | if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_INTEGRATION")) { 93 | requested = qgetenv("QT_QPA_EGLFS_INTEGRATION"); 94 | } else { 95 | // Device-specific makespecs may define a preferred plugin. 96 | #ifdef EGLFS_PREFERRED_PLUGIN 97 | #define DEFAULT_PLUGIN EGLFS_PREFERRED_PLUGIN 98 | #define STR(s) #s 99 | #define STRQ(s) STR(s) 100 | requested = STRQ(DEFAULT_PLUGIN); 101 | #endif 102 | } 103 | 104 | // Treat "none" as special. There has to be a way to indicate 105 | // that plugins must be ignored when the device is known to be 106 | // functional with the default, non-specialized integration. 107 | if (requested != QByteArrayLiteral("none")) { 108 | if (!requested.isEmpty()) { 109 | QString reqStr = QString::fromLocal8Bit(requested); 110 | pluginKeys.removeOne(reqStr); 111 | pluginKeys.prepend(reqStr); 112 | } 113 | qCDebug(qLcEglDevDebug) << "EGL device integration plugin keys (sorted):" << pluginKeys; 114 | while (!m_integration && !pluginKeys.isEmpty()) { 115 | QString key = pluginKeys.takeFirst(); 116 | qCDebug(qLcEglDevDebug) << "Trying to load device EGL integration" << key; 117 | m_integration = QEglFSDeviceIntegrationFactory::create(key); 118 | } 119 | } 120 | } 121 | 122 | if (!m_integration) { 123 | // Use a default, non-specialized device integration when no plugin is available. 124 | // For some systems this is sufficient. 125 | qCDebug(qLcEglDevDebug) << "Using base device integration"; 126 | m_integration = new QEglFSDeviceIntegration; 127 | } 128 | } 129 | 130 | QEglFSDeviceIntegration *qt_egl_device_integration() 131 | { 132 | return deviceIntegration()->integration(); 133 | } 134 | 135 | #endif // EGLFS_PLATFORM_HOOKS 136 | 137 | QT_END_NAMESPACE 138 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfshooks_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSHOOKS_H 41 | #define QEGLFSHOOKS_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include "qeglfsdeviceintegration_p.h" 56 | #include 57 | 58 | QT_BEGIN_NAMESPACE 59 | 60 | Q_EGLFS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcEglDevDebug) 61 | 62 | class QEglFSHooks : public QEglFSDeviceIntegration 63 | { 64 | }; 65 | 66 | Q_EGLFS_EXPORT QEglFSDeviceIntegration *qt_egl_device_integration(); 67 | 68 | QT_END_NAMESPACE 69 | 70 | #endif // QEGLFSHOOKS_H 71 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfsintegration_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSINTEGRATION_H 41 | #define QEGLFSINTEGRATION_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include 56 | #include 57 | #include 58 | #include 59 | 60 | #include 61 | 62 | namespace Liri { 63 | namespace Platform { 64 | class LibInputManager; 65 | class VtHandler; 66 | } 67 | } 68 | 69 | QT_BEGIN_NAMESPACE 70 | 71 | class QEglFSWindow; 72 | class QEglFSContext; 73 | class QEglFSLogindHandler; 74 | class QFbVtHandler; 75 | class QEvdevKeyboardManager; 76 | 77 | class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface 78 | { 79 | public: 80 | QEglFSIntegration(); 81 | 82 | void initialize() override; 83 | void destroy() override; 84 | 85 | EGLDisplay display() const { return m_display; } 86 | 87 | QAbstractEventDispatcher *createEventDispatcher() const override; 88 | QPlatformFontDatabase *fontDatabase() const override; 89 | QPlatformServices *services() const override; 90 | QPlatformInputContext *inputContext() const override { return m_inputContext; } 91 | QPlatformTheme *createPlatformTheme(const QString &name) const override; 92 | 93 | QPlatformWindow *createPlatformWindow(QWindow *window) const override; 94 | QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; 95 | #ifndef QT_NO_OPENGL 96 | QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; 97 | QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; 98 | #endif 99 | bool hasCapability(QPlatformIntegration::Capability cap) const override; 100 | 101 | QPlatformNativeInterface *nativeInterface() const override; 102 | 103 | // QPlatformNativeInterface 104 | void *nativeResourceForIntegration(const QByteArray &resource) override; 105 | void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; 106 | void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; 107 | #ifndef QT_NO_OPENGL 108 | void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; 109 | #endif 110 | NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override; 111 | 112 | QFunctionPointer platformFunction(const QByteArray &function) const override; 113 | 114 | Liri::Platform::VtHandler *vtHandler() { return m_vtHandler.data(); } 115 | 116 | void addScreen(QPlatformScreen *screen, bool isPrimary = false); 117 | void removeScreen(QPlatformScreen *screen); 118 | 119 | private: 120 | EGLNativeDisplayType nativeDisplay() const; 121 | void createInputHandlers(); 122 | 123 | static Liri::Platform::EglFSFunctions::PowerState getPowerStateStatic(QScreen *screen); 124 | static void setPowerStateStatic(QScreen *screen, Liri::Platform::EglFSFunctions::PowerState powerState); 125 | 126 | static void enableScreenCaptureStatic(QScreen *screen); 127 | static void disableScreenCaptureStatic(QScreen *screen); 128 | 129 | EGLDisplay m_display; 130 | QPlatformInputContext *m_inputContext; 131 | QScopedPointer m_fontDb; 132 | QScopedPointer m_services; 133 | QScopedPointer m_vtHandler; 134 | QScopedPointer m_liHandler; 135 | QEglFSLogindHandler *m_logindHandler; 136 | bool m_disableInputHandlers; 137 | }; 138 | 139 | QT_END_NAMESPACE 140 | 141 | #endif // QEGLFSINTEGRATION_H 142 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfslogindhandler.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2018 Pier Luigi Fiorini 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qeglfshooks_p.h" 41 | #include "qeglfslogindhandler_p.h" 42 | 43 | #include 44 | 45 | using namespace Liri; 46 | 47 | QEglFSLogindHandler::QEglFSLogindHandler() 48 | : QObject() 49 | , m_loop(new QEventLoop(this)) 50 | { 51 | } 52 | 53 | void QEglFSLogindHandler::initialize() 54 | { 55 | // Connect to logind and take control 56 | Logind *logind = Logind::instance(); 57 | if (logind->isConnected()) { 58 | qCDebug(qLcEglDevDebug) << "logind connection already established"; 59 | takeControl(true); 60 | } else { 61 | qCDebug(qLcEglDevDebug) << "logind connection not yet established"; 62 | connect(logind, &Logind::connectedChanged, 63 | this, &QEglFSLogindHandler::takeControl, 64 | Qt::QueuedConnection); 65 | } 66 | 67 | // Wait for logind setup 68 | m_loop->exec(); 69 | } 70 | 71 | void QEglFSLogindHandler::stop() 72 | { 73 | m_loop->quit(); 74 | } 75 | 76 | void QEglFSLogindHandler::takeControl(bool connected) 77 | { 78 | if (!connected) 79 | return; 80 | 81 | Logind *logind = Logind::instance(); 82 | 83 | disconnect(logind, &Logind::connectedChanged, 84 | this, &QEglFSLogindHandler::takeControl); 85 | 86 | if (logind->hasSessionControl()) { 87 | qCDebug(qLcEglDevDebug) << "Session control already acquired via logind"; 88 | Q_EMIT initializationRequested(); 89 | } else { 90 | qCDebug(qLcEglDevDebug) << "Take control of session via logind"; 91 | logind->takeControl(); 92 | connect(logind, &Logind::hasSessionControlChanged, 93 | this, &QEglFSLogindHandler::initializationRequested, 94 | Qt::QueuedConnection); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfslogindhandler_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2018 Pier Luigi Fiorini 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSLOGINDHANDLER_P_H 41 | #define QEGLFSLOGINDHANDLER_P_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include 55 | #include 56 | 57 | #include "qeglfsglobal_p.h" 58 | 59 | QT_BEGIN_NAMESPACE 60 | 61 | class Q_EGLFS_EXPORT QEglFSLogindHandler : public QObject 62 | { 63 | Q_OBJECT 64 | public: 65 | QEglFSLogindHandler(); 66 | 67 | void initialize(); 68 | void stop(); 69 | 70 | Q_SIGNALS: 71 | void initializationRequested(); 72 | 73 | private Q_SLOTS: 74 | void takeControl(bool connected); 75 | 76 | private: 77 | QEventLoop *m_loop; 78 | }; 79 | 80 | QT_END_NAMESPACE 81 | 82 | #endif // QEGLFSLOGINDHANDLER_P_H 83 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qeglfsoffscreenwindow_p.h" 41 | #include "qeglfshooks_p.h" 42 | #include 43 | #include 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | /* 48 | In some cases pbuffers are not available. Triggering QtGui's built-in 49 | fallback for a hidden QWindow is not suitable for eglfs since this would be 50 | treated as an attempt to create multiple top-level, native windows. 51 | 52 | Therefore this class is provided as an alternative to QEGLPbuffer. 53 | 54 | This class requires the hooks to implement createNativeOffscreenWindow(). 55 | */ 56 | 57 | QEglFSOffscreenWindow::QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface) 58 | : QPlatformOffscreenSurface(offscreenSurface) 59 | , m_format(format) 60 | , m_display(display) 61 | , m_surface(EGL_NO_SURFACE) 62 | , m_window(0) 63 | { 64 | m_window = qt_egl_device_integration()->createNativeOffscreenWindow(format); 65 | if (!m_window) { 66 | qWarning("QEglFSOffscreenWindow: Failed to create native window"); 67 | return; 68 | } 69 | EGLConfig config = q_configFromGLFormat(m_display, m_format); 70 | m_surface = eglCreateWindowSurface(m_display, config, m_window, 0); 71 | if (m_surface != EGL_NO_SURFACE) 72 | m_format = q_glFormatFromConfig(m_display, config); 73 | } 74 | 75 | QEglFSOffscreenWindow::~QEglFSOffscreenWindow() 76 | { 77 | if (m_surface != EGL_NO_SURFACE) 78 | eglDestroySurface(m_display, m_surface); 79 | if (m_window) 80 | qt_egl_device_integration()->destroyNativeWindow(m_window); 81 | } 82 | 83 | QT_END_NAMESPACE 84 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSOFFSCREENWINDOW_H 41 | #define QEGLFSOFFSCREENWINDOW_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include 56 | 57 | QT_BEGIN_NAMESPACE 58 | 59 | class Q_EGLFS_EXPORT QEglFSOffscreenWindow : public QPlatformOffscreenSurface 60 | { 61 | public: 62 | QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface); 63 | ~QEglFSOffscreenWindow(); 64 | 65 | QSurfaceFormat format() const override { return m_format; } 66 | bool isValid() const override { return m_surface != EGL_NO_SURFACE; } 67 | 68 | private: 69 | QSurfaceFormat m_format; 70 | EGLDisplay m_display; 71 | EGLSurface m_surface; 72 | EGLNativeWindowType m_window; 73 | }; 74 | 75 | QT_END_NAMESPACE 76 | 77 | #endif // QEGLFSOFFSCREENWINDOW_H 78 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfsscreen_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSSCREEN_H 41 | #define QEGLFSSCREEN_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include 56 | 57 | #include 58 | 59 | QT_BEGIN_NAMESPACE 60 | 61 | class QEglFSWindow; 62 | class QOpenGLContext; 63 | 64 | class Q_EGLFS_EXPORT QEglFSScreen : public QPlatformScreen 65 | { 66 | public: 67 | QEglFSScreen(EGLDisplay display); 68 | ~QEglFSScreen(); 69 | 70 | QRect geometry() const override; 71 | virtual QRect rawGeometry() const; 72 | int depth() const override; 73 | QImage::Format format() const override; 74 | 75 | QSizeF physicalSize() const override; 76 | QDpi logicalDpi() const override; 77 | qreal pixelDensity() const override; 78 | Qt::ScreenOrientation nativeOrientation() const override; 79 | Qt::ScreenOrientation orientation() const override; 80 | 81 | QPlatformCursor *cursor() const override; 82 | 83 | qreal refreshRate() const override; 84 | 85 | QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override; 86 | 87 | EGLSurface primarySurface() const { return m_surface; } 88 | 89 | EGLDisplay display() const { return m_dpy; } 90 | 91 | void handleCursorMove(const QPoint &pos); 92 | 93 | virtual bool modeChangeRequested() const { return m_modeChangeRequested; } 94 | virtual void setModeChangeRequested(bool enabled) { m_modeChangeRequested = enabled; } 95 | 96 | bool isRecordingEnabled() const { return m_recordingEnabled; } 97 | void setRecordingEnabled(bool enabled) { m_recordingEnabled = enabled; } 98 | 99 | private: 100 | void setPrimarySurface(EGLSurface surface); 101 | 102 | EGLDisplay m_dpy; 103 | QPointer m_pointerWindow; 104 | EGLSurface m_surface; 105 | QPlatformCursor *m_cursor; 106 | bool m_modeChangeRequested = false; 107 | bool m_recordingEnabled = true; 108 | 109 | friend class QEglFSWindow; 110 | }; 111 | 112 | QT_END_NAMESPACE 113 | 114 | #endif // QEGLFSSCREEN_H 115 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/qeglfswindow_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSWINDOW_H 41 | #define QEGLFSWINDOW_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the Qt API. It exists purely as an 48 | // implementation detail. This header file may change from version to 49 | // version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | 54 | #include "qeglfsglobal_p.h" 55 | #include "qeglfsintegration_p.h" 56 | #include "qeglfsscreen_p.h" 57 | 58 | #include 59 | #ifndef QT_NO_OPENGL 60 | # include 61 | #endif 62 | 63 | QT_BEGIN_NAMESPACE 64 | 65 | class QOpenGLCompositorBackingStore; 66 | class QPlatformTextureList; 67 | #ifndef QT_NO_OPENGL 68 | class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow, public QOpenGLCompositorWindow 69 | #else 70 | class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow 71 | #endif 72 | { 73 | public: 74 | QEglFSWindow(QWindow *w); 75 | ~QEglFSWindow(); 76 | 77 | void create(); 78 | void destroy(); 79 | 80 | void setGeometry(const QRect &) override; 81 | QRect geometry() const override; 82 | void setVisible(bool visible) override; 83 | void requestActivateWindow() override; 84 | void raise() override; 85 | void lower() override; 86 | 87 | void propagateSizeHints() override { } 88 | void setMask(const QRegion &) override { } 89 | bool setKeyboardGrabEnabled(bool) override { return false; } 90 | bool setMouseGrabEnabled(bool) override { return false; } 91 | void setOpacity(qreal) override; 92 | WId winId() const override; 93 | 94 | QSurfaceFormat format() const override; 95 | 96 | EGLNativeWindowType eglWindow() const; 97 | EGLSurface surface() const; 98 | QEglFSScreen *screen() const; 99 | 100 | bool hasNativeWindow() const { return m_flags.testFlag(HasNativeWindow); } 101 | 102 | void invalidateSurface() override; 103 | virtual void resetSurface(); 104 | virtual bool resizeSurface(const QSize &size); 105 | 106 | #ifndef QT_NO_OPENGL 107 | QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; } 108 | void setBackingStore(QOpenGLCompositorBackingStore *backingStore) { m_backingStore = backingStore; } 109 | #endif 110 | bool isRaster() const; 111 | #ifndef QT_NO_OPENGL 112 | QWindow *sourceWindow() const override; 113 | const QPlatformTextureList *textures() const override; 114 | void endCompositing() override; 115 | #endif 116 | 117 | protected: 118 | #ifndef QT_NO_OPENGL 119 | QOpenGLCompositorBackingStore *m_backingStore; 120 | #endif 121 | bool m_raster; 122 | WId m_winId; 123 | 124 | EGLSurface m_surface; 125 | EGLNativeWindowType m_window; 126 | 127 | EGLConfig m_config; 128 | QSurfaceFormat m_format; 129 | 130 | enum Flag { 131 | Created = 0x01, 132 | HasNativeWindow = 0x02 133 | }; 134 | Q_DECLARE_FLAGS(Flags, Flag) 135 | Flags m_flags; 136 | }; 137 | 138 | QT_END_NAMESPACE 139 | 140 | #endif // QEGLFSWINDOW_H 141 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/vthandler.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | #include "qeglfsglobal_p.h" 30 | 31 | Q_DECLARE_LOGGING_CATEGORY(lcVtHandler) 32 | 33 | namespace Liri { 34 | 35 | namespace Platform { 36 | 37 | class VtHandlerPrivate; 38 | 39 | class Q_EGLFS_EXPORT VtHandler : public QObject 40 | { 41 | Q_OBJECT 42 | Q_DECLARE_PRIVATE(VtHandler) 43 | public: 44 | explicit VtHandler(QObject *parent = nullptr); 45 | ~VtHandler(); 46 | 47 | bool isActive() const; 48 | 49 | void activate(quint32 nr); 50 | 51 | Q_SIGNALS: 52 | void created(); 53 | void activeChanged(bool active); 54 | void interrupted(); 55 | void aboutToSuspend(); 56 | void resumed(); 57 | 58 | private: 59 | VtHandlerPrivate *const d_ptr; 60 | }; 61 | 62 | } // namespace Platform 63 | 64 | } // namespace Liri 65 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/api/vthandler_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #include 25 | #include 26 | 27 | #pragma once 28 | 29 | namespace Liri { 30 | 31 | class Logind; 32 | 33 | namespace Platform { 34 | 35 | class VtHandler; 36 | 37 | class VtHandlerPrivate 38 | { 39 | Q_DECLARE_PUBLIC(VtHandler) 40 | public: 41 | explicit VtHandlerPrivate(VtHandler *self); 42 | ~VtHandlerPrivate(); 43 | 44 | void setup(int nr); 45 | 46 | bool installSignalHandler(); 47 | void toggleTtyCursor(bool enable); 48 | void toggleKeyboard(bool enable); 49 | 50 | void closeFd(); 51 | 52 | void setActive(bool v); 53 | 54 | static bool isValidVt(int fd); 55 | static void signalHandler(int sigNo); 56 | 57 | Liri::Logind *logind; 58 | 59 | int signalFd[2]; 60 | QSocketNotifier *notifier; 61 | 62 | int vtFd; 63 | int vtNumber; 64 | QString devName; 65 | 66 | int kbMode; 67 | 68 | bool active; 69 | 70 | protected: 71 | VtHandler *q_ptr; 72 | }; 73 | 74 | } // namespace Platform 75 | 76 | } // namespace Liri 77 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/cursor-atlas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liri-archive/wayland-archived/c382e327205577c9e7d3bbe052b29e332382fe6c/src/plugins/platforms/eglfs/cursor-atlas.png -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/cursor.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": ":/cursor-atlas.png", 3 | "cursorsPerRow": 8, 4 | "hotSpots": [ 5 | [7, 2], 6 | [12, 3], 7 | [12, 12], 8 | [12, 12], 9 | [12, 12], 10 | [12, 12], 11 | [12, 12], 12 | [12, 12], 13 | [12, 12], 14 | [11, 11], 15 | [12, 12], 16 | [12, 12], 17 | [12, 12], 18 | [9, 1], 19 | [12, 12], 20 | [1, 1], 21 | [1, 1], 22 | [12, 12], 23 | [12, 12], 24 | [7, 2], 25 | [7, 2], 26 | [7, 2] 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/cursor.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | cursor-atlas.png 4 | cursor.json 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "eglfs_kms" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | LiriDynamicLibrary { 4 | name: targetName 5 | targetName: "eglfs-kms-integration" 6 | 7 | Depends { name: "lirideployment" } 8 | Depends { name: "Qt"; submodules: ["core", "core-private", "gui", "gui-private"] } 9 | Depends { name: "LiriEglFSDeviceIntegration" } 10 | Depends { name: "LiriEglFSKmsSupport" } 11 | Depends { name: "Qt5Udev" } 12 | 13 | files: ["*.cpp", "*.h", "*.json"] 14 | 15 | FileTagger { 16 | patterns: "*.json" 17 | fileTags: ["qt_plugin_metadata"] 18 | } 19 | 20 | Group { 21 | qbs.install: true 22 | qbs.installDir: lirideployment.pluginsDir + "/liri/egldeviceintegrations" 23 | fileTagsFilter: ["dynamiclibrary"] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSKMSGBMCURSOR_H 41 | #define QEGLFSKMSGBMCURSOR_H 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include 49 | 50 | QT_BEGIN_NAMESPACE 51 | 52 | class QEglFSKmsGbmScreen; 53 | class QEglFSKmsGbmCursor; 54 | 55 | class QEglFSKmsGbmCursorDeviceListener : public QObject 56 | { 57 | Q_OBJECT 58 | 59 | public: 60 | QEglFSKmsGbmCursorDeviceListener(QEglFSKmsGbmCursor *cursor) : m_cursor(cursor) { } 61 | bool hasMouse() const; 62 | 63 | public slots: 64 | void onDeviceListChanged(QInputDeviceManager::DeviceType type); 65 | 66 | private: 67 | QEglFSKmsGbmCursor *m_cursor; 68 | }; 69 | 70 | class QEglFSKmsGbmCursor : public QPlatformCursor 71 | { 72 | Q_OBJECT 73 | 74 | public: 75 | QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen); 76 | ~QEglFSKmsGbmCursor(); 77 | 78 | // input methods 79 | void pointerEvent(const QMouseEvent & event) override; 80 | #ifndef QT_NO_CURSOR 81 | void changeCursor(QCursor * windowCursor, QWindow * window) override; 82 | #endif 83 | QPoint pos() const override; 84 | void setPos(const QPoint &pos) override; 85 | 86 | void updateMouseStatus(); 87 | 88 | private: 89 | void initCursorAtlas(); 90 | 91 | enum CursorState { 92 | CursorDisabled, 93 | CursorPendingHidden, 94 | CursorHidden, 95 | CursorPendingVisible, 96 | CursorVisible 97 | }; 98 | 99 | QEglFSKmsGbmScreen *m_screen; 100 | QSize m_cursorSize; 101 | gbm_bo *m_bo; 102 | QPoint m_pos; 103 | QPlatformCursorImage m_cursorImage; 104 | CursorState m_state; 105 | QEglFSKmsGbmCursorDeviceListener *m_deviceListener; 106 | 107 | // cursor atlas information 108 | struct CursorAtlas { 109 | CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { } 110 | int cursorsPerRow; 111 | int width, height; // width and height of the atlas 112 | int cursorWidth, cursorHeight; // width and height of cursors inside the atlas 113 | QList hotSpots; 114 | QImage image; 115 | } m_cursorAtlas; 116 | }; 117 | 118 | QT_END_NAMESPACE 119 | 120 | #endif // QEGLFSKMSGBMCURSOR_H 121 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 Pier Luigi Fiorini 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Copyright (C) 2016 Pelagicore AG 6 | ** Contact: https://www.qt.io/licensing/ 7 | ** 8 | ** This file is part of the plugins of the Qt Toolkit. 9 | ** 10 | ** $QT_BEGIN_LICENSE:LGPL$ 11 | ** Commercial License Usage 12 | ** Licensees holding valid commercial Qt licenses may use this file in 13 | ** accordance with the commercial license agreement provided with the 14 | ** Software or, alternatively, in accordance with the terms contained in 15 | ** a written agreement between you and The Qt Company. For licensing terms 16 | ** and conditions see https://www.qt.io/terms-conditions. For further 17 | ** information use the contact form at https://www.qt.io/contact-us. 18 | ** 19 | ** GNU Lesser General Public License Usage 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser 21 | ** General Public License version 3 as published by the Free Software 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 23 | ** packaging of this file. Please review the following information to 24 | ** ensure the GNU Lesser General Public License version 3 requirements 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 26 | ** 27 | ** GNU General Public License Usage 28 | ** Alternatively, this file may be used under the terms of the GNU 29 | ** General Public License version 2.0 or (at your option) the GNU General 30 | ** Public license version 3 or any later version approved by the KDE Free 31 | ** Qt Foundation. The licenses are as published by the Free Software 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 33 | ** included in the packaging of this file. Please review the following 34 | ** information to ensure the GNU General Public License requirements will 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. 37 | ** 38 | ** $QT_END_LICENSE$ 39 | ** 40 | ****************************************************************************/ 41 | 42 | #ifndef QEGLFSKMSGBMDEVICE_H 43 | #define QEGLFSKMSGBMDEVICE_H 44 | 45 | #include "qeglfskmsgbmcursor.h" 46 | #include 47 | 48 | #include 49 | 50 | QT_BEGIN_NAMESPACE 51 | 52 | class QEglFSKmsScreen; 53 | 54 | class QEglFSKmsGbmDevice: public QEglFSKmsDevice 55 | { 56 | public: 57 | QEglFSKmsGbmDevice(QKmsScreenConfig *screenConfig, const QString &path); 58 | 59 | bool open() override; 60 | void close() override; 61 | 62 | void *nativeDisplay() const override; 63 | gbm_device *gbmDevice() const; 64 | 65 | QPlatformCursor *globalCursor() const; 66 | void destroyGlobalCursor(); 67 | 68 | QPlatformScreen *createScreen(const QKmsOutput &output) override; 69 | QPlatformScreen *createHeadlessScreen() override; 70 | void registerScreenCloning(QPlatformScreen *screen, 71 | QPlatformScreen *screenThisScreenClones, 72 | const QVector &screensCloningThisScreen) override; 73 | 74 | private: 75 | Q_DISABLE_COPY(QEglFSKmsGbmDevice) 76 | 77 | gbm_device *m_gbm_device; 78 | 79 | QEglFSKmsGbmCursor *m_globalCursor; 80 | }; 81 | 82 | QT_END_NAMESPACE 83 | 84 | #endif // QEGLFSKMSGBMDEVICE_H 85 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 Pier Luigi Fiorini 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Copyright (C) 2016 Pelagicore AG 6 | ** Contact: https://www.qt.io/licensing/ 7 | ** 8 | ** This file is part of the plugins of the Qt Toolkit. 9 | ** 10 | ** $QT_BEGIN_LICENSE:LGPL$ 11 | ** Commercial License Usage 12 | ** Licensees holding valid commercial Qt licenses may use this file in 13 | ** accordance with the commercial license agreement provided with the 14 | ** Software or, alternatively, in accordance with the terms contained in 15 | ** a written agreement between you and The Qt Company. For licensing terms 16 | ** and conditions see https://www.qt.io/terms-conditions. For further 17 | ** information use the contact form at https://www.qt.io/contact-us. 18 | ** 19 | ** GNU Lesser General Public License Usage 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser 21 | ** General Public License version 3 as published by the Free Software 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 23 | ** packaging of this file. Please review the following information to 24 | ** ensure the GNU Lesser General Public License version 3 requirements 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 26 | ** 27 | ** GNU General Public License Usage 28 | ** Alternatively, this file may be used under the terms of the GNU 29 | ** General Public License version 2.0 or (at your option) the GNU General 30 | ** Public license version 3 or any later version approved by the KDE Free 31 | ** Qt Foundation. The licenses are as published by the Free Software 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 33 | ** included in the packaging of this file. Please review the following 34 | ** information to ensure the GNU General Public License requirements will 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. 37 | ** 38 | ** $QT_END_LICENSE$ 39 | ** 40 | ****************************************************************************/ 41 | 42 | #ifndef QEGLFSKMSGBMINTEGRATION_H 43 | #define QEGLFSKMSGBMINTEGRATION_H 44 | 45 | #include "qeglfskmsintegration.h" 46 | #include 47 | #include 48 | 49 | namespace QtUdev { 50 | class Udev; 51 | } 52 | 53 | QT_BEGIN_NAMESPACE 54 | 55 | class QEglFSKmsDevice; 56 | 57 | class QEglFSKmsGbmIntegration : public QEglFSKmsIntegration 58 | { 59 | public: 60 | QEglFSKmsGbmIntegration(); 61 | ~QEglFSKmsGbmIntegration(); 62 | 63 | EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) override; 64 | EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow, 65 | const QSize &size, 66 | const QSurfaceFormat &format); 67 | EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format) override; 68 | void destroyNativeWindow(EGLNativeWindowType window) override; 69 | 70 | QPlatformCursor *createCursor(QPlatformScreen *screen) const override; 71 | void presentBuffer(QPlatformSurface *surface) override; 72 | QEglFSWindow *createWindow(QWindow *window) const override; 73 | 74 | QFunctionPointer platformFunction(const QByteArray &function) const override; 75 | 76 | protected: 77 | QKmsDevice *createDevice() override; 78 | 79 | private: 80 | QtUdev::Udev *m_udev; 81 | 82 | static void setScreenPositionStatic(QScreen *screen, const QPoint &pos); 83 | static void setScreenModeStatic(QScreen *screen, int modeIndex); 84 | }; 85 | 86 | QT_END_NAMESPACE 87 | 88 | #endif // QEGLFSKMSGBMINTEGRATION_H 89 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Copyright (C) 2016 Pelagicore AG 5 | ** Contact: https://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the qmake spec of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see https://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at https://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or (at your option) the GNU General 29 | ** Public license version 3 or any later version approved by the KDE Free 30 | ** Qt Foundation. The licenses are as published by the Free Software 31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 32 | ** included in the packaging of this file. Please review the following 33 | ** information to ensure the GNU General Public License requirements will 34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 35 | ** https://www.gnu.org/licenses/gpl-3.0.html. 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "qeglfsdeviceintegration_p.h" 42 | #include "qeglfskmsgbmintegration.h" 43 | 44 | QT_BEGIN_NAMESPACE 45 | 46 | class QEglFSKmsGbmIntegrationPlugin : public QEglFSDeviceIntegrationPlugin 47 | { 48 | Q_OBJECT 49 | Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_kms.json") 50 | 51 | public: 52 | QEglFSDeviceIntegration *create() override { return new QEglFSKmsGbmIntegration; } 53 | }; 54 | 55 | QT_END_NAMESPACE 56 | 57 | #include "qeglfskmsgbmmain.moc" 58 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 Pier Luigi Fiorini 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Copyright (C) 2016 Pelagicore AG 6 | ** Contact: https://www.qt.io/licensing/ 7 | ** 8 | ** This file is part of the plugins of the Qt Toolkit. 9 | ** 10 | ** $QT_BEGIN_LICENSE:LGPL$ 11 | ** Commercial License Usage 12 | ** Licensees holding valid commercial Qt licenses may use this file in 13 | ** accordance with the commercial license agreement provided with the 14 | ** Software or, alternatively, in accordance with the terms contained in 15 | ** a written agreement between you and The Qt Company. For licensing terms 16 | ** and conditions see https://www.qt.io/terms-conditions. For further 17 | ** information use the contact form at https://www.qt.io/contact-us. 18 | ** 19 | ** GNU Lesser General Public License Usage 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser 21 | ** General Public License version 3 as published by the Free Software 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 23 | ** packaging of this file. Please review the following information to 24 | ** ensure the GNU Lesser General Public License version 3 requirements 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 26 | ** 27 | ** GNU General Public License Usage 28 | ** Alternatively, this file may be used under the terms of the GNU 29 | ** General Public License version 2.0 or (at your option) the GNU General 30 | ** Public license version 3 or any later version approved by the KDE Free 31 | ** Qt Foundation. The licenses are as published by the Free Software 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 33 | ** included in the packaging of this file. Please review the following 34 | ** information to ensure the GNU General Public License requirements will 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. 37 | ** 38 | ** $QT_END_LICENSE$ 39 | ** 40 | ****************************************************************************/ 41 | 42 | #ifndef QEGLFSKMSGBMSCREEN_H 43 | #define QEGLFSKMSGBMSCREEN_H 44 | 45 | #include "qeglfskmsscreen.h" 46 | #include 47 | 48 | #include 49 | 50 | QT_BEGIN_NAMESPACE 51 | 52 | class QEglFSKmsGbmCursor; 53 | 54 | class QEglFSKmsGbmScreen : public QEglFSKmsScreen 55 | { 56 | public: 57 | QEglFSKmsGbmScreen(QKmsDevice *device, const QKmsOutput &output, bool headless); 58 | ~QEglFSKmsGbmScreen(); 59 | 60 | QPlatformCursor *cursor() const override; 61 | 62 | gbm_surface *createSurface(); 63 | void resetSurface(); 64 | void setSurface(gbm_surface *surface); 65 | 66 | void initCloning(QPlatformScreen *screenThisScreenClones, 67 | const QVector &screensCloningThisScreen); 68 | 69 | void waitForFlip() override; 70 | 71 | void flip(); 72 | 73 | private: 74 | void flipFinished(); 75 | void ensureModeSet(uint32_t fb); 76 | void cloneDestFlipFinished(QEglFSKmsGbmScreen *cloneDestScreen); 77 | void updateFlipStatus(); 78 | void recordFrame(EGLClientBuffer bo, int width, int height); 79 | 80 | static void pageFlipHandler(int fd, 81 | unsigned int sequence, 82 | unsigned int tv_sec, 83 | unsigned int tv_usec, 84 | void *user_data); 85 | 86 | gbm_surface *m_gbm_surface; 87 | 88 | gbm_bo *m_gbm_bo_current; 89 | gbm_bo *m_gbm_bo_next; 90 | bool m_flipPending; 91 | 92 | QScopedPointer m_cursor; 93 | 94 | struct FrameBuffer { 95 | uint32_t fb = 0; 96 | }; 97 | static void bufferDestroyedHandler(gbm_bo *bo, void *data); 98 | FrameBuffer *framebufferForBufferObject(gbm_bo *bo); 99 | 100 | QEglFSKmsGbmScreen *m_cloneSource; 101 | struct CloneDestination { 102 | QEglFSKmsGbmScreen *screen = nullptr; 103 | bool cloneFlipPending = false; 104 | }; 105 | QVector m_cloneDests; 106 | 107 | static QMutex m_waitForFlipMutex; 108 | }; 109 | 110 | QT_END_NAMESPACE 111 | 112 | #endif // QEGLFSKMSGBMSCREEN_H 113 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 Pier Luigi Fiorini 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Copyright (C) 2016 Pelagicore AG 6 | ** Contact: https://www.qt.io/licensing/ 7 | ** 8 | ** This file is part of the plugins of the Qt Toolkit. 9 | ** 10 | ** $QT_BEGIN_LICENSE:LGPL$ 11 | ** Commercial License Usage 12 | ** Licensees holding valid commercial Qt licenses may use this file in 13 | ** accordance with the commercial license agreement provided with the 14 | ** Software or, alternatively, in accordance with the terms contained in 15 | ** a written agreement between you and The Qt Company. For licensing terms 16 | ** and conditions see https://www.qt.io/terms-conditions. For further 17 | ** information use the contact form at https://www.qt.io/contact-us. 18 | ** 19 | ** GNU Lesser General Public License Usage 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser 21 | ** General Public License version 3 as published by the Free Software 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 23 | ** packaging of this file. Please review the following information to 24 | ** ensure the GNU Lesser General Public License version 3 requirements 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 26 | ** 27 | ** GNU General Public License Usage 28 | ** Alternatively, this file may be used under the terms of the GNU 29 | ** General Public License version 2.0 or (at your option) the GNU General 30 | ** Public license version 3 or any later version approved by the KDE Free 31 | ** Qt Foundation. The licenses are as published by the Free Software 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 33 | ** included in the packaging of this file. Please review the following 34 | ** information to ensure the GNU General Public License requirements will 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. 37 | ** 38 | ** $QT_END_LICENSE$ 39 | ** 40 | ****************************************************************************/ 41 | 42 | #ifndef QEGLFSKMSGBMWINDOW_H 43 | #define QEGLFSKMSGBMWINDOW_H 44 | 45 | #include "private/qeglfswindow_p.h" 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | class QEglFSKmsGbmIntegration; 50 | 51 | class QEglFSKmsGbmWindow : public QEglFSWindow 52 | { 53 | public: 54 | QEglFSKmsGbmWindow(QWindow *w, const QEglFSKmsGbmIntegration *integration) 55 | : QEglFSWindow(w), 56 | m_integration(integration) 57 | { } 58 | void resetSurface() override; 59 | void invalidateSurface() override; 60 | bool resizeSurface(const QSize &size) override; 61 | 62 | private: 63 | const QEglFSKmsGbmIntegration *m_integration; 64 | }; 65 | 66 | QT_END_NAMESPACE 67 | 68 | #endif // QEGLFSKMSGBMWINDOW_H 69 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "eglfs_kms_egldevice" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | LiriDynamicLibrary { 4 | name: targetName 5 | targetName: "eglfs-kms-egldevice-integration" 6 | 7 | Depends { name: "lirideployment" } 8 | Depends { name: "Qt"; submodules: ["core", "core-private", "gui", "gui-private"] } 9 | Depends { name: "LiriEglFSDeviceIntegration" } 10 | Depends { name: "LiriEglFSKmsSupport" } 11 | 12 | files: ["*.cpp", "*.h", "*.json"] 13 | 14 | FileTagger { 15 | patterns: "*.json" 16 | fileTags: ["qt_plugin_metadata"] 17 | } 18 | 19 | Group { 20 | qbs.install: true 21 | qbs.installDir: lirideployment.pluginsDir + "/liri/egldeviceintegrations" 22 | fileTagsFilter: ["dynamiclibrary"] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Pelagicore AG 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qeglfskmsegldevice.h" 41 | #include "qeglfskmsegldevicescreen.h" 42 | #include "qeglfskmsegldeviceintegration.h" 43 | #include "private/qeglfsintegration_p.h" 44 | #include "private/qeglfscursor_p.h" 45 | 46 | #include 47 | 48 | #include 49 | 50 | using namespace Liri; 51 | 52 | QT_BEGIN_NAMESPACE 53 | 54 | QEglFSKmsEglDevice::QEglFSKmsEglDevice(QEglFSKmsEglDeviceIntegration *devInt, QKmsScreenConfig *screenConfig, const QString &path) 55 | : QEglFSKmsDevice(screenConfig, path), 56 | m_devInt(devInt), 57 | m_globalCursor(nullptr) 58 | { 59 | } 60 | 61 | bool QEglFSKmsEglDevice::open() 62 | { 63 | Q_ASSERT(fd() == -1); 64 | 65 | Logind *logind = Logind::instance(); 66 | 67 | if (!logind->isConnected()) { 68 | qCWarning(qLcEglfsKmsDebug, "Cannot open DRM device %s: logind connection was not established", 69 | qPrintable(devicePath())); 70 | return false; 71 | } 72 | if (!logind->hasSessionControl()) { 73 | qCWarning(qLcEglfsKmsDebug, "Cannot open DRM device %s: session control not acquired", 74 | qPrintable(devicePath())); 75 | return false; 76 | } 77 | 78 | int fd = logind->takeDevice(devicePath()); 79 | if (Q_UNLIKELY(fd < 0)) 80 | qFatal("Could not open DRM (NV) device"); 81 | 82 | setFd(fd); 83 | 84 | return true; 85 | } 86 | 87 | void QEglFSKmsEglDevice::close() 88 | { 89 | // Note: screens are gone at this stage. 90 | 91 | if (fd() != -1) { 92 | Logind::instance()->releaseDevice(fd()); 93 | setFd(-1); 94 | } 95 | } 96 | 97 | void *QEglFSKmsEglDevice::nativeDisplay() const 98 | { 99 | return m_devInt->eglDevice(); 100 | } 101 | 102 | QPlatformScreen *QEglFSKmsEglDevice::createScreen(const QKmsOutput &output) 103 | { 104 | QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(this, output); 105 | #if QT_CONFIG(opengl) 106 | if (!m_globalCursor && !screenConfig()->separateScreens()) { 107 | qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor"); 108 | m_globalCursor = new QEglFSCursor(screen); 109 | } 110 | #endif 111 | return screen; 112 | } 113 | 114 | void QEglFSKmsEglDevice::destroyGlobalCursor() 115 | { 116 | if (m_globalCursor) { 117 | qCDebug(qLcEglfsKmsDebug, "Destroying global mouse cursor"); 118 | delete m_globalCursor; 119 | m_globalCursor = nullptr; 120 | } 121 | } 122 | 123 | QT_END_NAMESPACE 124 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Pelagicore AG 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSKMSEGLDEVICE_H 41 | #define QEGLFSKMSEGLDEVICE_H 42 | 43 | #include 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QPlatformCursor; 48 | class QEglFSKmsEglDeviceIntegration; 49 | 50 | class QEglFSKmsEglDevice: public QEglFSKmsDevice 51 | { 52 | public: 53 | QEglFSKmsEglDevice(QEglFSKmsEglDeviceIntegration *devInt, QKmsScreenConfig *screenConfig, const QString &path); 54 | 55 | bool open() override; 56 | void close() override; 57 | 58 | void *nativeDisplay() const override; 59 | 60 | QPlatformScreen *createScreen(const QKmsOutput &output) override; 61 | 62 | QPlatformCursor *globalCursor() { return m_globalCursor; } 63 | void destroyGlobalCursor(); 64 | 65 | private: 66 | QEglFSKmsEglDeviceIntegration *m_devInt; 67 | QPlatformCursor *m_globalCursor; 68 | }; 69 | 70 | QT_END_NAMESPACE 71 | 72 | #endif // QEGLFSKMSEGLDEVICE_H 73 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Copyright (C) 2016 Pelagicore AG 5 | ** Contact: https://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the plugins of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see https://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at https://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or (at your option) the GNU General 29 | ** Public license version 3 or any later version approved by the KDE Free 30 | ** Qt Foundation. The licenses are as published by the Free Software 31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 32 | ** included in the packaging of this file. Please review the following 33 | ** information to ensure the GNU General Public License requirements will 34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 35 | ** https://www.gnu.org/licenses/gpl-3.0.html. 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef QEGLFSKMSEGLDEVICEINTEGRATION_H 42 | #define QEGLFSKMSEGLDEVICEINTEGRATION_H 43 | 44 | #include 45 | 46 | #include 47 | #include 48 | 49 | #include 50 | 51 | QT_BEGIN_NAMESPACE 52 | 53 | class QEglFSKmsEglDeviceIntegration : public QEglFSKmsIntegration 54 | { 55 | public: 56 | QEglFSKmsEglDeviceIntegration(); 57 | 58 | QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override; 59 | EGLint surfaceType() const override; 60 | EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) override; 61 | bool supportsSurfacelessContexts() const override; 62 | bool supportsPBuffers() const override; 63 | QEglFSWindow *createWindow(QWindow *window) const override; 64 | 65 | EGLDeviceEXT eglDevice() const { return m_egl_device; } 66 | 67 | protected: 68 | QKmsDevice *createDevice() override; 69 | QPlatformCursor *createCursor(QPlatformScreen *screen) const override; 70 | 71 | private: 72 | bool setup_kms(); 73 | bool query_egl_device(); 74 | 75 | EGLDeviceEXT m_egl_device; 76 | QEGLStreamConvenience *m_funcs; 77 | 78 | friend class QEglFSKmsEglDeviceWindow; 79 | }; 80 | 81 | QT_END_NAMESPACE 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the qmake spec of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qeglfskmsegldeviceintegration.h" 41 | 42 | QT_BEGIN_NAMESPACE 43 | 44 | class QEglFSKmsEglDeviceIntegrationPlugin : public QEglFSDeviceIntegrationPlugin 45 | { 46 | Q_OBJECT 47 | Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_kms_egldevice.json") 48 | 49 | public: 50 | QEglFSDeviceIntegration *create() override { return new QEglFSKmsEglDeviceIntegration; } 51 | }; 52 | 53 | QT_END_NAMESPACE 54 | 55 | #include "qeglfskmsegldevicemain.moc" 56 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Pelagicore AG 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qeglfskmsegldevicescreen.h" 41 | #include "qeglfskmsegldevice.h" 42 | #include 43 | #include 44 | #include 45 | 46 | QT_BEGIN_NAMESPACE 47 | 48 | Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) 49 | 50 | QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QKmsDevice *device, const QKmsOutput &output) 51 | : QEglFSKmsScreen(device, output) 52 | { 53 | } 54 | 55 | QEglFSKmsEglDeviceScreen::~QEglFSKmsEglDeviceScreen() 56 | { 57 | const int remainingScreenCount = qGuiApp->screens().count(); 58 | qCDebug(qLcEglfsKmsDebug, "Screen dtor. Remaining screens: %d", remainingScreenCount); 59 | if (!remainingScreenCount && !device()->screenConfig()->separateScreens()) 60 | static_cast(device())->destroyGlobalCursor(); 61 | } 62 | 63 | QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const 64 | { 65 | // The base class creates a cursor via integration->createCursor() 66 | // in its ctor. With separateScreens just use that. Otherwise 67 | // there's a virtual desktop and the device has a global cursor 68 | // and the base class has no dedicated cursor at all. 69 | // config->hwCursor() is ignored for now, just use the standard OpenGL cursor. 70 | return device()->screenConfig()->separateScreens() 71 | ? QEglFSScreen::cursor() 72 | : static_cast(device())->globalCursor(); 73 | } 74 | 75 | void QEglFSKmsEglDeviceScreen::waitForFlip() 76 | { 77 | QKmsOutput &op(output()); 78 | const int fd = device()->fd(); 79 | const uint32_t w = op.modes[op.mode].hdisplay; 80 | const uint32_t h = op.modes[op.mode].vdisplay; 81 | 82 | if (!op.mode_set) { 83 | op.mode_set = true; 84 | 85 | drmModeCrtcPtr currentMode = drmModeGetCrtc(fd, op.crtc_id); 86 | const bool alreadySet = currentMode && currentMode->width == w && currentMode->height == h; 87 | if (currentMode) 88 | drmModeFreeCrtc(currentMode); 89 | if (alreadySet) { 90 | // Maybe detecting the DPMS mode could help here, but there are no properties 91 | // exposed on the connector apparently. So rely on an env var for now. 92 | static bool alwaysDoSet = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ALWAYS_SET_MODE"); 93 | if (!alwaysDoSet) { 94 | qCDebug(qLcEglfsKmsDebug, "Mode already set"); 95 | return; 96 | } 97 | } 98 | 99 | qCDebug(qLcEglfsKmsDebug, "Setting mode"); 100 | int ret = drmModeSetCrtc(fd, op.crtc_id, 101 | uint32_t(-1), 0, 0, 102 | &op.connector_id, 1, 103 | &op.modes[op.mode]); 104 | if (ret) 105 | qErrnoWarning(errno, "drmModeSetCrtc failed"); 106 | } 107 | 108 | if (!op.forced_plane_set) { 109 | op.forced_plane_set = true; 110 | 111 | if (op.wants_forced_plane) { 112 | qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.forced_plane_id); 113 | int ret = drmModeSetPlane(fd, op.forced_plane_id, op.crtc_id, uint32_t(-1), 0, 114 | 0, 0, w, h, 115 | 0 << 16, 0 << 16, w << 16, h << 16); 116 | if (ret == -1) 117 | qErrnoWarning(errno, "drmModeSetPlane failed"); 118 | } 119 | } 120 | } 121 | 122 | QT_END_NAMESPACE 123 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Pelagicore AG 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QEGLFSKMSEGLDEVICESCREEN_H 41 | #define QEGLFSKMSEGLDEVICESCREEN_H 42 | 43 | #include 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QEglFSKmsEglDeviceScreen : public QEglFSKmsScreen 48 | { 49 | public: 50 | QEglFSKmsEglDeviceScreen(QKmsDevice *device, const QKmsOutput &output); 51 | ~QEglFSKmsEglDeviceScreen(); 52 | 53 | QPlatformCursor *cursor() const override; 54 | 55 | void waitForFlip() override; 56 | }; 57 | 58 | QT_END_NAMESPACE 59 | 60 | #endif // QEGLFSKMSEGLDEVICESCREEN_H 61 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | import LiriUtils 3 | 4 | LiriModuleProject { 5 | name: "LiriEglFSKmsSupport" 6 | moduleName: "LiriEglFSKmsSupport" 7 | description: "KMS support for EGL device integration" 8 | createPkgConfig: false 9 | createCMake: false 10 | 11 | resolvedProperties: ({ 12 | Depends: [{ name: LiriUtils.quote("Qt.core-private") }, 13 | { name: LiriUtils.quote("Qt.gui-private") }, 14 | { name: LiriUtils.quote("LiriEglFSDeviceIntegration") }, 15 | { name: LiriUtils.quote("LiriEdidSupport-private") }, 16 | { name: LiriUtils.quote("LiriKmsSupport-private") }], 17 | }) 18 | 19 | LiriHeaders { 20 | Group { 21 | name: "Headers" 22 | files: "**/*.h" 23 | fileTags: ["hpp_syncable"] 24 | } 25 | } 26 | 27 | LiriModule { 28 | name: project.moduleName 29 | targetName: project.targetName 30 | version: "0.0.0" 31 | 32 | Depends { name: project.headersName } 33 | Depends { 34 | name: "Qt" 35 | submodules: ["core-private", "gui-private"] 36 | } 37 | Depends { name: "LiriEglFSDeviceIntegration" } 38 | Depends { name: "LiriEdidSupport-private" } 39 | Depends { name: "LiriKmsSupport-private" } 40 | Depends { name: "gbm" } 41 | Depends { name: "libdrm" } 42 | 43 | condition: { 44 | if (!gbm.found) { 45 | console.error("gbm is required to build " + targetName); 46 | return false; 47 | } 48 | 49 | if (!libdrm.found) { 50 | console.error("libdrm is required to build " + targetName); 51 | return false; 52 | } 53 | 54 | return true; 55 | } 56 | 57 | cpp.defines: [ 58 | 'LIRIWAYLAND_VERSION="' + project.version + '"', 59 | ] 60 | 61 | files: ["*.cpp", "*.h"] 62 | 63 | Export { 64 | Depends { name: "cpp" } 65 | Depends { name: project.headersName } 66 | Depends { 67 | name: "Qt" 68 | submodules: ["core-private", "gui-private"] 69 | } 70 | Depends { name: "LiriEglFSDeviceIntegration" } 71 | Depends { name: "LiriEdidSupport-private" } 72 | Depends { name: "LiriKmsSupport-private" } 73 | Depends { name: "gbm" } 74 | Depends { name: "libdrm" } 75 | 76 | cpp.includePaths: product.sourceDirectory 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Copyright (C) 2016 Pelagicore AG 5 | ** Contact: https://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the plugins of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see https://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at https://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or (at your option) the GNU General 29 | ** Public license version 3 or any later version approved by the KDE Free 30 | ** Qt Foundation. The licenses are as published by the Free Software 31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 32 | ** included in the packaging of this file. Please review the following 33 | ** information to ensure the GNU General Public License requirements will 34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 35 | ** https://www.gnu.org/licenses/gpl-3.0.html. 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "qeglfskmsdevice.h" 42 | #include "qeglfskmsscreen.h" 43 | #include "private/qeglfsintegration_p.h" 44 | #include 45 | 46 | QT_BEGIN_NAMESPACE 47 | 48 | QEglFSKmsDevice::QEglFSKmsDevice(QKmsScreenConfig *screenConfig, const QString &path) 49 | : QKmsDevice(screenConfig, path) 50 | { 51 | } 52 | 53 | void QEglFSKmsDevice::registerScreen(QPlatformScreen *screen, 54 | bool isPrimary, 55 | const QPoint &virtualPos, 56 | const QList &virtualSiblings) 57 | { 58 | QEglFSKmsScreen *s = static_cast(screen); 59 | s->setVirtualPosition(virtualPos); 60 | s->setVirtualSiblings(virtualSiblings); 61 | static_cast(QGuiApplicationPrivate::platformIntegration())->addScreen(s, isPrimary); 62 | } 63 | 64 | QT_END_NAMESPACE 65 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Copyright (C) 2016 Pelagicore AG 5 | ** Contact: https://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the plugins of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:LGPL$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see https://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at https://www.qt.io/contact-us. 17 | ** 18 | ** GNU Lesser General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 22 | ** packaging of this file. Please review the following information to 23 | ** ensure the GNU Lesser General Public License version 3 requirements 24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 25 | ** 26 | ** GNU General Public License Usage 27 | ** Alternatively, this file may be used under the terms of the GNU 28 | ** General Public License version 2.0 or (at your option) the GNU General 29 | ** Public license version 3 or any later version approved by the KDE Free 30 | ** Qt Foundation. The licenses are as published by the Free Software 31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 32 | ** included in the packaging of this file. Please review the following 33 | ** information to ensure the GNU General Public License requirements will 34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 35 | ** https://www.gnu.org/licenses/gpl-3.0.html. 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef QEGLFSKMSDEVICE_H 42 | #define QEGLFSKMSDEVICE_H 43 | 44 | #include "private/qeglfsglobal_p.h" 45 | #include 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | class Q_EGLFS_EXPORT QEglFSKmsDevice : public QKmsDevice 50 | { 51 | public: 52 | QEglFSKmsDevice(QKmsScreenConfig *screenConfig, const QString &path); 53 | 54 | void registerScreen(QPlatformScreen *screen, 55 | bool isPrimary, 56 | const QPoint &virtualPos, 57 | const QList &virtualSiblings) override; 58 | }; 59 | 60 | QT_END_NAMESPACE 61 | 62 | #endif // QEGLFSKMSDEVICE_H 63 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 Pier Luigi Fiorini 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Copyright (C) 2016 Pelagicore AG 6 | ** Contact: https://www.qt.io/licensing/ 7 | ** 8 | ** This file is part of the plugins of the Qt Toolkit. 9 | ** 10 | ** $QT_BEGIN_LICENSE:LGPL$ 11 | ** Commercial License Usage 12 | ** Licensees holding valid commercial Qt licenses may use this file in 13 | ** accordance with the commercial license agreement provided with the 14 | ** Software or, alternatively, in accordance with the terms contained in 15 | ** a written agreement between you and The Qt Company. For licensing terms 16 | ** and conditions see https://www.qt.io/terms-conditions. For further 17 | ** information use the contact form at https://www.qt.io/contact-us. 18 | ** 19 | ** GNU Lesser General Public License Usage 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser 21 | ** General Public License version 3 as published by the Free Software 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 23 | ** packaging of this file. Please review the following information to 24 | ** ensure the GNU Lesser General Public License version 3 requirements 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 26 | ** 27 | ** GNU General Public License Usage 28 | ** Alternatively, this file may be used under the terms of the GNU 29 | ** General Public License version 2.0 or (at your option) the GNU General 30 | ** Public license version 3 or any later version approved by the KDE Free 31 | ** Qt Foundation. The licenses are as published by the Free Software 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 33 | ** included in the packaging of this file. Please review the following 34 | ** information to ensure the GNU General Public License requirements will 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. 37 | ** 38 | ** $QT_END_LICENSE$ 39 | ** 40 | ****************************************************************************/ 41 | 42 | #include "qeglfskmsintegration.h" 43 | #include "qeglfskmsscreen.h" 44 | 45 | #include 46 | 47 | #include 48 | #include 49 | 50 | #include 51 | #include 52 | 53 | #include 54 | 55 | QT_BEGIN_NAMESPACE 56 | 57 | Q_LOGGING_CATEGORY(qLcEglfsKmsDebug, "qt.qpa.eglfs.kms") 58 | 59 | QEglFSKmsIntegration::QEglFSKmsIntegration() 60 | : m_device(nullptr), 61 | m_screenConfig(new QKmsScreenConfig) 62 | { 63 | } 64 | 65 | QEglFSKmsIntegration::~QEglFSKmsIntegration() 66 | { 67 | delete m_screenConfig; 68 | } 69 | 70 | void QEglFSKmsIntegration::platformInit() 71 | { 72 | qCDebug(qLcEglfsKmsDebug, "platformInit: Opening DRM device"); 73 | m_device = createDevice(); 74 | if (Q_UNLIKELY(!m_device->open())) 75 | qFatal("Could not open DRM device"); 76 | } 77 | 78 | void QEglFSKmsIntegration::platformDestroy() 79 | { 80 | qCDebug(qLcEglfsKmsDebug, "platformDestroy: Closing DRM device"); 81 | m_device->close(); 82 | delete m_device; 83 | m_device = nullptr; 84 | } 85 | 86 | EGLNativeDisplayType QEglFSKmsIntegration::platformDisplay() const 87 | { 88 | Q_ASSERT(m_device); 89 | return (EGLNativeDisplayType) m_device->nativeDisplay(); 90 | } 91 | 92 | bool QEglFSKmsIntegration::usesDefaultScreen() 93 | { 94 | return false; 95 | } 96 | 97 | void QEglFSKmsIntegration::screenInit() 98 | { 99 | m_device->createScreens(); 100 | } 101 | 102 | QSurfaceFormat QEglFSKmsIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const 103 | { 104 | QSurfaceFormat format(inputFormat); 105 | format.setRenderableType(QSurfaceFormat::OpenGLES); 106 | format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); 107 | format.setRedBufferSize(8); 108 | format.setGreenBufferSize(8); 109 | format.setBlueBufferSize(8); 110 | return format; 111 | } 112 | 113 | bool QEglFSKmsIntegration::hasCapability(QPlatformIntegration::Capability cap) const 114 | { 115 | switch (cap) { 116 | case QPlatformIntegration::ThreadedPixmaps: 117 | case QPlatformIntegration::OpenGL: 118 | case QPlatformIntegration::ThreadedOpenGL: 119 | return true; 120 | default: 121 | return false; 122 | } 123 | } 124 | 125 | void QEglFSKmsIntegration::waitForVSync(QPlatformSurface *surface) const 126 | { 127 | QWindow *window = static_cast(surface->surface()); 128 | QEglFSKmsScreen *screen = static_cast(window->screen()->handle()); 129 | 130 | screen->waitForFlip(); 131 | } 132 | 133 | bool QEglFSKmsIntegration::supportsPBuffers() const 134 | { 135 | return m_screenConfig->supportsPBuffers(); 136 | } 137 | 138 | void *QEglFSKmsIntegration::nativeResourceForIntegration(const QByteArray &name) 139 | { 140 | if (name == QByteArrayLiteral("dri_fd") && m_device) 141 | return (void *) (qintptr) m_device->fd(); 142 | 143 | return nullptr; 144 | } 145 | 146 | QKmsDevice *QEglFSKmsIntegration::device() const 147 | { 148 | return m_device; 149 | } 150 | 151 | QKmsScreenConfig *QEglFSKmsIntegration::screenConfig() const 152 | { 153 | return m_screenConfig; 154 | } 155 | 156 | QFunctionPointer QEglFSKmsIntegration::platformFunction(const QByteArray &function) const 157 | { 158 | if (function == Liri::Platform::EglFSFunctions::setScreenScaleFactorIdentifier()) 159 | return QFunctionPointer(setScreenScaleFactorStatic); 160 | 161 | return nullptr; 162 | } 163 | 164 | void QEglFSKmsIntegration::setScreenScaleFactorStatic(QScreen *screen, qreal factor) 165 | { 166 | QEglFSKmsScreen *kmsScreen = static_cast(screen->handle()); 167 | kmsScreen->setScaleFactor(factor); 168 | } 169 | 170 | QT_END_NAMESPACE 171 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 Pier Luigi Fiorini 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Copyright (C) 2016 Pelagicore AG 6 | ** Contact: https://www.qt.io/licensing/ 7 | ** 8 | ** This file is part of the plugins of the Qt Toolkit. 9 | ** 10 | ** $QT_BEGIN_LICENSE:LGPL$ 11 | ** Commercial License Usage 12 | ** Licensees holding valid commercial Qt licenses may use this file in 13 | ** accordance with the commercial license agreement provided with the 14 | ** Software or, alternatively, in accordance with the terms contained in 15 | ** a written agreement between you and The Qt Company. For licensing terms 16 | ** and conditions see https://www.qt.io/terms-conditions. For further 17 | ** information use the contact form at https://www.qt.io/contact-us. 18 | ** 19 | ** GNU Lesser General Public License Usage 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser 21 | ** General Public License version 3 as published by the Free Software 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 23 | ** packaging of this file. Please review the following information to 24 | ** ensure the GNU Lesser General Public License version 3 requirements 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 26 | ** 27 | ** GNU General Public License Usage 28 | ** Alternatively, this file may be used under the terms of the GNU 29 | ** General Public License version 2.0 or (at your option) the GNU General 30 | ** Public license version 3 or any later version approved by the KDE Free 31 | ** Qt Foundation. The licenses are as published by the Free Software 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 33 | ** included in the packaging of this file. Please review the following 34 | ** information to ensure the GNU General Public License requirements will 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. 37 | ** 38 | ** $QT_END_LICENSE$ 39 | ** 40 | ****************************************************************************/ 41 | 42 | #ifndef QEGLFSKMSINTEGRATION_H 43 | #define QEGLFSKMSINTEGRATION_H 44 | 45 | #include "private/qeglfsdeviceintegration_p.h" 46 | #include 47 | #include 48 | #include 49 | 50 | QT_BEGIN_NAMESPACE 51 | 52 | class QKmsDevice; 53 | class QKmsScreenConfig; 54 | 55 | Q_EGLFS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) 56 | 57 | class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEglFSDeviceIntegration 58 | { 59 | public: 60 | QEglFSKmsIntegration(); 61 | ~QEglFSKmsIntegration(); 62 | 63 | void platformInit() override; 64 | void platformDestroy() override; 65 | EGLNativeDisplayType platformDisplay() const override; 66 | bool usesDefaultScreen() override; 67 | void screenInit() override; 68 | QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override; 69 | bool hasCapability(QPlatformIntegration::Capability cap) const override; 70 | void waitForVSync(QPlatformSurface *surface) const override; 71 | bool supportsPBuffers() const override; 72 | void *nativeResourceForIntegration(const QByteArray &name) override; 73 | 74 | QKmsDevice *device() const; 75 | QKmsScreenConfig *screenConfig() const; 76 | 77 | QFunctionPointer platformFunction(const QByteArray &function) const override; 78 | 79 | protected: 80 | virtual QKmsDevice *createDevice() = 0; 81 | 82 | QKmsDevice *m_device; 83 | QKmsScreenConfig *m_screenConfig; 84 | 85 | private: 86 | static void setScreenScaleFactorStatic(QScreen *screen, qreal factor); 87 | }; 88 | 89 | QT_END_NAMESPACE 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 Pier Luigi Fiorini 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Copyright (C) 2016 Pelagicore AG 6 | ** Contact: https://www.qt.io/licensing/ 7 | ** 8 | ** This file is part of the plugins of the Qt Toolkit. 9 | ** 10 | ** $QT_BEGIN_LICENSE:LGPL$ 11 | ** Commercial License Usage 12 | ** Licensees holding valid commercial Qt licenses may use this file in 13 | ** accordance with the commercial license agreement provided with the 14 | ** Software or, alternatively, in accordance with the terms contained in 15 | ** a written agreement between you and The Qt Company. For licensing terms 16 | ** and conditions see https://www.qt.io/terms-conditions. For further 17 | ** information use the contact form at https://www.qt.io/contact-us. 18 | ** 19 | ** GNU Lesser General Public License Usage 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser 21 | ** General Public License version 3 as published by the Free Software 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 23 | ** packaging of this file. Please review the following information to 24 | ** ensure the GNU Lesser General Public License version 3 requirements 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 26 | ** 27 | ** GNU General Public License Usage 28 | ** Alternatively, this file may be used under the terms of the GNU 29 | ** General Public License version 2.0 or (at your option) the GNU General 30 | ** Public license version 3 or any later version approved by the KDE Free 31 | ** Qt Foundation. The licenses are as published by the Free Software 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 33 | ** included in the packaging of this file. Please review the following 34 | ** information to ensure the GNU General Public License requirements will 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. 37 | ** 38 | ** $QT_END_LICENSE$ 39 | ** 40 | ****************************************************************************/ 41 | 42 | #ifndef QEGLFSKMSSCREEN_H 43 | #define QEGLFSKMSSCREEN_H 44 | 45 | #include "private/qeglfsscreen_p.h" 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | 52 | QT_BEGIN_NAMESPACE 53 | 54 | class QEglFSKmsInterruptHandler; 55 | 56 | class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen 57 | { 58 | public: 59 | QEglFSKmsScreen(QKmsDevice *device, const QKmsOutput &output, bool headless = false); 60 | ~QEglFSKmsScreen(); 61 | 62 | void setVirtualPosition(const QPoint &pos); 63 | 64 | QRect rawGeometry() const override; 65 | 66 | int depth() const override; 67 | QImage::Format format() const override; 68 | 69 | QSizeF physicalSize() const override; 70 | QDpi logicalDpi() const override; 71 | qreal pixelDensity() const override; 72 | Qt::ScreenOrientation nativeOrientation() const override; 73 | Qt::ScreenOrientation orientation() const override; 74 | 75 | QString name() const override; 76 | 77 | QString manufacturer() const override; 78 | QString model() const override; 79 | QString serialNumber() const override; 80 | 81 | qreal refreshRate() const override; 82 | 83 | QList virtualSiblings() const override { return m_siblings; } 84 | void setVirtualSiblings(QList sl) { m_siblings = sl; } 85 | 86 | QVector modes() const override; 87 | 88 | int currentMode() const override; 89 | void setCurrentMode(int modeIndex); 90 | int preferredMode() const override; 91 | 92 | QKmsDevice *device() const { return m_device; } 93 | 94 | virtual void waitForFlip(); 95 | 96 | QKmsOutput &output() { return m_output; } 97 | void restoreMode(); 98 | 99 | SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override; 100 | 101 | QPlatformScreen::PowerState powerState() const override; 102 | void setPowerState(QPlatformScreen::PowerState state) override; 103 | 104 | qreal scaleFactor() const; 105 | void setScaleFactor(qreal value); 106 | 107 | protected: 108 | QKmsDevice *m_device; 109 | 110 | QKmsOutput m_output; 111 | QEdidParser m_edid; 112 | QPoint m_pos; 113 | qreal m_scaleFactor = -1; 114 | 115 | QList m_siblings; 116 | 117 | PowerState m_powerState; 118 | 119 | QEglFSKmsInterruptHandler *m_interruptHandler; 120 | 121 | bool m_headless; 122 | }; 123 | 124 | QT_END_NAMESPACE 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/eglfs-plugin.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | LiriDynamicLibrary { 4 | name: targetName 5 | targetName: "lirieglfs" 6 | 7 | Depends { name: "lirideployment" } 8 | Depends { 9 | name: "Qt" 10 | submodules: ["core", "core-private", "gui", "gui-private"] 11 | versionAtLeast: project.minimumQtVersion 12 | } 13 | Depends { name: "LiriEglFSDeviceIntegration" } 14 | 15 | files: ["*.cpp", "*.h", "*.json"] 16 | 17 | FileTagger { 18 | patterns: "liri.json" 19 | fileTags: ["qt_plugin_metadata"] 20 | } 21 | 22 | Group { 23 | qbs.install: true 24 | qbs.installDir: lirideployment.pluginsDir + "/platforms" 25 | fileTagsFilter: product.type 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/eglfs.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | Project { 4 | name: "eglfs" 5 | 6 | references: [ 7 | "eglfsdeviceintegration.qbs", 8 | "eglfs-plugin.qbs", 9 | "deviceintegration/eglfs_kms_support/eglfs_kms_support.qbs", 10 | "deviceintegration/eglfs_kms/eglfs_kms.qbs", 11 | "deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.qbs", 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/eglfsdeviceintegration.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | import LiriUtils 3 | 4 | LiriModuleProject { 5 | name: "LiriEglFSDeviceIntegration" 6 | moduleName: "LiriEglFSDeviceIntegration" 7 | description: "EGL device integration" 8 | createPkgConfig: false 9 | createCMake: false 10 | 11 | resolvedProperties: ({ 12 | Depends: [{ name: LiriUtils.quote("Qt.core-private") }, 13 | { name: LiriUtils.quote("Qt.gui-private") }, 14 | { name: LiriUtils.quote("Qt.eventdispatcher_support-private") }, 15 | { name: LiriUtils.quote("Qt.service_support-private") }, 16 | { name: LiriUtils.quote("Qt.theme_support-private") }, 17 | { name: LiriUtils.quote("Qt.fontdatabase_support-private") }, 18 | { name: LiriUtils.quote("Qt.fb_support-private") }, 19 | { name: LiriUtils.quote("Qt.egl_support-private") }, 20 | { name: LiriUtils.quote("Qt.platformcompositor_support-private") }, 21 | { name: LiriUtils.quote("LiriPlatformHeaders") }], 22 | "cpp.defines": [LiriUtils.quote("QT_EGL_NO_X11")], 23 | }) 24 | 25 | LiriHeaders { 26 | Group { 27 | name: "Headers" 28 | files: "api/*.h" 29 | fileTags: ["hpp_syncable"] 30 | } 31 | } 32 | 33 | LiriModule { 34 | name: project.moduleName 35 | targetName: project.targetName 36 | version: "0.0.0" 37 | 38 | Depends { name: project.headersName } 39 | Depends { 40 | name: "Qt" 41 | submodules: [ 42 | "core-private", "gui-private", "eventdispatcher_support-private", 43 | "service_support-private", "theme_support-private", 44 | "fontdatabase_support-private", "fb_support-private", 45 | "egl_support-private", "platformcompositor_support-private" 46 | ] 47 | } 48 | Depends { name: "Qt5Udev" } 49 | Depends { name: "LiriLibInput-private" } 50 | Depends { name: "LiriPlatformHeaders" } 51 | Depends { name: "LiriLogind" } 52 | 53 | cpp.defines: [ 54 | 'LIRIWAYLAND_VERSION="' + project.version + '"', 55 | "QT_BUILD_EGL_DEVICE_LIB", 56 | "QT_EGL_NO_X11", 57 | ] 58 | 59 | files: ["cursor.qrc"] 60 | 61 | Group { 62 | name: "API" 63 | prefix: "api/" 64 | files: [ 65 | "libinputmanager.cpp", 66 | "libinputmanager_p.h", 67 | "qeglfslogindhandler.cpp", 68 | "qeglfswindow.cpp", 69 | "qeglfsscreen.cpp", 70 | "qeglfshooks.cpp", 71 | "qeglfsdeviceintegration.cpp", 72 | "qeglfsintegration.cpp", 73 | "qeglfsoffscreenwindow.cpp", 74 | "qeglfslogindhandler_p.h", 75 | "qeglfswindow_p.h", 76 | "qeglfsscreen_p.h", 77 | "qeglfshooks_p.h", 78 | "qeglfsdeviceintegration_p.h", 79 | "qeglfsintegration_p.h", 80 | "qeglfsoffscreenwindow_p.h", 81 | "qeglfsglobal_p.h", 82 | "vthandler.cpp", 83 | "vthandler.h", 84 | "vthandler_p.h", 85 | ] 86 | 87 | Group { 88 | name: "API (OpenGL)" 89 | prefix: "api/" 90 | files: [ 91 | "qeglfscursor.cpp", 92 | "qeglfscontext.cpp", 93 | "qeglfscursor_p.h", 94 | "qeglfscontext_p.h", 95 | ] 96 | } 97 | } 98 | 99 | Export { 100 | Depends { name: "cpp" } 101 | Depends { name: project.headersName } 102 | Depends { 103 | name: "Qt" 104 | submodules: [ 105 | "core-private", "gui-private", "eventdispatcher_support-private", 106 | "service_support-private", "theme_support-private", 107 | "fontdatabase_support-private", "fb_support-private", 108 | "egl_support-private", "platformcompositor_support-private" 109 | ] 110 | } 111 | Depends { name: "Qt5Udev" } 112 | Depends { name: "LiriLibInput-private" } 113 | Depends { name: "LiriLogind" } 114 | 115 | cpp.defines: ["QT_EGL_NO_X11"] 116 | cpp.includePaths: product.sourceDirectory + "/api" 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/liri.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "liri" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/plugins/platforms/eglfs/qeglfsmain.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the plugins of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include 41 | #include "qeglfsintegration_p.h" 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | class QEglFSIntegrationPlugin : public QPlatformIntegrationPlugin 46 | { 47 | Q_OBJECT 48 | Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "liri.json") 49 | public: 50 | QPlatformIntegration *create(const QString&, const QStringList&) override; 51 | }; 52 | 53 | QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList) 54 | { 55 | Q_UNUSED(paramList); 56 | if (!system.compare(QLatin1String("liri"), Qt::CaseInsensitive)) 57 | return new QEglFSIntegration; 58 | 59 | return 0; 60 | } 61 | 62 | QT_END_NAMESPACE 63 | 64 | #include "qeglfsmain.moc" 65 | -------------------------------------------------------------------------------- /src/plugins/plugins.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | Project { 4 | name: "Plugins" 5 | 6 | references: [ 7 | "shellintegrations/fullscreen-shell/fullscreen-shell.qbs", 8 | "platforms/eglfs/eglfs.qbs", 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/plugins/shellintegrations/fullscreen-shell/fullscreen-shell.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "fullscreen-shell" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/plugins/shellintegrations/fullscreen-shell/fullscreen-shell.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | LiriDynamicLibrary { 4 | name: targetName 5 | targetName: "fullscreen-shell" 6 | 7 | Depends { name: "lirideployment" } 8 | Depends { 9 | name: "Qt" 10 | submodules: ["gui", "gui-private", "waylandclient", "waylandclient-private"] 11 | versionAtLeast: project.minimumQtVersion 12 | } 13 | Depends { name: "WaylandScanner" } 14 | 15 | cpp.defines: [] 16 | cpp.includePaths: base.concat([product.buildDirectory]) 17 | 18 | files: ["*.cpp", "*.h"] 19 | 20 | Group { 21 | name: "Wayland Protocols" 22 | files: [ 23 | "../../../../data/protocols/wayland/fullscreen-shell-unstable-v1.xml" 24 | ] 25 | fileTags: ["wayland.client.protocol"] 26 | } 27 | 28 | FileTagger { 29 | patterns: "*.json" 30 | fileTags: ["qt_plugin_metadata"] 31 | } 32 | 33 | Group { 34 | qbs.install: true 35 | qbs.installDir: lirideployment.pluginsDir + "/wayland-shell-integration" 36 | fileTagsFilter: ["dynamiclibrary"] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/plugins/shellintegrations/fullscreen-shell/fullscreenshellintegration.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #include "fullscreenshellintegration.h" 25 | #include "fullscreenshellsurface.h" 26 | 27 | namespace QtWaylandClient { 28 | 29 | FullScreenShellIntegration::FullScreenShellIntegration() 30 | : QWaylandShellIntegration() 31 | , m_shell(nullptr) 32 | { 33 | } 34 | 35 | bool FullScreenShellIntegration::initialize(QWaylandDisplay *display) 36 | { 37 | QWaylandShellIntegration::initialize(display); 38 | 39 | for (const QWaylandDisplay::RegistryGlobal &global : display->globals()) { 40 | if (global.interface == QLatin1String("zwp_fullscreen_shell_v1")) { 41 | m_shell = new QtWayland::zwp_fullscreen_shell_v1(display->wl_registry(), global.id, 1); 42 | break; 43 | } 44 | } 45 | 46 | return m_shell != nullptr; 47 | } 48 | 49 | QWaylandShellSurface *FullScreenShellIntegration::createShellSurface(QWaylandWindow *window) 50 | { 51 | return new FullScreenShellSurface(m_shell, window); 52 | } 53 | 54 | } // namespace QtWaylandClient 55 | -------------------------------------------------------------------------------- /src/plugins/shellintegrations/fullscreen-shell/fullscreenshellintegration.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "qwayland-fullscreen-shell-unstable-v1.h" 31 | 32 | namespace QtWaylandClient { 33 | 34 | class Q_WAYLAND_CLIENT_EXPORT FullScreenShellIntegration : public QWaylandShellIntegration 35 | { 36 | public: 37 | FullScreenShellIntegration(); 38 | 39 | bool initialize(QWaylandDisplay *display) override; 40 | QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; 41 | 42 | private: 43 | QtWayland::zwp_fullscreen_shell_v1 *m_shell; 44 | }; 45 | 46 | } // namespace QtWaylandClient 47 | -------------------------------------------------------------------------------- /src/plugins/shellintegrations/fullscreen-shell/fullscreenshellsurface.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #include 25 | 26 | #include "fullscreenshellsurface.h" 27 | 28 | namespace QtWaylandClient { 29 | 30 | FullScreenShellSurface::FullScreenShellSurface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window) 31 | : QWaylandShellSurface(window) 32 | , m_shell(shell) 33 | , m_window(window) 34 | { 35 | } 36 | 37 | void FullScreenShellSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent) 38 | { 39 | Q_UNUSED(type); 40 | Q_UNUSED(transientParent); 41 | 42 | auto screen = static_cast(m_window->screen()); 43 | 44 | // setType is called after the wl_surface is initialized by QWaylandWindow, 45 | // we should be safe calling present_surface() here 46 | m_shell->present_surface(m_window->object(), 47 | QtWayland::zwp_fullscreen_shell_v1::present_method_default, 48 | screen->output()); 49 | } 50 | 51 | } // namespace QtWaylandClient 52 | -------------------------------------------------------------------------------- /src/plugins/shellintegrations/fullscreen-shell/fullscreenshellsurface.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "qwayland-fullscreen-shell-unstable-v1.h" 31 | 32 | namespace QtWaylandClient { 33 | 34 | class FullScreenShellSurface : public QWaylandShellSurface 35 | { 36 | public: 37 | FullScreenShellSurface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window); 38 | 39 | void setType(Qt::WindowType type, QWaylandWindow *transientParent); 40 | 41 | private: 42 | QtWayland::zwp_fullscreen_shell_v1 *m_shell; 43 | QWaylandWindow *m_window; 44 | }; 45 | 46 | } // namespace QtWaylandClient 47 | -------------------------------------------------------------------------------- /src/plugins/shellintegrations/fullscreen-shell/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:LGPLv3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #include 25 | 26 | #include "fullscreenshellintegration.h" 27 | 28 | namespace QtWaylandClient { 29 | 30 | class FullScreenShellIntegrationPlugin : public QWaylandShellIntegrationPlugin 31 | { 32 | Q_OBJECT 33 | Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "fullscreen-shell.json") 34 | public: 35 | QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; 36 | }; 37 | 38 | QWaylandShellIntegration *FullScreenShellIntegrationPlugin::create(const QString &key, const QStringList ¶mList) 39 | { 40 | Q_UNUSED(paramList); 41 | 42 | if (key == QLatin1String("fullscreen-shell")) 43 | return new FullScreenShellIntegration(); 44 | return nullptr; 45 | } 46 | 47 | } // namespace QtWaylandClient 48 | 49 | #include "main.moc" 50 | -------------------------------------------------------------------------------- /tests/manual/libinput/libinput.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | QtApplication { 4 | name: "tst_wl_libinput" 5 | 6 | Depends { 7 | name: "Qt" 8 | submodules: ["gui", "gui-private", "testlib"] 9 | versionAtLeast: project.minimumQtVersion 10 | } 11 | Depends { name: "LiriLibInput-private" } 12 | Depends { name: "LiriLogind" } 13 | 14 | files: ["*.cpp"] 15 | } 16 | -------------------------------------------------------------------------------- /tests/manual/libinput/tst_libinput.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file is part of Liri. 3 | * 4 | * Copyright (C) 2018 Pier Luigi Fiorini 5 | * 6 | * $BEGIN_LICENSE:GPL3+$ 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | * $END_LICENSE$ 22 | ***************************************************************************/ 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | using namespace Liri; 31 | using namespace Liri::Platform; 32 | 33 | int main(int argc, char *argv[]) 34 | { 35 | QCoreApplication app(argc, argv); 36 | 37 | Logind *logind = Logind::instance(); 38 | QObject::connect(logind, &Logind::connectedChanged, [logind](bool connected) { 39 | // Taking control on an already running session seems problematic: 40 | // screen goes black and the desktop crashes, so this is commented out 41 | // until I figure out what to do. Of course without taking control, 42 | // libinput won't have permission on the devices - unless the user is 43 | // in the input group. 44 | /* 45 | if (connected) 46 | logind->takeControl(); 47 | */ 48 | Q_UNUSED(connected); 49 | }); 50 | 51 | LibInputHandler *handler = new LibInputHandler(&app); 52 | QObject::connect(handler, &LibInputHandler::keyPressed, 53 | [](const LibInputKeyEvent &e) { 54 | qDebug() << "Key pressed:" << e.key; 55 | }); 56 | QObject::connect(handler, &LibInputHandler::keyPressed, 57 | [](const LibInputKeyEvent &e) { 58 | qDebug() << "Key released:" << e.key; 59 | if (e.key == Qt::Key_Q) 60 | QCoreApplication::instance()->quit(); 61 | }); 62 | QObject::connect(handler, &LibInputHandler::mousePressed, 63 | [](const LibInputMouseEvent &e) { 64 | qDebug() << "Mouse pressed:" << e.buttons; 65 | }); 66 | QObject::connect(handler, &LibInputHandler::mousePressed, 67 | [](const LibInputMouseEvent &e) { 68 | qDebug() << "Mouse released:" << e.buttons; 69 | }); 70 | QObject::connect(handler, &LibInputHandler::mouseMoved, 71 | [](const LibInputMouseEvent &e) { 72 | qDebug() << "Mouse moved:" << e.pos; 73 | }); 74 | QObject::connect(handler, &LibInputHandler::mouseWheel, 75 | [](const LibInputMouseEvent &e) { 76 | qDebug() << "Mouse wheel:" << e.wheelDelta << e.wheelOrientation; 77 | }); 78 | QObject::connect(handler, &LibInputHandler::touchEvent, 79 | [](const LibInputTouchEvent &e) { 80 | qDebug() << "Touch" << e.touchPoints; 81 | }); 82 | QObject::connect(handler, &LibInputHandler::touchCancel, 83 | [](const LibInputTouchEvent &e) { 84 | qDebug() << "Touch cancel:" << e.touchPoints; 85 | }); 86 | 87 | return app.exec(); 88 | } 89 | -------------------------------------------------------------------------------- /tests/manual/manual.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | Project { 4 | name: "Tests" 5 | 6 | references: [ 7 | "libinput/libinput.qbs", 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /wayland.qbs: -------------------------------------------------------------------------------- 1 | import qbs 1.0 2 | 3 | Project { 4 | name: "Wayland" 5 | 6 | readonly property string version: "0.9.1" 7 | readonly property var versionParts: version.split('.').map(function(part) { return parseInt(part); }) 8 | 9 | readonly property string minimumQtVersion: "5.9.0" 10 | 11 | property bool useStaticAnalyzer: false 12 | property bool autotestEnabled: false 13 | property stringList autotestArguments: [] 14 | property stringList autotestWrapper: [] 15 | 16 | condition: qbs.targetOS.contains("linux") && !qbs.targetOS.contains("android") 17 | 18 | minimumQbsVersion: "1.8.0" 19 | 20 | references: [ 21 | "src/deployment.qbs", 22 | "src/libs.qbs", 23 | "src/plugins/plugins.qbs", 24 | "tests/manual/manual.qbs", 25 | ] 26 | } 27 | --------------------------------------------------------------------------------