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