summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoey <joey@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-10 22:25:54 +0000
committerjoey <joey@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-10 22:25:54 +0000
commit8901ee0b0a8df948b9b308558aeef661b90474ba (patch)
treea516076dd020d3f3fabf7d31d1692efdf3a8a1cc
parent8318fcd06b7e2e94a2ef309f0ae3ed8890adc01d (diff)
downloadmpv-8901ee0b0a8df948b9b308558aeef661b90474ba.tar.bz2
mpv-8901ee0b0a8df948b9b308558aeef661b90474ba.tar.xz
add a switch, slave command, and vo control to toggle borderless window.
includes documentation. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16969 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/man/en/mplayer.17
-rw-r--r--DOCS/tech/libvo.txt2
-rw-r--r--DOCS/tech/slave.txt3
-rw-r--r--cfg-mplayer.h3
-rw-r--r--help/help_mp-en.h1
-rw-r--r--input/input.c1
-rw-r--r--input/input.h1
-rw-r--r--libvo/video_out.c1
-rw-r--r--libvo/video_out.h2
-rw-r--r--libvo/vo_directx.c28
-rw-r--r--mplayer.c15
11 files changed, 63 insertions, 1 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index a81e09fadd..8933da89c3 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -2085,6 +2085,13 @@ Override the autodetected color depth.
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.
diff --git a/DOCS/tech/libvo.txt b/DOCS/tech/libvo.txt
index 6e50974ed8..6b66897fb2 100644
--- a/DOCS/tech/libvo.txt
+++ b/DOCS/tech/libvo.txt
@@ -63,6 +63,8 @@ Each vo driver _has_ to implement these:
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.
diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt
index a6e2cdacca..2c0bba90b8 100644
--- a/DOCS/tech/slave.txt
+++ b/DOCS/tech/slave.txt
@@ -270,6 +270,9 @@ vo_ontop
vo_rootwin
Toggle playback on the root window.
+vo_border
+ Toggle borderless display.
+
volume <value>
Increase/decrease volume.
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 960763f370..37ca4b4292 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -45,6 +45,7 @@ extern int vo_gamma_contrast;
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 @@ m_option_t mplayer_opts[]={
{"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},
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index f0d1a2e79b..4d3f34c636 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -219,6 +219,7 @@ static char help_text[]=
#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"
diff --git a/input/input.c b/input/input.c
index 11a3b55a9b..7d5bf00ea4 100644
--- a/input/input.c
+++ b/input/input.c
@@ -108,6 +108,7 @@ static mp_cmd_t mp_cmds[] = {
{ 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}} } },
diff --git a/input/input.h b/input/input.h
index 60c70a6ca1..d27b3e11bf 100644
--- a/input/input.h
+++ b/input/input.h
@@ -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
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 9ce90a9d86..6dc90a80aa 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -45,6 +45,7 @@ int vo_adapter_num=0;
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
diff --git a/libvo/video_out.h b/libvo/video_out.h
index bf64e98186..3f6ba5e21a 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -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_refresh_rate;
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;
diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c
index dea6e9b6d3..ada591d483 100644
--- a/libvo/vo_directx.c
+++ b/libvo/vo_directx.c
@@ -670,6 +670,7 @@ static uint32_t Directx_ManageDisplay()
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 @@ static int preinit(const char *arg)
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 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
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 @@ static int control(uint32_t request, void *data, ...)
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)
diff --git a/mplayer.c b/mplayer.c
index e514f3d908..4b20573e73 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1062,6 +1062,7 @@ int osd_show_percentage = 0;
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 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
}
} 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 @@ if ((user_muted | edl_muted) != mixer.muted) mixer_mute(&mixer);
} 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 :