50 #if !defined(QT_NO_OPENGL) 51 #if !defined(QT_OPENGL_ES_2) 55 #include "../eglconvenience/qeglconvenience.h" 56 #include "../eglconvenience/qeglplatformcontext.h" 57 #include "../eglconvenience/qxlibeglintegration.h" 58 #endif //QT_OPENGL_ES_2 62 #include <QtGui/QWindowSystemInterface> 63 #include <QSocketNotifier> 64 #include <QApplication> 67 #include <QtGui/private/qwindowsurface_p.h> 68 #include <QtGui/private/qapplication_p.h> 77 , mScreen(
QXlibScreen::testLiteScreenForWidget(window))
81 int w = window->
width();
84 #if !defined(QT_NO_OPENGL) 87 || window->platformWindowFormat().alpha()) {
88 #if !defined(QT_OPENGL_ES_2) 93 EGLDisplay eglDisplay =
mScreen->eglDisplay();
97 XVisualInfo visualInfoTemplate;
98 memset(&visualInfoTemplate, 0,
sizeof(XVisualInfo));
99 visualInfoTemplate.visualid = id;
101 XVisualInfo *visualInfo;
102 int matchingCount = 0;
106 mDepth = visualInfo->depth;
111 XSetWindowAttributes
a;
116 0, visualInfo->depth, InputOutput, visualInfo->visual,
117 CWBackPixel|CWBorderPixel|CWColormap, &
a);
140 ExposureMask | KeyPressMask | KeyReleaseMask |
141 EnterWindowMask | LeaveWindowMask | FocusChangeMask |
142 PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
143 ButtonMotionMask | PropertyChangeMask |
144 StructureNotifyMask);
155 #endif // QT_NO_XSYNC 177 Qt::MouseButtons ret = 0;
208 int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1);
209 bool hor = (((e->button == Button4 || e->button == Button5)
211 || (e->button == 6 || e->button == 7));
214 QPoint(e->x_root, e->y_root),
226 QPoint(e->x_root, e->y_root),
229 mousePoint =
QPoint(e->x_root, e->y_root);
296 XTextProperty windowName;
297 windowName.value = (
unsigned char *)ba.
constData();
298 windowName.encoding = XA_STRING;
299 windowName.format = 8;
300 windowName.nitems = ba.
length();
311 qWarning(
"QTestLiteWindow::createGC() could not create GC");
343 qDebug() <<
hex <<
x_window <<
dec <<
"ConfigureNotify" << e->x << e->y << e->width << e->height <<
"geometry" << xpos << ypos << width << height;
346 QRect newRect(xpos, ypos, e->width, e->height);
352 static long prevTime = 0;
354 static int prevX = -999;
355 static int prevY = -999;
360 &&
qAbs(e->x - prevX) < 5 &&
qAbs(e->y - prevY) < 5) {
366 prevWindow = e->window;
379 ulong nitems, bytesLeft;
383 atomForMotifWmHints, &
type, &
format, &nitems, &bytesLeft,
385 && (type == atomForMotifWmHints
406 if (mwmhints.
flags != 0
l) {
408 atomForMotifWmHints, atomForMotifWmHints, 32,
409 PropModeReplace, (
unsigned char *) &mwmhints, 5);
435 ulong propertyLength;
437 uchar *propertyData = 0;
439 False, XA_ATOM, &actualType, &actualFormat,
440 &propertyLength, &bytesLeft, &propertyData) ==
Success 441 && actualType == XA_ATOM && actualFormat == 32) {
442 returnValue.
resize(bytesLeft / 4);
443 XFree((
char*) propertyData);
447 returnValue.
size(), False, XA_ATOM, &actualType, &actualFormat,
448 &propertyLength, &bytesLeft, &propertyData) !=
Success) {
450 }
else if (propertyLength != (
ulong)returnValue.
size()) {
451 returnValue.
resize(propertyLength);
456 memcpy(returnValue.
data(), propertyData, returnValue.
size() *
sizeof(
Atom));
458 XFree((
char*) propertyData);
470 qDebug() <<
"QTestLiteWindow::setWindowFlags" <<
hex <<
x_window <<
"flags" << flags;
493 XSetWindowAttributes wsa;
537 wsa.save_under = True;
538 wsa_mask |= CWSaveUnder;
542 wsa.override_redirect = True;
543 wsa_mask |= CWOverrideRedirect;
546 if (wsa_mask && initializeWindow) {
548 XChangeWindowAttributes(dpy,
id, wsa_mask, &wsa);
583 qWarning() <<
"QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time";
592 if (
widget()->isFullScreen()) {
596 if (
widget()->isMaximized()) {
610 (
unsigned char *) netWmState.
data(), netWmState.
size());
617 if (popup || tooltip) {
619 qDebug() <<
"Doing XChangeWindowAttributes for popup" << wsa.override_redirect;
624 wsa.override_redirect = True;
625 wsa.save_under = True;
630 qDebug() <<
"Doing XChangeWindowAttributes for non-popup";
646 if (widgetParent && widgetParent->platformWindow()) {
648 parentXWindow = parentWidnow->
x_window;
675 #if !defined(QT_NO_OPENGL) 676 #if !defined(QT_OPENGL_ES_2) 685 eglContextAttrs.
append(EGL_CONTEXT_CLIENT_VERSION);
686 eglContextAttrs.
append(2);
687 eglContextAttrs.
append(EGL_NONE);
717 s.flags |= USPosition;
718 s.flags |= PPosition;
721 s.flags |= PWinGravity;
733 return platformWindowFormat;
void setParent(const QPlatformWindow *window)
This function is called to enable native child widgets in QPA.
unsigned long whitePixel()
void lower()
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void setMWMHints(const QXlibMWMHints &mwmhints)
#define QT_END_NAMESPACE
This macro expands to.
static bool isTransient(const QWidget *w)
static void handleWheelEvent(QWidget *w, const QPoint &local, const QPoint &global, int d, Qt::Orientation o)
void raise()
Reimplement to be able to let Qt rais windows to the top of the desktop.
Qt::KeyboardModifiers translateModifiers(int s)
EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat, int surfaceType)
The QByteArray class provides an array of bytes.
Display * nativeDisplay() const
static Qt::MouseButtons buttons
QPlatformGLContext * mGLContext
void handleMouseEvent(QEvent::Type, XButtonEvent *ev)
int width() const
Returns the width of the rectangle.
long ASN1_INTEGER_get ASN1_INTEGER * a
void setGeometry(const QRect &rect)
This function is called by Qt whenever a window is moved or the window is resized.
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QVector class is a template class that provides a dynamic array.
void resizeEvent(XConfigureEvent *configure_event)
NativeWindowType EGLNativeWindowType
void handleFocusInEvent()
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
Q_CORE_EXPORT QTextStream & dec(QTextStream &s)
void resize(int size)
Sets the size of the vector to size.
QPlatformGLContext * glContext() const
Reimplement to return the glContext associated with the window.
QXlibWindow(QWidget *window)
QXlibMWMHints getMWMHints() const
static Qt::MouseButtons translateMouseButtons(int s)
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_GUI_EXPORT EGLDisplay display()
static VisualID getCompatibleVisualId(Display *display, EGLDisplay eglDisplay, EGLConfig config)
static void handleWindowActivated(QWidget *w)
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
void handleFocusOutEvent()
QXlibKeyboard * keyboard() const
static void handleMouseEvent(QWidget *w, const QPoint &local, const QPoint &global, Qt::MouseButtons b)
tlw == 0 means that ev is in global coords only
QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat) const
void append(const T &t)
Inserts value at the end of the vector.
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
static void handleCloseEvent(QWidget *w)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Qt::WindowFlags mWindowFlags
The QWindowSurface class provides the drawing area for top-level windows.
static QWidget * parentWidget(const QWidget *w)
static Atom atom(X11Atom atom)
int length() const
Same as size().
const char * constData() const
Returns a pointer to the data stored in the byte array.
GC graphicsContext() const
Q_CORE_EXPORT void qFatal(const char *,...)
int depth() const
Reimplement in subclass to return current depth of the screen.
The QPlatformGLContext class provides an abstraction for native GL contexts.
Qt::WindowFlags setWindowFlags(Qt::WindowFlags type)
Requests setting the window flags of this surface to type.
WId winId() const
Reimplement in subclasses to return a handle to the native window.
int xScreenNumber() const
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.
Visual * defaultVisual() const
static void handleGeometryChange(QWidget *w, const QRect &newRect)
The QRect class defines a rectangle in the plane using integer precision.
void setWindowTitle(const QString &title)
Reimplement to set the window title to title.
bool contains(const T &t) const
Returns true if the vector contains an occurrence of value; otherwise returns false.
int y() const
Returns the y coordinate of this point.
Qt::WindowFlags windowFlags() const
Returns the effective window flags for this surface.
XVisualInfo * qglx_findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format)
T * data()
Returns a pointer to the data stored in the vector.
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
void requestActivateWindow()
Reimplement to let Qt be able to request activation/focus for a window.
int x() const
Returns the x coordinate of this point.
QVector< Atom > getNetWmState() const
QImage::Format format() const
QXlibDisplay * display() const
static bool isRightToLeft()
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false...
static int doubleClickInterval()
static void handleEnterEvent(QWidget *w)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
static void handleLeaveEvent(QWidget *w)
void mousePressEvent(XButtonEvent *)
unsigned long blackPixel()
void setVisible(bool visible)
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false...
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
void setCursor(const Cursor &cursor)