Remove OpenKode OpenVG and qvfb platformplugins
Change-Id: Ic0bd8f68080bf139d81266d033cfd3c96a8d01f4 Reviewed-by: Donald Carr <donald.carr@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>bb10
parent
944d2e2f74
commit
44be58226e
|
|
@ -7,8 +7,6 @@ DESTDIR = $$QT.gui.plugins/platforms
|
|||
|
||||
#DEFINES += QEGL_EXTRA_DEBUG
|
||||
|
||||
#DEFINES += Q_OPENKODE
|
||||
|
||||
#Avoid X11 header collision
|
||||
DEFINES += MESA_EGL_NO_X11_HEADERS
|
||||
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@
|
|||
#include <QtPlatformSupport/private/qeglconvenience_p.h>
|
||||
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
|
||||
|
||||
#ifdef Q_OPENKODE
|
||||
#include <KD/kd.h>
|
||||
#include <KD/NV_initialize.h>
|
||||
#endif //Q_OPENKODE
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// #define QEGL_EXTRA_DEBUG
|
||||
|
|
@ -196,17 +191,8 @@ void QEglFSScreen::createAndSetPlatformContext()
|
|||
|
||||
EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat);
|
||||
|
||||
#ifdef Q_OPENKODE
|
||||
if (kdInitializeNV() == KD_ENOTINITIALIZED) {
|
||||
qFatal("Did not manage to initialize openkode");
|
||||
}
|
||||
KDWindow *window = kdCreateWindow(m_dpy,config,0);
|
||||
|
||||
kdRealizeWindow(window, &m_window);
|
||||
#else
|
||||
if (hooks)
|
||||
m_window = hooks->createNativeWindow(hooks->screenSize());
|
||||
#endif
|
||||
|
||||
#ifdef QEGL_EXTRA_DEBUG
|
||||
qWarning("Configuration %d matches requirements\n", (int)config);
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui/QPlatformIntegrationPlugin>
|
||||
#include "qopenkodeintegration.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QOpenKODEPlugin : public QPlatformIntegrationPlugin
|
||||
{
|
||||
public:
|
||||
QStringList keys() const;
|
||||
QPlatformIntegration *create(const QString&, const QStringList&);
|
||||
};
|
||||
|
||||
QStringList QOpenKODEPlugin::keys() const
|
||||
{
|
||||
QStringList list;
|
||||
list << "OpenKODE";
|
||||
return list;
|
||||
}
|
||||
|
||||
QPlatformIntegration * QOpenKODEPlugin::create(const QString& system, const QStringList& paramList)
|
||||
{
|
||||
Q_UNUSED(paramList);
|
||||
if (system.toLower() == "openkode")
|
||||
return new QOpenKODEIntegration;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(openkode, QOpenKODEPlugin)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
TARGET = qopenkodeintegration
|
||||
load(qt_plugin)
|
||||
|
||||
QT += opengl
|
||||
|
||||
DESTDIR = $$QT.gui.plugins/platforms
|
||||
|
||||
SOURCES = main.cpp \
|
||||
qopenkodeintegration.cpp \
|
||||
qopenkodewindow.cpp \
|
||||
../eglconvenience/qeglplatformcontext.cpp \
|
||||
../eglconvenience/qeglconvenience.cpp \
|
||||
qopenkodeeventloopintegration.cpp
|
||||
|
||||
HEADERS = qopenkodeintegration.h \
|
||||
qopenkodewindow.h \
|
||||
../eglconvenience/qeglplatformcontext.h \
|
||||
../eglconvenience/qeglconvenience.h \
|
||||
qopenkodeeventloopintegration.h \
|
||||
openkodekeytranslator.h
|
||||
|
||||
CONFIG += qpa/genericunixfontdatabase
|
||||
|
||||
RESOURCES = resources.qrc
|
||||
|
||||
target.path += $$[QT_INSTALL_PLUGINS]/platforms
|
||||
INSTALLS += target
|
||||
|
||||
LIBS += -lKD -lEGL
|
||||
!isEmpty(QMAKE_INCDIR_OPENGL_ES2){
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
|
||||
}
|
||||
!isEmpty(QMAKE_LIBDIR_OPENGL_ES2){
|
||||
for(p, QMAKE_LIBDIR_OPENGL_ES2) {
|
||||
exists($$p):LIBS += -L$$p
|
||||
}
|
||||
}
|
||||
!isEmpty(QMAKE_LIBS_OPENGL_ES2){
|
||||
LIBS += $$QMAKE_LIBS_OPENGL_ES2
|
||||
} else {
|
||||
LIBS += -lGLESv2
|
||||
}
|
||||
|
|
@ -1,244 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OPENKODEKEYTRANSLATOR_H
|
||||
#define OPENKODEKEYTRANSLATOR_H
|
||||
|
||||
#ifdef KD_ATX_keyboard
|
||||
|
||||
#include <KD/ATX_keyboard.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Qt::Key keyTranslator( int key )
|
||||
{
|
||||
switch (key) {
|
||||
// KD_KEY_ACCEPT_ATX:
|
||||
// KD_KEY_AGAIN_ATX:
|
||||
// KD_KEY_ALLCANDIDATES_ATX
|
||||
// KD_KEY_ALPHANUMERIC_ATX
|
||||
case KD_KEY_ALT_ATX:
|
||||
return Qt::Key_Alt;
|
||||
case KD_KEY_ALTGRAPH_ATX:
|
||||
return Qt::Key_AltGr;
|
||||
// KD_KEY_APPS_ATX
|
||||
// KD_KEY_ATTN_ATX
|
||||
// KD_KEY_BROWSERBACK_ATX
|
||||
// KD_KEY_BROWSERFAVORITES_ATX
|
||||
// KD_KEY_BROWSERFORWARD_ATX
|
||||
// KD_KEY_BROWSERHOME_ATX
|
||||
// KD_KEY_BROWSERREFRESH_ATX
|
||||
// KD_KEY_BROWSERSEARCH_ATX
|
||||
// KD_KEY_BROWSERSTOP_ATX
|
||||
case KD_KEY_CAPSLOCK_ATX:
|
||||
return Qt::Key_CapsLock;
|
||||
case KD_KEY_CLEAR_ATX:
|
||||
return Qt::Key_Clear;
|
||||
case KD_KEY_CODEINPUT_ATX:
|
||||
return Qt::Key_Codeinput;
|
||||
// KD_KEY_COMPOSE_ATX
|
||||
case KD_KEY_CONTROL_ATX:
|
||||
return Qt::Key_Control;
|
||||
// KD_KEY_CRSEL_ATX
|
||||
// KD_KEY_CONVERT_ATX
|
||||
case KD_KEY_COPY_ATX:
|
||||
return Qt::Key_Copy;
|
||||
case KD_KEY_CUT_ATX:
|
||||
return Qt::Key_Cut;
|
||||
case KD_KEY_DOWN_ATX:
|
||||
return Qt::Key_Down;
|
||||
case KD_KEY_END_ATX:
|
||||
return Qt::Key_End;
|
||||
case KD_KEY_ENTER_ATX:
|
||||
return Qt::Key_Enter;
|
||||
// KD_KEY_ERASEEOF_ATX
|
||||
// KD_KEY_EXECUTE_ATX
|
||||
// KD_KEY_EXSEL_ATX
|
||||
case KD_KEY_F1_ATX:
|
||||
return Qt::Key_F1;
|
||||
case KD_KEY_F2_ATX:
|
||||
return Qt::Key_F2;
|
||||
case KD_KEY_F3_ATX:
|
||||
return Qt::Key_F3;
|
||||
case KD_KEY_F4_ATX:
|
||||
return Qt::Key_F4;
|
||||
case KD_KEY_F5_ATX:
|
||||
return Qt::Key_F5;
|
||||
case KD_KEY_F6_ATX:
|
||||
return Qt::Key_F6;
|
||||
case KD_KEY_F7_ATX:
|
||||
return Qt::Key_F7;
|
||||
case KD_KEY_F8_ATX:
|
||||
return Qt::Key_F8;
|
||||
case KD_KEY_F9_ATX:
|
||||
return Qt::Key_F9;
|
||||
case KD_KEY_F10_ATX:
|
||||
return Qt::Key_F10;
|
||||
case KD_KEY_F11_ATX:
|
||||
return Qt::Key_F11;
|
||||
case KD_KEY_F12_ATX:
|
||||
return Qt::Key_F12;
|
||||
case KD_KEY_F13_ATX:
|
||||
return Qt::Key_F13;
|
||||
case KD_KEY_F14_ATX:
|
||||
return Qt::Key_F14;
|
||||
case KD_KEY_F15_ATX:
|
||||
return Qt::Key_F15;
|
||||
case KD_KEY_F16_ATX:
|
||||
return Qt::Key_F16;
|
||||
case KD_KEY_F17_ATX:
|
||||
return Qt::Key_F17;
|
||||
case KD_KEY_F18_ATX:
|
||||
return Qt::Key_F18;
|
||||
case KD_KEY_F19_ATX:
|
||||
return Qt::Key_F19;
|
||||
case KD_KEY_F20_ATX:
|
||||
return Qt::Key_F20;
|
||||
case KD_KEY_F21_ATX:
|
||||
return Qt::Key_F21;
|
||||
case KD_KEY_F22_ATX:
|
||||
return Qt::Key_F22;
|
||||
case KD_KEY_F23_ATX:
|
||||
return Qt::Key_F23;
|
||||
case KD_KEY_F24_ATX:
|
||||
return Qt::Key_F24;
|
||||
// KD_KEY_FINALMODE_ATX
|
||||
// KD_KEY_FIND_ATX
|
||||
// KD_KEY_FULLWIDTH_ATX
|
||||
// KD_KEY_HALFWIDTH_ATX
|
||||
case KD_KEY_HANGULMODE_ATX:
|
||||
return Qt::Key_Hangul;
|
||||
// KD_KEY_HANJAMODE_ATX
|
||||
case KD_KEY_HELP_ATX:
|
||||
return Qt::Key_Help;
|
||||
case KD_KEY_HIRAGANA_ATX:
|
||||
return Qt::Key_Hiragana;
|
||||
case KD_KEY_HOME_ATX:
|
||||
return Qt::Key_Home;
|
||||
case KD_KEY_INSERT_ATX:
|
||||
return Qt::Key_Insert;
|
||||
// KD_KEY_JAPANESEHIRAGANA_ATX:
|
||||
// KD_KEY_JAPANESEKATAKANA_ATX
|
||||
// KD_KEY_JAPANESEROMAJI_ATX
|
||||
// KD_KEY_JUNJAMODE_ATX
|
||||
case KD_KEY_KANAMODE_ATX:
|
||||
return Qt::Key_Kana_Lock; //?
|
||||
case KD_KEY_KANJIMODE_ATX:
|
||||
return Qt::Key_Kanji;
|
||||
// KD_KEY_KATAKANA_ATX
|
||||
// KD_KEY_LAUNCHAPPLICATION1_ATX
|
||||
// KD_KEY_LAUNCHAPPLICATION2_ATX
|
||||
case KD_KEY_LAUNCHMAIL_ATX:
|
||||
return Qt::Key_MailForward;
|
||||
case KD_KEY_LEFT_ATX:
|
||||
return Qt::Key_Left;
|
||||
case KD_KEY_META_ATX:
|
||||
return Qt::Key_Meta;
|
||||
case KD_KEY_MEDIANEXTTRACK_ATX:
|
||||
return Qt::Key_MediaNext;
|
||||
case KD_KEY_MEDIAPLAYPAUSE_ATX:
|
||||
return Qt::Key_MediaPause;
|
||||
case KD_KEY_MEDIAPREVIOUSTRACK_ATX:
|
||||
return Qt::Key_MediaPrevious;
|
||||
case KD_KEY_MEDIASTOP_ATX:
|
||||
return Qt::Key_MediaStop;
|
||||
case KD_KEY_MODECHANGE_ATX:
|
||||
return Qt::Key_Mode_switch;
|
||||
// KD_KEY_NONCONVERT_ATX
|
||||
case KD_KEY_NUMLOCK_ATX:
|
||||
return Qt::Key_NumLock;
|
||||
case KD_KEY_PAGEDOWN_ATX:
|
||||
return Qt::Key_PageDown;
|
||||
case KD_KEY_PAGEUP_ATX:
|
||||
return Qt::Key_PageUp;
|
||||
case KD_KEY_PASTE_ATX:
|
||||
return Qt::Key_Paste;
|
||||
case KD_KEY_PAUSE_ATX:
|
||||
return Qt::Key_Pause;
|
||||
case KD_KEY_PLAY_ATX:
|
||||
return Qt::Key_Play;
|
||||
// KD_KEY_PREVIOUSCANDIDATE_ATX
|
||||
case KD_KEY_PRINTSCREEN_ATX:
|
||||
return Qt::Key_Print;
|
||||
// case KD_KEY_PROCESS_ATX
|
||||
// case KD_KEY_PROPS_ATX
|
||||
case KD_KEY_RIGHT_ATX:
|
||||
return Qt::Key_Right;
|
||||
// KD_KEY_ROMANCHARACTERS_ATX
|
||||
case KD_KEY_SCROLL_ATX:
|
||||
return Qt::Key_ScrollLock;
|
||||
case KD_KEY_SELECT_ATX:
|
||||
return Qt::Key_Select;
|
||||
// KD_KEY_SELECTMEDIA_ATX
|
||||
case KD_KEY_SHIFT_ATX:
|
||||
return Qt::Key_Shift;
|
||||
case KD_KEY_STOP_ATX:
|
||||
return Qt::Key_Stop;
|
||||
case KD_KEY_UP_ATX:
|
||||
return Qt::Key_Up;
|
||||
// KD_KEY_UNDO_ATX
|
||||
case KD_KEY_VOLUMEDOWN_ATX:
|
||||
return Qt::Key_VolumeDown;
|
||||
case KD_KEY_VOLUMEMUTE_ATX:
|
||||
return Qt::Key_VolumeMute;
|
||||
case KD_KEY_VOLUMEUP_ATX:
|
||||
return Qt::Key_VolumeUp;
|
||||
case KD_KEY_WIN_ATX:
|
||||
return Qt::Key_Meta;
|
||||
case KD_KEY_ZOOM_ATX:
|
||||
return Qt::Key_Zoom;
|
||||
case 0x8:
|
||||
return Qt::Key_Backspace;
|
||||
case 0x1b:
|
||||
return Qt::Key_Escape;
|
||||
case 0x9:
|
||||
return Qt::Key_Tab;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Qt::Key_Escape;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif //KD_ATX_keyboard
|
||||
#endif // OPENKODEKEYTRANSLATOR_H
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenkodeeventloopintegration.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <KD/kd.h>
|
||||
#include <KD/ATX_keyboard.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const int QT_EVENT_WAKEUP_EVENTLOOP = KD_EVENT_USER + 1;
|
||||
|
||||
void kdprocessevent( const KDEvent *event)
|
||||
{
|
||||
switch (event->type) {
|
||||
case KD_EVENT_INPUT:
|
||||
qDebug() << "KD_EVENT_INPUT";
|
||||
break;
|
||||
case KD_EVENT_INPUT_POINTER:
|
||||
qDebug() << "KD_EVENT_INPUT_POINTER";
|
||||
break;
|
||||
case KD_EVENT_WINDOW_CLOSE:
|
||||
qDebug() << "KD_EVENT_WINDOW_CLOSE";
|
||||
break;
|
||||
case KD_EVENT_WINDOWPROPERTY_CHANGE:
|
||||
qDebug() << "KD_EVENT_WINDOWPROPERTY_CHANGE";
|
||||
qDebug() << event->data.windowproperty.pname;
|
||||
break;
|
||||
case KD_EVENT_WINDOW_FOCUS:
|
||||
qDebug() << "KD_EVENT_WINDOW_FOCUS";
|
||||
break;
|
||||
case KD_EVENT_WINDOW_REDRAW:
|
||||
qDebug() << "KD_EVENT_WINDOW_REDRAW";
|
||||
break;
|
||||
case KD_EVENT_USER:
|
||||
qDebug() << "KD_EVENT_USER";
|
||||
break;
|
||||
case KD_EVENT_INPUT_KEY_ATX:
|
||||
qDebug() << "KD_EVENT_INPUT_KEY_ATX";
|
||||
break;
|
||||
case QT_EVENT_WAKEUP_EVENTLOOP:
|
||||
QPlatformEventLoopIntegration::processEvents();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
kdDefaultEvent(event);
|
||||
|
||||
}
|
||||
|
||||
QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration()
|
||||
: m_quit(false)
|
||||
{
|
||||
m_kdThread = kdThreadSelf();
|
||||
kdInstallCallback(&kdprocessevent,QT_EVENT_WAKEUP_EVENTLOOP,this);
|
||||
}
|
||||
|
||||
void QOpenKODEEventLoopIntegration::startEventLoop()
|
||||
{
|
||||
|
||||
while(!m_quit) {
|
||||
qint64 msec = nextTimerEvent();
|
||||
const KDEvent *event = kdWaitEvent(msec);
|
||||
if (event) {
|
||||
kdDefaultEvent(event);
|
||||
while ((event = kdWaitEvent(0)) != 0) {
|
||||
kdDefaultEvent(event);
|
||||
}
|
||||
}
|
||||
QPlatformEventLoopIntegration::processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void QOpenKODEEventLoopIntegration::quitEventLoop()
|
||||
{
|
||||
m_quit = true;
|
||||
}
|
||||
|
||||
void QOpenKODEEventLoopIntegration::qtNeedsToProcessEvents()
|
||||
{
|
||||
KDEvent *event = kdCreateEvent();
|
||||
event->type = QT_EVENT_WAKEUP_EVENTLOOP;
|
||||
event->userptr = this;
|
||||
kdPostThreadEvent(event,m_kdThread);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENKODEEVENTLOOPINTEGRATION_H
|
||||
#define QOPENKODEEVENTLOOPINTEGRATION_H
|
||||
|
||||
#include <QtGui/QPlatformEventLoopIntegration>
|
||||
|
||||
class KDThread;
|
||||
class KDEvent;
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QOpenKODEEventLoopIntegration : public QPlatformEventLoopIntegration
|
||||
{
|
||||
public:
|
||||
QOpenKODEEventLoopIntegration();
|
||||
void startEventLoop();
|
||||
void quitEventLoop();
|
||||
void qtNeedsToProcessEvents();
|
||||
|
||||
void processInputEvent(const KDEvent *event);
|
||||
private:
|
||||
|
||||
bool m_quit;
|
||||
KDThread *m_kdThread;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QOPENKODEEVENTLOOPINTEGRATION_H
|
||||
|
|
@ -1,247 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenkodeintegration.h"
|
||||
#include "qopenkodewindow.h"
|
||||
#include "qopenkodeeventloopintegration.h"
|
||||
|
||||
#include <QtOpenGL/qplatformpixmap_gl_p.h>
|
||||
#include <QtOpenGL/private/qwindowsurface_gl_p.h>
|
||||
|
||||
#include <QtGui/private/qpixmap_raster_p.h>
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/qthread.h>
|
||||
#include <QtCore/qfile.h>
|
||||
|
||||
#include "qgenericunixfontdatabase.h"
|
||||
|
||||
#include <KD/kd.h>
|
||||
#include <KD/NV_display.h>
|
||||
#include <KD/NV_initialize.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "GLES2/gl2ext.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QOpenKODEScreen::QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop)
|
||||
: mIsFullScreen(false)
|
||||
{
|
||||
qDebug() << "QOpenKODEScreen::QOpenKODEIntegrationScreen()";
|
||||
|
||||
KDboolean enabled = KD_TRUE;
|
||||
kdSetDisplayPropertybvNV(kdDisplay,
|
||||
KD_DISPLAYPROPERTY_ENABLED_NV,
|
||||
&enabled);
|
||||
KDboolean power = KD_DISPLAY_POWER_ON;
|
||||
kdSetDisplayPropertyivNV(kdDisplay,
|
||||
KD_DISPLAYPROPERTY_POWER_NV,
|
||||
&power);
|
||||
|
||||
kdSetDisplayPropertycvNV(kdDisplay,
|
||||
KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,
|
||||
KD_DEFAULT_DESKTOP_NV);
|
||||
|
||||
KDDisplayModeNV mode;
|
||||
if (kdGetDisplayModeNV(kdDisplay, &mode)) {
|
||||
qErrnoWarning(kdGetError(), "Could not get display mode");
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << " - display mode " << mode.width << "x" << mode.height << " refresh " << mode.refresh;
|
||||
|
||||
KDint desktopSize[] = { mode.width, mode.height };
|
||||
|
||||
if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set desktop size");
|
||||
return;
|
||||
}
|
||||
|
||||
// Once we've set up the desktop and display we don't need them anymore
|
||||
kdReleaseDisplayNV(kdDisplay);
|
||||
kdReleaseDesktopNV(kdDesktop);
|
||||
|
||||
mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (mEglDisplay == EGL_NO_DISPLAY) {
|
||||
qErrnoWarning("EGL failed to obtain display");
|
||||
}
|
||||
|
||||
/* Initialize EGL display */
|
||||
EGLBoolean rvbool = eglInitialize(mEglDisplay, 0, 0);
|
||||
if (!rvbool) {
|
||||
qErrnoWarning("EGL failed to initialize display");
|
||||
}
|
||||
|
||||
// cursor = new QOpenKODECursor(this);
|
||||
|
||||
mGeometry = QRect(0, 0, mode.width, mode.height);
|
||||
mDepth = 24;
|
||||
mFormat = QImage::Format_RGB32;
|
||||
|
||||
|
||||
}
|
||||
|
||||
QOpenKODEIntegration::QOpenKODEIntegration()
|
||||
: mEventLoopIntegration(0)
|
||||
, mFontDb(new QGenericUnixFontDatabase())
|
||||
, mMainGlContext(0)
|
||||
{
|
||||
if (kdInitializeNV() == KD_ENOTINITIALIZED) {
|
||||
qFatal("Did not manage to initialize openkode");
|
||||
}
|
||||
|
||||
KDDisplaySystemNV *kdDisplaySystem = kdCreateDisplaySystemSnapshotNV(this);
|
||||
KDint32 displayCount = 0;
|
||||
kdGetDisplaySystemPropertyivNV(kdDisplaySystem, KD_DISPLAYPROPERTY_COUNT_NV, 0, &displayCount);
|
||||
|
||||
for (int i = 0; i < displayCount; i++) {
|
||||
KDchar *displayName = 0;
|
||||
KDsize displayNameLength = 0;
|
||||
kdGetDisplaySystemPropertycvNV(kdDisplaySystem,KD_DISPLAYPROPERTY_NAME_NV,i,0,&displayNameLength);
|
||||
if (!displayNameLength)
|
||||
continue;
|
||||
displayName = new KDchar[displayNameLength];
|
||||
kdGetDisplaySystemPropertycvNV(kdDisplaySystem,KD_DISPLAYPROPERTY_NAME_NV,i,displayName,&displayNameLength);
|
||||
|
||||
KDDisplayNV *display = kdGetDisplayNV(displayName,this);
|
||||
if (!display || display == (void*)-1) {
|
||||
qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer");
|
||||
return;
|
||||
}
|
||||
if (displayNameLength)
|
||||
delete[] displayName;
|
||||
|
||||
KDchar *desktopName = 0;
|
||||
KDsize desktopNameLength = 0;
|
||||
bool openkodeImpDoesNotFail = false;
|
||||
if (openkodeImpDoesNotFail) {
|
||||
qDebug() << "printing desktopname";
|
||||
kdGetDisplayPropertycvNV(display,KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,desktopName,&desktopNameLength);
|
||||
if (desktopNameLength) {
|
||||
desktopName = new KDchar[desktopNameLength];
|
||||
kdGetDisplayPropertycvNV(display,KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,desktopName,&desktopNameLength);
|
||||
} else {
|
||||
desktopName = KD_DEFAULT_DESKTOP_NV;
|
||||
}
|
||||
} else {
|
||||
desktopName = KD_DEFAULT_DESKTOP_NV;
|
||||
}
|
||||
|
||||
KDDesktopNV *desktop = kdGetDesktopNV(desktopName,this);
|
||||
if (!desktop || desktop == (void*)-1) {
|
||||
qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer");
|
||||
kdReleaseDisplayNV(display);
|
||||
return;
|
||||
}
|
||||
if (desktopNameLength)
|
||||
delete desktopName;
|
||||
|
||||
QOpenKODEScreen *screen = new QOpenKODEScreen(display,desktop);
|
||||
mScreens.append(screen);
|
||||
}
|
||||
}
|
||||
|
||||
QOpenKODEIntegration::~QOpenKODEIntegration()
|
||||
{
|
||||
delete mEventLoopIntegration;
|
||||
delete mFontDb;
|
||||
}
|
||||
|
||||
|
||||
bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
{
|
||||
switch (cap) {
|
||||
case ThreadedPixmaps: return true;
|
||||
case OpenGL: return true;
|
||||
default: return QPlatformIntegration::hasCapability(cap);
|
||||
}
|
||||
}
|
||||
|
||||
QPlatformPixmap *QOpenKODEIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
|
||||
{
|
||||
return new QGLPlatformPixmap(type);
|
||||
}
|
||||
|
||||
QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) const
|
||||
{
|
||||
return new QOpenKODEWindow(tlw);
|
||||
}
|
||||
|
||||
QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId) const
|
||||
{
|
||||
QWindowSurface *returnSurface = 0;
|
||||
switch (widget->platformWindowFormat().windowApi()) {
|
||||
|
||||
case QPlatformWindowFormat::Raster:
|
||||
case QPlatformWindowFormat::OpenGL:
|
||||
returnSurface = new QGLWindowSurface(widget);
|
||||
break;
|
||||
|
||||
case QPlatformWindowFormat::OpenVG:
|
||||
// returnSurface = new QVGWindowSurface(widget);
|
||||
// break;
|
||||
|
||||
default:
|
||||
returnSurface = new QGLWindowSurface(widget);
|
||||
break;
|
||||
}
|
||||
|
||||
return returnSurface;
|
||||
}
|
||||
|
||||
QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration() const
|
||||
{
|
||||
if (!mEventLoopIntegration) {
|
||||
QOpenKODEIntegration *that = const_cast<QOpenKODEIntegration *>(this);
|
||||
that->mEventLoopIntegration = new QOpenKODEEventLoopIntegration;
|
||||
}
|
||||
return mEventLoopIntegration;
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *QOpenKODEIntegration::fontDatabase() const
|
||||
{
|
||||
return mFontDb;
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QGRAPHICSSYSTEM_OPENKODE_H
|
||||
#define QGRAPHICSSYSTEM_OPENKODE_H
|
||||
|
||||
#include "qopenkodeeventloopintegration.h"
|
||||
|
||||
#include <QtCore/qsemaphore.h>
|
||||
|
||||
#include <QtGui/QPlatformIntegration>
|
||||
#include <QtGui/QPlatformScreen>
|
||||
#include <QtGui/QPlatformOpenGLContext>
|
||||
#include <QtGui/QPlatformFontDatabase>
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
struct KDDesktopNV;
|
||||
struct KDDisplayNV;
|
||||
class QOpenKODECursor;
|
||||
|
||||
class QOpenKODEScreen : public QPlatformScreen
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop);
|
||||
~QOpenKODEScreen() {}
|
||||
|
||||
QRect geometry() const { return mGeometry; }
|
||||
int depth() const { return mDepth; }
|
||||
QImage::Format format() const { return mFormat; }
|
||||
|
||||
EGLDisplay eglDisplay() { return mEglDisplay; }
|
||||
|
||||
bool isFullScreen() const {return mIsFullScreen;}
|
||||
void setFullScreen(bool fullscreen) { mIsFullScreen = fullscreen; }
|
||||
private:
|
||||
QRect mGeometry;
|
||||
int mDepth;
|
||||
QImage::Format mFormat;
|
||||
EGLDisplay mEglDisplay;
|
||||
bool mIsFullScreen;
|
||||
};
|
||||
|
||||
class QOpenKODEIntegration : public QPlatformIntegration
|
||||
{
|
||||
public:
|
||||
QOpenKODEIntegration();
|
||||
~QOpenKODEIntegration();
|
||||
|
||||
bool hasCapability(QPlatformIntegration::Capability cap) const;
|
||||
|
||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
|
||||
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
|
||||
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
|
||||
|
||||
QPlatformEventLoopIntegration *createEventLoopIntegration() const;
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
virtual QList<QPlatformScreen *> screens() const { return mScreens; }
|
||||
|
||||
static GLuint blitterProgram();
|
||||
|
||||
void setMainGLContext(QEGLPlatformContext *ctx) { mMainGlContext = ctx; }
|
||||
void mainGLContext() const { return mMainGlContext; }
|
||||
|
||||
private:
|
||||
QList<QPlatformScreen *> mScreens;
|
||||
QOpenKODEEventLoopIntegration *mEventLoopIntegration;
|
||||
QPlatformFontDatabase *mFontDb;
|
||||
QEGLPlatformContext *mMainGlContext;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
QT_END_HEADER
|
||||
|
||||
#endif
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenkodewindow.h"
|
||||
#include "qopenkodeintegration.h"
|
||||
#include "../eglconvenience/qeglplatformcontext.h"
|
||||
#include "../eglconvenience/qeglconvenience.h"
|
||||
|
||||
#include <KD/kd.h>
|
||||
#include <KD/NV_display.h>
|
||||
#include <KD/kdplatform.h>
|
||||
#ifdef KD_ATX_keyboard
|
||||
#include "openkodekeytranslator.h"
|
||||
#endif
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#include <QtGui/private/qwidget_p.h>
|
||||
#include <QtGui/private/qapplication_p.h>
|
||||
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
void kdProcessMouseEvents( const KDEvent *event )
|
||||
{
|
||||
QOpenKODEWindow *window = static_cast<QOpenKODEWindow *>(event->userptr);
|
||||
window->processMouseEvents(event);
|
||||
}
|
||||
|
||||
#ifdef KD_ATX_keyboard
|
||||
void kdProcessKeyEvents( const KDEvent *event )
|
||||
{
|
||||
QOpenKODEWindow *window = static_cast<QOpenKODEWindow *>(event->userptr);
|
||||
window->processKeyEvents(event);
|
||||
}
|
||||
#endif //KD_ATX_keyboard
|
||||
|
||||
QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw)
|
||||
: QPlatformWindow(tlw), isFullScreen(false)
|
||||
{
|
||||
if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) {
|
||||
m_eglApi = EGL_OPENVG_API;
|
||||
} else {
|
||||
m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
|
||||
m_eglContextAttrs.append(2);
|
||||
|
||||
m_eglApi = EGL_OPENGL_ES_API;
|
||||
}
|
||||
eglBindAPI(m_eglApi);
|
||||
|
||||
m_eglContextAttrs.append(EGL_NONE);
|
||||
m_eglWindowAttrs.append(EGL_NONE);
|
||||
|
||||
QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens();
|
||||
//XXXX: jl figure out how to pick the correct screen.
|
||||
// Q_ASSERT(screens.size() > tlw->d_func()->screenNumber);
|
||||
// QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(tlw->d_func()->screenNumber));
|
||||
QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0));
|
||||
if (!screen) {
|
||||
qErrnoWarning("Could not make QOpenKODEWindow without a screen");
|
||||
}
|
||||
|
||||
QPlatformWindowFormat format = tlw->platformWindowFormat();
|
||||
format.setRedBufferSize(5);
|
||||
format.setGreenBufferSize(6);
|
||||
format.setBlueBufferSize(5);
|
||||
|
||||
m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),format);
|
||||
|
||||
m_kdWindow = kdCreateWindow(screen->eglDisplay(),
|
||||
m_eglConfig,
|
||||
this);
|
||||
kdInstallCallback(kdProcessMouseEvents,KD_EVENT_INPUT_POINTER,this);
|
||||
#ifdef KD_ATX_keyboard
|
||||
kdInstallCallback(kdProcessKeyEvents, KD_EVENT_INPUT_KEY_ATX,this);
|
||||
#endif //KD_ATX_keyboard
|
||||
|
||||
if (!m_kdWindow) {
|
||||
qErrnoWarning(kdGetError(), "Error creating native window");
|
||||
return;
|
||||
}
|
||||
|
||||
KDboolean exclusive(false);
|
||||
if (kdSetWindowPropertybv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, &exclusive)) {
|
||||
isFullScreen = true;
|
||||
}
|
||||
|
||||
if (isFullScreen) {
|
||||
tlw->setGeometry(screen->geometry());
|
||||
screen->setFullScreen(isFullScreen);
|
||||
}else {
|
||||
const KDint windowSize[2] = { tlw->width(), tlw->height() };
|
||||
if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set native window size");
|
||||
}
|
||||
KDboolean visibillity(false);
|
||||
if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set visibillity to false");
|
||||
}
|
||||
|
||||
const KDint windowPos[2] = { tlw->x(), tlw->y() };
|
||||
if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set native window position");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QOpenKODEIntegration *integration = static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration());
|
||||
|
||||
if (!isFullScreen || (isFullScreen && !integration->mainGLContext())) {
|
||||
if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) {
|
||||
qErrnoWarning(kdGetError(), "Could not realize native window");
|
||||
return;
|
||||
}
|
||||
|
||||
EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData());
|
||||
m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig,
|
||||
m_eglContextAttrs.data(), surface, m_eglApi);
|
||||
integration->setMainGLContext(m_platformGLContext);
|
||||
} else {
|
||||
m_platformGlContext = integration->mainGLContext();
|
||||
kdDestroyWindow(m_kdWindow);
|
||||
m_kdWindow = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QOpenKODEWindow::~QOpenKODEWindow()
|
||||
{
|
||||
if (m_platformGlContext != static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration())) {
|
||||
delete m_platformGlContext;
|
||||
}
|
||||
if (m_kdWindow)
|
||||
kdDestroyWindow(m_kdWindow);
|
||||
}
|
||||
void QOpenKODEWindow::setGeometry(const QRect &rect)
|
||||
{
|
||||
if (isFullScreen) {
|
||||
QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens();
|
||||
QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0));
|
||||
widget()->setGeometry(screen->geometry());
|
||||
return;
|
||||
}
|
||||
bool needToDeleteContext = false;
|
||||
if (!isFullScreen) {
|
||||
const QRect geo = geometry();
|
||||
if (geo.size() != rect.size()) {
|
||||
const KDint windowSize[2] = { rect.width(), rect.height() };
|
||||
if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set native window size");
|
||||
//return;
|
||||
} else {
|
||||
needToDeleteContext = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (geo.topLeft() != rect.topLeft()) {
|
||||
const KDint windowPos[2] = { rect.x(), rect.y() };
|
||||
if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set native window position");
|
||||
//return;
|
||||
} else {
|
||||
needToDeleteContext = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//need to recreate context
|
||||
if (needToDeleteContext) {
|
||||
delete m_platformGlContext;
|
||||
|
||||
QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens();
|
||||
QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0));
|
||||
EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData());
|
||||
m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,
|
||||
m_eglContextAttrs.data(),surface,m_eglApi);
|
||||
}
|
||||
}
|
||||
|
||||
void QOpenKODEWindow::setVisible(bool visible)
|
||||
{
|
||||
if (!m_kdWindow)
|
||||
return;
|
||||
KDboolean visibillity(visible);
|
||||
if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set visibillity property");
|
||||
}
|
||||
}
|
||||
|
||||
WId QOpenKODEWindow::winId() const
|
||||
{
|
||||
static int i = 0;
|
||||
return i++;
|
||||
}
|
||||
|
||||
QPlatformOpenGLContext *QOpenKODEWindow::glContext() const
|
||||
{
|
||||
return m_platformGlContext;
|
||||
}
|
||||
|
||||
void QOpenKODEWindow::raise()
|
||||
{
|
||||
if (!m_kdWindow)
|
||||
return;
|
||||
KDboolean focus(true);
|
||||
if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set focus");
|
||||
}
|
||||
}
|
||||
|
||||
void QOpenKODEWindow::lower()
|
||||
{
|
||||
if (!m_kdWindow)
|
||||
return;
|
||||
KDboolean focus(false);
|
||||
if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) {
|
||||
qErrnoWarning(kdGetError(), "Could not set focus");
|
||||
}
|
||||
}
|
||||
|
||||
void QOpenKODEWindow::processMouseEvents(const KDEvent *event)
|
||||
{
|
||||
int x = event->data.inputpointer.x;
|
||||
int y = event->data.inputpointer.y;
|
||||
Qt::MouseButtons buttons;
|
||||
switch(event->data.inputpointer.select) {
|
||||
case 1:
|
||||
buttons = Qt::LeftButton;
|
||||
break;
|
||||
default:
|
||||
buttons = Qt::NoButton;
|
||||
}
|
||||
QPoint pos(x,y);
|
||||
QWindowSystemInterface::handleMouseEvent(0,event->timestamp,pos,pos,buttons);
|
||||
}
|
||||
|
||||
void QOpenKODEWindow::processKeyEvents(const KDEvent *event)
|
||||
{
|
||||
#ifdef KD_ATX_keyboard
|
||||
//KD_KEY_PRESS_ATX 1
|
||||
QEvent::Type keyPressed = QEvent::KeyRelease;
|
||||
if (event->data.keyboardInputKey.flags)
|
||||
keyPressed = QEvent::KeyPress;
|
||||
//KD_KEY_LOCATION_LEFT_ATX // dont care for now
|
||||
//KD_KEY_LOCATION_RIGHT_ATX
|
||||
//KD_KEY_LOCATION_NUMPAD_ATX
|
||||
Qt::KeyboardModifiers mod = Qt::NoModifier;
|
||||
int openkodeMods = event->data.keyboardInputKey.flags;
|
||||
if (openkodeMods & KD_KEY_MODIFIER_SHIFT_ATX)
|
||||
mod |= Qt::ShiftModifier;
|
||||
if (openkodeMods & KD_KEY_MODIFIER_CTRL_ATX)
|
||||
mod |= Qt::ControlModifier;
|
||||
if (openkodeMods & KD_KEY_MODIFIER_ALT_ATX)
|
||||
mod |= Qt::AltModifier;
|
||||
if (openkodeMods & KD_KEY_MODIFIER_META_ATX)
|
||||
mod |= Qt::MetaModifier;
|
||||
|
||||
Qt::Key qtKey;
|
||||
QChar keyText;
|
||||
int key = event->data.keyboardInputKey.keycode;
|
||||
if (key >= 0x20 && key <= 0x0ff){ // 8 bit printable Latin1
|
||||
qtKey = Qt::Key(key);
|
||||
keyText = QChar(event->data.keyboardInputKeyChar.character);
|
||||
if (!(mod & Qt::ShiftModifier))
|
||||
keyText = keyText.toLower();
|
||||
} else {
|
||||
qtKey = keyTranslator(key);
|
||||
}
|
||||
QWindowSystemInterface::handleKeyEvent(0,event->timestamp,keyPressed,qtKey,mod,keyText);
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENKODEWINDOW_H
|
||||
#define QOPENKODEWINDOW_H
|
||||
|
||||
#include <QtGui/QPlatformWindow>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#include <KD/kd.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QEGLPlatformContext;
|
||||
class QPlatformEventLoopIntegration;
|
||||
|
||||
class QOpenKODEWindow : public QPlatformWindow
|
||||
{
|
||||
public:
|
||||
QOpenKODEWindow(QWidget *tlw);
|
||||
~QOpenKODEWindow();
|
||||
|
||||
void setGeometry(const QRect &rect);
|
||||
void setVisible(bool visible);
|
||||
WId winId() const;
|
||||
|
||||
QPlatformOpenGLContext *glContext() const;
|
||||
|
||||
void raise();
|
||||
void lower();
|
||||
|
||||
void processKeyEvents( const KDEvent *event );
|
||||
void processMouseEvents( const KDEvent *event );
|
||||
|
||||
private:
|
||||
struct KDWindow *m_kdWindow;
|
||||
EGLNativeWindowType m_eglWindow;
|
||||
EGLConfig m_eglConfig;
|
||||
QVector<EGLint> m_eglWindowAttrs;
|
||||
QVector<EGLint> m_eglContextAttrs;
|
||||
EGLenum m_eglApi;
|
||||
QEGLPlatformContext *m_platformGlContext;
|
||||
|
||||
bool isFullScreen;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
QT_END_HEADER
|
||||
|
||||
#endif //QOPENKODEWINDOW_H
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>shaders/vert.glslv</file>
|
||||
<file>shaders/frag.glslf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
uniform sampler2D tex_samp;
|
||||
|
||||
varying vec2 texcoord_var;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_FragColor = texture2D(tex_samp, texcoord_var);
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
uniform vec2 window; // window size
|
||||
|
||||
// Per-vertex attributes]
|
||||
attribute vec2 pos_attr;
|
||||
attribute vec2 texcoord_attr;
|
||||
|
||||
// Output vertex color
|
||||
varying vec2 texcoord_var;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4( (2.0 * pos_attr / window -1.0) * vec2(1.0, -1.0), 0.0, 1.0);
|
||||
texcoord_var = texcoord_attr;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <private/qgraphicssystemplugin_p.h>
|
||||
#include "qgraphicssystem_vglite.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin
|
||||
{
|
||||
public:
|
||||
QStringList keys() const;
|
||||
QGraphicsSystem *create(const QString&);
|
||||
};
|
||||
|
||||
QStringList QVGGraphicsSystemPlugin::keys() const
|
||||
{
|
||||
QStringList list;
|
||||
list << "OpenVG";
|
||||
return list;
|
||||
}
|
||||
|
||||
QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system)
|
||||
{
|
||||
if (system.toLower() == "openvg")
|
||||
return new QVGLiteGraphicsSystem;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
TARGET = qvglitegraphicssystem
|
||||
load(qt_plugin)
|
||||
|
||||
QT += openvg
|
||||
|
||||
DESTDIR = $$QT.gui.plugins/graphicssystems
|
||||
|
||||
SOURCES = main.cpp qgraphicssystem_vglite.cpp qwindowsurface_vglite.cpp
|
||||
HEADERS = qgraphicssystem_vglite.h qwindowsurface_vglite.h
|
||||
|
||||
target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
|
||||
INSTALLS += target
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qgraphicssystem_vglite.h"
|
||||
#include "qwindowsurface_vglite.h"
|
||||
#include <QtOpenVG/qplatformpixmap_vg_p.h>
|
||||
#include <QtGui/private/qegl_p.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#ifdef OPENVG_USBHP_INIT
|
||||
extern "C" {
|
||||
#include <linuxusbhp.h>
|
||||
};
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QVGLiteGraphicsSystem::QVGLiteGraphicsSystem()
|
||||
: w(0), h(0), d(0), dw(0), dh(0), physWidth(0), physHeight(0),
|
||||
surface(0), context(0), rootWindow(0),
|
||||
screenFormat(QImage::Format_RGB16), preservedSwap(false)
|
||||
{
|
||||
#ifdef OPENVG_USBHP_INIT
|
||||
initLibrary();
|
||||
#endif
|
||||
|
||||
// The graphics system is also the screen definition.
|
||||
mScreens.append(this);
|
||||
|
||||
QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY"));
|
||||
QStringList displayArgs = displaySpec.split(QLatin1Char(':'));
|
||||
|
||||
// Initialize EGL and create the global EGL context.
|
||||
context = qt_vg_create_context(0);
|
||||
if (!context) {
|
||||
qFatal("QVGLiteGraphicsSystem: could not initialize EGL");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the root window handle to use. Default to zero.
|
||||
QRegExp winidRx(QLatin1String("winid=?(\\d+)"));
|
||||
int winidIdx = displayArgs.indexOf(winidRx);
|
||||
int handle = 0;
|
||||
if (winidIdx >= 0) {
|
||||
winidRx.exactMatch(displayArgs.at(winidIdx));
|
||||
handle = winidRx.cap(1).toInt();
|
||||
}
|
||||
|
||||
// Create a full-screen window based on the native handle.
|
||||
// If the context is premultiplied, the window should be too.
|
||||
QEglProperties props;
|
||||
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
|
||||
EGLint surfaceType = 0;
|
||||
if (context->configAttrib(EGL_SURFACE_TYPE, &surfaceType) &&
|
||||
(surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
|
||||
props.setValue(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE);
|
||||
#endif
|
||||
rootWindow = eglCreateWindowSurface
|
||||
(context->display(), context->config(),
|
||||
(EGLNativeWindowType)handle, props.properties());
|
||||
if (rootWindow == EGL_NO_SURFACE) {
|
||||
delete context;
|
||||
context = 0;
|
||||
qFatal("QVGLiteGraphicsSystem: could not create full-screen window");
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to turn on preserved swap behaviour on the root window.
|
||||
// This will allow us to optimize compositing to focus on just
|
||||
// the screen region that has changed. Otherwise we must
|
||||
// re-composite the entire screen every frame.
|
||||
#if !defined(QVG_NO_PRESERVED_SWAP)
|
||||
eglGetError(); // Clear error state first.
|
||||
eglSurfaceAttrib(context->display(), rootWindow,
|
||||
EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
|
||||
preservedSwap = (eglGetError() == EGL_SUCCESS);
|
||||
#else
|
||||
preservedSwap = false;
|
||||
#endif
|
||||
|
||||
// Fetch the root window properties.
|
||||
eglQuerySurface(context->display(), rootWindow, EGL_WIDTH, &w);
|
||||
eglQuerySurface(context->display(), rootWindow, EGL_HEIGHT, &h);
|
||||
screenFormat = qt_vg_config_to_image_format(context);
|
||||
switch (screenFormat) {
|
||||
case QImage::Format_ARGB32_Premultiplied:
|
||||
case QImage::Format_ARGB32:
|
||||
case QImage::Format_RGB32:
|
||||
default:
|
||||
d = 32;
|
||||
break;
|
||||
case QImage::Format_RGB16:
|
||||
case QImage::Format_ARGB4444_Premultiplied:
|
||||
d = 16;
|
||||
break;
|
||||
}
|
||||
dw = w;
|
||||
dh = h;
|
||||
qDebug("screen size: %dx%dx%d", w, h, d);
|
||||
|
||||
// Handle display physical size spec. From qscreenlinuxfb_qws.cpp.
|
||||
QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)"));
|
||||
int dimIdxW = displayArgs.indexOf(mmWidthRx);
|
||||
QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)"));
|
||||
int dimIdxH = displayArgs.indexOf(mmHeightRx);
|
||||
if (dimIdxW >= 0) {
|
||||
mmWidthRx.exactMatch(displayArgs.at(dimIdxW));
|
||||
physWidth = mmWidthRx.cap(1).toInt();
|
||||
if (dimIdxH < 0)
|
||||
physHeight = dh*physWidth/dw;
|
||||
}
|
||||
if (dimIdxH >= 0) {
|
||||
mmHeightRx.exactMatch(displayArgs.at(dimIdxH));
|
||||
physHeight = mmHeightRx.cap(1).toInt();
|
||||
if (dimIdxW < 0)
|
||||
physWidth = dw*physHeight/dh;
|
||||
}
|
||||
if (dimIdxW < 0 && dimIdxH < 0) {
|
||||
const int dpi = 72;
|
||||
physWidth = qRound(dw * 25.4 / dpi);
|
||||
physHeight = qRound(dh * 25.4 / dpi);
|
||||
}
|
||||
}
|
||||
|
||||
QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem()
|
||||
{
|
||||
}
|
||||
|
||||
QPlatformPixmap *QVGLiteGraphicsSystem::createPlatformPixmap(QPlatformPixmap::PixelType type) const
|
||||
{
|
||||
#if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA)
|
||||
// Pixmaps can use QVGLitePlatformPixmap; bitmaps must use raster.
|
||||
if (type == QPlatformPixmap::PixmapType)
|
||||
return new QVGPlatformPixmap(type);
|
||||
else
|
||||
return new QRasterPlatformPixmap(type);
|
||||
#else
|
||||
return new QRasterPlatformPixmap(type);
|
||||
#endif
|
||||
}
|
||||
|
||||
QWindowSurface *QVGLiteGraphicsSystem::createWindowSurface(QWidget *widget) const
|
||||
{
|
||||
if (widget->windowType() == Qt::Desktop)
|
||||
return 0; // Don't create an explicit window surface for the destkop.
|
||||
if (surface) {
|
||||
qWarning() << "QVGLiteGraphicsSystem: only one window surface "
|
||||
"is supported at a time";
|
||||
return 0;
|
||||
}
|
||||
surface = new QVGLiteWindowSurface
|
||||
(const_cast<QVGLiteGraphicsSystem *>(this), widget);
|
||||
return surface;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QGRAPHICSSYSTEM_VGLITE_H
|
||||
#define QGRAPHICSSYSTEM_VGLITE_H
|
||||
|
||||
#include <QtGui/private/qgraphicssystem_p.h>
|
||||
#include <QtGui/private/qegl_p.h>
|
||||
#include <QtGui/qimage.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVGLiteWindowSurface;
|
||||
|
||||
class QVGLiteGraphicsSystem : public QGraphicsSystem,
|
||||
public QGraphicsSystemScreen
|
||||
{
|
||||
public:
|
||||
QVGLiteGraphicsSystem();
|
||||
~QVGLiteGraphicsSystem();
|
||||
|
||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
|
||||
QWindowSurface *createWindowSurface(QWidget *widget) const;
|
||||
QList<QGraphicsSystemScreen *> screens() const { return mScreens; }
|
||||
|
||||
QRect geometry() const { return QRect(0, 0, w, h); }
|
||||
int depth() const { return d; }
|
||||
QImage::Format format() const { return screenFormat; }
|
||||
QSize physicalSize() const { return QSize(physWidth, physHeight); }
|
||||
|
||||
private:
|
||||
friend class QVGLiteWindowSurface;
|
||||
|
||||
int w;
|
||||
int h;
|
||||
int d;
|
||||
|
||||
int dw;
|
||||
int dh;
|
||||
|
||||
int physWidth;
|
||||
int physHeight;
|
||||
|
||||
mutable QVGLiteWindowSurface *surface;
|
||||
QEglContext *context;
|
||||
EGLSurface rootWindow;
|
||||
QImage::Format screenFormat;
|
||||
bool preservedSwap;
|
||||
|
||||
QList<QGraphicsSystemScreen *> mScreens;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qwindowsurface_vglite.h"
|
||||
#include "qgraphicssystem_vglite.h"
|
||||
#include <QtOpenVG/qvg.h>
|
||||
#include <QtOpenVG/private/qvg_p.h>
|
||||
#include <QtOpenVG/private/qpaintengine_vg_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QVGLiteWindowSurface::QVGLiteWindowSurface
|
||||
(QVGLiteGraphicsSystem *gs, QWidget *window)
|
||||
: QWindowSurface(window), graphicsSystem(gs),
|
||||
isPaintingActive(false), engine(0)
|
||||
{
|
||||
}
|
||||
|
||||
QVGLiteWindowSurface::~QVGLiteWindowSurface()
|
||||
{
|
||||
graphicsSystem->surface = 0;
|
||||
if (engine)
|
||||
qt_vg_destroy_paint_engine(engine);
|
||||
}
|
||||
|
||||
QPaintDevice *QVGLiteWindowSurface::paintDevice()
|
||||
{
|
||||
qt_vg_make_current(graphicsSystem->context, graphicsSystem->rootWindow);
|
||||
isPaintingActive = true;
|
||||
// TODO: clear the parts of the back buffer that are not
|
||||
// covered by the window surface to black.
|
||||
return this;
|
||||
}
|
||||
|
||||
void QVGLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
|
||||
{
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(region);
|
||||
Q_UNUSED(offset);
|
||||
QEglContext *context = graphicsSystem->context;
|
||||
if (context) {
|
||||
if (!isPaintingActive)
|
||||
qt_vg_make_current(context, graphicsSystem->rootWindow);
|
||||
context->swapBuffers();
|
||||
qt_vg_done_current(context);
|
||||
context->setSurface(EGL_NO_SURFACE);
|
||||
isPaintingActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
void QVGLiteWindowSurface::setGeometry(const QRect &rect)
|
||||
{
|
||||
QWindowSurface::setGeometry(rect);
|
||||
}
|
||||
|
||||
bool QVGLiteWindowSurface::scroll(const QRegion &area, int dx, int dy)
|
||||
{
|
||||
return QWindowSurface::scroll(area, dx, dy);
|
||||
}
|
||||
|
||||
void QVGLiteWindowSurface::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
}
|
||||
|
||||
void QVGLiteWindowSurface::endPaint(const QRegion ®ion)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
}
|
||||
|
||||
QPaintEngine *QVGLiteWindowSurface::paintEngine() const
|
||||
{
|
||||
if (!engine)
|
||||
engine = qt_vg_create_paint_engine();
|
||||
return engine;
|
||||
}
|
||||
|
||||
// We need to get access to QWidget::metric() from QVGLiteWindowSurface::metric,
|
||||
// but it is not a friend of QWidget. To get around this, we create a
|
||||
// fake QX11PaintEngine class, which is a friend.
|
||||
class QX11PaintEngine
|
||||
{
|
||||
public:
|
||||
static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met)
|
||||
{
|
||||
return widget->metric(met);
|
||||
}
|
||||
};
|
||||
|
||||
int QVGLiteWindowSurface::metric(PaintDeviceMetric met) const
|
||||
{
|
||||
return QX11PaintEngine::metric(window(), met);
|
||||
}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QWINDOWSURFACE_VGLITE_H
|
||||
#define QWINDOWSURFACE_VGLITE_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtGui/private/qwindowsurface_p.h>
|
||||
#include <QtGui/private/qegl_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVGLiteGraphicsSystem;
|
||||
class QVGPaintEngine;
|
||||
|
||||
class Q_OPENVG_EXPORT QVGLiteWindowSurface : public QWindowSurface, public QPaintDevice
|
||||
{
|
||||
public:
|
||||
QVGLiteWindowSurface(QVGLiteGraphicsSystem *gs, QWidget *window);
|
||||
~QVGLiteWindowSurface();
|
||||
|
||||
QPaintDevice *paintDevice();
|
||||
void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset);
|
||||
void setGeometry(const QRect &rect);
|
||||
bool scroll(const QRegion &area, int dx, int dy);
|
||||
|
||||
void beginPaint(const QRegion ®ion);
|
||||
void endPaint(const QRegion ®ion);
|
||||
|
||||
QPaintEngine *paintEngine() const;
|
||||
|
||||
protected:
|
||||
int metric(PaintDeviceMetric metric) const;
|
||||
|
||||
private:
|
||||
QVGLiteGraphicsSystem *graphicsSystem;
|
||||
bool isPaintingActive;
|
||||
mutable QVGPaintEngine *engine;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QWINDOWSURFACE_VGLITE_H
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QPlatformIntegrationPlugin>
|
||||
#include "qvfbintegration.h"
|
||||
#include <qstringlist.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVFbIntegrationPlugin : public QPlatformIntegrationPlugin
|
||||
{
|
||||
public:
|
||||
QStringList keys() const;
|
||||
QPlatformIntegration *create(const QString&, const QStringList&);
|
||||
};
|
||||
|
||||
QStringList QVFbIntegrationPlugin::keys() const
|
||||
{
|
||||
QStringList list;
|
||||
list << "QVFb";
|
||||
return list;
|
||||
}
|
||||
|
||||
QPlatformIntegration* QVFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
||||
{
|
||||
Q_UNUSED(paramList);
|
||||
if (system.toLower() == "qvfb")
|
||||
return new QVFbIntegration(paramList);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(qvfb, QVFbIntegrationPlugin)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
TARGET = qvfbintegration
|
||||
load(qt_plugin)
|
||||
|
||||
DESTDIR = $$QT.gui.plugins/platforms
|
||||
|
||||
QT += core-private gui-private platformsupport-private
|
||||
|
||||
SOURCES = main.cpp qvfbintegration.cpp qvfbwindowsurface.cpp
|
||||
HEADERS = qvfbintegration.h qvfbwindowsurface.h
|
||||
|
||||
CONFIG += qpa/genericunixfontdatabase
|
||||
|
||||
target.path += $$[QT_INSTALL_PLUGINS]/platforms
|
||||
INSTALLS += target
|
||||
|
|
@ -1,454 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <private/qcore_unix_p.h> // overrides QT_OPEN
|
||||
|
||||
#include <qvfbhdr.h>
|
||||
#include <qsocketnotifier.h>
|
||||
|
||||
#include "qvfbintegration.h"
|
||||
#include "qvfbwindowsurface.h"
|
||||
#include <QtGui/private/qpixmap_raster_p.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <qsocketnotifier.h>
|
||||
#include <QApplication>
|
||||
#include <QWindowSystemInterface>
|
||||
|
||||
#include "qgenericunixfontdatabase.h"
|
||||
#include "qgenericunixeventdispatcher.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QVFbScreenKeyboardHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QVFbScreenKeyboardHandler(int displayId);
|
||||
~QVFbScreenKeyboardHandler();
|
||||
|
||||
private slots:
|
||||
void readKeyboardData();
|
||||
|
||||
private:
|
||||
int kbdFD;
|
||||
int kbdIdx;
|
||||
int kbdBufferLen;
|
||||
unsigned char *kbdBuffer;
|
||||
QSocketNotifier *keyNotifier;
|
||||
};
|
||||
|
||||
QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler(int displayId)
|
||||
{
|
||||
const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId);
|
||||
|
||||
|
||||
kbdFD = -1;
|
||||
kbdIdx = 0;
|
||||
kbdBufferLen = sizeof(QVFbKeyData) * 5;
|
||||
kbdBuffer = new unsigned char [kbdBufferLen];
|
||||
|
||||
kbdFD = QT_OPEN(keyboardDev.toLatin1().constData(), O_RDWR | O_NDELAY);
|
||||
|
||||
if (kbdFD == -1) {
|
||||
perror("QVFbScreenKeyboardHandler");
|
||||
qWarning("QVFbScreenKeyboardHandler: Unable to open device %s",
|
||||
qPrintable(keyboardDev));
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear pending input
|
||||
char buf[2];
|
||||
while (QT_READ(kbdFD, buf, 1) > 0) { }
|
||||
|
||||
keyNotifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this);
|
||||
connect(keyNotifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
|
||||
|
||||
}
|
||||
|
||||
QVFbScreenKeyboardHandler::~QVFbScreenKeyboardHandler()
|
||||
{
|
||||
if (kbdFD >= 0)
|
||||
QT_CLOSE(kbdFD);
|
||||
delete [] kbdBuffer;
|
||||
}
|
||||
|
||||
|
||||
void QVFbScreenKeyboardHandler::readKeyboardData()
|
||||
{
|
||||
int n;
|
||||
do {
|
||||
n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
|
||||
if (n > 0)
|
||||
kbdIdx += n;
|
||||
} while (n > 0);
|
||||
|
||||
int idx = 0;
|
||||
while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) {
|
||||
QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx);
|
||||
if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) {
|
||||
// magic exit key
|
||||
qWarning("Instructed to quit by Virtual Keyboard");
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
//QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat);
|
||||
|
||||
QEvent::Type type = kd->press ? QEvent::KeyPress : QEvent::KeyRelease;
|
||||
|
||||
QString text;
|
||||
if (kd->unicode && kd->unicode != 0xffff)
|
||||
text += QChar(kd->unicode);
|
||||
|
||||
// qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text;
|
||||
|
||||
QWindowSystemInterface::handleKeyEvent(0, type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length()));
|
||||
idx += sizeof(QVFbKeyData);
|
||||
}
|
||||
|
||||
int surplus = kbdIdx - idx;
|
||||
for (int i = 0; i < surplus; i++)
|
||||
kbdBuffer[i] = kbdBuffer[idx+i];
|
||||
kbdIdx = surplus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class QVFbScreenMouseHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QVFbScreenMouseHandler(int displayId);
|
||||
~QVFbScreenMouseHandler();
|
||||
|
||||
private slots:
|
||||
void readMouseData();
|
||||
|
||||
private:
|
||||
int mouseFD;
|
||||
int mouseIdx;
|
||||
enum {mouseBufSize = 128};
|
||||
uchar mouseBuf[mouseBufSize];
|
||||
QSocketNotifier *mouseNotifier;
|
||||
|
||||
int oldButtonState;
|
||||
};
|
||||
|
||||
QVFbScreenMouseHandler::QVFbScreenMouseHandler(int displayId)
|
||||
{
|
||||
QString mouseDev = QT_VFB_MOUSE_PIPE(displayId);
|
||||
|
||||
mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY);
|
||||
|
||||
if (mouseFD == -1) {
|
||||
perror("QVFbMouseHandler::QVFbMouseHandler");
|
||||
qWarning("QVFbMouseHander: Unable to open device %s",
|
||||
qPrintable(mouseDev));
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear pending input
|
||||
char buf[2];
|
||||
while (QT_READ(mouseFD, buf, 1) > 0) { }
|
||||
|
||||
mouseIdx = 0;
|
||||
oldButtonState = 0;
|
||||
mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
|
||||
connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
|
||||
}
|
||||
|
||||
|
||||
QVFbScreenMouseHandler::~QVFbScreenMouseHandler()
|
||||
{
|
||||
if (mouseFD >= 0)
|
||||
QT_CLOSE(mouseFD);
|
||||
}
|
||||
|
||||
void QVFbScreenMouseHandler::readMouseData()
|
||||
{
|
||||
int n;
|
||||
do {
|
||||
n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
|
||||
if (n > 0)
|
||||
mouseIdx += n;
|
||||
} while (n > 0);
|
||||
|
||||
int idx = 0;
|
||||
static const int packetsize = sizeof(QPoint) + 2*sizeof(int);
|
||||
while (mouseIdx-idx >= packetsize) {
|
||||
uchar *mb = mouseBuf+idx;
|
||||
QPoint mousePos = *reinterpret_cast<QPoint *>(mb);
|
||||
mb += sizeof(QPoint);
|
||||
int bstate = *reinterpret_cast<int *>(mb);
|
||||
mb += sizeof(int);
|
||||
//int wheel = *reinterpret_cast<int *>(mb);
|
||||
|
||||
int button = bstate ^ oldButtonState;
|
||||
QEvent::Type type = QEvent::MouseMove;
|
||||
|
||||
if (button) {
|
||||
type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease;
|
||||
}
|
||||
QWindowSystemInterface::handleMouseEvent(0, mousePos, mousePos, Qt::MouseButtons(bstate));
|
||||
|
||||
// qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type;
|
||||
|
||||
oldButtonState = bstate;
|
||||
|
||||
idx += packetsize;
|
||||
}
|
||||
|
||||
int surplus = mouseIdx - idx;
|
||||
for (int i = 0; i < surplus; i++)
|
||||
mouseBuf[i] = mouseBuf[idx+i];
|
||||
mouseIdx = surplus;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class QVFbScreenPrivate
|
||||
{
|
||||
public:
|
||||
QVFbScreenPrivate(int id)
|
||||
: shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0)
|
||||
{
|
||||
displayId = id;
|
||||
connect(displayId);
|
||||
}
|
||||
|
||||
~QVFbScreenPrivate() { disconnect(); }
|
||||
void setDirty(const QRect &r);
|
||||
|
||||
bool connect(int displayId);
|
||||
void disconnect();
|
||||
|
||||
QImage *screenImage() { return &img; }
|
||||
QSize screenSize() { return img.size(); }
|
||||
|
||||
int depth() const { return img.depth(); }
|
||||
QImage::Format format() const { return img.format(); }
|
||||
|
||||
private:
|
||||
unsigned char *shmrgn;
|
||||
QVFbHeader *hdr;
|
||||
uchar *data;
|
||||
QVFbScreenMouseHandler *mouseHandler;
|
||||
QVFbScreenKeyboardHandler *keyboardHandler;
|
||||
int displayId;
|
||||
|
||||
QImage img;
|
||||
};
|
||||
|
||||
|
||||
void QVFbScreenPrivate::setDirty(const QRect &r)
|
||||
{
|
||||
hdr->dirty = true;
|
||||
hdr->update = hdr->update.united(r);
|
||||
}
|
||||
|
||||
|
||||
bool QVFbScreenPrivate::connect(int displayId)
|
||||
{
|
||||
qDebug() << "QVFbScreenPrivate::connect" << displayId;
|
||||
key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b');
|
||||
|
||||
if (key == -1)
|
||||
return false;
|
||||
|
||||
|
||||
int shmId = shmget(key, 0, 0);
|
||||
if (shmId != -1)
|
||||
shmrgn = (unsigned char *)shmat(shmId, 0, 0);
|
||||
else
|
||||
return false;
|
||||
|
||||
if ((long)shmrgn == -1 || shmrgn == 0) {
|
||||
qDebug("No shmrgn %ld", (long)shmrgn);
|
||||
return false;
|
||||
}
|
||||
|
||||
hdr = (QVFbHeader *)shmrgn;
|
||||
data = shmrgn + hdr->dataoffset;
|
||||
|
||||
int w = hdr->width;
|
||||
int h = hdr->height;
|
||||
int d = hdr->depth;
|
||||
int lstep = hdr->linestep;
|
||||
|
||||
QImage::Format format = QImage::Format_Invalid;
|
||||
if (d == 32)
|
||||
format = QImage::Format_ARGB32_Premultiplied;
|
||||
else if (d == 16)
|
||||
format = QImage::Format_RGB16;
|
||||
|
||||
|
||||
if (format == QImage::Format_Invalid) {
|
||||
img = QImage();
|
||||
return false;
|
||||
}
|
||||
|
||||
img = QImage(data, w, h, lstep, format);
|
||||
|
||||
qDebug("connected %dx%d %d bpp", w, h, d);
|
||||
|
||||
|
||||
mouseHandler = new QVFbScreenMouseHandler(displayId);
|
||||
keyboardHandler = new QVFbScreenKeyboardHandler(displayId);
|
||||
return true;
|
||||
}
|
||||
|
||||
void QVFbScreenPrivate::disconnect()
|
||||
{
|
||||
if ((long)shmrgn != -1 && shmrgn) {
|
||||
shmdt((char*)shmrgn);
|
||||
shmrgn = 0;
|
||||
}
|
||||
delete mouseHandler;
|
||||
mouseHandler = 0;
|
||||
delete keyboardHandler;
|
||||
keyboardHandler = 0;
|
||||
}
|
||||
|
||||
|
||||
QVFbScreen::QVFbScreen(int id)
|
||||
{
|
||||
d_ptr = new QVFbScreenPrivate(id);
|
||||
}
|
||||
|
||||
|
||||
QVFbScreen::~QVFbScreen()
|
||||
{
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
void QVFbScreen::setDirty(const QRect &rect)
|
||||
{
|
||||
d_ptr->setDirty(rect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QRect QVFbScreen::geometry() const {
|
||||
return QRect(QPoint(), d_ptr->screenSize());
|
||||
}
|
||||
|
||||
|
||||
int QVFbScreen::depth() const
|
||||
{
|
||||
return d_ptr->depth();
|
||||
}
|
||||
|
||||
QImage::Format QVFbScreen::format() const
|
||||
{
|
||||
return d_ptr->format();
|
||||
}
|
||||
|
||||
QSizeF QVFbScreen::physicalSize() const {
|
||||
return (QSizeF(d_ptr->screenSize())*254)/720.;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int QVFbScreen::linestep() const {
|
||||
return d_ptr->screenImage() ? d_ptr->screenImage()->bytesPerLine() : 0;
|
||||
}
|
||||
|
||||
uchar *QVFbScreen::base() const {
|
||||
return d_ptr->screenImage() ? d_ptr->screenImage()->bits() : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
QImage *QVFbScreen::screenImage()
|
||||
{
|
||||
return d_ptr->screenImage();
|
||||
}
|
||||
|
||||
QVFbIntegration::QVFbIntegration(const QStringList ¶mList)
|
||||
: mFontDb(new QGenericUnixFontDatabase())
|
||||
{
|
||||
int displayId = 0;
|
||||
if (paramList.length() > 0)
|
||||
displayId = paramList.at(0).toInt();
|
||||
|
||||
mPrimaryScreen = new QVFbScreen(displayId);
|
||||
|
||||
mScreens.append(mPrimaryScreen);
|
||||
}
|
||||
|
||||
QPlatformPixmap *QVFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
|
||||
{
|
||||
return new QRasterPlatformPixmap(type);
|
||||
}
|
||||
|
||||
QWindowSurface *QVFbIntegration::createWindowSurface(QWidget *widget, WId) const
|
||||
{
|
||||
return new QVFbWindowSurface(mPrimaryScreen, widget);
|
||||
}
|
||||
|
||||
|
||||
QPlatformWindow *QVFbIntegration::createPlatformWindow(QWidget *widget, WId) const
|
||||
{
|
||||
return new QVFbWindow(mPrimaryScreen, widget);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const
|
||||
{
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *QVFbIntegration::fontDatabase() const
|
||||
{
|
||||
return mFontDb;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "qvfbintegration.moc"
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QGRAPHICSSYSTEM_QVFB_H
|
||||
#define QGRAPHICSSYSTEM_QVFB_H
|
||||
|
||||
#include <QPlatformScreen>
|
||||
#include <QPlatformIntegration>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QVFbScreenPrivate;
|
||||
class QAbstractEventDispatcher;
|
||||
|
||||
class QVFbScreen : public QPlatformScreen
|
||||
{
|
||||
public:
|
||||
QVFbScreen(int id);
|
||||
~QVFbScreen();
|
||||
|
||||
QRect geometry() const;
|
||||
int depth() const;
|
||||
QImage::Format format() const;
|
||||
QSizeF physicalSize() const;
|
||||
|
||||
QImage *screenImage();
|
||||
|
||||
void setDirty(const QRect &rect);
|
||||
|
||||
public:
|
||||
|
||||
QVFbScreenPrivate *d_ptr;
|
||||
};
|
||||
|
||||
class QVFbIntegrationPrivate;
|
||||
|
||||
|
||||
class QVFbIntegration : public QPlatformIntegration
|
||||
{
|
||||
public:
|
||||
QVFbIntegration(const QStringList ¶mList);
|
||||
|
||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
|
||||
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
|
||||
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
QList<QPlatformScreen *> screens() const { return mScreens; }
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
private:
|
||||
QVFbScreen *mPrimaryScreen;
|
||||
QList<QPlatformScreen *> mScreens;
|
||||
QPlatformFontDatabase *mFontDb;
|
||||
};
|
||||
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "qvfbwindowsurface.h"
|
||||
#include "qvfbintegration.h"
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <private/qapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QVFbWindowSurface::QVFbWindowSurface(//QVFbIntegration *graphicsSystem,
|
||||
QVFbScreen *screen, QWidget *window)
|
||||
: QWindowSurface(window),
|
||||
mScreen(screen)
|
||||
{
|
||||
}
|
||||
|
||||
QVFbWindowSurface::~QVFbWindowSurface()
|
||||
{
|
||||
}
|
||||
|
||||
QPaintDevice *QVFbWindowSurface::paintDevice()
|
||||
{
|
||||
return mScreen->screenImage();
|
||||
}
|
||||
|
||||
void QVFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
|
||||
{
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(offset);
|
||||
|
||||
// QRect rect = geometry();
|
||||
// QPoint topLeft = rect.topLeft();
|
||||
|
||||
mScreen->setDirty(region.boundingRect());
|
||||
}
|
||||
|
||||
void QVFbWindowSurface::resize(const QSize&)
|
||||
{
|
||||
|
||||
// any size you like as long as it's full-screen...
|
||||
|
||||
QRect rect(mScreen->availableGeometry());
|
||||
QWindowSurface::resize(rect.size());
|
||||
}
|
||||
|
||||
|
||||
QVFbWindow::QVFbWindow(QVFbScreen *screen, QWidget *window)
|
||||
: QPlatformWindow(window),
|
||||
mScreen(screen)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QVFbWindow::setGeometry(const QRect &)
|
||||
{
|
||||
|
||||
// any size you like as long as it's full-screen...
|
||||
|
||||
QRect rect(mScreen->availableGeometry());
|
||||
QWindowSystemInterface::handleGeometryChange(this->widget(), rect);
|
||||
|
||||
QPlatformWindow::setGeometry(rect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QWINDOWSURFACE_QVFB_H
|
||||
#define QWINDOWSURFACE_QVFB_H
|
||||
|
||||
#include <QtGui/private/qwindowsurface_p.h>
|
||||
#include <QPlatformWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVFbIntegration;
|
||||
class QVFbScreen;
|
||||
|
||||
class QVFbWindowSurface : public QWindowSurface
|
||||
{
|
||||
public:
|
||||
QVFbWindowSurface(QVFbScreen *screen, QWidget *window);
|
||||
~QVFbWindowSurface();
|
||||
|
||||
QPaintDevice *paintDevice();
|
||||
void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset);
|
||||
void resize(const QSize &size);
|
||||
|
||||
private:
|
||||
QVFbScreen *mScreen;
|
||||
};
|
||||
|
||||
class QVFbWindow : public QPlatformWindow
|
||||
{
|
||||
public:
|
||||
QVFbWindow(QVFbScreen *screen, QWidget *window);
|
||||
void setGeometry(const QRect &rect);
|
||||
|
||||
private:
|
||||
QVFbScreen *mScreen;
|
||||
};
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue