Verify desktop widget screen number before applying size changes

This resolves Bug 1378
pull/2/head
Timothy Pearson 12 years ago
parent f19aa203c9
commit b85cdabf48

@ -3472,13 +3472,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

Loading…
Cancel
Save