2008-04-22 09:33:39 +00:00
|
|
|
/*
|
|
|
|
* sub window
|
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-09 20:47:14 +00:00
|
|
|
#include <inttypes.h>
|
2007-05-16 21:45:46 +00:00
|
|
|
#include <string.h>
|
2003-01-09 20:47:14 +00:00
|
|
|
|
2008-04-12 16:03:07 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "libvo/x11_common.h"
|
|
|
|
#include "help_mp.h"
|
2003-01-09 20:47:14 +00:00
|
|
|
|
2007-04-29 12:44:34 +00:00
|
|
|
#include "gmplayer.h"
|
2008-04-11 16:55:27 +00:00
|
|
|
#include "gui/app.h"
|
|
|
|
#include "gui/interface.h"
|
2002-11-02 18:57:14 +00:00
|
|
|
#include "widgets.h"
|
|
|
|
|
2002-07-25 20:26:38 +00:00
|
|
|
int mplSubRender = 0;
|
2001-09-04 15:21:00 +00:00
|
|
|
int SubVisible = 0;
|
2001-08-31 21:19:52 +00:00
|
|
|
|
2002-11-02 18:57:14 +00:00
|
|
|
extern int boxMoved;
|
|
|
|
extern int sx,sy;
|
|
|
|
extern int i,pot;
|
|
|
|
|
2002-11-02 20:10:18 +00:00
|
|
|
void mplSubDraw( void )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
2002-05-01 09:29:06 +00:00
|
|
|
if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
|
|
|
|
|
2001-10-02 15:01:56 +00:00
|
|
|
if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++;
|
2003-01-09 20:47:14 +00:00
|
|
|
if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--;
|
2001-11-12 12:26:09 +00:00
|
|
|
|
2001-09-04 15:21:00 +00:00
|
|
|
if ( !appMPlayer.subWindow.Mapped ||
|
|
|
|
appMPlayer.subWindow.Visible == wsWindowNotVisible ) return;
|
2001-09-01 17:53:07 +00:00
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( guiIntfStruct.Playing ) mplSubRender=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-07-25 20:26:38 +00:00
|
|
|
if ( mplSubRender && appMPlayer.subWindow.State == wsWindowExpose )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
2001-10-01 12:28:39 +00:00
|
|
|
if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
2001-11-12 12:26:09 +00:00
|
|
|
appMPlayer.subWindow.State=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
|
|
|
|
{
|
2001-08-31 21:19:52 +00:00
|
|
|
static int mplSubMoved = 0;
|
2001-11-12 12:26:09 +00:00
|
|
|
static int msButton = 0;
|
2001-08-31 21:19:52 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
mplPBShow( X,Y );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
switch( Button )
|
|
|
|
{
|
2005-12-04 15:58:52 +00:00
|
|
|
case wsRRMouseButton:
|
2002-02-23 15:12:55 +00:00
|
|
|
gtkShow( evShowPopUpMenu,NULL );
|
2001-11-18 19:22:55 +00:00
|
|
|
break;
|
2002-07-05 23:47:00 +00:00
|
|
|
case wsPMMouseButton:
|
2002-02-23 15:12:55 +00:00
|
|
|
gtkShow( evHidePopUpMenu,NULL );
|
2001-08-25 21:04:29 +00:00
|
|
|
mplShowMenu( RX,RY );
|
2002-07-05 23:47:00 +00:00
|
|
|
msButton=wsPMMouseButton;
|
2001-08-25 21:04:29 +00:00
|
|
|
break;
|
2002-07-05 23:47:00 +00:00
|
|
|
case wsRMMouseButton:
|
2002-05-01 09:29:06 +00:00
|
|
|
mplHideMenu( RX,RY,1 );
|
2001-08-25 21:04:29 +00:00
|
|
|
msButton=0;
|
|
|
|
break;
|
2001-11-12 12:26:09 +00:00
|
|
|
// ---
|
2001-08-25 21:04:29 +00:00
|
|
|
case wsPLMouseButton:
|
2002-02-23 15:12:55 +00:00
|
|
|
gtkShow( evHidePopUpMenu,NULL );
|
2001-08-25 21:04:29 +00:00
|
|
|
sx=X; sy=Y;
|
|
|
|
msButton=wsPLMouseButton;
|
|
|
|
mplSubMoved=0;
|
|
|
|
break;
|
|
|
|
case wsMoveMouse:
|
|
|
|
switch ( msButton )
|
|
|
|
{
|
|
|
|
case wsPLMouseButton:
|
|
|
|
mplSubMoved=1;
|
2001-11-12 15:16:13 +00:00
|
|
|
if ( !appMPlayer.subWindow.isFullScreen ) wsMoveWindow( &appMPlayer.subWindow,False,RX - sx,RY - sy );
|
2001-08-25 21:04:29 +00:00
|
|
|
break;
|
2002-07-05 23:47:00 +00:00
|
|
|
case wsPMMouseButton:
|
2001-08-25 21:04:29 +00:00
|
|
|
mplMenuMouseHandle( X,Y,RX,RY );
|
|
|
|
break;
|
2003-01-17 22:39:43 +00:00
|
|
|
default: mplPBShow( X,Y ); break;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case wsRLMouseButton:
|
2002-05-06 15:05:07 +00:00
|
|
|
if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) )
|
2001-11-12 12:26:09 +00:00
|
|
|
{
|
2002-05-20 13:56:16 +00:00
|
|
|
if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
|
2003-01-09 20:47:14 +00:00
|
|
|
else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
|
2002-07-02 22:31:50 +00:00
|
|
|
}
|
2001-08-25 21:04:29 +00:00
|
|
|
msButton=0;
|
|
|
|
mplSubMoved=0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|