changeset 12826:fb55f94f3001

Add Window Level Key, Can switch mode with T key
author nplourde
date Thu, 15 Jul 2004 17:36:01 +0000
parents 388e2fe5107e
children f7c6d352c238
files libvo/vo_quartz.c
diffstat 1 files changed, 39 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_quartz.c	Thu Jul 15 16:37:54 2004 +0000
+++ b/libvo/vo_quartz.c	Thu Jul 15 17:36:01 2004 +0000
@@ -10,7 +10,6 @@
 	MPlayer Mac OSX Quartz video out module.
 	
 	todo:	-RGB32 color space support
-			-rootwin
 			-screen overlay output
 			-while mouse button down event mplayer is locked, fix that
 			-(add sugestion here)
@@ -72,6 +71,14 @@
 extern int vo_fs; // user want fullscreen
 static int vo_quartz_fs; // we are in fullscreen
 
+static int winLevel = 1;
+int levelList[] =
+{
+    kCGDesktopWindowLevelKey,
+    kCGNormalWindowLevelKey,
+    kCGScreenSaverWindowLevelKey
+};
+
 static int int_pause = 0;
 static float winAlpha = 1;
 
@@ -80,6 +87,7 @@
 static int device_id;
 
 static WindowRef theWindow = NULL;
+static WindowGroupRef winGroup = NULL;
 
 static Rect imgRect; // size of the original image (unscaled)
 static Rect dstRect; // size of the displayed image (after scaling)
@@ -299,7 +307,10 @@
 	SetRect(&dstRect, 0, 0, d_width, d_height);
   
 	CreateNewWindow(kDocumentWindowClass, windowAttrs, &winRect, &theWindow);
-  
+	
+	CreateWindowGroup(0, &winGroup);
+	SetWindowGroup(theWindow, winGroup);
+
 	//Set window title
 	titleKey	= CFSTR("MPlayer - The Movie Player");
 	windowTitle = CFCopyLocalizedString(titleKey, NULL);
@@ -897,10 +908,27 @@
 
 void window_ontop()
 {
-	if(vo_ontop)
-		SetWindowClass( theWindow, kUtilityWindowClass);
-	else
-		SetWindowClass( theWindow, kDocumentWindowClass);
+	//Cycle between level
+	winLevel++;
+	if(winLevel>2)
+		winLevel = 0;
+		
+	//hide menu bar and mouse cursor if in fullscreen and quiting wallpaper mode
+	if(vo_fs)
+	{
+		if(winLevel != 0)
+		{
+			HideMenuBar();
+			HideCursor();
+		}
+		else
+		{
+			ShowMenuBar();
+			ShowfCursor();
+		}
+	}
+
+	SetWindowGroupLevel(winGroup, CGWindowLevelForKey(levelList[winLevel]));
 }
 
 void window_fullscreen()
@@ -908,15 +936,16 @@
 	//go fullscreen
 	if(vo_fs)
 	{
-		HideMenuBar();
+		if(winLevel != 0)
+		{
+			HideMenuBar();
+			HideCursor();
+		}
 
 		//save old window size
  		if (!vo_quartz_fs)
 			GetWindowPortBounds(theWindow, &oldWinRect);
 		
-		//hide mouse cursor
-		HideCursor();
-		
 		//go fullscreen
 		//ChangeWindowAttributes(theWindow, 0, kWindowResizableAttribute);