2008-04-22 09:33:39 +00:00
|
|
|
/*
|
|
|
|
* AutoSpace Window System for Linux/Win32 v0.61
|
|
|
|
* written by pontscho/fresh!mindworkz
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_GUI_WS_H
|
|
|
|
#define MPLAYER_GUI_WS_H
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
#include <X11/extensions/XShm.h>
|
2002-02-12 22:06:12 +00:00
|
|
|
#ifdef HAVE_XDPMS
|
2001-08-25 21:04:29 +00:00
|
|
|
#include <X11/extensions/dpms.h>
|
2002-02-12 22:06:12 +00:00
|
|
|
#endif
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#define wsKeyReleased 0
|
|
|
|
#define wsKeyPressed 1
|
|
|
|
|
|
|
|
#define wsShift (1L<<0)
|
|
|
|
#define wsLock (1L<<1)
|
|
|
|
#define wsCtrl (1L<<2)
|
|
|
|
#define wsAlt (1L<<3)
|
|
|
|
|
|
|
|
#define wsPLMouseButton 1
|
|
|
|
#define wsPMMouseButton 2
|
|
|
|
#define wsPRMouseButton 3
|
2001-11-12 12:26:09 +00:00
|
|
|
#define wsP4MouseButton 4
|
|
|
|
#define wsP5MouseButton 5
|
2006-10-08 10:02:40 +00:00
|
|
|
#define wsRLMouseButton (1 + 128)
|
|
|
|
#define wsRMMouseButton (2 + 128)
|
|
|
|
#define wsRRMouseButton (3 + 128)
|
|
|
|
#define wsR4MouseButton (4 + 128)
|
|
|
|
#define wsR5MouseButton (5 + 128)
|
2001-08-25 21:04:29 +00:00
|
|
|
#define wsEnterWindow 253
|
|
|
|
#define wsLeaveWindow 254
|
|
|
|
#define wsMoveMouse 255
|
|
|
|
|
|
|
|
#define wsShowMouseCursor 1
|
|
|
|
#define wsMouse 1
|
|
|
|
#define wsHideMouseCursor 0
|
|
|
|
#define wsNoMouse 0
|
|
|
|
#define wsHandleMouseButton 2
|
|
|
|
#define wsHandleMouseMove 4
|
|
|
|
|
|
|
|
#define wsHideFrame 0
|
|
|
|
#define wsNoFrame 0
|
|
|
|
#define wsShowFrame 1
|
|
|
|
#define wsFrame 1
|
|
|
|
#define wsMaxSize 2
|
|
|
|
#define wsMinSize 4
|
|
|
|
#define wsShowWindow 8
|
|
|
|
#define wsHideWindow 16
|
|
|
|
#define wsOverredirect 32
|
|
|
|
|
|
|
|
#define wsNoBorder 0
|
|
|
|
|
|
|
|
#define wsSysName "AutoSpace Window System LiTe"
|
|
|
|
|
|
|
|
#define wsRGB32 1
|
|
|
|
#define wsBGR32 2
|
|
|
|
#define wsRGB24 3
|
|
|
|
#define wsBGR24 4
|
|
|
|
#define wsRGB16 5
|
|
|
|
#define wsBGR16 6
|
|
|
|
#define wsRGB15 7
|
|
|
|
#define wsBGR15 8
|
|
|
|
|
|
|
|
#define wsWindowVisible 1
|
|
|
|
#define wsWindowPartialVisible 2
|
|
|
|
#define wsWindowNotVisible 4
|
|
|
|
#define wsWindowMapped 8
|
|
|
|
#define wsWindowUnmapped 16
|
|
|
|
#define wsWindowFocusIn 32
|
|
|
|
#define wsWindowFocusOut 64
|
|
|
|
#define wsWindowExpose 128
|
|
|
|
#define wsWindowRolled 256
|
2002-05-01 09:29:06 +00:00
|
|
|
#define wsWindowClosed 512
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#define wsNone 0
|
|
|
|
#define wsMapped 1
|
|
|
|
#define wsFocused 2
|
|
|
|
#define wsVisible 3
|
|
|
|
#define wsNotVisible 4
|
|
|
|
#define wsPVisible 5
|
|
|
|
#define wsRolled 6
|
|
|
|
|
2002-05-14 11:41:02 +00:00
|
|
|
#define wsWMUnknown 0
|
|
|
|
#define wsWMNetWM 1
|
|
|
|
#define wsWMKDE 2
|
|
|
|
#define wsWMIceWM 3
|
|
|
|
#define wsWMWMaker 4
|
2002-05-06 15:05:07 +00:00
|
|
|
|
2002-11-02 20:10:18 +00:00
|
|
|
typedef void (*wsTReDraw)( void );
|
2001-08-25 21:04:29 +00:00
|
|
|
typedef void (*wsTReSize)( unsigned int X,unsigned int Y,unsigned int width,unsigned int height );
|
|
|
|
typedef void (*wsTIdle)( void );
|
2002-05-25 09:46:37 +00:00
|
|
|
typedef void (*wsTKeyHandler)( int KeyCode,int Type,int Key );
|
2001-08-25 21:04:29 +00:00
|
|
|
typedef void (*wsTMouseHandler)( int Button,int X,int Y,int RX,int RY );
|
2002-08-11 13:12:38 +00:00
|
|
|
typedef void (*wsTDNDHandler)( int num,char ** str );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Window WindowID;
|
|
|
|
Window Parent;
|
|
|
|
int X,Y,Width,Height;
|
|
|
|
int OldX,OldY,OldWidth,OldHeight;
|
|
|
|
int MaxX,MaxY;
|
|
|
|
int isFullScreen;
|
|
|
|
int BorderWidth;
|
|
|
|
int Property;
|
|
|
|
unsigned char * bImage;
|
|
|
|
XImage * xImage;
|
|
|
|
Pixmap Mask;
|
|
|
|
int Decorations;
|
|
|
|
|
|
|
|
int State;
|
|
|
|
int Visible;
|
|
|
|
int Mapped;
|
|
|
|
int Focused;
|
|
|
|
int Rolled;
|
|
|
|
|
|
|
|
wsTReDraw ReDraw;
|
|
|
|
wsTReSize ReSize;
|
|
|
|
wsTIdle Idle;
|
|
|
|
wsTKeyHandler KeyHandler;
|
|
|
|
wsTMouseHandler MouseHandler;
|
2002-08-11 13:12:38 +00:00
|
|
|
wsTDNDHandler DandDHandler;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
int Alt;
|
|
|
|
int Shift;
|
|
|
|
int Control;
|
|
|
|
int NumLock;
|
|
|
|
int CapsLock;
|
|
|
|
// --- Misc -------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Atom AtomDeleteWindow;
|
|
|
|
Atom AtomTakeFocus;
|
|
|
|
Atom AtomRolle;
|
|
|
|
Atom AtomProtocols;
|
|
|
|
Atom AtomsProtocols[3];
|
|
|
|
Atom AtomLeaderClient;
|
|
|
|
Atom AtomRemote;
|
2001-11-12 12:26:09 +00:00
|
|
|
Atom AtomWMSizeHint;
|
|
|
|
Atom AtomWMNormalHint;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
XShmSegmentInfo Shminfo;
|
|
|
|
unsigned char * ImageData;
|
|
|
|
unsigned short int * ImageDataw;
|
|
|
|
unsigned int * ImageDatadw;
|
|
|
|
GC wGC;
|
|
|
|
XGCValues wGCV;
|
|
|
|
unsigned long WindowMask;
|
|
|
|
XVisualInfo VisualInfo;
|
|
|
|
XSetWindowAttributes WindowAttrib;
|
|
|
|
XSizeHints SizeHint;
|
|
|
|
XWMHints WMHints;
|
|
|
|
|
|
|
|
XFontStruct * Font;
|
|
|
|
int FontHeight;
|
|
|
|
|
|
|
|
Cursor wsCursor;
|
|
|
|
char wsCursorData[1];
|
|
|
|
Pixmap wsCursorPixmap;
|
|
|
|
int wsMouseEventType;
|
|
|
|
XColor wsColor;
|
|
|
|
} wsTWindow;
|
|
|
|
|
2002-02-01 16:34:22 +00:00
|
|
|
extern int wsMaxX;
|
|
|
|
extern int wsMaxY;
|
2003-05-26 08:45:43 +00:00
|
|
|
extern int wsOrgX;
|
|
|
|
extern int wsOrgY;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
extern Display * wsDisplay;
|
|
|
|
extern int wsScreen;
|
|
|
|
extern Window wsRootWin;
|
2002-05-06 15:05:07 +00:00
|
|
|
extern int wsLayer;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
extern unsigned char * wsImageData;
|
|
|
|
|
|
|
|
extern XEvent wsEvent;
|
|
|
|
|
|
|
|
extern int wsDepthOnScreen;
|
|
|
|
extern int wsRedMask;
|
|
|
|
extern int wsGreenMask;
|
|
|
|
extern int wsBlueMask;
|
|
|
|
|
|
|
|
extern int wsUseXShm;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
// wsKeyTable
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
extern unsigned long wsKeyTable[512];
|
|
|
|
|
|
|
|
extern void wsXDone( void );
|
2001-08-27 23:56:44 +00:00
|
|
|
extern void wsXInit( void* disp );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
extern int wsGetDepthOnScreen( void );
|
|
|
|
|
|
|
|
extern void wsDoExit( void );
|
|
|
|
extern void wsMainLoop( void );
|
2002-02-23 15:12:55 +00:00
|
|
|
extern Bool wsEvents( Display * display,XEvent * Event,XPointer arg );
|
|
|
|
extern void wsHandleEvents( void );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
// wsCrateWindow: create a new window on the screen.
|
|
|
|
// X,Y : window position
|
|
|
|
// wX,hY : window size
|
|
|
|
// bW : window frame size
|
|
|
|
// cV : mouse cursor visible
|
|
|
|
// D : "decoration", visible titlebar, etc ...
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
extern void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,unsigned char D,char * label );
|
|
|
|
extern void wsDestroyWindow( wsTWindow * win );
|
2001-11-12 15:16:13 +00:00
|
|
|
extern void wsMoveWindow( wsTWindow * win,int b,int x, int y );
|
2001-08-25 21:04:29 +00:00
|
|
|
extern void wsResizeWindow( wsTWindow * win,int sx, int sy );
|
|
|
|
extern void wsIconify( wsTWindow win );
|
2002-05-20 13:56:16 +00:00
|
|
|
extern void wsMoveTopWindow( Display * wsDisplay,Window win );
|
2001-08-25 21:04:29 +00:00
|
|
|
extern void wsSetBackground( wsTWindow * win,int color );
|
2001-08-31 22:06:28 +00:00
|
|
|
extern void wsSetForegroundRGB( wsTWindow * win,int r,int g,int b );
|
2001-08-25 21:04:29 +00:00
|
|
|
extern void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b );
|
2002-07-25 20:26:38 +00:00
|
|
|
#define wsClearWindow( win ) XClearWindow( wsDisplay,win.WindowID )
|
2001-08-25 21:04:29 +00:00
|
|
|
extern void wsSetTitle( wsTWindow * win,char * name );
|
|
|
|
extern void wsVisibleWindow( wsTWindow * win,int show );
|
|
|
|
extern void wsWindowDecoration( wsTWindow * win,long d );
|
2002-05-06 15:05:07 +00:00
|
|
|
extern void wsSetLayer( Display * wsDisplay,Window win, int layer );
|
2001-08-25 21:04:29 +00:00
|
|
|
extern void wsFullScreen( wsTWindow * win );
|
|
|
|
extern void wsPostRedisplay( wsTWindow * win );
|
|
|
|
extern void wsSetShape( wsTWindow * win,char * data );
|
2002-07-05 23:47:00 +00:00
|
|
|
extern void wsSetIcon( Display * dsp,Window win,Pixmap icon,Pixmap mask );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
// Draw string at x,y with fc ( foreground color ) and bc ( background color ).
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
extern void wsDrawString( wsTWindow win,int x,int y,char * str,int fc,int bc );
|
|
|
|
extern int wsTextWidth( wsTWindow win,char * str );
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
// Show / hide mouse cursor.
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
extern void wsVisibleMouse( wsTWindow * win,int m );
|
|
|
|
extern void wsSetMousePosition( wsTWindow * win,int x, int y );
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
|
|
|
// Image handling
|
|
|
|
// ----------------------------------------------------------------------------------------------
|
2001-09-05 18:17:22 +00:00
|
|
|
extern void wsCreateImage( wsTWindow * win,int Width,int Height );
|
2001-08-25 21:04:29 +00:00
|
|
|
extern void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size );
|
|
|
|
extern void wsPutImage( wsTWindow * win );
|
2001-09-05 18:17:22 +00:00
|
|
|
extern void wsResizeImage( wsTWindow * win,int Width,int Height );
|
2001-08-25 21:04:29 +00:00
|
|
|
extern void wsDestroyImage( wsTWindow * win );
|
|
|
|
extern int wsGetOutMask( void );
|
|
|
|
|
|
|
|
extern void wsScreenSaverOn( Display *mDisplay );
|
|
|
|
extern void wsScreenSaverOff( Display * mDisplay );
|
|
|
|
|
2003-01-15 11:16:33 +00:00
|
|
|
#define wgIsRect( X,Y,tX,tY,bX,bY ) ( ( (X) > (tX) )&&( (Y) > (tY) )&&( (X) < (bX) )&&( (Y) < (bY) ) )
|
2002-11-02 18:18:24 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_GUI_WS_H */
|