changeset 16968:e9d849bf8050

add a switch, slave command, and vo control to toggle borderless window. includes documentation.
author joey
date Thu, 10 Nov 2005 22:25:54 +0000
parents 32e2c59c8e86
children c35e21308577
files DOCS/man/en/mplayer.1 DOCS/tech/libvo.txt DOCS/tech/slave.txt cfg-mplayer.h help/help_mp-en.h input/input.c input/input.h libvo/video_out.c libvo/video_out.h libvo/vo_directx.c mplayer.c
diffstat 11 files changed, 63 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Thu Nov 10 21:33:12 2005 +0000
+++ b/DOCS/man/en/mplayer.1	Thu Nov 10 22:25:54 2005 +0000
@@ -2085,6 +2085,13 @@
 Only supported by the fbdev, dga, svga, vesa video output drivers.
 .
 .TP
+.B \-border
+Play movie with window border and decorations.
+Since this is on by default, use \-noborder to disable the standard window
+decorations.
+Supported by directx video output driver.
+.
+.TP
 .B \-brightness <-100\-100>
 Adjust the brightness of the video signal (default: 0).
 Not supported by all video output drivers.
--- a/DOCS/tech/libvo.txt	Thu Nov 10 21:33:12 2005 +0000
+++ b/DOCS/tech/libvo.txt	Thu Nov 10 22:25:54 2005 +0000
@@ -63,6 +63,8 @@
 		Makes the player window stay-on-top. Only supported (currently)
 		by drivers which use X11, except SDL, as well as directx and
 		gl2 under Windows.
+	 VOCTRL_BORDER
+		Makes the player window borderless.  Only supported by directx.
 
     config():	
       Set up the video system. You get the dimensions and flags.
--- a/DOCS/tech/slave.txt	Thu Nov 10 21:33:12 2005 +0000
+++ b/DOCS/tech/slave.txt	Thu Nov 10 22:25:54 2005 +0000
@@ -270,6 +270,9 @@
 vo_rootwin
     Toggle playback on the root window.
 
+vo_border
+    Toggle borderless display.
+
 volume <value>
     Increase/decrease volume.
 
--- a/cfg-mplayer.h	Thu Nov 10 21:33:12 2005 +0000
+++ b/cfg-mplayer.h	Thu Nov 10 22:25:54 2005 +0000
@@ -45,6 +45,7 @@
 extern int vo_gamma_hue;
 extern char *vo_geometry;
 extern int vo_ontop;
+extern int vo_border;
 extern int vo_keepaspect;
 extern int vo_rootwin;
 
@@ -144,6 +145,8 @@
 	{"ontop", &vo_ontop, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 	{"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"border", &vo_border, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"noborder", &vo_border, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 
 	{"aop", "-aop is deprecated, use -af instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
 	{"dsp", "Use -ao oss:dsp_path.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
--- a/help/help_mp-en.h	Thu Nov 10 21:33:12 2005 +0000
+++ b/help/help_mp-en.h	Thu Nov 10 22:25:54 2005 +0000
@@ -219,6 +219,7 @@
 #define MSGTR_OSDSpeed "Speed: x %6.2f"
 #define MSGTR_OSDStayOnTop "Stay on top: %s"
 #define MSGTR_OSDRootwin "Rootwin: %s"
+#define MSGTR_OSDBorder "Border: %s"
 #define MSGTR_OSDFramedrop "Framedropping: %s"
 #define MSGTR_OSDFramedropOn "on"
 #define MSGTR_OSDFramedropHard "hard"
--- a/input/input.c	Thu Nov 10 21:33:12 2005 +0000
+++ b/input/input.c	Thu Nov 10 22:25:54 2005 +0000
@@ -108,6 +108,7 @@
   { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } },
   { MP_CMD_VO_ONTOP, "vo_ontop", 0, { {-1,{0}} } },
   { MP_CMD_VO_ROOTWIN, "vo_rootwin", 0, { {-1,{0}} } },
+  { MP_CMD_VO_BORDER, "vo_border", 0, { {-1,{0}} } },
   { MP_CMD_SCREENSHOT, "screenshot", 0, { {-1,{0}} } },
   { MP_CMD_PANSCAN, "panscan",1,  { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
   { MP_CMD_SWITCH_VSYNC, "switch_vsync", 0, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
--- a/input/input.h	Thu Nov 10 21:33:12 2005 +0000
+++ b/input/input.h	Thu Nov 10 22:25:54 2005 +0000
@@ -68,6 +68,7 @@
 #define MP_CMD_SUB_LOAD 64
 #define MP_CMD_SUB_REMOVE 65
 #define MP_CMD_KEYDOWN_EVENTS 66
+#define MP_CMD_VO_BORDER 67
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
--- a/libvo/video_out.c	Thu Nov 10 21:33:12 2005 +0000
+++ b/libvo/video_out.c	Thu Nov 10 22:25:54 2005 +0000
@@ -45,6 +45,7 @@
 int vo_refresh_rate=0;
 int vo_keepaspect=1;
 int vo_rootwin=0;
+int vo_border=1;
 int WinID = -1;
 
 int vo_pts=0; // for hw decoding
--- a/libvo/video_out.h	Thu Nov 10 21:33:12 2005 +0000
+++ b/libvo/video_out.h	Thu Nov 10 22:25:54 2005 +0000
@@ -57,6 +57,7 @@
 
 #define VOCTRL_ONTOP 25
 #define VOCTRL_ROOTWIN 26
+#define VOCTRL_BORDER 27
 
 // Vo can be used by xover
 #define VOCTRL_XOVERLAY_SUPPORT 22
@@ -202,6 +203,7 @@
 extern int vo_keepaspect;
 extern int vo_rootwin;
 extern int vo_ontop;
+extern int vo_border;
 
 extern int vo_gamma_brightness;
 extern int vo_gamma_saturation;
--- a/libvo/vo_directx.c	Thu Nov 10 21:33:12 2005 +0000
+++ b/libvo/vo_directx.c	Thu Nov 10 22:25:54 2005 +0000
@@ -670,6 +670,7 @@
     if(!vidmode && !vo_fs){
       if(WinID == -1) {
           RECT rdw=rd;
+          if (vo_border)
           AdjustWindowRect(&rdw,WNDSTYLE,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 */
@@ -1039,7 +1040,7 @@
     if (WinID != -1) hWnd = WinID;
     else
     hWnd = CreateWindowEx(vidmode?WS_EX_TOPMOST:0,
-        WNDCLASSNAME_WINDOWED,"",(vidmode)?WS_POPUP:WNDSTYLE,
+        WNDCLASSNAME_WINDOWED,"",(vidmode || !vo_border)?WS_POPUP:WNDSTYLE,
         CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,NULL,NULL,hInstance,NULL);
     wc.hbrBackground = blackbrush;
     wc.lpszClassName = WNDCLASSNAME_FULLSCREEN;
@@ -1295,6 +1296,7 @@
         rd.right = rd.left + d_image_width;
         rd.bottom = rd.top + d_image_height;
         if (WinID == -1) {
+        if (vo_border)
         AdjustWindowRect(&rd,WNDSTYLE,FALSE);  
         SetWindowPos(hWnd,NULL, vo_dx, vo_dy,rd.right-rd.left,rd.bottom-rd.top,SWP_SHOWWINDOW|SWP_NOOWNERZORDER); 
         }
@@ -1449,6 +1451,30 @@
         return query_format(*((uint32_t*)data));
 	case VOCTRL_DRAW_IMAGE:
         return put_image(data);
+    case VOCTRL_BORDER:
+			if(WinID != -1) return VO_TRUE;
+	        if(vidmode)
+			{
+				mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>border has no meaning in exclusive mode\n");
+			}
+	        else
+			{
+				if(vo_border) {
+					vo_border = 0;
+					SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
+				} else {
+					vo_border = 1;
+					SetWindowLong(hWnd, GWL_STYLE, WNDSTYLE);
+				}
+				// needed AFAICT to force the window to
+				// redisplay with the new style.  --Joey
+				if (!vo_fs) {
+					ShowWindow(hWnd,SW_HIDE);
+					ShowWindow(hWnd,SW_SHOW);
+				}
+				Directx_ManageDisplay();
+			}
+		return VO_TRUE;
     case VOCTRL_ONTOP:
 			if(WinID != -1) return VO_TRUE;
 	        if(vidmode)
--- a/mplayer.c	Thu Nov 10 21:33:12 2005 +0000
+++ b/mplayer.c	Thu Nov 10 22:25:54 2005 +0000
@@ -1062,6 +1062,7 @@
 int osd_show_tv_channel = 25;
 int osd_show_ontop = 0;
 int osd_show_rootwin = 0;
+int osd_show_border = 0;
 int osd_show_framedropping = 0;
 int osd_show_status = 0;
 
@@ -3442,6 +3443,17 @@
      }
 
     } break;
+    case MP_CMD_VO_BORDER:
+    {
+     if(video_out && vo_config_count) {
+       video_out->control(VOCTRL_BORDER, 0);
+#ifdef USE_OSD
+       osd_show_border=10;
+       vo_osd_changed(OSDTYPE_SUBTITLE);
+#endif
+     }
+
+    } break;
     case MP_CMD_PANSCAN : {
       if ( !video_out ) break;
       if ( video_out->control( VOCTRL_GET_PANSCAN,NULL ) == VO_TRUE )
@@ -4212,6 +4224,9 @@
       } else if (osd_show_rootwin) {
 	  snprintf(osd_text_tmp, 63, MSGTR_OSDRootwin, vo_rootwin? MSGTR_OSDenabled : MSGTR_OSDdisabled);
 	  osd_show_rootwin--;
+      } else if (osd_show_border) {
+	  snprintf(osd_text_tmp, 63, MSGTR_OSDBorder, vo_border? MSGTR_OSDenabled : MSGTR_OSDdisabled);
+	  osd_show_border--;
       } else if (osd_show_framedropping) {
 	  snprintf(osd_text_tmp, 63, MSGTR_OSDFramedrop,
 	     (frame_dropping == 1 ? MSGTR_OSDFramedropOn :