[patch] PlasmaApp::adjustSize with multiple monitors

Aike J Sommer dev at aikesommer.name
Mon Aug 25 19:36:01 CEST 2008


Am Montag 25 August 2008 15:20:14 schrieb Guillaume Pothier:
> Following up on this issue.
> The code in Qt that emits the resized signal is in
> qapplication_x11.cpp, line 2998:
>
>         int scr = XRRRootToScreen(X11->display, event->xany.window);
>         QWidget *w = desktop()->screen(scr);
>         QSize oldSize(w->size());
>         w->data->crect.setWidth(DisplayWidth(X11->display, scr));
>         w->data->crect.setHeight(DisplayHeight(X11->display, scr));
>         if (w->size() != oldSize) {
>             QResizeEvent e(w->size(), oldSize);
>             QApplication::sendEvent(w, &e);
>             emit desktop()->resized(scr);
>         }
>
> Someone knows xrandr enough to understand why XRRRootToScreen would
> always return 0?

The problem is that this is from pre-1.2 days! ;-)
In pre-1.2 xrandr there would be 1 screen per output, basically. But now that 
multiple outputs can be merged onto one framebuffer, the screen is the 
complete active area of the framebuffer and thus not the same as a screen in 
the sense of QDesktopWidget.
Xrandr in fact has no name for what we like to use as "screen", the closest 
thing is the area of the framebuffer occupied by one crtc, but there can be 
multiple crtcs on the same area!

There are also some resizes which do not even result in the signal being 
emitted.

The attached patch from some time ago fixes that, but a real fix would be to 
implement xrandr 1.2 in QDesktopWidget instead of xrandr 1.1 + xinerama!

As soon as we get my gsoc stuff in, this should be fixed, at least for plasma, 
though!
:-)


>
> Regards,
> g
>
> On Sat, Aug 23, 2008 at 8:45 PM, Guillaume Pothier <gpothier at gmail.com> 
wrote:
> > Hi,
> > This is related to http://bugs.kde.org/show_bug.cgi?id=163676
> > It seems there is indeed a problem with QDesktopWidget. When I resize
> > my external monitor, the resize signal is fired with screen=0,
> > although the screen whose size changed is screen 1. Thus adjustSize
> > doesn't adjust the size of the panel, which I put on screen 1.
> >
> > So as a workaround I wrote a hack that calls adjustSize for each
> > screen when we receive the signal. This works fine, at least on my
> > machine. The patch is attached. I'll try to have a look at
> > QDesktopWidget, but in the meantime this patch seems useful.
> >
> > Regards,
> > g
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt-copy-patch-01.diff
Type: text/x-diff
Size: 1712 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080825/8d85132e/attachment.bin 


More information about the Plasma-devel mailing list