Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> Yes. I am going to delay the redraw until the next cursor
Abdelrazak> blink happens. This way all the asked screen updates that
Abdelrazak> happens between two cursor blinks will be unified in a
Abdelrazak> single redraw.

Looks like a nice solution. Are we sure that the cursor always blinks?

It blinks for sure only for the active view. We need to find a solution for the other views. In the mean time, this commit is fixing bug 3099. The renderPreview needs some cleanup because the signal is send but we don't know from which buffer. Because of that, we cannot distinguish between necessary redraws or not. Also, even if ths is the current buffer, a redraw will happen even if this inset is not visible on screen...

Abdel.


Author: younes
Date: Tue Jan 16 16:16:09 2007
New Revision: 16708

URL: http://www.lyx.org/trac/changeset/16708
Log:
* LyXView::updateInset(): schedule a redraw instead of redraw immediately.

* WorkArea::sheduleRedraw(): new pure virtual method.

* GuiWorkArea::showCursor(): handle the scheduled redraw.

Modified:
    lyx-devel/trunk/src/frontends/LyXView.C
    lyx-devel/trunk/src/frontends/WorkArea.h
    lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.C
    lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.h

Modified: lyx-devel/trunk/src/frontends/LyXView.C
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/LyXView.C?rev=16708
==============================================================================
--- lyx-devel/trunk/src/frontends/LyXView.C (original)
+++ lyx-devel/trunk/src/frontends/LyXView.C Tue Jan 16 16:16:09 2007
@@ -431,11 +431,10 @@
 {
        Buffer const * buffer_ptr = 0;
        if (inset) {
+               BOOST_ASSERT(work_area_);
+               work_area_->sheduleRedraw();
+
                buffer_ptr = work_area_->bufferView().buffer();
-               // No FitCursor:
-               BOOST_ASSERT(work_area_);
-               work_area_->bufferView().update(Update::Force);
-               work_area_->redraw();
        }
        return buffer_ptr;
 }

Modified: lyx-devel/trunk/src/frontends/WorkArea.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/WorkArea.h?rev=16708
==============================================================================
--- lyx-devel/trunk/src/frontends/WorkArea.h (original)
+++ lyx-devel/trunk/src/frontends/WorkArea.h Tue Jan 16 16:16:09 2007
@@ -82,6 +82,9 @@
         */
virtual void setScrollbarParams(int height, int pos, int line_height) = 0;

+       ///
+       virtual void sheduleRedraw() = 0;
+
        /// redraw the screen, without using existing pixmap
        virtual void redraw();
        ///

Modified: lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.C
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.C?rev=16708
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.C (original)
+++ lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.C Tue Jan 16 16:16:09 2007
@@ -159,7 +159,7 @@


 GuiWorkArea::GuiWorkArea(int w, int h, int id, LyXView & lyx_view)
-       : WorkArea(id, lyx_view), need_resize_(false)
+       : WorkArea(id, lyx_view), need_resize_(false), shedule_redraw_(false)
 {
        cursor_ = new frontend::CursorWidget();
        cursor_->hide();
@@ -535,6 +535,19 @@

 void GuiWorkArea::showCursor(int x, int y, int h, CursorShape shape)
 {
+       if (shedule_redraw_) {
+               if (buffer_view_ && buffer_view_->buffer()) {
+                       buffer_view_->update(Update::Force);
+                       updateScreen();
+ viewport()->update(QRect(0, 0, viewport()->width(), viewport()->height()));
+               }
+               shedule_redraw_ = false;
+               // Show the cursor immediately after the update.
+               hideCursor();
+               toggleCursor();
+               return;
+       }
+
        cursor_->update(x, y, h, shape);
        cursor_->show();
        viewport()->update(cursor_->rect());

Modified: lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.h?rev=16708
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.h (original)
+++ lyx-devel/trunk/src/frontends/qt4/GuiWorkArea.h Tue Jan 16 16:16:09 2007
@@ -103,6 +103,8 @@
        virtual int height() const { return viewport()->height(); }
        ///
        virtual void setScrollbarParams(int height, int pos, int line_height);
+       ///
+       virtual void sheduleRedraw() { shedule_redraw_ = true; }

        /// update the passed area.
        void update(int x, int y, int w, int h);
@@ -171,6 +173,8 @@
        QPixmap screen_;
        ///
        bool need_resize_;
+       ///
+       bool shedule_redraw_;
 };

 } // namespace frontend



Reply via email to