summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-12 19:30:06 -0600
committerSlávek Banko <slavek.banko@axis.cz>2013-01-13 02:45:04 +0100
commitb8ca17c69c9150ef6f3d356f8c75860a085d508a (patch)
tree5070270ad34ac2dc7ae6a7cde8eacb6128e5488f
parentcbe0a27bbf33c03fc8b30404d9ecdf872ee94183 (diff)
downloadqt3-b8ca17c69c9150ef6f3d356f8c75860a085d508a.tar.gz
qt3-b8ca17c69c9150ef6f3d356f8c75860a085d508a.zip
Verify desktop widget screen number before applying size changes
This resolves Bug 1378 (cherry picked from commit b85cdabf4805af35799b141cb3dd6deb411b9b47)
-rw-r--r--src/kernel/qapplication_x11.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp
index 203cb39..4a03d95 100644
--- a/src/kernel/qapplication_x11.cpp
+++ b/src/kernel/qapplication_x11.cpp
@@ -3446,13 +3446,26 @@ int QApplication::x11ProcessEvent( XEvent* event )
// update the size for desktop widget
int scr = XRRRootToScreen( appDpy, event->xany.window );
QWidget *w = desktop()->screen( scr );
- QSize oldSize( w->size() );
- w->crect.setWidth( DisplayWidth( appDpy, scr ) );
- w->crect.setHeight( DisplayHeight( appDpy, scr ) );
- if ( w->size() != oldSize ) {
- QResizeEvent e( w->size(), oldSize );
- QApplication::sendEvent( w, &e );
- emit desktop()->resized( scr );
+
+ if (w) {
+ int widgetScr = -1;
+ // make sure the specified widget is on the same screen that received the XRandR event
+ XWindowAttributes widgetAttr;
+ XGetWindowAttributes(appDpy, w->winId(), &widgetAttr);
+ if (widgetAttr.screen) {
+ widgetScr = XScreenNumberOfScreen(widgetAttr.screen);
+ }
+
+ if ((widgetScr < 0) || (widgetScr == scr)) {
+ QSize oldSize( w->size() );
+ w->crect.setWidth( DisplayWidth( appDpy, scr ) );
+ w->crect.setHeight( DisplayHeight( appDpy, scr ) );
+ if ( w->size() != oldSize ) {
+ QResizeEvent e( w->size(), oldSize );
+ QApplication::sendEvent( w, &e );
+ emit desktop()->resized( scr );
+ }
+ }
}
}
#endif // QT_NO_XRANDR