diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-08-24 14:46:24 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-08-25 09:31:39 +0200 |
commit | 82f95318d61dbfebaa04182de2445a6576a621cd (patch) | |
tree | aabdbb2f6e05e0933004e507898f194248e032c2 /src/plugins/platforms/xlib/qxlibscreen.cpp | |
parent | b2c4c4fc2aee411b4476c6a351688060785aed7e (diff) |
Fix the xlib backend for lighthouse
Adapt the backend to the changes in lighthouse.
Change-Id: If2d795c901143a80eed4f23d14add6ab9f42750b
Reviewed-on: http://codereview.qt.nokia.com/3568
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/platforms/xlib/qxlibscreen.cpp')
-rw-r--r-- | src/plugins/platforms/xlib/qxlibscreen.cpp | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index b069985a5c..e6263c0b33 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <private/qguiapplication_p.h> #include "qxlibscreen.h" #include <X11/extensions/Xfixes.h> @@ -54,7 +55,7 @@ #include <QtCore/QSocketNotifier> #include <QtCore/QElapsedTimer> -#include <private/qapplication_p.h> +#include <QtGui/QScreen> QT_BEGIN_NAMESPACE @@ -263,11 +264,9 @@ unsigned long QXlibScreen::whitePixel() bool QXlibScreen::handleEvent(XEvent *xe) { int quit = false; - QXlibWindow *platformWindow = 0; - QWidget *widget = QWidget::find(xe->xany.window); - if (widget) { - platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); - } + QXlibWindow *platformWindow = QXlibWindow::platformWindowForXWindow(xe->xany.window); + if (!platformWindow) + return false; Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); @@ -282,56 +281,48 @@ bool QXlibScreen::handleEvent(XEvent *xe) break; case Expose: - if (platformWindow) - if (xe->xexpose.count == 0) - platformWindow->paintEvent(); + // ### +// if (xe->xexpose.count == 0) +// platformWindow->paintEvent(); break; case ConfigureNotify: - if (platformWindow) - platformWindow->resizeEvent(&xe->xconfigure); + platformWindow->resizeEvent(&xe->xconfigure); break; case ButtonPress: - if (platformWindow) - platformWindow->mousePressEvent(&xe->xbutton); + platformWindow->mousePressEvent(&xe->xbutton); break; case ButtonRelease: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); break; case MotionNotify: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); break; - case XKeyPress: - mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); + case XKeyPress: + mKeyboard->handleKeyEvent(platformWindow->window(), QEvent::KeyPress, &xe->xkey); break; case XKeyRelease: - mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); + mKeyboard->handleKeyEvent(platformWindow->window(), QEvent::KeyRelease, &xe->xkey); break; case EnterNotify: - if (platformWindow) - platformWindow->handleEnterEvent(); + platformWindow->handleEnterEvent(); break; case LeaveNotify: - if (platformWindow) - platformWindow->handleLeaveEvent(); + platformWindow->handleLeaveEvent(); break; case XFocusIn: - if (platformWindow) - platformWindow->handleFocusInEvent(); + platformWindow->handleFocusInEvent(); break; case XFocusOut: - if (platformWindow) - platformWindow->handleFocusOutEvent(); + platformWindow->handleFocusOutEvent(); break; case PropertyNotify: @@ -452,10 +443,9 @@ QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) return result; } -QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWindow *widget) { - QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast<QXlibScreen *>(platformScreen); + return static_cast<QXlibScreen *>(widget->screen()->handle()); } QXlibDisplay * QXlibScreen::display() const @@ -480,7 +470,7 @@ QXlibKeyboard * QXlibScreen::keyboard() const void QXlibScreen::handleSelectionRequest(XEvent *event) { - QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); clipboard->handleSelectionRequest(event); } |