summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget_qpa.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-06-03 11:30:23 +0200
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-06-03 11:59:15 +0200
commit1f456b4cbb93e3fea699878d117900b703146213 (patch)
treece33b7dc746a1ef1b6a044fbcf742755c0c5744b /src/widgets/kernel/qwidget_qpa.cpp
parent7d9fcaccb1e6e056336b9ad1f7f89afac4699aee (diff)
Add support for mouse and keyboard grab.
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index b8a7cb5463..8764f633f1 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -338,8 +338,8 @@ void QWidget::grabMouse()
if (qt_mouseGrb)
qt_mouseGrb->releaseMouse();
- // XXX
- //qwsDisplay()->grabMouse(this,true);
+ if (windowHandle())
+ windowHandle()->setMouseGrabEnabled(true);
qt_mouseGrb = this;
qt_pressGrab = 0;
@@ -353,19 +353,27 @@ void QWidget::grabMouse(const QCursor &cursor)
if (qt_mouseGrb)
qt_mouseGrb->releaseMouse();
- // XXX
- //qwsDisplay()->grabMouse(this,true);
- //qwsDisplay()->selectCursor(this, cursor.handle());
+ if (windowHandle())
+ windowHandle()->setMouseGrabEnabled(true);
+
qt_mouseGrb = this;
qt_pressGrab = 0;
}
#endif
+bool QWidgetPrivate::stealMouseGrab(bool grab)
+{
+ // This is like a combination of grab/releaseMouse() but with error checking
+ // and it has no effect on the result of mouseGrabber().
+ Q_Q(QWidget);
+ return q->windowHandle() ? q->windowHandle()->setMouseGrabEnabled(grab) : false;
+}
+
void QWidget::releaseMouse()
{
if (qt_mouseGrb == this) {
- // XXX
- //qwsDisplay()->grabMouse(this,false);
+ if (windowHandle())
+ windowHandle()->setMouseGrabEnabled(false);
qt_mouseGrb = 0;
}
}
@@ -374,16 +382,24 @@ void QWidget::grabKeyboard()
{
if (keyboardGrb)
keyboardGrb->releaseKeyboard();
- // XXX
- //qwsDisplay()->grabKeyboard(this, true);
+ if (windowHandle())
+ windowHandle()->setKeyboardGrabEnabled(true);
keyboardGrb = this;
}
+bool QWidgetPrivate::stealKeyboardGrab(bool grab)
+{
+ // This is like a combination of grab/releaseKeyboard() but with error
+ // checking and it has no effect on the result of keyboardGrabber().
+ Q_Q(QWidget);
+ return q->windowHandle() ? q->windowHandle()->setKeyboardGrabEnabled(grab) : false;
+}
+
void QWidget::releaseKeyboard()
{
if (keyboardGrb == this) {
- // XXX
- //qwsDisplay()->grabKeyboard(this, false);
+ if (windowHandle())
+ windowHandle()->setKeyboardGrabEnabled(false);
keyboardGrb = 0;
}
}