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/qclipboard_x11.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7979#include "qvariant.h"
    8080#include "qdnd_p.h"
     81
    8182
    8283#ifndef QT_NO_XFIXES
     
    132133    requestor->createWinId();
    133134    requestor->setObjectName(QLatin1String("internal clipboard requestor"));
     135
     136
     137
     138
     139
    134140    qAddPostRoutine(cleanup);
    135141}
     
    429435    // clipboard.
    430436    (void)QApplication::desktop();
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
    431451    if (X11->time == CurrentTime) {
    432452        // send a dummy event to myself to get the timestamp from X11.
     
    756776    requestor = new QWidget(0);
    757777    requestor->setObjectName(QLatin1String("internal clipboard requestor"));
     778
     779
     780
    758781
    759782    return QByteArray();
     
    774797    types.append(ATOM(MULTIPLE));
    775798    types.append(ATOM(TIMESTAMP));
     799
    776800
    777801    XChangeProperty(X11->display, window, property, XA_ATOM, 32,
     
    787811
    788812    QByteArray fmt = X11->xdndAtomToString(target);
    789     if (fmt.isEmpty() || !QInternalMimeData::hasFormatHelper(QString::fromAscii(fmt), d->source())) { // Not a MIME type we have
     813    if (fmt.isEmpty()) { // Not a MIME type we have
    790814        DEBUG("QClipboard: send_selection(): converting to type '%s' is not supported", fmt.data());
    791815        return XNone;
     
    898922    Display *dpy = X11->display;
    899923
    900     if (!xevent)
     924    if (!xevent) {
     925        // That means application exits and we need to give clipboard
     926        // content to the clipboard manager.
     927        // First we check if there is a clipboard manager.
     928        if (XGetSelectionOwner(X11->display, ATOM(CLIPBOARD_MANAGER)) == XNone
     929            || !owner)
     930            return true;
     931
     932        Window ownerId = owner->internalWinId();
     933        Q_ASSERT(ownerId);
     934        // we delete the property so the manager saves all TARGETS.
     935        XDeleteProperty(X11->display, ownerId, ATOM(_QT_SELECTION));
     936        XConvertSelection(X11->display, ATOM(CLIPBOARD_MANAGER), ATOM(SAVE_TARGETS),
     937                          ATOM(_QT_SELECTION), ownerId, X11->time);
     938        XSync(dpy, false);
     939
     940        XEvent event;
     941        // waiting until the clipboard manager fetches the content.
     942        if (!X11->clipboardWaitForEvent(ownerId, SelectionNotify, &event, 10000)) {
     943            qWarning("QClipboard: Unable to receive an event from the "
     944                     "clipboard manager in a reasonable time");
     945        }
     946
    901947        return true;
     948
    902949
    903950    switch (xevent->type) {
Note: See TracChangeset for help on using the changeset viewer.