44 #include "../eglconvenience/qeglplatformcontext.h" 45 #include "../eglconvenience/qeglconvenience.h" 48 #include <KD/NV_display.h> 49 #include <KD/kdplatform.h> 50 #ifdef KD_ATX_keyboard 56 #include <QtGui/qwidget.h> 57 #include <QtGui/private/qwidget_p.h> 58 #include <QtGui/private/qapplication_p.h> 60 #include <QtCore/qvector.h> 61 #include <QtCore/QDebug> 71 #ifdef KD_ATX_keyboard 72 void kdProcessKeyEvents(
const KDEvent *
event )
77 #endif //KD_ATX_keyboard 101 qErrnoWarning(
"Could not make QOpenKODEWindow without a screen");
115 #ifdef KD_ATX_keyboard 116 kdInstallCallback(kdProcessKeyEvents, KD_EVENT_INPUT_KEY_ATX,
this);
117 #endif //KD_ATX_keyboard 124 KDboolean exclusive(
false);
125 if (kdSetWindowPropertybv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, &exclusive)) {
133 const KDint windowSize[2] = { tlw->
width(), tlw->
height() };
134 if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) {
135 qErrnoWarning(kdGetError(),
"Could not set native window size");
137 KDboolean visibillity(
false);
138 if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) {
139 qErrnoWarning(kdGetError(),
"Could not set visibillity to false");
142 const KDint windowPos[2] = { tlw->
x(), tlw->
y() };
143 if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) {
144 qErrnoWarning(kdGetError(),
"Could not set native window position");
154 qErrnoWarning(kdGetError(),
"Could not realize native window");
164 kdDestroyWindow(m_kdWindow);
172 if (
m_platformGlContext != static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration())) {
186 bool needToDeleteContext =
false;
190 const KDint windowSize[2] = { rect.
width(), rect.
height() };
191 if (kdSetWindowPropertyiv(
m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) {
192 qErrnoWarning(kdGetError(),
"Could not set native window size");
195 needToDeleteContext =
true;
200 const KDint windowPos[2] = { rect.
x(), rect.
y() };
201 if (kdSetWindowPropertyiv(
m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) {
202 qErrnoWarning(kdGetError(),
"Could not set native window position");
205 needToDeleteContext =
true;
211 if (needToDeleteContext) {
226 KDboolean visibillity(visible);
227 if (kdSetWindowPropertybv(
m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) {
228 qErrnoWarning(kdGetError(),
"Could not set visibillity property");
247 KDboolean focus(
true);
248 if (kdSetWindowPropertybv(
m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) {
257 KDboolean focus(
false);
258 if (kdSetWindowPropertybv(
m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) {
265 int x =
event->data.inputpointer.x;
266 int y =
event->data.inputpointer.y;
268 switch(event->data.inputpointer.select) {
281 #ifdef KD_ATX_keyboard 284 if (event->data.keyboardInputKey.flags)
290 int openkodeMods =
event->data.keyboardInputKey.flags;
291 if (openkodeMods & KD_KEY_MODIFIER_SHIFT_ATX)
293 if (openkodeMods & KD_KEY_MODIFIER_CTRL_ATX)
295 if (openkodeMods & KD_KEY_MODIFIER_ALT_ATX)
297 if (openkodeMods & KD_KEY_MODIFIER_META_ATX)
302 int key =
event->data.keyboardInputKey.keycode;
303 if (key >= 0x20 && key <= 0x0ff){
305 keyText =
QChar(event->data.keyboardInputKeyChar.character);
T qobject_cast(QObject *object)
#define QT_END_NAMESPACE
This macro expands to.
EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat, int surfaceType)
static Qt::MouseButtons buttons
void processMouseEvents(const KDEvent *event)
static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
EGLNativeWindowType m_eglWindow
int width() const
Returns the width of the rectangle.
int height() const
Returns the height of the rectangle.
QRect geometry() const
Reimplement in subclass to return the pixel geometry of the screen.
The QChar class provides a 16-bit Unicode character.
void setVisible(bool visible)
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false...
void lower()
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void raise()
Reimplement to be able to let Qt rais windows to the top of the desktop.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
WId winId() const
Reimplement in subclasses to return a handle to the native window.
static void handleMouseEvent(QWidget *w, const QPoint &local, const QPoint &global, Qt::MouseButtons b)
tlw == 0 means that ev is in global coords only
void processKeyEvents(const KDEvent *event)
void append(const T &t)
Inserts value at the end of the vector.
QOpenKODEWindow(QWidget *tlw)
void setMainGLContext(QEGLPlatformContext *ctx)
Qt::Key keyTranslator(int key)
struct KDWindow * m_kdWindow
void setGeometry(const QRect &rect)
This function is called by Qt whenever a window is moved or the window is resized.
void mainGLContext() const
QPlatformGLContext * glContext() const
Reimplement to return the glContext associated with the window.
The QPlatformGLContext class provides an abstraction for native GL contexts.
Type
This enum type defines the valid event types in Qt.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
QVector< EGLint > m_eglContextAttrs
QVector< EGLint > m_eglWindowAttrs
void kdProcessMouseEvents(const KDEvent *event)
T * data()
Returns a pointer to the data stored in the vector.
const T * constData() const
Returns a const pointer to the data stored in the vector.
static QString qtKey(CFStringRef cfkey)
void setFullScreen(bool fullscreen)
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
The QList class is a template class that provides lists.
QEGLPlatformContext * m_platformGlContext
void qErrnoWarning(const char *msg,...)
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.