Fix xrandr resize event failing on some systems

(cherry picked from commit 6ff026570d)
v3.5.13-sru
Timothy Pearson 12 years ago committed by Slávek Banko
parent 55af72cf2c
commit 34681cac0d

@ -3436,6 +3436,27 @@ int QApplication::x11ProcessEvent( XEvent* event )
return 0;
}
#ifndef QT_NO_XRANDR
// XRandR doesn't care if Qt doesn't know about the widget, so handle XRandR stuff before the !widget check below
if (event->type == xrandr_eventbase + RRScreenChangeNotify
|| ( event->type == ConfigureNotify && event->xconfigure.window == QPaintDevice::x11AppRootWindow())) {
// update Xlib internals with the latest screen configuration
XRRUpdateConfiguration(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 );
}
}
#endif // QT_NO_XRANDR
if ( !widget ) { // don't know this windows
QWidget* popup = QApplication::activePopupWidget();
if ( popup ) {
@ -3486,26 +3507,6 @@ int QApplication::x11ProcessEvent( XEvent* event )
}
#endif
#ifndef QT_NO_XRANDR
if (event->type == xrandr_eventbase + RRScreenChangeNotify
|| ( event->type == ConfigureNotify && event->xconfigure.window == QPaintDevice::x11AppRootWindow())) {
// update Xlib internals with the latest screen configuration
XRRUpdateConfiguration(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 );
}
}
#endif // QT_NO_XRANDR
switch ( event->type ) {
case ButtonRelease: // mouse event

Loading…
Cancel
Save