Index: /trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h	(revision 22845)
+++ /trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h	(revision 22846)
@@ -431,5 +431,5 @@
     void updatedMem(const QRect * aRect);
 
-    void performDisplay(VBoxVHWASurfaceBase *pPrimary);
+    bool performDisplay(VBoxVHWASurfaceBase *pPrimary, bool bForce);
 
     void setRects(VBoxVHWASurfaceBase *pPrimary, const QRect & aTargRect, const QRect & aSrcRect, const QRect & aVisibleTargRect, bool bForceReinit);
@@ -583,5 +583,5 @@
     GLuint createDisplay(VBoxVHWASurfaceBase *pPrimary);
     void doDisplay(VBoxVHWASurfaceBase *pPrimary, VBoxVHWAGlProgramVHWA * pProgram, bool bBindDst);
-    void synchTexMem(const QRect * aRect);
+    bool synchTexMem(const QRect * aRect);
 
     int performBlt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrcSurface, const QRect * pSrcRect, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool blt);
@@ -772,8 +772,8 @@
     }
 
-    void performDisplay()
+    bool performDisplay(bool bForce)
     {
         VBoxVHWASurfaceBase * pPrimary = mPrimary.current();
-        pPrimary->performDisplay(NULL);
+        bForce |= pPrimary->performDisplay(NULL, bForce);
 
         for (OverlayList::const_iterator it = mOverlays.begin();
@@ -783,7 +783,8 @@
             if(pOverlay)
             {
-                pOverlay->performDisplay(pPrimary);
+                bForce |= pOverlay->performDisplay(pPrimary, bForce);
             }
         }
+        return bForce;
     }
 
@@ -1061,5 +1062,5 @@
     const QRect & vboxViewport() const {return mViewport;}
 
-    void performDisplay() { mDisplay.performDisplay(); }
+    bool performDisplay(bool bForce) { return mDisplay.performDisplay(bForce); }
 protected:
 
@@ -1073,5 +1074,5 @@
 //        else
 //        {
-            mDisplay.performDisplay();
+            mDisplay.performDisplay(true);
 //        }
     }
@@ -1165,10 +1166,10 @@
 
 
-typedef enum
-{
-    VBOXFBOVERLAY_DONE = 1,
-    VBOXFBOVERLAY_MODIFIED,
-    VBOXFBOVERLAY_UNTOUCHED
-} VBOXFBOVERLAY_RESUT;
+//typedef enum
+//{
+//    VBOXFBOVERLAY_DONE = 1,
+//    VBOXFBOVERLAY_MODIFIED,
+//    VBOXFBOVERLAY_UNTOUCHED
+//} VBOXFBOVERLAY_RESUT;
 
 class VBoxQGLOverlay
@@ -1201,9 +1202,10 @@
     }
 
-    VBOXFBOVERLAY_RESUT onPaintEvent (const QPaintEvent *pe, QRect *pRect);
+//    VBOXFBOVERLAY_RESUT onPaintEvent (const QPaintEvent *pe, QRect *pRect);
+
     void onResizeEvent (const class VBoxResizeEvent *re);
     void onResizeEventPostprocess (const class VBoxResizeEvent *re);
 
-    void viewportResized(QResizeEvent * re)
+    void onViewportResized(QResizeEvent * re)
     {
         vboxDoCheckUpdateViewport();
@@ -1211,5 +1213,5 @@
     }
 
-    void viewportScrolled(int dx, int dy)
+    void onViewportScrolled(int dx, int dy)
     {
         vboxDoCheckUpdateViewport();
@@ -1257,5 +1259,5 @@
 #else
             makeCurrent();
-            mpOverlayWidget->performDisplay();
+            mpOverlayWidget->performDisplay(false);
             mpOverlayWidget->swapBuffers();
 #endif
@@ -1350,22 +1352,22 @@
     }
 
-    void paintEvent (QPaintEvent *pe)
-    {
-        QRect rect;
-        VBOXFBOVERLAY_RESUT res = mOverlay.onPaintEvent(pe, &rect);
-        switch(res)
-        {
-            case VBOXFBOVERLAY_MODIFIED:
-            {
-                QPaintEvent modified(rect);
-                T::paintEvent(&modified);
-            } break;
-            case VBOXFBOVERLAY_UNTOUCHED:
-                T::paintEvent(pe);
-                break;
-            default:
-                break;
-        }
-    }
+//    void paintEvent (QPaintEvent *pe)
+//    {
+//        QRect rect;
+//        VBOXFBOVERLAY_RESUT res = mOverlay.onPaintEvent(pe, &rect);
+//        switch(res)
+//        {
+//            case VBOXFBOVERLAY_MODIFIED:
+//            {
+//                QPaintEvent modified(rect);
+//                T::paintEvent(&modified);
+//            } break;
+//            case VBOXFBOVERLAY_UNTOUCHED:
+//                T::paintEvent(pe);
+//                break;
+//            default:
+//                break;
+//        }
+//    }
 
     void resizeEvent (VBoxResizeEvent *re)
@@ -1378,5 +1380,5 @@
     void viewportResized(QResizeEvent * re)
     {
-        mOverlay.viewportResized(re);
+        mOverlay.onViewportResized(re);
         T::viewportResized(re);
     }
@@ -1384,5 +1386,5 @@
     void viewportScrolled(int dx, int dy)
     {
-        mOverlay.viewportScrolled(dx, dy);
+        mOverlay.onViewportScrolled(dx, dy);
         T::viewportScrolled(dx, dy);
     }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 22845)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp	(revision 22846)
@@ -2147,5 +2147,5 @@
 GLenum VBoxVHWATextureNP2Rect::texTarget() {return GL_TEXTURE_RECTANGLE; }
 
-void VBoxVHWASurfaceBase::synchTexMem(const QRect * pRect)
+bool VBoxVHWASurfaceBase::synchTexMem(const QRect * pRect)
 {
     if(pRect)
@@ -2155,8 +2155,8 @@
 
     if(mUpdateMem2TexRect.isClear())
-        return;
+        return false;
 
     if(pRect && !mUpdateMem2TexRect.rect().intersects(*pRect))
-        return;
+        return false;
 
     mpTex[0]->update(&mUpdateMem2TexRect.rect());
@@ -2179,4 +2179,5 @@
 //    VBOXPRINTDIF(dbgTime, ("texMem:"));
 //#endif
+    return true;
 }
 
@@ -2870,5 +2871,5 @@
 //}
 
-void VBoxVHWASurfaceBase::performDisplay(VBoxVHWASurfaceBase *pPrimary)
+bool VBoxVHWASurfaceBase::performDisplay(VBoxVHWASurfaceBase *pPrimary, bool bForce)
 {
     Assert(mVisibleDisplayInitialized);
@@ -2879,5 +2880,5 @@
         Assert(mVisibleSrcRect.isEmpty());
         Assert(mVisibleTargRect.isEmpty());
-        return;
+        return false;
     }
     else
@@ -2887,9 +2888,12 @@
     }
 
-    synchTexMem(&mVisibleSrcRect);
+    bForce |= synchTexMem(&mVisibleSrcRect);
     if(pPrimary && getActiveDstOverlayCKey(pPrimary))
     {
-        pPrimary->synchTexMem(&mVisibleTargRect);
-    }
+        bForce |= pPrimary->synchTexMem(&mVisibleTargRect);
+    }
+
+    if(!bForce)
+        return false;
 
 #ifdef DEBUG_misha
@@ -2924,4 +2928,7 @@
                 );
     }
+
+    Assert(bForce);
+    return true;
 }
 
@@ -5165,17 +5172,17 @@
 }
 
-VBOXFBOVERLAY_RESUT VBoxQGLOverlay::onPaintEvent (const QPaintEvent *pe, QRect *pRect)
-{
-    Q_UNUSED(pe);
-    Q_UNUSED(pRect);
-
-//    if(mOverlayWidgetVisible && !mProcessingCommands)
-//    {
-//        Assert(!mGlCurrent);
-//        vboxDoCheckUpdateViewport();
-//        vboxOpExit();
-//    }
-    return VBOXFBOVERLAY_UNTOUCHED;
-}
+//VBOXFBOVERLAY_RESUT VBoxQGLOverlay::onPaintEvent (const QPaintEvent *pe, QRect *pRect)
+//{
+//    Q_UNUSED(pe);
+//    Q_UNUSED(pRect);
+//
+////    if(mOverlayWidgetVisible && !mProcessingCommands)
+////    {
+////        Assert(!mGlCurrent);
+////        vboxDoCheckUpdateViewport();
+////        vboxOpExit();
+////    }
+//    return VBOXFBOVERLAY_UNTOUCHED;
+//}
 
 void VBoxQGLOverlay::onResizeEvent (const VBoxResizeEvent *re)
@@ -5391,8 +5398,5 @@
     {
         mpOverlayWidget->vboxDoUpdateRect(&aRect);
-        if(aRect.intersects(mpOverlayWidget->vboxViewport()))
-        {
-            mNeedOverlayRepaint = true;
-        }
+        mNeedOverlayRepaint = true;
     }
 }
@@ -5403,4 +5407,5 @@
     VBoxVHWASurfaceBase * pVGA = mpOverlayWidget->vboxGetVGASurface();
     const VBoxVHWADirtyRect & rect = pVGA->getDirtyRect();
+    mNeedOverlayRepaint = true;
     if(!rect.isClear())
     {
@@ -5438,4 +5443,5 @@
                 }
                 vboxDoCheckUpdateViewport();
+                mNeedOverlayRepaint = true;
             }
         } break;
@@ -5456,4 +5462,5 @@
                 }
                 vboxDoCheckUpdateViewport();
+                mNeedOverlayRepaint = true;
             }
         } break;
@@ -5472,4 +5479,5 @@
             VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT);
             pCmd->rc = mpOverlayWidget->vhwaSurfaceBlt(pBody);
+            mNeedOverlayRepaint = true;
         } break;
         case VBOXVHWACMD_TYPE_SURF_FLIP:
@@ -5489,4 +5497,5 @@
             }
             vboxDoCheckUpdateViewport();
+            mNeedOverlayRepaint = true;
         } break;
         case VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION:
@@ -5500,4 +5509,5 @@
             }
             vboxDoCheckUpdateViewport();
+            mNeedOverlayRepaint = true;
         } break;
         case VBOXVHWACMD_TYPE_SURF_COLORKEY_SET:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp	(revision 22845)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp	(revision 22846)
@@ -130,5 +130,5 @@
     }
 
-    pw->performDisplay();
+    pw->performDisplay(true);
 
     pw->swapBuffers();
