changeset 19535:69b134c4caea

Further fullscreen switching improvements. Fixes sub window position bug when exiting a file from fullscreen. Fixes sub window position when switching between windows and fullscreen modes.
author vayne
date Sat, 26 Aug 2006 16:52:51 +0000
parents b0a6a97e2ba0
children 7dee65ac137e
files Gui/win32/gui.c Gui/win32/interface.c
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/win32/gui.c	Sat Aug 26 09:53:06 2006 +0000
+++ b/Gui/win32/gui.c	Sat Aug 26 16:52:51 2006 +0000
@@ -309,6 +309,17 @@
     if((time - oldtime) < 100) return;
     oldtime=time;
 
+    /* suppress directx's fullscreen window when using the sub window */
+    if(sub_window && &video_driver_list[0] && strstr("directx", video_driver_list[0]))
+    {
+        HWND hWndFS = NULL; //handle to directx's fullscreen window
+        if(hWndFS == NULL)
+        {
+            hWndFS = FindWindow(NULL, "MPlayer Fullscreen");
+            if(hWndFS != NULL) DestroyWindow(hWndFS); //sub window handles fullscreen
+        }
+    }
+
     for (i=0; i<gui->window_priv_count; i++)
     {
         if(gui->window_priv[i]->hwnd == hwnd)
--- a/Gui/win32/interface.c	Sat Aug 26 09:53:06 2006 +0000
+++ b/Gui/win32/interface.c	Sat Aug 26 16:52:51 2006 +0000
@@ -68,6 +68,7 @@
 static gui_t *mygui = NULL;
 static int update_subwindow(void);
 static RECT old_rect;
+static DWORD style;
 
 /* test for playlist files, no need to specify -playlist on the commandline.
  * add any conceivable playlist extensions here.
@@ -404,6 +405,11 @@
         mygui->playlist->current = 0;
 
     fullscreen = 0;
+    if(style == WS_VISIBLE | WS_POPUP)
+    {
+        style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
+        SetWindowLong(mygui->subwindow, GWL_STYLE, style);
+    }
     guiGetEvent(guiCEvent, (void *) guiSetStop);
 }
 
@@ -434,9 +440,6 @@
        gtkAutoSync = autosync;
     }
 
-    old_rect.left = gui_sub_pos_x;
-    old_rect.top = gui_sub_pos_y;
-
     while(mygui)
     {
         GetMessage(&msg, NULL, 0, 0);
@@ -670,9 +673,6 @@
                 case guiSetPlay:
                 {
                     guiIntfStruct.Playing = 1;
-                    if(guiIntfStruct.sh_video && !IsIconic(mygui->subwindow)
-                       && IsWindowVisible(mygui->subwindow) && !fullscreen)
-                        GetWindowRect(mygui->subwindow, &old_rect);
                     break;
                 }
                 case guiSetStop:
@@ -697,10 +697,6 @@
             {
                 case MP_CMD_GUI_FULLSCREEN:
                 {
-                    DWORD style;
-                    /* vo_directx's fullscreen window */
-                    HWND hWndFS = FindWindow(NULL, "MPlayer Fullscreen");
-
                     if(!guiIntfStruct.sh_video) break;
 
                     if(!sub_window)
@@ -719,7 +715,6 @@
                     } else {
                         fullscreen = 1;
                         style = WS_VISIBLE | WS_POPUP;
-                        if(hWndFS) DestroyWindow(hWndFS);
                     }
                     SetWindowLong(mygui->subwindow, GWL_STYLE, style);
                     mpcodecs_config_vo(guiIntfStruct.sh_video, guiIntfStruct.MovieWidth,
@@ -944,14 +939,15 @@
         ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
 
     /* get our current window coordinates */
-    if(fullscreen)
-        GetWindowRect(mygui->subwindow, &rd);
-    else
-        CopyRect(&rd, &old_rect);
+    GetWindowRect(mygui->subwindow, &rd);
 
     x = rd.left;
     y = rd.top;
 
+    /* restore sub window position when coming out of fullscreen */
+    if(x <= 0) x = old_rect.left;
+    if(y <= 0) y = old_rect.top;
+
     if(!guiIntfStruct.Playing)
     {
         window *desc = NULL;