[MPlayer-dev-eng] [PATCH] stay-on-top

Joey Parrish joey at nicewarrior.org
Mon Nov 17 01:48:04 CET 2003


On Sun, Nov 16, 2003 at 10:55:11AM +0100, Attila Kinali wrote:
> This patch is rejected as it is.
> 
> 1) vo_ontop belongs to x11_common.c not to video_out.c
Not if it affects non-x11 vo's.  (directx)

> 2) the whole ontop system should be in a #ifdef HAVE_X11
>    especialy for those vo modules which may use x11 but
>    dont depend on it.
Same as #1.

> 3) mplayer should still compile w/o x11
With this patch, it does.

I took the last version (ontop6.patch, i think)
and added directx support and corrected a few 
mistakes in DOCS.  Please review DOCS parts.

I have tested with x11, xv, and gl under linux,
and directx and gl2 under win32.  These all work.
(When I used a wm that let's me... fluxbox
doesn't stay on top, I don't know if it can.)

Also tested on non-x11 machine, it compiles fine.

The relevant code for other vo's has not changed
since the last patch.  Please review and comment.

--Joey

-- 
"Living in the complex world of the future is somewhat
like having bees live in your head.  But, there they are."
-------------- next part --------------
diff -ur main.cvs/DOCS/man/en/mplayer.1 main.ontop/DOCS/man/en/mplayer.1
--- main.cvs/DOCS/man/en/mplayer.1	2003-11-13 13:17:26.463182400 -0600
+++ main.ontop/DOCS/man/en/mplayer.1	2003-11-16 15:12:11.187332800 -0600
@@ -278,6 +278,9 @@
 mute sound
 .IPs f\ \ \ \ 
 toggle fullscreen
+.IPs T\ \ \ \ 
+toggle stay-on-top. Supported by drivers which use X11, except SDL.
+Also supported by directx and gl2 under win32.
 .IPs "w and e"
 decrease/\:increase panscan range
 .IPs o\ \ \ \ 
@@ -1810,6 +1813,11 @@
 .B \-noxv (SDL only)
 Disables XVideo SDL driver.
 .TP
+.B \-ontop 
+Makes the player window stay on top other windows. Can also be toggled with
+the 'T' key. Supported by drivers which use X11, except SDL. Also supported
+by directx and gl2 under win32.
+.TP
 .B \-panscan <0.0\-1.0>
 Enables Pan & Scan functionality, i.e.\& in order to display a 16:9 movie
 on a 4:3 display, the sides of the movie are cropped to get a 4:3 image
diff -ur main.cvs/DOCS/tech/libvo.txt main.ontop/DOCS/tech/libvo.txt
--- main.cvs/DOCS/tech/libvo.txt	2003-09-21 05:47:19.000000000 -0500
+++ main.ontop/DOCS/tech/libvo.txt	2003-11-16 15:15:29.272164800 -0600
@@ -57,8 +57,12 @@
 	 VOCTRL_GET_EQUALIZER
 		get the current video equalizer values
 		two arguments are provided: item and value
-		item is a string, the possible values are (currenlty):
+		item is a string, the possible values are (currently):
 		    brightness, contrast, saturation, hue
+	 VOCTRL_ONTOP
+		Makes the player window stay-on-top. Only supported (currently)
+		by drivers which use X11, except SDL. Also supported by
+		directx and gl2 under win32.
 
     config():	
       Set up the video system. You get the dimensions and flags.
diff -ur main.cvs/DOCS/tech/slave.txt main.ontop/DOCS/tech/slave.txt
--- main.cvs/DOCS/tech/slave.txt	2003-11-13 13:17:27.524708800 -0600
+++ main.ontop/DOCS/tech/slave.txt	2003-11-16 15:16:35.817852800 -0600
@@ -86,6 +86,10 @@
 get_vo_fullscreen
     Print out fullscreen status (1 == fullscreened, 0 == windowed).
 
+vo_ontop
+	Toggle stay-on-top. Supported by drivers which use X11, except SDL.
+	Also supported by directx and gl2 under win32.
+
 panscan <value> [value2]
     ???
 
diff -ur main.cvs/DOCS/xml/en/usage.xml main.ontop/DOCS/xml/en/usage.xml
--- main.cvs/DOCS/xml/en/usage.xml	2003-11-01 11:03:30.732588800 -0600
+++ main.ontop/DOCS/xml/en/usage.xml	2003-11-16 15:17:48.552440000 -0600
@@ -295,6 +295,11 @@
   <para>
   Switch fullscreen mode.
   </para></listitem>
+<listitem><para><literal>vo_ontop</literal></para>
+  <para>
+  Toggle stay-on-top. Supported by drivers which use X11, except SDL.
+  Also supported by directx and gl2 under win32.
+  </para></listitem>
 <listitem><para><literal>tv_step_channel</literal> (int) dir</para>
   <para>
   Select next/previous tv channel.
diff -ur main.cvs/Gui/wm/ws.c main.ontop/Gui/wm/ws.c
--- main.cvs/Gui/wm/ws.c	2003-08-13 20:45:16.000000000 -0500
+++ main.ontop/Gui/wm/ws.c	2003-11-16 13:10:42.929580800 -0600
@@ -779,6 +779,9 @@
  vo_x11_decoration( wsDisplay,win->WindowID,decoration );
  vo_x11_sizehint( win->X,win->Y,win->Width,win->Height,0 );
  vo_x11_setlayer( wsDisplay,win->WindowID,win->isFullScreen );
+
+if ((!(win->isFullScreen)) & vo_ontop) vo_x11_setlayer(wsDisplay, win->WindowID,1);
+
  if ( vo_wm_type == 0 && !(vo_fsmode&16) )
   XWithdrawWindow( wsDisplay,win->WindowID,wsScreen );
  XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height );
diff -ur main.cvs/cfg-mplayer.h main.ontop/cfg-mplayer.h
--- main.cvs/cfg-mplayer.h	2003-11-01 11:03:28.589507200 -0600
+++ main.ontop/cfg-mplayer.h	2003-11-16 13:10:42.398817600 -0600
@@ -63,6 +63,7 @@
 extern int vo_gamma_contrast;
 extern int vo_gamma_hue;
 extern char *vo_geometry;
+extern int vo_ontop;
 
 extern int opt_screen_size_x;
 extern int opt_screen_size_y;
@@ -296,6 +297,8 @@
 	{"nokeepaspect", &vo_x11_keepaspect, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 	{"fstype", &vo_fstype_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
 	{"nomouseinput", &vo_nomouse_input, CONF_TYPE_FLAG,0,0,-1,NULL},
+	{"ontop", &vo_ontop, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 #endif
 
 #ifdef HAVE_XINERAMA
diff -ur main.cvs/etc/example.conf main.ontop/etc/example.conf
--- main.cvs/etc/example.conf	2003-11-01 11:03:32.615296000 -0600
+++ main.ontop/etc/example.conf	2003-11-16 15:19:07.756329600 -0600
@@ -34,6 +34,10 @@
 # monitoraspect=4:3	# standard monitor size, with square pixels
 # monitoraspect=16:9	# use this for widescreen monitor! non-square pixels
 
+# ontop=yes		# Makes the player window stay ontop
+			# Used by drivers which use X11, except SDL
+			# Also supported by directx and gl2 under win32
+
 ##
 ## Specify your preferred default skin here
 ## (skins are searched in /usr/local/share/mplayer/Skin/yourskin
diff -ur main.cvs/etc/input.conf main.ontop/etc/input.conf
--- main.cvs/etc/input.conf	2003-05-04 22:13:43.000000000 -0500
+++ main.ontop/etc/input.conf	2003-11-16 13:10:43.109840000 -0600
@@ -47,6 +47,7 @@
 #? sub_step +1		# immediately display next subtitle
 #? sub_step -1		#                     previous
 f vo_fullscreen
+T vo_ontop
 w panscan -0.1
 e panscan +0.1
 
diff -ur main.cvs/input/input.c main.ontop/input/input.c
--- main.cvs/input/input.c	2003-11-05 13:27:46.026355200 -0600
+++ main.ontop/input/input.c	2003-11-16 13:10:43.189955200 -0600
@@ -98,6 +98,7 @@
   { MP_CMD_DVB_SET_CHANNEL, "dvb_set_channel", 1, { { MP_CMD_ARG_INT, {0}}, {-1,{0}}  }},
 #endif
   { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } },
+  { MP_CMD_VO_ONTOP, "vo_ontop", 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}} } },
@@ -330,6 +331,7 @@
   { { JOY_BTN2, 0 }, "volume 1"},
   { { JOY_BTN3, 0 }, "volume -1"},
 #endif
+  { { 'T', 0 }, "vo_ontop" },
   { { 'f', 0 }, "vo_fullscreen" },
   { { 's', 0 }, "screenshot" },
   { { 'w', 0 }, "panscan -0.1" },
diff -ur main.cvs/input/input.h main.ontop/input/input.h
--- main.cvs/input/input.h	2003-09-21 09:21:43.000000000 -0500
+++ main.ontop/input/input.h	2003-11-16 13:10:43.240027200 -0600
@@ -52,6 +52,7 @@
 #define MP_CMD_GET_VO_FULLSCREEN 48
 #define MP_CMD_GET_SUB_VISIBILITY 49
 #define MP_CMD_SUB_FORCED_ONLY 50
+#define MP_CMD_VO_ONTOP 51
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
diff -ur main.cvs/libvo/mga_common.c main.ontop/libvo/mga_common.c
--- main.cvs/libvo/mga_common.c	2003-06-01 16:59:28.000000000 -0500
+++ main.ontop/libvo/mga_common.c	2003-11-16 13:10:43.310128000 -0600
@@ -324,6 +324,9 @@
 #endif
 
 #ifdef VO_XMGA
+  case VOCTRL_ONTOP:
+      vo_x11_ontop();
+      return VO_TRUE;
   case VOCTRL_GET_PANSCAN:
       if ( !inited || !vo_fs ) return VO_FALSE;
       return VO_TRUE;
diff -ur main.cvs/libvo/video_out.c main.ontop/libvo/video_out.c
--- main.cvs/libvo/video_out.c	2003-11-07 10:41:48.429187200 -0600
+++ main.ontop/libvo/video_out.c	2003-11-16 13:10:43.370214400 -0600
@@ -40,6 +40,7 @@
 int vo_fs = 0;
 int vo_fsmode = 0;
 float vo_panscan = 0.0f;
+int vo_ontop = 0;
 
 int vo_pts=0; // for hw decoding
 float vo_fps=0; // for mp1e rte
diff -ur main.cvs/libvo/video_out.h main.ontop/libvo/video_out.h
--- main.cvs/libvo/video_out.h	2003-10-03 13:13:45.000000000 -0500
+++ main.ontop/libvo/video_out.h	2003-11-16 13:10:43.440315200 -0600
@@ -55,6 +55,8 @@
 // ... 21
 #define VOCTRL_START_SLICE 21
 
+#define VOCTRL_ONTOP 25
+
 // Vo can be used by xover
 #define VOCTRL_XOVERLAY_SUPPORT 22
 
diff -ur main.cvs/libvo/vo_directx.c main.ontop/libvo/vo_directx.c
--- main.cvs/libvo/vo_directx.c	2003-10-09 12:28:16.000000000 -0500
+++ main.ontop/libvo/vo_directx.c	2003-11-16 13:10:44.421726400 -0600
@@ -43,7 +43,6 @@
 static RECT                 rd;                     //rect of our stretched image
 static RECT                 rs;                     //rect of our source image
 static HWND                 hWnd=NULL;              //handle to the window
-static uint32_t             ontop=0;                //always in foreground
 static uint32_t image_width, image_height;          //image width and height
 static uint32_t d_image_width, d_image_height;      //image width and height zoomed 
 static uint8_t  *image=NULL;                        //image data
@@ -60,6 +59,7 @@
 extern int vo_doublebuffering;                      //tribblebuffering    
 extern int vo_fs;
 extern int vo_directrendering;
+extern int vo_ontop;
 
 /*****************************************************************************
  * DirectDraw GUIDs.
@@ -527,12 +527,12 @@
         dwUpdateFlags = DDOVER_SHOW | DDOVER_DDFX;
         /*if hardware can't do colorkeying set the window on top*/
 		if(capsDrv.dwCKeyCaps & DDCKEYCAPS_DESTOVERLAY) dwUpdateFlags |= DDOVER_KEYDESTOVERRIDE;
-        else ontop = 1;
+        else vo_ontop = 1;
 	}
 	/*calculate window rect with borders*/
 	if(!vo_fs)AdjustWindowRect(&rd_window,WS_OVERLAPPEDWINDOW|WS_SIZEBOX,0);
 
-	if((vo_fs) || (!vo_fs && ontop))hWndafter=HWND_TOPMOST;
+	if((vo_fs) || (!vo_fs && vo_ontop))hWndafter=HWND_TOPMOST;
 	else hWndafter=HWND_NOTOPMOST;
 
 	/*display the window*/
@@ -822,11 +822,6 @@
 			mp_msg(MSGT_VO,MSGL_V,"<vo_directx><INFO>disabled overlay\n");
 		    nooverlay = 1;
 		}
-		if(strstr(arg,"ontop"))
-		{
-			mp_msg(MSGT_VO,MSGL_V,"<vo_directx><INFO>window ontop\n");
-			ontop = 1;
-		}
 	}
 	if (Directx_InitDirectDraw()!= 0)return 1;          //init DirectDraw
     if (Directx_CheckPrimaryPixelformat()!=0)return 1;
@@ -1162,6 +1157,18 @@
         return query_format(*((uint32_t*)data));
 	case VOCTRL_DRAW_IMAGE:
         return put_image(data);
+    case VOCTRL_ONTOP:
+	        if(vm)
+			{
+				mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>ontop has no meaning in exclusive mode\n");
+			}
+	        else
+			{
+				if(vo_ontop) vo_ontop = 0;
+				else vo_ontop = 1;
+				Directx_ManageDisplay(0,0);
+			}
+		return VO_TRUE;
     case VOCTRL_FULLSCREEN:
 		{
 	        if(vm)
diff -ur main.cvs/libvo/vo_dxr2.c main.ontop/libvo/vo_dxr2.c
--- main.cvs/libvo/vo_dxr2.c	2003-08-13 11:29:32.000000000 -0500
+++ main.ontop/libvo/vo_dxr2.c	2003-11-16 13:10:43.540459200 -0600
@@ -854,6 +854,8 @@
     break;
   }
 
+  if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+  
   // start playing
   if(ioctl(dxr2_fd, DXR2_IOC_PLAY, NULL) == 0) {
     playing = 1;
@@ -1065,6 +1067,9 @@
     flush_dxr2();
     ioctl(dxr2_fd, DXR2_IOC_PLAY, NULL);
     return VO_TRUE;
+  case VOCTRL_ONTOP:
+    vo_x11_ontop();
+    return VO_TRUE;
   case VOCTRL_FULLSCREEN:
     if(!use_ol)
       return VO_NOTIMPL;
diff -ur main.cvs/libvo/vo_dxr3.c main.ontop/libvo/vo_dxr3.c
--- main.cvs/libvo/vo_dxr3.c	2003-02-18 17:22:44.000000000 -0600
+++ main.ontop/libvo/vo_dxr3.c	2003-11-16 13:10:43.640603200 -0600
@@ -281,6 +281,9 @@
 		}
 		return VO_TRUE;
 #ifdef HAVE_X11
+	case VOCTRL_ONTOP:
+		vo_x11_ontop();
+		return VO_TRUE;
 	case VOCTRL_FULLSCREEN:
 		if (dxr3_overlay) {
 			vo_x11_fullscreen();
@@ -664,6 +667,9 @@
 		overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OVERLAY);
 		overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_RECTANGLE);
 	}
+
+	if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
 #endif
 
 	return 0;
diff -ur main.cvs/libvo/vo_gl.c main.ontop/libvo/vo_gl.c
--- main.cvs/libvo/vo_gl.c	2003-09-21 10:44:23.000000000 -0500
+++ main.ontop/libvo/vo_gl.c	2003-11-16 13:10:43.730732800 -0600
@@ -207,6 +207,8 @@
 
       saver_off(mDisplay);  // turning off screen saver
 
+      if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
 	return 0;
 }
 
@@ -314,6 +316,9 @@
   case VOCTRL_RESUME: return (int_pause=0);
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
+  case VOCTRL_ONTOP:
+    vo_x11_ontop();
+    return VO_TRUE;
   case VOCTRL_FULLSCREEN:
     vo_x11_fullscreen();
     return VO_TRUE;
diff -ur main.cvs/libvo/vo_gl2.c main.ontop/libvo/vo_gl2.c
--- main.cvs/libvo/vo_gl2.c	2003-10-12 09:42:27.000000000 -0500
+++ main.ontop/libvo/vo_gl2.c	2003-11-16 14:58:40.501624000 -0600
@@ -1006,6 +1006,7 @@
       return -1;
 #ifndef GL_WIN32
       saver_off(mDisplay);
+      if (vo_ontop) vo_x11_setlayer(mDisplay,vo_window, vo_ontop);
 #endif
 
 	return 0;
@@ -1172,6 +1173,13 @@
   case VOCTRL_RESUME: return (int_pause=0);
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
+  case VOCTRL_ONTOP:
+#ifdef GL_WIN32
+    vo_w32_ontop();
+#else
+    vo_x11_ontop();
+#endif 
+    return VO_TRUE;
   case VOCTRL_FULLSCREEN:
 #ifdef GL_WIN32
     vo_w32_fullscreen();
diff -ur main.cvs/libvo/vo_x11.c main.ontop/libvo/vo_x11.c
--- main.cvs/libvo/vo_x11.c	2003-10-04 12:29:04.000000000 -0500
+++ main.ontop/libvo/vo_x11.c	2003-11-16 13:10:43.890963200 -0600
@@ -435,6 +435,9 @@
 #endif  
 
  saver_off(mDisplay);
+
+ if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
  return 0;
 }
 
@@ -657,6 +660,9 @@
       va_end(ap);
       return vo_x11_get_equalizer(data, value);
     }
+  case VOCTRL_ONTOP:
+      vo_x11_ontop();
+      return VO_TRUE;
   case VOCTRL_FULLSCREEN:
     {
       vo_x11_fullscreen();
diff -ur main.cvs/libvo/vo_xmga.c main.ontop/libvo/vo_xmga.c
--- main.cvs/libvo/vo_xmga.c	2003-10-03 13:13:45.000000000 -0500
+++ main.ontop/libvo/vo_xmga.c	2003-11-16 13:10:43.951049600 -0600
@@ -221,6 +221,8 @@
 
  saver_off(mDisplay);
 
+ if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
  XFlush( mDisplay );
  XSync( mDisplay,False );
  
diff -ur main.cvs/libvo/vo_xover.c main.ontop/libvo/vo_xover.c
--- main.cvs/libvo/vo_xover.c	2003-10-03 13:13:45.000000000 -0500
+++ main.ontop/libvo/vo_xover.c	2003-11-16 13:10:44.001121600 -0600
@@ -192,6 +192,9 @@
   XSetForeground(mDisplay, vo_gc, colorkey);
   XFillRectangle(mDisplay, vo_window, vo_gc, drwX, drwY, drwWidth,
 		 (vo_fs ? drwHeight - 1 : drwHeight));
+
+  if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
   /* flush, update drawable */
   XFlush(mDisplay);
 
@@ -456,6 +459,9 @@
   case VOCTRL_GET_PANSCAN:
     if ( !vo_config_count || !vo_fs ) return VO_FALSE;
     return VO_TRUE;
+  case VOCTRL_ONTOP:
+    vo_x11_ontop();
+    return VO_TRUE;
   case VOCTRL_FULLSCREEN:
     vo_x11_fullscreen();
   case VOCTRL_SET_PANSCAN:
diff -ur main.cvs/libvo/vo_xv.c main.ontop/libvo/vo_xv.c
--- main.cvs/libvo/vo_xv.c	2003-11-01 11:03:34.848507200 -0600
+++ main.ontop/libvo/vo_xv.c	2003-11-16 13:10:44.061208000 -0600
@@ -346,6 +346,9 @@
      mp_msg(MSGT_VO,MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight );
 
      saver_off(mDisplay);  // turning off screen saver
+
+     if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
      return 0;
 }
 
@@ -749,6 +752,9 @@
     
     return(vo_xv_get_eq(xv_port, data, value));
   }
+  case VOCTRL_ONTOP:
+    vo_x11_ontop();
+    return VO_TRUE;
   }
   return VO_NOTIMPL;
 }
diff -ur main.cvs/libvo/vo_xvidix.c main.ontop/libvo/vo_xvidix.c
--- main.cvs/libvo/vo_xvidix.c	2003-11-01 11:03:34.868536000 -0600
+++ main.ontop/libvo/vo_xvidix.c	2003-11-16 13:10:44.111280000 -0600
@@ -368,6 +368,8 @@
 
     panscan_calc();
 
+    if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
     saver_off(mDisplay); /* turning off screen saver */
 
     return(0);
@@ -466,6 +468,9 @@
   case VOCTRL_GET_PANSCAN:
       if ( !vo_config_count || !vo_fs ) return VO_FALSE;
       return VO_TRUE;
+  case VOCTRL_ONTOP:
+      vo_x11_ontop();
+      return VO_TRUE;
   case VOCTRL_FULLSCREEN:
       vo_x11_fullscreen();
   case VOCTRL_SET_PANSCAN:
diff -ur main.cvs/libvo/vo_xvmc.c main.ontop/libvo/vo_xvmc.c
--- main.cvs/libvo/vo_xvmc.c	2003-11-13 13:17:38.129958400 -0600
+++ main.ontop/libvo/vo_xvmc.c	2003-11-16 13:10:44.191395200 -0600
@@ -792,6 +792,8 @@
 
    mp_msg(MSGT_VO,MSGL_V, "[xvmc] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight );
 
+   if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
    saver_off(mDisplay);  // turning off screen saver
 //end vo_xv
 
@@ -1408,6 +1410,9 @@
       //vo_xv
       case VOCTRL_GUISUPPORT:
          return VO_TRUE;
+      case VOCTRL_ONTOP:
+         vo_x11_ontop();
+	 return VO_TRUE;
       case VOCTRL_FULLSCREEN:
          vo_x11_fullscreen();
       case VOCTRL_GET_PANSCAN:
diff -ur main.cvs/libvo/w32_common.c main.ontop/libvo/w32_common.c
--- main.cvs/libvo/w32_common.c	2003-09-19 09:33:51.000000000 -0500
+++ main.ontop/libvo/w32_common.c	2003-11-16 14:59:48.148896000 -0600
@@ -146,18 +146,20 @@
 }
 
 int createRenderingContext(void) {
+    HWND layer = HWND_NOTOPMOST;
     if (wglContext) return 1;
 
+    if (vo_fs || vo_ontop) layer = HWND_TOPMOST;
     if (vo_fs) {
 	changeMode();
-	SetWindowPos(vo_hwnd, HWND_TOPMOST, 0, 0, vo_screenwidth, vo_screenheight, SWP_SHOWWINDOW);
+	SetWindowPos(vo_hwnd, layer, 0, 0, vo_screenwidth, vo_screenheight, SWP_SHOWWINDOW);
 	if (cursor) {
 	    ShowCursor(0);
 	    cursor = 0;
 	}
     } else {
 	resetMode();
-	SetWindowPos(vo_hwnd, HWND_NOTOPMOST, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
+	SetWindowPos(vo_hwnd, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
 	if (!cursor) {
 	    ShowCursor(1);
 	    cursor = 1;
@@ -256,6 +258,16 @@
     createRenderingContext();
 }
 
+void vo_w32_ontop( void )
+{
+    vo_ontop = !vo_ontop;
+    if (!vo_fs) {
+	HWND layer = HWND_NOTOPMOST;
+	if (vo_ontop) layer = HWND_TOPMOST;
+	SetWindowPos(vo_hwnd, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
+    }
+}
+
 void vo_w32_uninit() {
     mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n");
     resetMode();
diff -ur main.cvs/libvo/w32_common.h main.ontop/libvo/w32_common.h
--- main.cvs/libvo/w32_common.h	2003-09-19 09:33:51.000000000 -0500
+++ main.ontop/libvo/w32_common.h	2003-11-16 14:21:21.211683200 -0600
@@ -6,6 +6,7 @@
 extern HDC vo_hdc;
 extern int vo_fs;
 extern int vo_vm;
+extern int vo_ontop;
 
 extern int vo_init(void);
 extern void vo_w32_uninit(void);
diff -ur main.cvs/libvo/x11_common.c main.ontop/libvo/x11_common.c
--- main.cvs/libvo/x11_common.c	2003-09-24 02:38:57.000000000 -0500
+++ main.ontop/libvo/x11_common.c	2003-11-16 13:10:44.281524800 -0600
@@ -1050,6 +1050,9 @@
  vo_x11_decoration( mDisplay,vo_window,(vo_fs) ? 0 : 1 );
  vo_x11_sizehint( x,y,w,h,0 );
  vo_x11_setlayer( mDisplay,vo_window,vo_fs );
+
+ if ((!(vo_fs)) & vo_ontop) vo_x11_setlayer(mDisplay, vo_window,vo_ontop);
+
  if(vo_wm_type==0 && !(vo_fsmode&16))
 //    XUnmapWindow( mDisplay,vo_window );  // required for MWM
       XWithdrawWindow(mDisplay,vo_window,mScreen);
@@ -1062,6 +1065,13 @@
  XFlush( mDisplay );
 }
 
+void vo_x11_ontop( void )
+{
+ vo_ontop = (!(vo_ontop));
+
+ vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+}
+
 /*
  * XScreensaver stuff
  */
diff -ur main.cvs/libvo/x11_common.h main.ontop/libvo/x11_common.h
--- main.cvs/libvo/x11_common.h	2003-09-12 10:48:33.000000000 -0500
+++ main.ontop/libvo/x11_common.h	2003-11-16 13:10:44.331596800 -0600
@@ -27,6 +27,7 @@
 extern int vo_wm_type;
 extern int vo_fs_type;
 extern char** vo_fstype_list;
+extern int vo_ontop;
 
 extern char *mDisplayName;
 extern Display *mDisplay;
@@ -60,6 +61,7 @@
 extern void vo_x11_clearwindow_part(Display *mDisplay, Window vo_window,
 	int img_width, int img_height, int use_fs);
 extern void vo_x11_clearwindow( Display *mDisplay, Window vo_window );
+extern void vo_x11_ontop();
 
 #endif
 
diff -ur main.cvs/mplayer.c main.ontop/mplayer.c
--- main.cvs/mplayer.c	2003-11-01 11:03:28.889939200 -0600
+++ main.ontop/mplayer.c	2003-11-16 13:10:42.529004800 -0600
@@ -736,6 +736,7 @@
 int osd_show_sub_changed = 0;
 int osd_show_percentage = 0;
 int osd_show_tv_channel = 25;
+int osd_show_ontop = 0;
 
 int rtc_fd=-1;
 
@@ -3001,6 +3002,17 @@
 #endif
 	if(video_out && vo_config_count) video_out->control(VOCTRL_FULLSCREEN, 0);
     } break;
+    case MP_CMD_VO_ONTOP:
+    {
+     if(video_out && vo_config_count) {
+       video_out->control(VOCTRL_ONTOP, 0);
+#ifdef USE_OSD
+       osd_show_ontop=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 )
@@ -3551,6 +3563,9 @@
       if (osd_show_av_delay) {
 	  snprintf(osd_text_tmp, 63, "A-V delay: %d ms", ROUND(audio_delay*1000));
 	  osd_show_av_delay--;
+      } else if (osd_show_ontop) {
+	  snprintf(osd_text_tmp, 63, "Stay on top: %sabled", vo_ontop?"en":"dis");
+	  osd_show_ontop--;
       } else if(osd_level>=2) {
           int len = demuxer_get_time_length(demuxer);
           int percentage = -1;


More information about the MPlayer-dev-eng mailing list