From 49b59762a9eed8d3e34bbaf0a4209f4f0216b16e Mon Sep 17 00:00:00 2001 From: mgubi Date: Thu, 10 Dec 2009 23:16:26 +0000 Subject: [PATCH] fixes for event handling & repaint git-svn-id: svn://svn.savannah.gnu.org/texmacs/trunk@2873 64cb5145-927a-446d-8aed-2fb7b4773692 --- src/misc/bundle/TeXmacs.xcodeproj/project.pbxproj | 2 ++ src/src/Plugins/Qt/QTMWidget.cpp | 18 ++++++++++-------- src/src/Plugins/Qt/qt_gui.cpp | 13 +++++-------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/misc/bundle/TeXmacs.xcodeproj/project.pbxproj b/src/misc/bundle/TeXmacs.xcodeproj/project.pbxproj index 141e0df7..5b187d66 100644 --- a/src/misc/bundle/TeXmacs.xcodeproj/project.pbxproj +++ b/src/misc/bundle/TeXmacs.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 9C08C97610D19EB20070A0B7 /* QTMPipeLink.hpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C1D126710D102B300232476 /* QTMPipeLink.hpp */; }; 9C0B49F010A8CC110097A335 /* generic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C0B476110A8CC0F0097A335 /* generic.cpp */; }; 9C0B49F110A8CC110097A335 /* input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C0B476210A8CC0F0097A335 /* input.cpp */; }; 9C0B49F210A8CC110097A335 /* from_scheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C0B476510A8CC0F0097A335 /* from_scheme.cpp */; }; @@ -3015,6 +3016,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9C08C97610D19EB20070A0B7 /* QTMPipeLink.hpp in Sources */, 9C99F05710AD8C6100B2113D /* QTMScrollView.hpp in Sources */, 9CC614B710A99B2F0055F808 /* QTMGuiHelper.hpp in Sources */, 9CC6149010A999460055F808 /* QTMInteractiveInputHelper.hpp in Sources */, diff --git a/src/src/Plugins/Qt/QTMWidget.cpp b/src/src/Plugins/Qt/QTMWidget.cpp index e61a82f4..3e18cf36 100644 --- a/src/src/Plugins/Qt/QTMWidget.cpp +++ b/src/src/Plugins/Qt/QTMWidget.cpp @@ -256,14 +256,14 @@ QTMWidget::repaint_invalid_regions () { sz.width(),sz.height())) ; if (dy<0) - invalidate_rect(0,0,sz.width(),-dy); + invalidate_rect(0,0,sz.width(),min(sz.height(),-dy)); else if (dy>0) - invalidate_rect(0,sz.height()-dy,sz.width(),sz.height()); + invalidate_rect(0,max(0,sz.height()-dy),sz.width(),sz.height()); if (dx<0) - invalidate_rect(0,0,-dx,sz.height()); + invalidate_rect(0,0,min(-dx,sz.width()),sz.height()); else if (dx>0) - invalidate_rect(sz.width()-dx,0,sz.width(),sz.height()); + invalidate_rect(max(0,sz.width()-dx),0,sz.width(),sz.height()); // we cal update now to allow repainint of invalid regions // this cannot be done directly since interpose handler needs @@ -319,6 +319,10 @@ QTMWidget::repaint_invalid_regions () { ren->set_clipping (r->x1, r->y2, r->x2, r->y1); tm_widget()->handle_repaint (r->x1, r->y2, r->x2, r->y1); if (ren->interrupted ()) { + //cout << "interrupted repainting of " << r0 << "\n"; + //ren->set_color(green); + //ren->line(r->x1, r->y1, r->x2, r->y2); + //ren->line(r->x1, r->y2, r->x2, r->y1); invalidate_rect (r0->x1, r0->y1, r0->x2, r0->y2); } qrgn += qr; @@ -331,11 +335,9 @@ QTMWidget::repaint_invalid_regions () { } - // propagate immediatly the changes to the screen - - //backingPixmap.save("/Users/mgubi/Desktop/backingPixmap.png"); + // propagate immediatly the changes to the screen QAbstractScrollArea::viewport()->repaint(qrgn); - //QAbstractScrollArea::viewport()->update(qrgn); + } void diff --git a/src/src/Plugins/Qt/qt_gui.cpp b/src/src/Plugins/Qt/qt_gui.cpp index 077ee09b..83c869ff 100755 --- a/src/src/Plugins/Qt/qt_gui.cpp +++ b/src/src/Plugins/Qt/qt_gui.cpp @@ -623,7 +623,7 @@ qt_gui_rep::check_event (int type) { timeout_time= now + (100 / (N(waiting_events) + 1)); interrupted= (N(waiting_events) > 0); //if (interrupted) cout << "INTERRUPT " - // << texmacs_time() << "------------------" << LF; + // << now << "------------------" << LF; return interrupted; } case INTERRUPTED_EVENT: @@ -640,21 +640,17 @@ qt_gui_rep::update () { // needs_update, and ensuring that interpose_handler is run during a pass in // the eventloop afterwards we reactivate the timer with a pause // (see FIXME below) - time_t now = texmacs_time(); time_credit = 100; updating = true; updatetimer->stop(); - - int count_events = 0; int max_proc_events = 2; do { - interrupted = false; + time_t now = texmacs_time(); needing_update = false; - timeout_time = now + time_credit; count_events++; @@ -687,10 +683,11 @@ qt_gui_rep::update () { w->repaint_invalid_regions(); } + if (interrupted) needing_update = true; //cout << "AND END" << LF; } - - } while (N(waiting_events) || needing_update); + + } while ((N(waiting_events)>0) || needing_update); updating = false; -- 2.11.4.GIT