[Mplayer-cvslog] CVS: main/libvo vo_directx.c,1.39,1.40

Sascha Sommer CVS syncmail at mplayerhq.hu
Wed Oct 27 19:21:21 CEST 2004


CVS change done by Sascha Sommer CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv24522/libvo

Modified Files:
	vo_directx.c 
Log Message:
make it possible to select the monitor even when in nonexclusive mode, based on patch by Anton Ragarsson <anton at infeline.org>

Index: vo_directx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_directx.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- vo_directx.c	22 Oct 2004 13:37:43 -0000	1.39
+++ vo_directx.c	27 Oct 2004 17:21:18 -0000	1.40
@@ -68,6 +68,7 @@
 static int adapter_count=0;
 static GUID selected_guid;
 static GUID *selected_guid_ptr = NULL;
+static RECT monitor_rect;	                        //monitor coordinates 
 static float window_aspect;
 
 extern void mplayer_put_key(int code);              //let mplayer handel the keyevents 
@@ -367,6 +368,7 @@
     }
     
     if(adapter_count == vo_adapter_num){
+        MONITORINFO mi;
         if (!lpGUID)
             selected_guid_ptr = NULL;
         else
@@ -374,6 +376,10 @@
             selected_guid = *lpGUID;
             selected_guid_ptr = &selected_guid;
         }
+        mi.cbSize = sizeof(mi);
+        if (GetMonitorInfo(hm, &mi)) {
+			monitor_rect = mi.rcMonitor;
+        }
         mp_msg(MSGT_VO, MSGL_INFO ,"\t\t<--");
     }
     mp_msg(MSGT_VO, MSGL_INFO ,"\n");
@@ -510,6 +516,10 @@
       GetClientRect(hWnd, &rd);
 	  width=rd.right - rd.left;
 	  height=rd.bottom - rd.top;
+      pt.x -= monitor_rect.left;    /* move coordinates from global to local monitor space */
+      pt.y -= monitor_rect.top;
+      rd.right -= monitor_rect.left;
+      rd.bottom -= monitor_rect.top;
 	  rd.left = pt.x;
       rd.top = pt.y; 
       if(!nooverlay && (!width || !height)){
@@ -619,6 +629,10 @@
           RECT rdw=rd;
           AdjustWindowRect(&rdw,WS_OVERLAPPEDWINDOW|WS_SIZEBOX,FALSE);
 //          printf("window: %i %i %ix%i\n",rdw.left,rdw.top,rdw.right - rdw.left,rdw.bottom - rdw.top);      
+		  rdw.left += monitor_rect.left; /* move to global coordinate space */
+          rdw.top += monitor_rect.top;
+		  rdw.right += monitor_rect.left;
+		  rdw.bottom += monitor_rect.top;
           SetWindowPos(hWnd,(vo_ontop)?HWND_TOPMOST:(vo_rootwin?HWND_BOTTOM:HWND_NOTOPMOST),rdw.left,rdw.top,rdw.right-rdw.left,rdw.bottom-rdw.top,SWP_NOOWNERZORDER); 
     }
     else SetWindowPos(vidmode?hWnd:hWndFS,vo_rootwin?HWND_BOTTOM:HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOOWNERZORDER);
@@ -841,7 +855,7 @@
 			//printf("Windowposchange\n");
 			if(g_lpddsBack != NULL)  //or it will crash with -vm
 			{
-				Directx_ManageDisplay(0,0);
+				Directx_ManageDisplay();
 			}
 		    break;
 		}
@@ -961,6 +975,9 @@
         mplayericon = ExtractIcon( hInstance, exedir, 0 );
   	}
     if(!mplayericon)mplayericon=LoadIcon(NULL,IDI_APPLICATION);
+    monitor_rect.right=GetSystemMetrics(SM_CXSCREEN);
+    monitor_rect.bottom=GetSystemMetrics(SM_CYSCREEN);
+	
     wc.style         =  CS_HREDRAW | CS_VREDRAW;
     wc.lpfnWndProc   =  WndProc;
     wc.cbClsExtra    =  0;
@@ -978,10 +995,12 @@
 	wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));                     
     wc.lpszClassName = "MPlayer - Fullscreen";
     RegisterClass(&wc);
-    if(!vidmode)hWndFS = CreateWindow("MPlayer - Fullscreen","MPlayer Fullscreen",WS_POPUP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),hWnd,NULL,hInstance,NULL);			
-    mp_msg(MSGT_VO, MSGL_DBG3 ,"<vo_directx><INFO>initial mplayer windows created\n");
 	
 	if (Directx_InitDirectDraw()!= 0)return 1;          //init DirectDraw
+	
+    if(!vidmode)hWndFS = CreateWindow("MPlayer - Fullscreen","MPlayer Fullscreen",WS_POPUP,monitor_rect.left,monitor_rect.top,monitor_rect.right-monitor_rect.left,monitor_rect.bottom-monitor_rect.top,hWnd,NULL,hInstance,NULL);			
+    mp_msg(MSGT_VO, MSGL_DBG3 ,"<vo_directx><INFO>initial mplayer windows created\n");
+    
     if (Directx_CheckPrimaryPixelformat()!=0)return 1;
 	if (!nooverlay && Directx_CheckOverlayPixelformats() == 0)        //check for supported hardware
 	{
@@ -1173,8 +1192,8 @@
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t options, char *title, uint32_t format)
 {
     RECT rd;
-	vo_screenwidth = GetSystemMetrics(SM_CXSCREEN);
-	vo_screenheight = GetSystemMetrics(SM_CYSCREEN);
+    vo_screenwidth = monitor_rect.right - monitor_rect.left;
+    vo_screenheight = monitor_rect.bottom - monitor_rect.top;
     vo_fs = options & 0x01;
 	image_format =  format;
 	image_width = width;
@@ -1203,6 +1222,8 @@
             vo_dx=rd.left;
             vo_dy=rd.top;
         }
+        vo_dx += monitor_rect.left; /* move position to global window space */
+        vo_dy += monitor_rect.top;
         rd.left = vo_dx;
         rd.top = vo_dy;
         rd.right = rd.left + d_image_width;




More information about the MPlayer-cvslog mailing list