[vlc-commits] commit: msw: remove unneeded code and useless "shaking" of window ( Erwan Tulou )

git at videolan.org git at videolan.org
Thu Jun 10 22:43:37 CEST 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jun 10 21:04:49 2010 +0200| [0a231ffaab59a0a98af8f72922cfd70bd553b26e] | committer: Erwan Tulou 

msw: remove unneeded code and useless "shaking" of window

For lack of a faster detection (based on win32 api messages),
resize/move of the parent window are detected in the Manage function
on a regular basis and acted upon if need be.

Move is an issue only for directx (surface doesn't automatically follow
the associated window). Though coordinates doesn't change, an UpdateRects
is still required to update the various rectangles used by directx.

As it was coded, everything was already taken care of.
The artificial "shaking" of the window was quite useless.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a231ffaab59a0a98af8f72922cfd70bd553b26e
---

 modules/video_output/msw/common.c |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c
index 8904179..9d607c9 100644
--- a/modules/video_output/msw/common.c
+++ b/modules/video_output/msw/common.c
@@ -161,6 +161,7 @@ void CommonManage(vout_display_t *vd)
         RECT rect_parent;
         POINT point;
 
+        /* Check if the parent window has resized or moved */
         GetClientRect(sys->hparent, &rect_parent);
         point.x = point.y = 0;
         ClientToScreen(sys->hparent, &point);
@@ -169,30 +170,25 @@ void CommonManage(vout_display_t *vd)
         if (!EqualRect(&rect_parent, &sys->rect_parent)) {
             sys->rect_parent = rect_parent;
 
-            /* FIXME I find such #ifdef quite weirds. Are they really needed ? */
-
-#if defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
+            /* This code deals with both resize and move
+             *
+             * For most drivers(direct3d, gdi, opengl), move is never
+             * an issue. The surface automatically gets moved together
+             * with the associated window (hvideownd)
+             *
+             * For directx, it is still important to call UpdateRects
+             * on a move of the parent window, even if no resize occured
+             */
             SetWindowPos(sys->hwnd, 0, 0, 0,
                          rect_parent.right - rect_parent.left,
                          rect_parent.bottom - rect_parent.top,
                          SWP_NOZORDER);
-            UpdateRects(vd, NULL, NULL, true);
-#else
-            /* This one is to force the update even if only
-             * the position has changed */
-            SetWindowPos(sys->hwnd, 0, 1, 1,
-                         rect_parent.right - rect_parent.left,
-                         rect_parent.bottom - rect_parent.top, 0);
-
-            SetWindowPos(sys->hwnd, 0, 0, 0,
-                         rect_parent.right - rect_parent.left,
-                         rect_parent.bottom - rect_parent.top, 0);
 
-#endif
+            UpdateRects(vd, NULL, NULL, true);
         }
     }
 
-    /* */
+    /* HasMoved means here resize or move */
     if (EventThreadGetAndResetHasMoved(sys->event))
         UpdateRects(vd, NULL, NULL, false);
 



More information about the vlc-commits mailing list