2 * AutoSpace Window System for Linux/Win32 v0.61
3 * written by pontscho/fresh!mindworkz
5 * This file is part of MPlayer.
7 * MPlayer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * MPlayer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef MPLAYER_GUI_WS_H
23 #define MPLAYER_GUI_WS_H
26 #include <X11/Xutil.h>
27 #include <X11/keysym.h>
28 #include <X11/Xatom.h>
29 #include <X11/extensions/XShm.h>
31 #include <X11/extensions/dpms.h>
34 #define wsKeyReleased 0
35 #define wsKeyPressed 1
37 #define wsShift (1L<<0)
38 #define wsLock (1L<<1)
39 #define wsCtrl (1L<<2)
42 #define wsPLMouseButton 1
43 #define wsPMMouseButton 2
44 #define wsPRMouseButton 3
45 #define wsP4MouseButton 4
46 #define wsP5MouseButton 5
47 #define wsRLMouseButton (1 + 128)
48 #define wsRMMouseButton (2 + 128)
49 #define wsRRMouseButton (3 + 128)
50 #define wsR4MouseButton (4 + 128)
51 #define wsR5MouseButton (5 + 128)
52 #define wsEnterWindow 253
53 #define wsLeaveWindow 254
54 #define wsMoveMouse 255
56 #define wsShowMouseCursor 1
58 #define wsHideMouseCursor 0
60 #define wsHandleMouseButton 2
61 #define wsHandleMouseMove 4
69 #define wsShowWindow 8
70 #define wsHideWindow 16
71 #define wsOverredirect 32
75 #define wsSysName "AutoSpace Window System LiTe"
86 #define wsWindowVisible 1
87 #define wsWindowPartialVisible 2
88 #define wsWindowNotVisible 4
89 #define wsWindowMapped 8
90 #define wsWindowUnmapped 16
91 #define wsWindowFocusIn 32
92 #define wsWindowFocusOut 64
93 #define wsWindowExpose 128
94 #define wsWindowRolled 256
95 #define wsWindowClosed 512
101 #define wsNotVisible 4
105 #define wsWMUnknown 0
111 typedef void (*wsTReDraw
)( void );
112 typedef void (*wsTReSize
)( unsigned int X
,unsigned int Y
,unsigned int width
,unsigned int height
);
113 typedef void (*wsTIdle
)( void );
114 typedef void (*wsTKeyHandler
)( int KeyCode
,int Type
,int Key
);
115 typedef void (*wsTMouseHandler
)( int Button
,int X
,int Y
,int RX
,int RY
);
116 typedef void (*wsTDNDHandler
)( int num
,char ** str
);
122 int X
,Y
,Width
,Height
;
123 int OldX
,OldY
,OldWidth
,OldHeight
;
128 unsigned char * bImage
;
142 wsTKeyHandler KeyHandler
;
143 wsTMouseHandler MouseHandler
;
144 wsTDNDHandler DandDHandler
;
151 // --- Misc -------------------------------------------------------------------------------------
153 Atom AtomDeleteWindow
;
157 Atom AtomsProtocols
[3];
158 Atom AtomLeaderClient
;
161 Atom AtomWMNormalHint
;
163 XShmSegmentInfo Shminfo
;
164 unsigned char * ImageData
;
165 unsigned short int * ImageDataw
;
166 unsigned int * ImageDatadw
;
169 unsigned long WindowMask
;
170 XVisualInfo VisualInfo
;
171 XSetWindowAttributes WindowAttrib
;
179 char wsCursorData
[1];
180 Pixmap wsCursorPixmap
;
181 int wsMouseEventType
;
190 extern Display
* wsDisplay
;
192 extern Window wsRootWin
;
195 extern unsigned char * wsImageData
;
197 extern XEvent wsEvent
;
199 extern int wsDepthOnScreen
;
200 extern int wsRedMask
;
201 extern int wsGreenMask
;
202 extern int wsBlueMask
;
204 extern int wsUseXShm
;
206 // ----------------------------------------------------------------------------------------------
208 // ----------------------------------------------------------------------------------------------
209 extern unsigned long wsKeyTable
[512];
211 void wsXDone( void );
212 void wsXInit( void* disp
);
214 int wsGetDepthOnScreen( void );
216 void wsDoExit( void );
217 void wsMainLoop( void );
218 Bool
wsEvents( Display
* display
, XEvent
* Event
, XPointer arg
);
219 void wsHandleEvents( void );
221 // ----------------------------------------------------------------------------------------------
222 // wsCrateWindow: create a new window on the screen.
223 // X,Y : window position
224 // wX,hY : window size
225 // bW : window frame size
226 // cV : mouse cursor visible
227 // D : "decoration", visible titlebar, etc ...
228 // ----------------------------------------------------------------------------------------------
229 void wsCreateWindow( wsTWindow
* win
, int X
, int Y
, int wX
, int hY
, int bW
, int cV
, unsigned char D
, char * label
);
230 void wsDestroyWindow( wsTWindow
* win
);
231 void wsMoveWindow( wsTWindow
* win
, int b
, int x
, int y
);
232 void wsResizeWindow( wsTWindow
* win
, int sx
, int sy
);
233 void wsIconify( wsTWindow win
);
234 void wsMoveTopWindow( Display
* wsDisplay
, Window win
);
235 void wsSetBackground( wsTWindow
* win
, int color
);
236 void wsSetForegroundRGB( wsTWindow
* win
, int r
, int g
, int b
);
237 void wsSetBackgroundRGB( wsTWindow
* win
, int r
, int g
, int b
);
238 #define wsClearWindow( win ) XClearWindow( wsDisplay, win.WindowID )
239 void wsSetTitle( wsTWindow
* win
, char * name
);
240 void wsVisibleWindow( wsTWindow
* win
, int show
);
241 void wsWindowDecoration( wsTWindow
* win
, long d
);
242 void wsSetLayer( Display
* wsDisplay
, Window win
, int layer
);
243 void wsFullScreen( wsTWindow
* win
);
244 void wsPostRedisplay( wsTWindow
* win
);
245 void wsSetShape( wsTWindow
* win
, char * data
);
246 void wsSetIcon( Display
* dsp
, Window win
, Pixmap icon
, Pixmap mask
);
248 // ----------------------------------------------------------------------------------------------
249 // Draw string at x,y with fc ( foreground color ) and bc ( background color ).
250 // ----------------------------------------------------------------------------------------------
251 void wsDrawString( wsTWindow win
, int x
, int y
, char * str
, int fc
, int bc
);
252 int wsTextWidth( wsTWindow win
, char * str
);
254 // ----------------------------------------------------------------------------------------------
255 // Show / hide mouse cursor.
256 // ----------------------------------------------------------------------------------------------
257 void wsVisibleMouse( wsTWindow
* win
, int m
);
258 void wsSetMousePosition( wsTWindow
* win
, int x
, int y
);
260 // ----------------------------------------------------------------------------------------------
262 // ----------------------------------------------------------------------------------------------
263 void wsCreateImage( wsTWindow
* win
, int Width
, int Height
);
264 void wsConvert( wsTWindow
* win
, unsigned char * Image
, unsigned int Size
);
265 void wsPutImage( wsTWindow
* win
);
266 void wsResizeImage( wsTWindow
* win
, int Width
, int Height
);
267 void wsDestroyImage( wsTWindow
* win
);
268 int wsGetOutMask( void );
270 void wsScreenSaverOn( Display
*mDisplay
);
271 void wsScreenSaverOff( Display
* mDisplay
);
273 #define wgIsRect( X,Y,tX,tY,bX,bY ) ( ( (X) > (tX) )&&( (Y) > (tY) )&&( (X) < (bX) )&&( (Y) < (bY) ) )
275 #endif /* MPLAYER_GUI_WS_H */