equal
deleted
inserted
replaced
63 |
63 |
64 #include "qabstracteventdispatcher.h" |
64 #include "qabstracteventdispatcher.h" |
65 #include "qapplication.h" |
65 #include "qapplication.h" |
66 #include "qdesktopwidget.h" |
66 #include "qdesktopwidget.h" |
67 #include "qbitmap.h" |
67 #include "qbitmap.h" |
68 #include "qdatetime.h" |
|
69 #include "qiodevice.h" |
68 #include "qiodevice.h" |
70 #include "qbuffer.h" |
69 #include "qbuffer.h" |
71 #include "qtextcodec.h" |
70 #include "qtextcodec.h" |
72 #include "qlist.h" |
71 #include "qlist.h" |
73 #include "qmap.h" |
72 #include "qmap.h" |
74 #include "qapplication_p.h" |
73 #include "qapplication_p.h" |
75 #include "qevent.h" |
74 #include "qevent.h" |
76 #include "qt_x11_p.h" |
75 #include "qt_x11_p.h" |
77 #include "qx11info_x11.h" |
76 #include "qx11info_x11.h" |
78 #include "qimagewriter.h" |
77 #include "qimagewriter.h" |
|
78 #include "qelapsedtimer.h" |
79 #include "qvariant.h" |
79 #include "qvariant.h" |
80 #include "qdnd_p.h" |
80 #include "qdnd_p.h" |
81 #include <private/qwidget_p.h> |
81 #include <private/qwidget_p.h> |
82 |
82 |
83 #ifndef QT_NO_XFIXES |
83 #ifndef QT_NO_XFIXES |
514 || e->xselectionclear.selection == ATOM(CLIPBOARD)))); |
514 || e->xselectionclear.selection == ATOM(CLIPBOARD)))); |
515 } |
515 } |
516 |
516 |
517 bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout) |
517 bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout) |
518 { |
518 { |
519 QTime started = QTime::currentTime(); |
519 QElapsedTimer started; |
520 QTime now = started; |
520 started.start(); |
|
521 QElapsedTimer now = started; |
521 |
522 |
522 if (QAbstractEventDispatcher::instance()->inherits("QtMotif") |
523 if (QAbstractEventDispatcher::instance()->inherits("QtMotif") |
523 || QApplication::clipboard()->property("useEventLoopWhenWaiting").toBool()) { |
524 || QApplication::clipboard()->property("useEventLoopWhenWaiting").toBool()) { |
524 if (waiting_for_data) { |
525 if (waiting_for_data) { |
525 Q_ASSERT(!"QClipboard: internal error, qt_xclb_wait_for_event recursed"); |
526 Q_ASSERT(!"QClipboard: internal error, qt_xclb_wait_for_event recursed"); |
543 } |
544 } |
544 |
545 |
545 XSync(X11->display, false); |
546 XSync(X11->display, false); |
546 usleep(50000); |
547 usleep(50000); |
547 |
548 |
548 now = QTime::currentTime(); |
549 now.start(); |
549 if (started > now) // crossed midnight |
|
550 started = now; |
|
551 |
550 |
552 QEventLoop::ProcessEventsFlags flags(QEventLoop::ExcludeUserInputEvents |
551 QEventLoop::ProcessEventsFlags flags(QEventLoop::ExcludeUserInputEvents |
553 | QEventLoop::ExcludeSocketNotifiers |
552 | QEventLoop::ExcludeSocketNotifiers |
554 | QEventLoop::WaitForMoreEvents |
553 | QEventLoop::WaitForMoreEvents |
555 | QEventLoop::X11ExcludeTimers); |
554 | QEventLoop::X11ExcludeTimers); |
574 // process other clipboard events, since someone is probably requesting data from us |
573 // process other clipboard events, since someone is probably requesting data from us |
575 XEvent e; |
574 XEvent e; |
576 if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0)) |
575 if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0)) |
577 qApp->x11ProcessEvent(&e); |
576 qApp->x11ProcessEvent(&e); |
578 |
577 |
579 now = QTime::currentTime(); |
578 now.start(); |
580 if ( started > now ) // crossed midnight |
|
581 started = now; |
|
582 |
579 |
583 XFlush(X11->display); |
580 XFlush(X11->display); |
584 |
581 |
585 // sleep 50 ms, so we don't use up CPU cycles all the time. |
582 // sleep 50 ms, so we don't use up CPU cycles all the time. |
586 struct timeval usleep_tv; |
583 struct timeval usleep_tv; |