Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/kernel/qdesktopwidget_x11.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    198198    if (screens) {
    199199        // leaks QWidget* pointers on purpose, can't delete them as pointer escapes
    200         screens = (QWidget**) realloc(screens, j * sizeof(QWidget*));
     200        screens = q_check_ptr((QWidget**) realloc(screens, j * sizeof(QWidget*)));
    201201        if (j > screenCount)
    202202            memset(&screens[screenCount], 0, (j-screenCount) * sizeof(QWidget*));
     
    286286        return d->workareas[screen];
    287287
    288     if ((d->screenCount == 1 || !isVirtualDesktop())
    289         && X11->isSupportedByWM(ATOM(_NET_WORKAREA))) {
     288    if (X11->isSupportedByWM(ATOM(_NET_WORKAREA))) {
     289        int x11Screen = isVirtualDesktop() ? DefaultScreen(X11->display) : screen;
     290
    290291        Atom ret;
    291292        int format, e;
     
    294295
    295296        e = XGetWindowProperty(X11->display,
    296                                 QX11Info::appRootWindow(screen),
    297                                 ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL,
    298                                 &ret, &format, &nitems, &after, &data);
    299 
     297                               QX11Info::appRootWindow(x11Screen),
     298                               ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL,
     299                               &ret, &format, &nitems, &after, &data);
     300
     301        QRect workArea;
    300302        if (e == Success && ret == XA_CARDINAL &&
    301303            format == 32 && nitems == 4) {
    302304            long *workarea = (long *) data;
    303             d->workareas[screen].setRect(workarea[0], workarea[1],
    304                                           workarea[2], workarea[3]);
     305            workArea = QRect(workarea[0], workarea[1], workarea[2], workarea[3]);
    305306        } else {
    306             d->workareas[screen] = screenGeometry(screen);
    307         }
     307            workArea = screenGeometry(screen);
     308        }
     309
     310        if (isVirtualDesktop()) {
     311            // intersect the workarea (which spawns all Xinerama screens) with the rect for the
     312            // requested screen
     313            workArea &= screenGeometry(screen);
     314        }
     315
     316        d->workareas[screen] = workArea;
     317
    308318        if (data)
    309319            XFree(data);
     
    373383{
    374384    Q_D(QDesktopWidget);
     385    int oldScreenCount = d->screenCount;
     386    QVector<QRect> oldRects(oldScreenCount);
     387    for (int i = 0; i < oldScreenCount; ++i) {
     388        oldRects[i] = d->rects[i];
     389    }
     390
    375391    d->init();
     392
     393    for (int i = 0; i < qMin(oldScreenCount, d->screenCount); ++i) {
     394        if (oldRects.at(i) != d->rects[i])
     395            emit resized(i);
     396    }
     397
     398    if (oldScreenCount != d->screenCount) {
     399        emit screenCountChanged(d->screenCount);
     400    }
     401
    376402    qt_desktopwidget_workarea_dirty = true;
    377403    QWidget::resizeEvent(event);
Note: See TracChangeset for help on using the changeset viewer.