From 896b8f4c2f2ff8793265855017511ccd1ccf6380 Mon Sep 17 00:00:00 2001
From: joey <joey@b3059339-0415-0410-9bf9-f77b7e298cf2>
Date: Sun, 22 Aug 2004 19:01:56 +0000
Subject: [PATCH] added runtime toggle of root window playback only directx
 supports this at the moment

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13092 b3059339-0415-0410-9bf9-f77b7e298cf2
---
 DOCS/tech/slave.txt |  4 ++++
 input/input.c       |  1 +
 input/input.h       |  1 +
 libvo/video_out.h   |  1 +
 libvo/vo_directx.c  | 12 ++++++++++++
 mplayer.c           | 15 +++++++++++++++
 6 files changed, 34 insertions(+)

diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt
index f9c4aee37e..481494c7d5 100644
--- a/DOCS/tech/slave.txt
+++ b/DOCS/tech/slave.txt
@@ -95,6 +95,10 @@ vo_ontop
 	Toggle stay-on-top. Supported by drivers which use X11, except SDL,
 	as well as directx and gl2 under Windows.
 
+vo_rootwin
+	Toggle playback on the root window. This runtime toggle is only
+	supported by the directx driver at the moment.
+
 panscan <value> [value2]
     ???
 
diff --git a/input/input.c b/input/input.c
index cdcc52af56..430dd95120 100644
--- a/input/input.c
+++ b/input/input.c
@@ -100,6 +100,7 @@ static mp_cmd_t mp_cmds[] = {
 #endif
   { 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_SCREENSHOT, "screenshot", 0, { {-1,{0}} } },
   { MP_CMD_PANSCAN, "panscan",1,  { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
   { MP_CMD_LOADFILE, "loadfile", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
diff --git a/input/input.h b/input/input.h
index 5764feb707..7ec8de3337 100644
--- a/input/input.h
+++ b/input/input.h
@@ -54,6 +54,7 @@
 #define MP_CMD_SUB_FORCED_ONLY 50
 #define MP_CMD_VO_ONTOP 51
 #define MP_CMD_SUB_SELECT 52
+#define MP_CMD_VO_ROOTWIN 53
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 799c25615c..e16bd2d7c3 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -56,6 +56,7 @@
 #define VOCTRL_START_SLICE 21
 
 #define VOCTRL_ONTOP 25
+#define VOCTRL_ROOTWIN 26
 
 // Vo can be used by xover
 #define VOCTRL_XOVERLAY_SUPPORT 22
diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c
index d128a5def5..8231f260bd 100644
--- a/libvo/vo_directx.c
+++ b/libvo/vo_directx.c
@@ -1260,6 +1260,18 @@ static uint32_t control(uint32_t request, void *data, ...)
 				Directx_ManageDisplay();
 			}
 		return VO_TRUE;
+    case VOCTRL_ROOTWIN:
+	        if(vidmode)
+			{
+				mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>rootwin has no meaning in exclusive mode\n");
+			}
+	        else
+			{
+				if(vo_rootwin) vo_rootwin = 0;
+				else vo_rootwin = 1;
+				Directx_ManageDisplay();
+			}
+		return VO_TRUE;
     case VOCTRL_FULLSCREEN:
 		{
 	        if(vidmode)
diff --git a/mplayer.c b/mplayer.c
index 0a7f57f07a..c66c0f41b3 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -749,6 +749,7 @@ int osd_show_sub_changed = 0;
 int osd_show_percentage = 0;
 int osd_show_tv_channel = 25;
 int osd_show_ontop = 0;
+int osd_show_rootwin = 0;
 int osd_show_framedropping = 0;
 
 int rtc_fd=-1;
@@ -3042,6 +3043,17 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
 #endif
      }
 
+    } break;
+    case MP_CMD_VO_ROOTWIN:
+    {
+     if(video_out && vo_config_count) {
+       video_out->control(VOCTRL_ROOTWIN, 0);
+#ifdef USE_OSD
+       osd_show_rootwin=10;
+       vo_osd_changed(OSDTYPE_SUBTITLE);
+#endif
+     }
+
     } break;
     case MP_CMD_PANSCAN : {
       if ( !video_out ) break;
@@ -3640,6 +3652,9 @@ if(rel_seek_secs || abs_seek_pos){
       } else if (osd_show_ontop) {
 	  snprintf(osd_text_tmp, 63, "Stay on top: %sabled", vo_ontop?"en":"dis");
 	  osd_show_ontop--;
+      } else if (osd_show_rootwin) {
+	  snprintf(osd_text_tmp, 63, "Rootwin: %sabled", vo_rootwin?"en":"dis");
+	  osd_show_rootwin--;
       } else if (osd_show_framedropping) {
 	  snprintf(osd_text_tmp, 63, "Framedropping: %s",
 	     (frame_dropping == 1 ? "on" :