[MPlayer-cvslog] r19250 - in trunk/Gui/win32: gui.c interface.c

vayne subversion at mplayerhq.hu
Sat Jul 29 21:30:39 CEST 2006


Author: vayne
Date: Sat Jul 29 21:30:38 2006
New Revision: 19250

Modified:
   trunk/Gui/win32/gui.c
   trunk/Gui/win32/interface.c

Log:
improved fullscreen switching

Modified: trunk/Gui/win32/gui.c
==============================================================================
--- trunk/Gui/win32/gui.c	(original)
+++ trunk/Gui/win32/gui.c	Sat Jul 29 21:30:38 2006
@@ -64,10 +64,6 @@
 NOTIFYICONDATA nid;
 int console_state = 0;
 
-/* Sub window stuff */
-static HBRUSH    colorbrush = NULL;           //Handle to colorkey brush
-static COLORREF windowcolor = RGB(0,0,16);    //Windowcolor == colorkey
-
 void console_toggle(void)
 {
     if (console_state)
@@ -560,6 +556,7 @@
             int tmpheight=0;
             static uint32_t rect_width;
             static uint32_t rect_height;
+            DWORD style, flags;
             RECT rd;
             POINT pt;
             while(ShowCursor(TRUE) <= 0){}
@@ -584,9 +581,18 @@
             rd.right = rd.left + rect_width;
             rd.bottom = rd.top + rect_height;
 
-            AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
-            SetWindowPos(hWnd, HWND_NOTOPMOST, pt.x+rd.left, pt.y+rd.top,
-                         rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
+            if(fullscreen)
+            {
+                style = WS_VISIBLE | WS_POPUP;
+                flags = SWP_NOZORDER | SWP_FRAMECHANGED;
+            } else {
+                style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
+                flags = SWP_NOOWNERZORDER;
+            }
+
+            AdjustWindowRect(&rd, style, 0);
+            SetWindowPos(hWnd, 0, fullscreen?0:pt.x+rd.left, fullscreen?0:pt.y+rd.top,
+                         fullscreen?vo_screenwidth:rd.right-rd.left, fullscreen?vo_screenheight:rd.bottom-rd.top, flags);
             return 0;
         }
         case WM_PAINT:
@@ -1325,6 +1331,7 @@
     window_priv_t *priv = NULL;
     window *desc = NULL;
     int i, x = -1, y = -1;
+    vo_colorkey = 0xff000000;
 
     for (i=0; i<gui->skin->windowcount; i++)
         if(gui->skin->windows[i]->type == wiSub)
@@ -1336,8 +1343,6 @@
         return 1;
     }
 
-    windowcolor = vo_colorkey;
-    colorbrush = CreateSolidBrush(windowcolor);
     wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
     wc.lpfnWndProc = SubProc;
     wc.cbClsExtra = 0;
@@ -1345,7 +1350,7 @@
     wc.hInstance = instance;
     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
     wc.hIcon = gui->icon;
-    wc.hbrBackground = colorbrush;
+    wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
     wc.lpszClassName = "MPlayer Sub for Windows";
     wc.lpszMenuName = NULL;
     RegisterClass(&wc);

Modified: trunk/Gui/win32/interface.c
==============================================================================
--- trunk/Gui/win32/interface.c	(original)
+++ trunk/Gui/win32/interface.c	Sat Jul 29 21:30:38 2006
@@ -67,6 +67,7 @@
 int mplGotoTheNext = 1;
 static gui_t *mygui = NULL;
 static int update_subwindow(void);
+static RECT old_rect;
 
 /* test for playlist files, no need to specify -playlist on the commandline.
  * add any conceivable playlist extensions here.
@@ -402,6 +403,7 @@
     if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
         mygui->playlist->current = 0;
 
+    fullscreen = vo_fs = 0;
     guiGetEvent(guiCEvent, (void *) guiSetStop);
 }
 
@@ -432,6 +434,9 @@
        gtkAutoSync = autosync;
     }
 
+    old_rect.left = gui_sub_pos_x;
+    old_rect.top = gui_sub_pos_y;
+
     while(mygui)
     {
         GetMessage(&msg, NULL, 0, 0);
@@ -665,6 +670,9 @@
                 case guiSetPlay:
                 {
                     guiIntfStruct.Playing = 1;
+                    if(guiIntfStruct.sh_video && !IsIconic(mygui->subwindow)
+                       && IsWindowVisible(mygui->subwindow) && !fullscreen)
+                        GetWindowRect(mygui->subwindow, &old_rect);
                     break;
                 }
                 case guiSetStop:
@@ -690,22 +698,33 @@
                 case MP_CMD_GUI_FULLSCREEN:
                 {
                     if(!guiIntfStruct.sh_video) break;
-                    video_out->control(VOCTRL_FULLSCREEN, 0);
 
-                    /* no WinID, keep the sub window hidden */
-                    if(!sub_window)
+                    /* FIXME: vo_directx is behaving unexpectedly, this maintains current functionality */
+                    if(!sub_window || (&video_driver_list && strstr(video_driver_list[0], "directx")))
+                    {
+                        video_out->control(VOCTRL_FULLSCREEN, 0);
                         break;
+                    }
+
+                    if(!fullscreen)
+                        GetWindowRect(mygui->subwindow, &old_rect);
 
-                    if(vo_fs)
+                    if(fullscreen)
                     {
-                        WinID = -1;
-                        ShowWindow(mygui->subwindow, SW_HIDE);
-                        while(ShowCursor(FALSE) >= 0){}
+                        fullscreen = vo_fs = 0;
+                        vo_dwidth = guiIntfStruct.MovieWidth = old_rect.right-old_rect.left;
+                        vo_dheight = guiIntfStruct.MovieHeight = old_rect.bottom-old_rect.top;
+                        vo_dx = old_rect.left;
+                        vo_dy = old_rect.top;
                     } else {
-                        WinID = mygui->subwindow;
-                        ShowWindow(mygui->subwindow, SW_SHOW);
-                        while(ShowCursor(TRUE) <= 0){}
+                        fullscreen = vo_fs = 1;
+                        vo_dwidth = guiIntfStruct.MovieWidth = vo_screenwidth;
+                        vo_dheight = guiIntfStruct.MovieHeight = vo_screenheight;
+                        vo_dx = 0;
+                        vo_dy = 0;
                     }
+                    mpcodecs_config_vo(guiIntfStruct.sh_video, guiIntfStruct.MovieWidth,
+                                       guiIntfStruct.MovieHeight, 0);
                     break;
                 }
                 case MP_CMD_QUIT:
@@ -723,24 +742,24 @@
                     guiGetEvent(guiCEvent, (void *) guiSetPlay);
                     break;
                 case MP_CMD_GUI_SKINBROWSER:
-                    if(vo_fs) guiSetEvent(evFullScreen);
+                    if(fullscreen) guiSetEvent(evFullScreen);
                     PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_SKINBROWSER, 0);
                     break;
                 case MP_CMD_GUI_PLAYLIST:
-                    if(vo_fs) guiSetEvent(evFullScreen);
+                    if(fullscreen) guiSetEvent(evFullScreen);
                     PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PLAYLIST, 0);
                     break;
                 case MP_CMD_GUI_PREFERENCES:
-                    if(vo_fs) guiSetEvent(evFullScreen);
+                    if(fullscreen) guiSetEvent(evFullScreen);
                     PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PREFS, 0);
                     break;
                 case MP_CMD_GUI_LOADFILE:
-                    if(vo_fs) guiSetEvent(evFullScreen);
+                    if(fullscreen) guiSetEvent(evFullScreen);
                     PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDFILE_OPEN, 0);
                     break;
 #ifdef USE_SUB
                 case MP_CMD_GUI_LOADSUBTITLE:
-                    if(vo_fs) guiSetEvent(evFullScreen);
+                    if(fullscreen) guiSetEvent(evFullScreen);
                     PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDSUBTITLE_OPEN, 0);
                     break;
 #endif
@@ -926,7 +945,11 @@
         ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
 
     /* get our current window coordinates */
-    GetWindowRect(mygui->subwindow, &rd);
+    if(fullscreen)
+        GetWindowRect(mygui->subwindow, &rd);
+    else
+        CopyRect(&rd, &old_rect);
+
     x = rd.left;
     y = rd.top;
 
@@ -952,8 +975,9 @@
             sub_aspect = movie_aspect;
     }
 
+
     AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
-    SetWindowPos(mygui->subwindow, HWND_NOTOPMOST, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
+    SetWindowPos(mygui->subwindow, 0, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
 
     wp.hwnd = mygui->subwindow;
     wp.x = rd.left;



More information about the MPlayer-cvslog mailing list