26458
|
1 /*
|
|
2 * AutoSpace Window System for Linux/Win32 v0.61
|
|
3 * written by pontscho/fresh!mindworkz
|
|
4 *
|
|
5 * This file is part of MPlayer.
|
|
6 *
|
|
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.
|
|
11 *
|
|
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.
|
|
16 *
|
|
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.
|
|
20 */
|
23077
|
21
|
26029
|
22 #ifndef MPLAYER_GUI_WS_H
|
|
23 #define MPLAYER_GUI_WS_H
|
23077
|
24
|
|
25 #include <X11/Xlib.h>
|
|
26 #include <X11/Xutil.h>
|
|
27 #include <X11/keysym.h>
|
|
28 #include <X11/Xatom.h>
|
|
29 #include <X11/extensions/XShm.h>
|
|
30 #ifdef HAVE_XDPMS
|
|
31 #include <X11/extensions/dpms.h>
|
|
32 #endif
|
|
33
|
|
34 #define wsKeyReleased 0
|
|
35 #define wsKeyPressed 1
|
|
36
|
|
37 #define wsShift (1L<<0)
|
|
38 #define wsLock (1L<<1)
|
|
39 #define wsCtrl (1L<<2)
|
|
40 #define wsAlt (1L<<3)
|
|
41
|
|
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
|
|
55
|
|
56 #define wsShowMouseCursor 1
|
|
57 #define wsMouse 1
|
|
58 #define wsHideMouseCursor 0
|
|
59 #define wsNoMouse 0
|
|
60 #define wsHandleMouseButton 2
|
|
61 #define wsHandleMouseMove 4
|
|
62
|
|
63 #define wsHideFrame 0
|
|
64 #define wsNoFrame 0
|
|
65 #define wsShowFrame 1
|
|
66 #define wsFrame 1
|
|
67 #define wsMaxSize 2
|
|
68 #define wsMinSize 4
|
|
69 #define wsShowWindow 8
|
|
70 #define wsHideWindow 16
|
|
71 #define wsOverredirect 32
|
|
72
|
|
73 #define wsNoBorder 0
|
|
74
|
|
75 #define wsSysName "AutoSpace Window System LiTe"
|
|
76
|
|
77 #define wsRGB32 1
|
|
78 #define wsBGR32 2
|
|
79 #define wsRGB24 3
|
|
80 #define wsBGR24 4
|
|
81 #define wsRGB16 5
|
|
82 #define wsBGR16 6
|
|
83 #define wsRGB15 7
|
|
84 #define wsBGR15 8
|
|
85
|
|
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
|
|
96
|
|
97 #define wsNone 0
|
|
98 #define wsMapped 1
|
|
99 #define wsFocused 2
|
|
100 #define wsVisible 3
|
|
101 #define wsNotVisible 4
|
|
102 #define wsPVisible 5
|
|
103 #define wsRolled 6
|
|
104
|
|
105 #define wsWMUnknown 0
|
|
106 #define wsWMNetWM 1
|
|
107 #define wsWMKDE 2
|
|
108 #define wsWMIceWM 3
|
|
109 #define wsWMWMaker 4
|
|
110
|
|
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 );
|
|
117
|
|
118 typedef struct
|
|
119 {
|
|
120 Window WindowID;
|
|
121 Window Parent;
|
|
122 int X,Y,Width,Height;
|
|
123 int OldX,OldY,OldWidth,OldHeight;
|
|
124 int MaxX,MaxY;
|
|
125 int isFullScreen;
|
|
126 int BorderWidth;
|
|
127 int Property;
|
|
128 unsigned char * bImage;
|
|
129 XImage * xImage;
|
|
130 Pixmap Mask;
|
|
131 int Decorations;
|
|
132
|
|
133 int State;
|
|
134 int Visible;
|
|
135 int Mapped;
|
|
136 int Focused;
|
|
137 int Rolled;
|
|
138
|
|
139 wsTReDraw ReDraw;
|
|
140 wsTReSize ReSize;
|
|
141 wsTIdle Idle;
|
|
142 wsTKeyHandler KeyHandler;
|
|
143 wsTMouseHandler MouseHandler;
|
|
144 wsTDNDHandler DandDHandler;
|
|
145
|
|
146 int Alt;
|
|
147 int Shift;
|
|
148 int Control;
|
|
149 int NumLock;
|
|
150 int CapsLock;
|
|
151 // --- Misc -------------------------------------------------------------------------------------
|
|
152
|
|
153 Atom AtomDeleteWindow;
|
|
154 Atom AtomTakeFocus;
|
|
155 Atom AtomRolle;
|
|
156 Atom AtomProtocols;
|
|
157 Atom AtomsProtocols[3];
|
|
158 Atom AtomLeaderClient;
|
|
159 Atom AtomRemote;
|
|
160 Atom AtomWMSizeHint;
|
|
161 Atom AtomWMNormalHint;
|
|
162
|
|
163 XShmSegmentInfo Shminfo;
|
|
164 unsigned char * ImageData;
|
|
165 unsigned short int * ImageDataw;
|
|
166 unsigned int * ImageDatadw;
|
|
167 GC wGC;
|
|
168 XGCValues wGCV;
|
|
169 unsigned long WindowMask;
|
|
170 XVisualInfo VisualInfo;
|
|
171 XSetWindowAttributes WindowAttrib;
|
|
172 XSizeHints SizeHint;
|
|
173 XWMHints WMHints;
|
|
174
|
|
175 XFontStruct * Font;
|
|
176 int FontHeight;
|
|
177
|
|
178 Cursor wsCursor;
|
|
179 char wsCursorData[1];
|
|
180 Pixmap wsCursorPixmap;
|
|
181 int wsMouseEventType;
|
|
182 XColor wsColor;
|
|
183 } wsTWindow;
|
|
184
|
|
185 extern int wsMaxX;
|
|
186 extern int wsMaxY;
|
|
187 extern int wsOrgX;
|
|
188 extern int wsOrgY;
|
|
189
|
|
190 extern Display * wsDisplay;
|
|
191 extern int wsScreen;
|
|
192 extern Window wsRootWin;
|
|
193 extern int wsLayer;
|
|
194
|
|
195 extern unsigned char * wsImageData;
|
|
196
|
|
197 extern XEvent wsEvent;
|
|
198
|
|
199 extern int wsDepthOnScreen;
|
|
200 extern int wsRedMask;
|
|
201 extern int wsGreenMask;
|
|
202 extern int wsBlueMask;
|
|
203
|
|
204 extern int wsUseXShm;
|
|
205
|
|
206 // ----------------------------------------------------------------------------------------------
|
|
207 // wsKeyTable
|
|
208 // ----------------------------------------------------------------------------------------------
|
|
209 extern unsigned long wsKeyTable[512];
|
|
210
|
|
211 extern void wsXDone( void );
|
|
212 extern void wsXInit( void* disp );
|
|
213
|
|
214 extern int wsGetDepthOnScreen( void );
|
|
215
|
|
216 extern void wsDoExit( void );
|
|
217 extern void wsMainLoop( void );
|
|
218 extern Bool wsEvents( Display * display,XEvent * Event,XPointer arg );
|
|
219 extern void wsHandleEvents( void );
|
|
220
|
|
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 extern void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,unsigned char D,char * label );
|
|
230 extern void wsDestroyWindow( wsTWindow * win );
|
|
231 extern void wsMoveWindow( wsTWindow * win,int b,int x, int y );
|
|
232 extern void wsResizeWindow( wsTWindow * win,int sx, int sy );
|
|
233 extern void wsIconify( wsTWindow win );
|
|
234 extern void wsMoveTopWindow( Display * wsDisplay,Window win );
|
|
235 extern void wsSetBackground( wsTWindow * win,int color );
|
|
236 extern void wsSetForegroundRGB( wsTWindow * win,int r,int g,int b );
|
|
237 extern void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b );
|
|
238 #define wsClearWindow( win ) XClearWindow( wsDisplay,win.WindowID )
|
|
239 extern void wsSetTitle( wsTWindow * win,char * name );
|
|
240 extern void wsVisibleWindow( wsTWindow * win,int show );
|
|
241 extern void wsWindowDecoration( wsTWindow * win,long d );
|
|
242 extern void wsSetLayer( Display * wsDisplay,Window win, int layer );
|
|
243 extern void wsFullScreen( wsTWindow * win );
|
|
244 extern void wsPostRedisplay( wsTWindow * win );
|
|
245 extern void wsSetShape( wsTWindow * win,char * data );
|
|
246 extern void wsSetIcon( Display * dsp,Window win,Pixmap icon,Pixmap mask );
|
|
247
|
|
248 // ----------------------------------------------------------------------------------------------
|
|
249 // Draw string at x,y with fc ( foreground color ) and bc ( background color ).
|
|
250 // ----------------------------------------------------------------------------------------------
|
|
251 extern void wsDrawString( wsTWindow win,int x,int y,char * str,int fc,int bc );
|
|
252 extern int wsTextWidth( wsTWindow win,char * str );
|
|
253
|
|
254 // ----------------------------------------------------------------------------------------------
|
|
255 // Show / hide mouse cursor.
|
|
256 // ----------------------------------------------------------------------------------------------
|
|
257 extern void wsVisibleMouse( wsTWindow * win,int m );
|
|
258 extern void wsSetMousePosition( wsTWindow * win,int x, int y );
|
|
259
|
|
260 // ----------------------------------------------------------------------------------------------
|
|
261 // Image handling
|
|
262 // ----------------------------------------------------------------------------------------------
|
|
263 extern void wsCreateImage( wsTWindow * win,int Width,int Height );
|
|
264 extern void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size );
|
|
265 extern void wsPutImage( wsTWindow * win );
|
|
266 extern void wsResizeImage( wsTWindow * win,int Width,int Height );
|
|
267 extern void wsDestroyImage( wsTWindow * win );
|
|
268 extern int wsGetOutMask( void );
|
|
269
|
|
270 extern void wsScreenSaverOn( Display *mDisplay );
|
|
271 extern void wsScreenSaverOff( Display * mDisplay );
|
|
272
|
|
273 #define wgIsRect( X,Y,tX,tY,bX,bY ) ( ( (X) > (tX) )&&( (Y) > (tY) )&&( (X) < (bX) )&&( (Y) < (bY) ) )
|
|
274
|
26029
|
275 #endif /* MPLAYER_GUI_WS_H */
|