changeset 31125:ff79dd5474f8

Handle -wid Window being closed for direct3d and gl vos on Windows.
author reimar
date Wed, 19 May 2010 17:53:47 +0000
parents b11e3ae960ac
children 2fef741f9ecc
files libvo/w32_common.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/w32_common.c	Wed May 19 13:31:11 2010 +0000
+++ b/libvo/w32_common.c	Wed May 19 17:53:47 2010 +0000
@@ -200,15 +200,19 @@
         DispatchMessage(&msg);
     }
     if (WinID >= 0) {
+        BOOL res;
         RECT r;
-        GetClientRect(vo_window, &r);
-        if (r.right != vo_dwidth || r.bottom != vo_dheight) {
+        res = GetClientRect(vo_window, &r);
+        if (res && (r.right != vo_dwidth || r.bottom != vo_dheight)) {
             vo_dwidth = r.right; vo_dheight = r.bottom;
             event_flags |= VO_EVENT_RESIZE;
         }
-        GetClientRect(WinID, &r);
-        if (r.right != vo_dwidth || r.bottom != vo_dheight)
+        res = GetClientRect(WinID, &r);
+        if (res && (r.right != vo_dwidth || r.bottom != vo_dheight))
             MoveWindow(vo_window, 0, 0, r.right, r.bottom, FALSE);
+        if (!IsWindow(WinID))
+            // Window has probably been closed, e.g. due to program crash
+            mplayer_put_key(KEY_CLOSE_WIN);
     }
 
     return event_flags;