From 07d10b57b72e366cc793302d8209752927311eec Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 12 Feb 2013 18:15:36 -0600 Subject: Automated update from Qt3 --- src/kernel/qeventloop_glib_p.h | 3 +++ src/kernel/qeventloop_x11_glib.cpp | 32 ++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/qeventloop_glib_p.h b/src/kernel/qeventloop_glib_p.h index 537406854..7c459ef88 100644 --- a/src/kernel/qeventloop_glib_p.h +++ b/src/kernel/qeventloop_glib_p.h @@ -100,6 +100,8 @@ public: exitloop = FALSE; shortcut = FALSE; singletoolkit = TRUE; + ctx = 0; + ctx_is_default = false; } int looplevel; @@ -129,6 +131,7 @@ public: // main context GMainContext *ctx; + bool ctx_is_default; }; #endif // TQEVENTLOOP_GLIB_P_H diff --git a/src/kernel/qeventloop_x11_glib.cpp b/src/kernel/qeventloop_x11_glib.cpp index 40205f805..7106bf4e6 100644 --- a/src/kernel/qeventloop_x11_glib.cpp +++ b/src/kernel/qeventloop_x11_glib.cpp @@ -79,8 +79,7 @@ static GSourceFuncs qt_gsource_funcs = { // forward main loop callbacks to TQEventLoop methods! -static gboolean qt_gsource_prepare ( GSource *source, - gint *timeout ) +static gboolean qt_gsource_prepare ( GSource *source, gint *timeout ) { TQtGSource * qtGSource = (TQtGSource*) source; TQEventLoop* candidateEventLoop = qtGSource->qeventLoop; @@ -95,7 +94,7 @@ static gboolean qt_gsource_prepare ( GSource *source, } } -static gboolean qt_gsource_check ( GSource *source ) +static gboolean qt_gsource_check ( GSource *source ) { TQtGSource * qtGSource = (TQtGSource*) source; TQEventLoop* candidateEventLoop = qtGSource->qeventLoop; @@ -110,8 +109,7 @@ static gboolean qt_gsource_check ( GSource *source ) } } -static gboolean qt_gsource_dispatch ( GSource *source, - GSourceFunc callback, gpointer user_data ) +static gboolean qt_gsource_dispatch ( GSource *source, GSourceFunc callback, gpointer user_data ) { Q_UNUSED(callback); Q_UNUSED(user_data); @@ -215,6 +213,7 @@ void TQEventLoop::init() // new main context for thread d->ctx = g_main_context_new(); g_main_context_push_thread_default(d->ctx); + d->ctx_is_default = true; // new GSource TQtGSource * qtGSource = (TQtGSource*) g_source_new(&qt_gsource_funcs, sizeof(TQtGSource)); @@ -241,9 +240,9 @@ void TQEventLoop::init() d->threadPipe_gPollFD.fd = d->thread_pipe[0]; d->threadPipe_gPollFD.events = G_IO_IN | G_IO_HUP | G_IO_ERR; - g_source_add_poll(d->gSource, &d->threadPipe_gPollFD); + g_source_add_poll(d->gSource, &d->threadPipe_gPollFD); -#ifdef DEBUG_QT_GLIBMAINLOOP +#ifdef DEBUG_QT_GLIBMAINLOOP printf("inside init(2)\n"); #endif @@ -375,7 +374,7 @@ bool TQEventLoop::processX11Events() } -bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) +bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) { Q_UNUSED(gs); @@ -428,7 +427,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) #ifdef DEBUG_QT_GLIBMAINLOOP printf("inside gsourcePrepare(2) canwait=%d\n", canWait); -#endif +#endif if ( canWait ) { emit aboutToBlock(); @@ -440,7 +439,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) (**it)(); } -#ifdef DEBUG_QT_GLIBMAINLOOP +#ifdef DEBUG_QT_GLIBMAINLOOP printf("inside gsourcePrepare(2.1) canwait=%d\n", canWait); #endif @@ -649,4 +648,17 @@ void TQEventLoop::appClosingDown() void TQEventLoop::setSingleToolkitEventHandling(bool enabled) { d->singletoolkit = enabled; + + if (!d->singletoolkit) { + if (d->ctx_is_default) { + d->ctx_is_default = false; + g_main_context_pop_thread_default(d->ctx); + } + } + else { + if (!d->ctx_is_default) { + g_main_context_push_thread_default(d->ctx); + d->ctx_is_default = true; + } + } } \ No newline at end of file -- cgit v1.2.3 From f49d7e22b58dd3a6b9f1d5f8c87df80c6751eb8c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 13 Feb 2013 20:35:40 -0600 Subject: Automated update from Qt3 --- src/kernel/qeventloop_glib_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/qeventloop_glib_p.h b/src/kernel/qeventloop_glib_p.h index 7c459ef88..225054bf2 100644 --- a/src/kernel/qeventloop_glib_p.h +++ b/src/kernel/qeventloop_glib_p.h @@ -90,6 +90,9 @@ public: xfd = -1; x_gPollFD.fd = -1; #endif // Q_WS_X11 + singletoolkit = TRUE; + ctx = 0; + ctx_is_default = false; reset(); } @@ -99,11 +102,8 @@ public: quitnow = FALSE; exitloop = FALSE; shortcut = FALSE; - singletoolkit = TRUE; - ctx = 0; - ctx_is_default = false; } - + int looplevel; int quitcode; unsigned int quitnow : 1; -- cgit v1.2.3 From cff522f98666e1bf24c36a3a0a2abe3fb2e1abe8 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 18 Feb 2013 20:37:37 -0600 Subject: Automated update from Qt3 --- src/iconview/ntqiconview.h | 1 + src/iconview/qiconview.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++- src/kernel/qapplication.cpp | 2 +- src/kernel/qprocess_unix.cpp | 2 +- 4 files changed, 49 insertions(+), 3 deletions(-) (limited to 'src/kernel') diff --git a/src/iconview/ntqiconview.h b/src/iconview/ntqiconview.h index bda8273f4..e45cfca65 100644 --- a/src/iconview/ntqiconview.h +++ b/src/iconview/ntqiconview.h @@ -452,6 +452,7 @@ protected: void contentsDropEvent( TQDropEvent *e ); #endif + void bufferedPaintEvent( TQPaintEvent* ); void resizeEvent( TQResizeEvent* e ); void keyPressEvent( TQKeyEvent *e ); void focusInEvent( TQFocusEvent *e ); diff --git a/src/iconview/qiconview.cpp b/src/iconview/qiconview.cpp index ee4a0fe36..dbf764a0f 100644 --- a/src/iconview/qiconview.cpp +++ b/src/iconview/qiconview.cpp @@ -214,6 +214,7 @@ public: TQIconViewItem *currentItem, *tmpCurrentItem, *highlightedItem, *startDragItem, *pressedItem, *selectAnchor, *renamingItem; TQRect *rubber; + TQPixmap *backBuffer; TQTimer *scrollTimer, *adjustTimer, *updateTimer, *inputTimer, *fullRedrawTimer; int rastX, rastY, spacing; @@ -2800,6 +2801,7 @@ TQIconView::TQIconView( TQWidget *parent, const char *name, WFlags f ) d->currentItem = 0; d->highlightedItem = 0; d->rubber = 0; + d->backBuffer = 0; d->scrollTimer = 0; d->startDragItem = 0; d->tmpCurrentItem = 0; @@ -2953,6 +2955,8 @@ TQIconView::~TQIconView() delete item; item = tmp; } + delete d->backBuffer; + d->backBuffer = 0; delete d->fm; d->fm = 0; #ifndef QT_NO_TOOLTIP @@ -4972,6 +4976,47 @@ void TQIconView::contentsDropEvent( TQDropEvent *e ) } #endif +/*! + This function grabs all paintevents that otherwise would have been + processed by the TQScrollView::viewportPaintEvent(). Here we use a + doublebuffer to reduce 'on-paint' flickering on TQIconView + (and of course its children). + + \sa TQScrollView::viewportPaintEvent(), TQIconView::drawContents() +*/ + +void TQIconView::bufferedPaintEvent( TQPaintEvent* pe ) +{ + TQWidget* vp = viewport(); + TQRect r = pe->rect() & vp->rect(); + int ex = r.x() + contentsX(); + int ey = r.y() + contentsY(); + int ew = r.width(); + int eh = r.height(); + + if ( !d->backBuffer ) + d->backBuffer = new TQPixmap(vp->size()); + if ( d->backBuffer->size() != vp->size() ) { + // Resize function (with hysteresis). Uses a good compromise between memory + // consumption and speed (number) of resizes. + float newWidth = (float)vp->width(); + float newHeight = (float)vp->height(); + if ( newWidth > d->backBuffer->width() || newHeight > d->backBuffer->height() ) + { + newWidth *= 1.1892; + newHeight *= 1.1892; + d->backBuffer->resize( (int)newWidth, (int)newHeight ); + } else if ( 1.5*newWidth < d->backBuffer->width() || 1.5*newHeight < d->backBuffer->height() ) + d->backBuffer->resize( (int)newWidth, (int)newHeight ); + } + + TQPainter p; + p.begin(d->backBuffer, vp); + drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh); + p.end(); + bitBlt(vp, r.x(), r.y(), d->backBuffer, r.x(), r.y(), ew, eh); +} + /*! \reimp */ @@ -5756,7 +5801,7 @@ bool TQIconView::eventFilter( TQObject * o, TQEvent * e ) if ( !d->rubber ) drawDragShapes( d->oldDragPos ); } - viewportPaintEvent( (TQPaintEvent*)e ); + bufferedPaintEvent( (TQPaintEvent*)e ); if ( d->dragging ) { if ( !d->rubber ) drawDragShapes( d->oldDragPos ); diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index 7aefd35b8..76b265926 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -545,7 +545,7 @@ public: TQThreadInstance::setCurrentThread(this); // thread should be running and not finished for the lifetime - // of the application (even if QCoreApplication goes away) + // of the application (even if TQCoreApplication goes away) d->running = true; d->finished = false; d->eventLoop = NULL; diff --git a/src/kernel/qprocess_unix.cpp b/src/kernel/qprocess_unix.cpp index a18672473..39027459d 100644 --- a/src/kernel/qprocess_unix.cpp +++ b/src/kernel/qprocess_unix.cpp @@ -1135,7 +1135,7 @@ bool TQProcess::canReadLineStderr() const This function always returns immediately. The data you pass to writeToStdin() is copied into an internal memory buffer in TQProcess, and when control goes back to the event loop, TQProcess will - starting transferring data from this buffer to the running process. � + starting transferring data from this buffer to the running process.   Sometimes the data will be transferred in several payloads, depending on how much data is read at a time by the process itself. When TQProcess has transferred all the data from its memory buffer to the running process, it -- cgit v1.2.3 From 2d10fcbf891ee3a034f083ba67dc1a37cbeca387 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 24 Feb 2013 02:28:01 -0600 Subject: Automated update from Qt3 --- src/kernel/qapplication.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/kernel') diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index 76b265926..d67df12b0 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -2931,7 +2931,14 @@ int TQApplication::exec() */ void TQApplication::exit( int retcode ) { - tqApp->eventLoop()->exit( retcode ); + TQThread* thread = tqApp->guiThread(); + if (thread) { + if (thread->d) { + if (thread->d->eventLoop) { + thread->d->eventLoop->exit( retcode ); + } + } + } } /*! -- cgit v1.2.3