aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslaw Jaryszew <jaroslaw.jaryszew@teleca.com>2010-11-02 11:03:58 +0100
committerNatalia Dobrovolskaya <natalia.dobrovolskaya@nokia.com>2010-11-03 15:22:05 +0200
commit75e7b10a8de42b3c7b77215c0f9cb4efb57306ca (patch)
tree6d8e2c597b6dafc2f38e604a05c01760b74725c3
parent61c9de5fe984efee16f4e45035415588214d0bf4 (diff)
Fix: NB#201706 - MOrientationTracker discards current X input event mask
RevBy: Vesa Halttunen, Daniel d'Andrada Details: Now MOrientationTrackerPrivate::handleCurrentAppWindowChange stores x event mask for the window it started to listen. We use it to OR new mask with XPropertyEventFlag or restore the old one.
-rw-r--r--src/corelib/events/morientationtracker.cpp24
-rw-r--r--src/corelib/events/morientationtracker_p.h1
2 files changed, 20 insertions, 5 deletions
diff --git a/src/corelib/events/morientationtracker.cpp b/src/corelib/events/morientationtracker.cpp
index 96cf3fe1..a5f2c2ad 100644
--- a/src/corelib/events/morientationtracker.cpp
+++ b/src/corelib/events/morientationtracker.cpp
@@ -45,6 +45,7 @@ MOrientationTrackerPrivate::MOrientationTrackerPrivate(MOrientationTracker *cont
#endif
#ifdef Q_WS_X11
, widCurrentAppWindow(0)
+ , originalEventMaskCurrentAppWindow(0)
#endif //Q_WS_X11
, q_ptr(controller)
{
@@ -253,14 +254,22 @@ void MOrientationTrackerPrivate::handleCurrentAppWindowOrientationAngleChange()
void MOrientationTrackerPrivate::handleCurrentAppWindowChange()
{
- //We stop listenieng to previous top window
- XSelectInput(QX11Info::display(), widCurrentAppWindow, 0);
+ if (widCurrentAppWindow) {
+ //We stop listening to previous top window
+ XSelectInput(QX11Info::display(), widCurrentAppWindow, originalEventMaskCurrentAppWindow);
+ }
+
widCurrentAppWindow = fetchWIdCurrentAppWindow();
//if current window is invalid or not set then return
if (widCurrentAppWindow == 0)
return;
+
+ //Get current window original event mask
+ XWindowAttributes attributes;
+ XGetWindowAttributes(QX11Info::display(), widCurrentAppWindow, &attributes);
+ originalEventMaskCurrentAppWindow = attributes.your_event_mask;
//And start listening to new top window
- XSelectInput(QX11Info::display(), widCurrentAppWindow, PropertyChangeMask);
+ XSelectInput(QX11Info::display(), widCurrentAppWindow, originalEventMaskCurrentAppWindow | PropertyChangeMask);
}
WId MOrientationTrackerPrivate::fetchWIdCurrentAppWindow()
@@ -325,13 +334,18 @@ void MOrientationTrackerPrivate::startFollowingCurrentAppWindow(MWindow *win)
windowsFollowingCurrentAppWindow.append(win);
M::OrientationAngle angle = fetchCurrentAppWindowOrientationAngle();
win->setOrientationAngle(angle);
+
+ handleCurrentAppWindowChange();
}
void MOrientationTrackerPrivate::stopFollowingCurrentAppWindow(MWindow *win)
{
windowsFollowingCurrentAppWindow.removeAll(win);
- if (windowsFollowingCurrentAppWindow.count() == 0)
- XSelectInput(QX11Info::display(), widCurrentAppWindow, 0);
+ if (windowsFollowingCurrentAppWindow.count() == 0) {
+ XSelectInput(QX11Info::display(), widCurrentAppWindow, originalEventMaskCurrentAppWindow);
+ widCurrentAppWindow = 0;
+ originalEventMaskCurrentAppWindow = 0;
+ }
}
#endif //Q_WS_X11
diff --git a/src/corelib/events/morientationtracker_p.h b/src/corelib/events/morientationtracker_p.h
index 471e5529..4035c022 100644
--- a/src/corelib/events/morientationtracker_p.h
+++ b/src/corelib/events/morientationtracker_p.h
@@ -60,6 +60,7 @@ public:
WId fetchWIdCurrentAppWindow();
M::OrientationAngle fetchCurrentAppWindowOrientationAngle();
WId widCurrentAppWindow;
+ long originalEventMaskCurrentAppWindow;
QList<MWindow* > windowsFollowingCurrentAppWindow;
void startFollowingCurrentAppWindow(MWindow* win);
void stopFollowingCurrentAppWindow(MWindow* win);