[Mplayer-cvslog] CVS: main/libvo mga_common.c,1.57,1.58 video_out.c,1.80,1.81 video_out.h,1.53,1.54 vo_directx.c,1.23,1.24 vo_dxr2.c,1.16,1.17 vo_dxr3.c,1.118,1.119 vo_gl.c,1.37,1.38 vo_gl2.c,1.38,1.39 vo_x11.c,1.135,1.136 vo_xmga.c,1.85,1.86 vo_xover.c,1.5,1.6 vo_xv.c,1.150,1.151 vo_xvidix.c,1.65,1.66 vo_xvmc.c,1.8,1.9 w32_common.c,1.2,1.3 w32_common.h,1.1,1.2 x11_common.c,1.159,1.160 x11_common.h,1.33,1.34

Joey Parrish CVS joey at mplayerhq.hu
Sun Nov 30 17:36:14 CET 2003


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv7217/libvo

Modified Files:
	mga_common.c video_out.c video_out.h vo_directx.c vo_dxr2.c 
	vo_dxr3.c vo_gl.c vo_gl2.c vo_x11.c vo_xmga.c vo_xover.c 
	vo_xv.c vo_xvidix.c vo_xvmc.c w32_common.c w32_common.h 
	x11_common.c x11_common.h 
Log Message:
runtime 'stay-on-top' functionality


Index: mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- mga_common.c	1 Jun 2003 21:59:28 -0000	1.57
+++ mga_common.c	30 Nov 2003 16:36:08 -0000	1.58
@@ -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;

Index: video_out.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- video_out.c	4 Nov 2003 20:05:47 -0000	1.80
+++ video_out.c	30 Nov 2003 16:36:09 -0000	1.81
@@ -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

Index: video_out.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- video_out.h	3 Oct 2003 18:13:45 -0000	1.53
+++ video_out.h	30 Nov 2003 16:36:09 -0000	1.54
@@ -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
 

Index: vo_directx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_directx.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- vo_directx.c	23 Nov 2003 16:59:57 -0000	1.23
+++ vo_directx.c	30 Nov 2003 16:36:10 -0000	1.24
@@ -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)

Index: vo_dxr2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dxr2.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- vo_dxr2.c	13 Aug 2003 16:29:32 -0000	1.16
+++ vo_dxr2.c	30 Nov 2003 16:36:10 -0000	1.17
@@ -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;
@@ -1064,6 +1066,9 @@
   case VOCTRL_RESET:
     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)

Index: vo_dxr3.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dxr3.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- vo_dxr3.c	28 Nov 2003 20:49:34 -0000	1.118
+++ vo_dxr3.c	30 Nov 2003 16:36:10 -0000	1.119
@@ -285,6 +285,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();
@@ -668,6 +671,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;

Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- vo_gl.c	21 Sep 2003 15:44:23 -0000	1.37
+++ vo_gl.c	30 Nov 2003 16:36:10 -0000	1.38
@@ -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;

Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- vo_gl2.c	12 Oct 2003 14:42:27 -0000	1.38
+++ vo_gl2.c	30 Nov 2003 16:36:10 -0000	1.39
@@ -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();

Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -r1.135 -r1.136
--- vo_x11.c	4 Oct 2003 17:29:04 -0000	1.135
+++ vo_x11.c	30 Nov 2003 16:36:10 -0000	1.136
@@ -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();

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- vo_xmga.c	3 Oct 2003 18:13:45 -0000	1.85
+++ vo_xmga.c	30 Nov 2003 16:36:10 -0000	1.86
@@ -221,6 +221,8 @@
 
  saver_off(mDisplay);
 
+ if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+
  XFlush( mDisplay );
  XSync( mDisplay,False );
  

Index: vo_xover.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xover.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- vo_xover.c	3 Oct 2003 18:13:45 -0000	1.5
+++ vo_xover.c	30 Nov 2003 16:36:10 -0000	1.6
@@ -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);
 
@@ -455,6 +458,9 @@
     return VO_TRUE;
   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();

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -r1.150 -r1.151
--- vo_xv.c	19 Oct 2003 21:13:39 -0000	1.150
+++ vo_xv.c	30 Nov 2003 16:36:10 -0000	1.151
@@ -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;
 }

Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- vo_xvidix.c	15 Nov 2003 09:58:15 -0000	1.65
+++ vo_xvidix.c	30 Nov 2003 16:36:10 -0000	1.66
@@ -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);
@@ -465,6 +467,9 @@
     return VO_TRUE;
   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();

Index: vo_xvmc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvmc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- vo_xvmc.c	8 Nov 2003 02:07:10 -0000	1.8
+++ vo_xvmc.c	30 Nov 2003 16:36:10 -0000	1.9
@@ -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:

Index: w32_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/w32_common.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- w32_common.c	16 Nov 2003 14:37:42 -0000	1.2
+++ w32_common.c	30 Nov 2003 16:36:10 -0000	1.3
@@ -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;
@@ -254,6 +256,16 @@
 
     destroyRenderingContext();
     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() {

Index: w32_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/w32_common.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- w32_common.h	19 Sep 2003 14:33:51 -0000	1.1
+++ w32_common.h	30 Nov 2003 16:36:10 -0000	1.2
@@ -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);

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- x11_common.c	24 Sep 2003 07:38:57 -0000	1.159
+++ x11_common.c	30 Nov 2003 16:36:10 -0000	1.160
@@ -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);
@@ -1060,6 +1063,13 @@
  XMapRaised( mDisplay,vo_window );
  XRaiseWindow( mDisplay,vo_window );
  XFlush( mDisplay );
+}
+
+void vo_x11_ontop( void )
+{
+ vo_ontop = (!(vo_ontop));
+
+ vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
 }
 
 /*

Index: x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- x11_common.h	12 Sep 2003 15:48:33 -0000	1.33
+++ x11_common.h	30 Nov 2003 16:36:10 -0000	1.34
@@ -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
 



More information about the MPlayer-cvslog mailing list