Mercurial > mplayer.hg
annotate Gui/wm/ws.c @ 6967:0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
author | pontscho |
---|---|
date | Sun, 11 Aug 2002 13:12:38 +0000 |
parents | 77980ab4e296 |
children | 09722d199d83 |
rev | line source |
---|---|
1693 | 1 |
2 // -------------------------------------------------------------------------- | |
3 // AutoSpace Window System for Linux/Win32 v0.85 | |
4 // Writed by pontscho/fresh!mindworkz | |
5 // -------------------------------------------------------------------------- | |
6 | |
7 #include <X11/Xlib.h> | |
8 #include <X11/Xproto.h> | |
9 #include <X11/Xutil.h> | |
10 #include <X11/keysym.h> | |
11 #include <X11/Xatom.h> | |
2081 | 12 |
13 #include <stdio.h> | |
1693 | 14 #include <stdlib.h> |
2081 | 15 #include <string.h> |
16 #include <unistd.h> | |
17 #include <errno.h> | |
1693 | 18 |
2733 | 19 #include <inttypes.h> |
20 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4566
diff
changeset
|
21 #include "../../config.h" |
1693 | 22 #include "ws.h" |
23 #include "wsconv.h" | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
24 #include "wsxdnd.h" |
2733 | 25 #include "../../postproc/rgb2rgb.h" |
5919 | 26 #include "../../mp_msg.h" |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
27 #include "../../mplayer.h" |
1693 | 28 |
29 #include <X11/extensions/XShm.h> | |
2476 | 30 #ifdef HAVE_XSHAPE |
1693 | 31 #include <X11/extensions/shape.h> |
2476 | 32 #endif |
33 | |
1693 | 34 #include <sys/ipc.h> |
35 #include <sys/shm.h> | |
36 | |
37 typedef struct | |
38 { | |
3054 | 39 unsigned long flags; |
40 unsigned long functions; | |
41 unsigned long decorations; | |
1693 | 42 long input_mode; |
3054 | 43 unsigned long status; |
1693 | 44 } MotifWmHints; |
45 | |
46 Atom wsMotifHints; | |
47 | |
4465 | 48 int wsMaxX = 0; // Screen width. |
49 int wsMaxY = 0; // Screen height. | |
1693 | 50 |
51 Display * wsDisplay; | |
52 int wsScreen; | |
53 Window wsRootWin; | |
54 XEvent wsEvent; | |
55 int wsWindowDepth; | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
56 int wsWMType = wsWMUnknown; |
1693 | 57 GC wsHGC; |
58 MotifWmHints wsMotifWmHints; | |
59 Atom wsTextProperlyAtom = None; | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
60 int wsLayer = 0; |
1693 | 61 |
62 int wsDepthOnScreen = 0; | |
63 int wsRedMask = 0; | |
64 int wsGreenMask = 0; | |
65 int wsBlueMask = 0; | |
66 int wsOutMask = 0; | |
67 | |
68 int wsTrue = True; | |
69 | |
70 wsTWindow * wsWindowList[5] = { NULL,NULL,NULL,NULL,NULL }; | |
71 int wsWLCount = 0; | |
72 | |
73 unsigned long wsKeyTable[512]; | |
74 | |
75 int wsUseXShm = 1; | |
76 int wsUseXShape = 1; | |
77 | |
78 int XShmGetEventBase( Display* ); | |
79 inline int wsSearch( Window win ); | |
80 | |
81 #define MWM_HINTS_FUNCTIONS (1L << 0) | |
82 #define MWM_HINTS_DECORATIONS (1L << 1) | |
83 #define MWM_HINTS_INPUT_MODE (1L << 2) | |
84 #define MWM_HINTS_STATUS (1L << 3) | |
85 | |
86 #define MWM_FUNC_ALL (1L << 0) | |
87 #define MWM_FUNC_RESIZE (1L << 1) | |
88 #define MWM_FUNC_MOVE (1L << 2) | |
89 #define MWM_FUNC_MINIMIZE (1L << 3) | |
90 #define MWM_FUNC_MAXIMIZE (1L << 4) | |
91 #define MWM_FUNC_CLOSE (1L << 5) | |
92 | |
93 #define MWM_DECOR_ALL (1L << 0) | |
94 #define MWM_DECOR_BORDER (1L << 1) | |
95 #define MWM_DECOR_RESIZEH (1L << 2) | |
96 #define MWM_DECOR_TITLE (1L << 3) | |
97 #define MWM_DECOR_MENU (1L << 4) | |
98 #define MWM_DECOR_MINIMIZE (1L << 5) | |
99 #define MWM_DECOR_MAXIMIZE (1L << 6) | |
100 | |
101 #define MWM_INPUT_MODELESS 0 | |
102 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 | |
103 #define MWM_INPUT_SYSTEM_MODAL 2 | |
104 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 | |
105 #define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL | |
106 | |
107 #define MWM_TEAROFF_WINDOW (1L<<0) | |
108 | |
109 void wsWindowDecoration( wsTWindow * win,long d ) | |
110 { | |
111 wsMotifHints=XInternAtom( wsDisplay,"_MOTIF_WM_HINTS",0 ); | |
3054 | 112 if ( wsMotifHints == None ) return; |
113 | |
114 memset( &wsMotifWmHints,0,sizeof( MotifWmHints ) ); | |
5031 | 115 wsMotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; |
116 if ( d ) | |
117 { | |
118 wsMotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE; | |
119 wsMotifWmHints.decorations=MWM_DECOR_ALL; | |
120 } | |
3054 | 121 XChangeProperty( wsDisplay,win->WindowID,wsMotifHints,wsMotifHints,32, |
122 PropModeReplace,(unsigned char *)&wsMotifWmHints,5 ); | |
1693 | 123 } |
124 | |
125 // ---------------------------------------------------------------------------------------------- | |
126 // Init X Window System. | |
127 // ---------------------------------------------------------------------------------------------- | |
128 | |
129 int wsIOErrorHandler( Display * dpy ) | |
130 { | |
131 fprintf( stderr,"[ws] io error in display.\n" ); | |
132 exit( 0 ); | |
133 } | |
134 | |
135 int wsErrorHandler( Display * dpy,XErrorEvent * Event ) | |
136 { | |
137 char type[128]; | |
138 XGetErrorText( wsDisplay,Event->error_code,type,128 ); | |
139 fprintf(stderr,"[ws] Error in display.\n"); | |
140 fprintf(stderr,"[ws] Error code: %d ( %s )\n",Event->error_code,type ); | |
141 fprintf(stderr,"[ws] Request code: %d\n",Event->request_code ); | |
142 fprintf(stderr,"[ws] Minor code: %d\n",Event->minor_code ); | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
143 fprintf(stderr,"[ws] Modules: %s\n",current_module ); |
1693 | 144 exit( 0 ); |
145 } | |
146 | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
147 int wsWindowManagerType( void ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
148 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
149 Atom type; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
150 int format; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
151 unsigned long nitems, bytesafter; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
152 unsigned char * args = NULL; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
153 |
6009 | 154 Window win; |
155 XEvent xev; | |
156 int c = 0; | |
157 int wm = wsWMUnknown; | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
158 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
159 // --- gnome |
6089 | 160 /* |
6009 | 161 type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); |
6159
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6146
diff
changeset
|
162 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
6009 | 163 { |
164 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is Gnome\n" ); | |
165 XFree( args ); | |
166 return wsWMGnome; | |
167 } | |
6089 | 168 */ |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
169 // --- net wm |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
170 type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); |
6159
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6146
diff
changeset
|
171 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
172 { |
6009 | 173 mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is NetWM\n" ); |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
174 XFree( args ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
175 return wsWMNetWM; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
176 } |
6009 | 177 |
178 // --- other wm | |
179 mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Create window for WM detect ...\n" ); | |
180 win=XCreateSimpleWindow( wsDisplay,wsRootWin,wsMaxX,wsMaxY,1,1,0,0,0 ); | |
181 XSelectInput( wsDisplay,win,PropertyChangeMask | StructureNotifyMask ); | |
182 XMapWindow( wsDisplay,win ); | |
183 XMoveWindow( wsDisplay,win,wsMaxX,wsMaxY ); | |
184 do | |
185 { | |
186 XCheckWindowEvent( wsDisplay,win,PropertyChangeMask | StructureNotifyMask,&xev ); | |
187 | |
188 if ( xev.type == PropertyNotify ) | |
189 { | |
190 char * name = XGetAtomName( wsDisplay,xev.xproperty.atom ); | |
191 if ( !name ) break; | |
192 | |
193 if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) | |
194 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is IceWM.\n" ); wm=wsWMIceWM; break; } | |
195 if ( !strncmp( name,"_KDE_",5 ) ) | |
196 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is KDE.\n" ); wm=wsWMKDE; break; } | |
197 if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) | |
198 { mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); wm=wsWMWMaker; break; } | |
199 // fprintf(stderr,"[ws] PropertyNotify ( 0x%x ) %s ( 0x%x )\n",win,name,xev.xproperty.atom ); | |
200 XFree( name ); | |
201 } | |
202 } while( c++ < 25 ); | |
6089 | 203 XUnmapWindow( wsDisplay,win ); |
6009 | 204 XDestroyWindow( wsDisplay,win ); |
205 #ifdef MP_DEBUG | |
206 if ( wm == wsWMUnknown ) mp_dbg( MSGT_VO,MSGL_STATUS,"[ws] Unknown wm type...\n" ); | |
207 #endif | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
208 return wsWMUnknown; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
209 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
210 |
6089 | 211 extern int vo_wm_type; |
212 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
213 void wsXInit( void* mDisplay ) |
1693 | 214 { |
215 int eventbase; | |
216 int errorbase; | |
217 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
218 if(mDisplay){ |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
219 wsDisplay=mDisplay; |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
220 } else { |
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
221 char * DisplayName = ":0.0"; |
1693 | 222 if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); |
223 wsDisplay=XOpenDisplay( DisplayName ); | |
224 if ( !wsDisplay ) | |
225 { | |
5919 | 226 mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] couldn't open the display !\n" ); |
1693 | 227 exit( 0 ); |
228 } | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1709
diff
changeset
|
229 } |
1693 | 230 |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
231 /* enable DND atoms */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
232 wsXDNDInitialize(); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
233 |
1838 | 234 { /* on remote display XShm will be disabled - LGB */ |
235 char *dispname=DisplayString(wsDisplay); | |
236 int localdisp=1; | |
237 if (dispname&&*dispname!=':') { | |
238 localdisp=0; | |
239 wsUseXShm=0; | |
240 } | |
5919 | 241 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Display name: %s => %s display.\n",dispname,localdisp?"local":"REMOTE"); |
242 if (!localdisp) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Remote display, disabling XMITSHM\n"); | |
1838 | 243 } |
244 | |
1693 | 245 if ( !XShmQueryExtension( wsDisplay ) ) |
246 { | |
5919 | 247 mp_msg( MSGT_GPLAYER,MSGL_ERR,"[ws] sorry, your system is not supported X shared memory extension.\n" ); |
1693 | 248 wsUseXShm=0; |
249 } | |
1699 | 250 #ifdef HAVE_XSHAPE |
1693 | 251 if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) ) |
252 { | |
5919 | 253 mp_msg( MSGT_GPLAYER,MSGL_ERR,"[ws] sorry, your system is not supported XShape extension.\n" ); |
1693 | 254 wsUseXShape=0; |
255 } | |
1699 | 256 #else |
1693 | 257 wsUseXShape=0; |
1699 | 258 #endif |
1693 | 259 |
260 XSynchronize( wsDisplay,True ); | |
261 | |
262 wsScreen=DefaultScreen( wsDisplay ); | |
263 wsRootWin=RootWindow( wsDisplay,wsScreen ); | |
264 wsMaxX=DisplayWidth( wsDisplay,wsScreen ); | |
265 wsMaxY=DisplayHeight( wsDisplay,wsScreen ); | |
266 | |
6089 | 267 if ( vo_wm_type != -1 ) wsWMType=vo_wm_type; |
268 else wsWMType=wsWindowManagerType(); | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
269 |
1693 | 270 wsGetDepthOnScreen(); |
1699 | 271 #ifdef DEBUG |
1693 | 272 { |
273 int minor,major,shp; | |
5919 | 274 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Screen depth: %d\n",wsDepthOnScreen ); |
275 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] size: %dx%d\n",wsMaxX,wsMaxY ); | |
276 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] red mask: 0x%x\n",wsRedMask ); | |
277 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] green mask: 0x%x\n",wsGreenMask ); | |
278 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] blue mask: 0x%x\n",wsBlueMask ); | |
1693 | 279 if ( wsUseXShm ) |
280 { | |
281 XShmQueryVersion( wsDisplay,&major,&minor,&shp ); | |
5919 | 282 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] XShm version is %d.%d\n",major,minor ); |
1693 | 283 } |
284 #ifdef HAVE_XSHAPE | |
285 if ( wsUseXShape ) | |
286 { | |
287 XShapeQueryVersion( wsDisplay,&major,&minor ); | |
5919 | 288 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] XShape version is %d.%d\n",major,minor ); |
1693 | 289 } |
290 #endif | |
291 } | |
1699 | 292 #endif |
1693 | 293 initConverter(); |
294 wsOutMask=wsGetOutMask(); | |
5919 | 295 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Initialized converter: " ); |
1693 | 296 switch ( wsOutMask ) |
297 { | |
298 case wsRGB32: | |
5919 | 299 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb32\n" ); |
6794 | 300 wsConvFunc=(void *)BGR8880_to_RGB8880_c; |
1693 | 301 break; |
302 case wsBGR32: | |
5919 | 303 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr32\n" ); |
2782 | 304 wsConvFunc=rgb32tobgr32; |
1693 | 305 break; |
306 case wsRGB24: | |
5919 | 307 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb24\n" ); |
2733 | 308 wsConvFunc=rgb32to24; |
1693 | 309 break; |
310 case wsBGR24: | |
5919 | 311 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr24\n" ); |
6794 | 312 wsConvFunc=(void *)BGR8880_to_BGR888_c; |
1693 | 313 break; |
314 case wsRGB16: | |
5919 | 315 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb16\n" ); |
2733 | 316 wsConvFunc=rgb32to16; |
1693 | 317 break; |
318 case wsBGR16: | |
5919 | 319 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr16\n" ); |
6794 | 320 wsConvFunc=(void *)BGR8880_to_BGR565_c; |
1693 | 321 break; |
322 case wsRGB15: | |
5919 | 323 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb15\n" ); |
2733 | 324 wsConvFunc=rgb32to15; |
1693 | 325 break; |
326 case wsBGR15: | |
5919 | 327 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr15\n" ); |
6794 | 328 wsConvFunc=(void *)BGR8880_to_BGR555_c; |
1693 | 329 break; |
330 } | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
331 XSetErrorHandler( wsErrorHandler ); |
1693 | 332 } |
333 | |
334 // ---------------------------------------------------------------------------------------------- | |
335 // Create window. | |
336 // X,Y : window position | |
337 // wX,wY : size of window | |
338 // bW : border width | |
339 // cV : visible mouse cursor on window | |
340 // D : visible frame, title, etc. | |
341 // sR : screen ratio | |
342 // ---------------------------------------------------------------------------------------------- | |
343 | |
344 XClassHint wsClassHint; | |
345 XTextProperty wsTextProperty; | |
346 Window LeaderWindow; | |
347 | |
348 void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,unsigned char D,char * label ) | |
349 { | |
350 win->Property=D; | |
351 if ( D & wsShowFrame ) win->Decorations=1; | |
352 wsHGC=DefaultGC( wsDisplay,wsScreen ); | |
353 // The window position and size. | |
354 switch ( X ) | |
355 { | |
356 case -1: win->X=( wsMaxX / 2 ) - ( wX / 2 ); break; | |
357 case -2: win->X=wsMaxX - wX - 1; break; | |
358 default: win->X=X; break; | |
359 } | |
360 switch ( Y ) | |
361 { | |
362 case -1: win->Y=( wsMaxY / 2 ) - ( hY / 2 ); break; | |
363 case -2: win->Y=wsMaxY - hY - 1; break; | |
364 default: win->Y=Y; break; | |
365 } | |
366 win->Width=wX; | |
367 win->Height=hY; | |
368 win->OldX=win->X; | |
369 win->OldY=win->Y; | |
370 win->OldWidth=win->Width; | |
371 win->OldHeight=win->Height; | |
372 | |
373 // Border size for window. | |
374 win->BorderWidth=bW; | |
375 // Hide Mouse Cursor | |
376 win->wsCursor=None; | |
377 win->wsMouseEventType=cV; | |
378 win->wsCursorData[0]=0; | |
379 win->wsCursorPixmap=XCreateBitmapFromData( wsDisplay,wsRootWin,win->wsCursorData,1,1 ); | |
380 if ( !(cV & wsShowMouseCursor) ) win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 ); | |
381 | |
382 XGetWindowAttributes( wsDisplay,wsRootWin,&win->Attribs ); | |
383 if ( win->Attribs.depth < 15 ) | |
384 { | |
5919 | 385 mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] sorry, this color depth is not enough.\n" ); |
1693 | 386 exit( 0 ); |
387 } | |
388 XMatchVisualInfo( wsDisplay,wsScreen,win->Attribs.depth,TrueColor,&win->VisualInfo ); | |
389 | |
390 // --- | |
391 win->AtomLeaderClient=XInternAtom( wsDisplay,"WM_CLIENT_LEADER",False ); | |
392 win->AtomDeleteWindow=XInternAtom( wsDisplay,"WM_DELETE_WINDOW",False ); | |
393 win->AtomTakeFocus=XInternAtom( wsDisplay,"WM_TAKE_FOCUS",False ); | |
394 win->AtomRolle=XInternAtom( wsDisplay,"WM_WINDOW_ROLE",False ); | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
395 win->AtomWMSizeHint=XInternAtom( wsDisplay,"WM_SIZE_HINT",False ); |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
396 win->AtomWMNormalHint=XInternAtom( wsDisplay,"WM_NORMAL_HINT",False ); |
1693 | 397 win->AtomProtocols=XInternAtom( wsDisplay,"WM_PROTOCOLS",False ); |
398 win->AtomsProtocols[0]=win->AtomDeleteWindow; | |
399 win->AtomsProtocols[1]=win->AtomTakeFocus; | |
400 win->AtomsProtocols[2]=win->AtomRolle; | |
401 // --- | |
402 | |
403 win->WindowAttrib.background_pixel=BlackPixel( wsDisplay,wsScreen ); | |
404 win->WindowAttrib.border_pixel=WhitePixel( wsDisplay,wsScreen ); | |
405 win->WindowAttrib.colormap=XCreateColormap( wsDisplay,wsRootWin,win->VisualInfo.visual,AllocNone ); | |
406 win->WindowAttrib.event_mask=StructureNotifyMask | FocusChangeMask | | |
407 ExposureMask | PropertyChangeMask | | |
408 EnterWindowMask | LeaveWindowMask | | |
409 VisibilityChangeMask | | |
410 KeyPressMask | KeyReleaseMask; | |
411 if ( ( cV & wsHandleMouseButton ) ) win->WindowAttrib.event_mask|=ButtonPressMask | ButtonReleaseMask; | |
412 if ( ( cV & wsHandleMouseMove ) ) win->WindowAttrib.event_mask|=PointerMotionMask; | |
413 win->WindowAttrib.cursor=win->wsCursor; | |
414 win->WindowAttrib.override_redirect=False; | |
415 if ( D & wsOverredirect ) win->WindowAttrib.override_redirect=True; | |
416 | |
417 win->WindowMask=CWBackPixel | CWBorderPixel | | |
418 CWColormap | CWEventMask | CWCursor | | |
419 CWX | CWY | CWWidth | CWHeight | | |
420 CWOverrideRedirect; | |
421 | |
422 win->WindowID=XCreateWindow( wsDisplay, | |
423 (win->Parent != 0?win->Parent:wsRootWin), | |
424 win->X,win->Y,win->Width,win->Height,win->BorderWidth, | |
425 win->VisualInfo.depth, | |
426 InputOutput, | |
427 win->VisualInfo.visual, | |
428 win->WindowMask,&win->WindowAttrib ); | |
429 | |
4411 | 430 wsClassHint.res_name="MPlayer"; |
431 | |
2029 | 432 wsClassHint.res_class="MPlayer"; |
1693 | 433 XSetClassHint( wsDisplay,win->WindowID,&wsClassHint ); |
434 | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
435 win->SizeHint.flags=PPosition | PSize | PResizeInc | PWinGravity;// | PBaseSize; |
1693 | 436 win->SizeHint.x=win->X; |
437 win->SizeHint.y=win->Y; | |
438 win->SizeHint.width=win->Width; | |
439 win->SizeHint.height=win->Height; | |
5986 | 440 |
1860 | 441 if ( D & wsMinSize ) |
442 { | |
443 win->SizeHint.flags|=PMinSize; | |
444 win->SizeHint.min_width=win->Width; | |
445 win->SizeHint.min_height=win->Height; | |
446 } | |
1693 | 447 if ( D & wsMaxSize ) |
448 { | |
449 win->SizeHint.flags|=PMaxSize; | |
450 win->SizeHint.max_width=win->Width; | |
451 win->SizeHint.max_height=win->Height; | |
452 } | |
5986 | 453 |
1693 | 454 win->SizeHint.height_inc=1; |
455 win->SizeHint.width_inc=1; | |
5919 | 456 win->SizeHint.base_width=win->Width; |
457 win->SizeHint.base_height=win->Height; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
458 win->SizeHint.win_gravity=StaticGravity; |
1693 | 459 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); |
460 | |
461 win->WMHints.flags=InputHint | StateHint; | |
462 win->WMHints.input=True; | |
463 win->WMHints.initial_state=NormalState; | |
464 XSetWMHints( wsDisplay,win->WindowID,&win->WMHints ); | |
465 | |
466 wsWindowDecoration( win,win->Decorations ); | |
467 XStoreName( wsDisplay,win->WindowID,label ); | |
468 XmbSetWMProperties( wsDisplay,win->WindowID,label,label,NULL,0,NULL,NULL,NULL ); | |
469 | |
470 XSetWMProtocols( wsDisplay,win->WindowID,win->AtomsProtocols,3 ); | |
471 XChangeProperty( wsDisplay,win->WindowID, | |
472 win->AtomLeaderClient, | |
473 XA_WINDOW,32,PropModeReplace, | |
474 (unsigned char *)&LeaderWindow,1 ); | |
475 | |
476 wsTextProperty.value=label; | |
477 wsTextProperty.encoding=XA_STRING; | |
478 wsTextProperty.format=8; | |
479 wsTextProperty.nitems=strlen( label ); | |
480 XSetWMIconName( wsDisplay,win->WindowID,&wsTextProperty ); | |
481 | |
482 win->wGC=XCreateGC( wsDisplay,win->WindowID, | |
1814 | 483 GCForeground | GCBackground, |
1693 | 484 &win->wGCV ); |
485 | |
486 win->Visible=0; | |
487 win->Focused=0; | |
488 win->Mapped=0; | |
489 win->Rolled=0; | |
490 if ( D & wsShowWindow ) XMapWindow( wsDisplay,win->WindowID ); | |
491 | |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1853
diff
changeset
|
492 wsCreateImage( win,win->Width,win->Height ); |
1693 | 493 // --- End of creating -------------------------------------------------------------------------- |
494 | |
495 wsWindowList[wsWLCount++]=win; | |
496 | |
497 XFlush( wsDisplay ); | |
498 XSync( wsDisplay,False ); | |
499 | |
500 win->ReDraw=NULL; | |
501 win->ReSize=NULL; | |
502 win->Idle=NULL; | |
503 win->MouseHandler=NULL; | |
504 win->KeyHandler=NULL; | |
5919 | 505 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] window is created. ( %s ).\n",label ); |
1693 | 506 } |
507 | |
508 void wsDestroyWindow( wsTWindow * win ) | |
509 { | |
510 int l; | |
511 l=wsSearch( win->WindowID ); | |
512 wsWindowList[l]=NULL; | |
513 if ( win->wsCursor != None ) | |
514 { | |
515 XFreeCursor( wsDisplay,win->wsCursor ); | |
516 win->wsCursor=None; | |
517 } | |
518 XUnmapWindow( wsDisplay,win->WindowID ); | |
519 wsDestroyImage( win ); | |
520 XDestroyWindow( wsDisplay,win->WindowID ); | |
521 win->ReDraw=NULL; | |
522 win->ReSize=NULL; | |
523 win->Idle=NULL; | |
524 win->MouseHandler=NULL; | |
525 win->KeyHandler=NULL; | |
526 win->Visible=0; | |
527 win->Focused=0; | |
528 win->Mapped=0; | |
529 win->Rolled=0; | |
530 } | |
531 | |
532 // ---------------------------------------------------------------------------------------------- | |
533 // Handle events. | |
534 // ---------------------------------------------------------------------------------------------- | |
535 | |
536 inline int wsSearch( Window win ) | |
537 { | |
538 int i; | |
539 for ( i=0;i<wsWLCount;i++ ) if ( wsWindowList[i]->WindowID == win ) return i; | |
540 return -1; | |
541 } | |
542 | |
543 Bool wsEvents( Display * display,XEvent * Event,XPointer arg ) | |
544 { | |
545 unsigned long i = 0; | |
546 int l; | |
547 int x,y; | |
548 Window child_window = 0; | |
549 | |
550 l=wsSearch( Event->xany.window ); | |
551 if ( l == -1 ) return !wsTrue; | |
1782 | 552 wsWindowList[l]->State=0; |
1693 | 553 switch( Event->type ) |
554 { | |
555 case ClientMessage: | |
556 if ( Event->xclient.message_type == wsWindowList[l]->AtomProtocols ) | |
557 { | |
558 if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomDeleteWindow ) | |
5919 | 559 { i=wsWindowClosed; goto expose; } |
1693 | 560 if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomTakeFocus ) |
561 { i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; } | |
562 if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomRolle ) | |
5919 | 563 { mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] rolled.\n" ); } |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
564 } else { |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
565 /* try to process DND events */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
566 wsXDNDProcessClientMessage(wsWindowList[l],&Event->xclient); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
567 } |
1693 | 568 break; |
569 | |
570 case MapNotify: i=wsWindowMapped; wsWindowList[l]->Mapped=wsMapped; goto expose; | |
571 case UnmapNotify: i=wsWindowUnmapped; wsWindowList[l]->Mapped=wsNone; goto expose; | |
572 case FocusIn: | |
573 if ( wsWindowList[l]->Focused == wsFocused ) break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
574 i=wsWindowFocusIn; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
575 wsWindowList[l]->Focused=wsFocused; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
576 goto expose; |
1693 | 577 case FocusOut: |
578 if ( wsWindowList[l]->Focused == wsNone ) break; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
579 i=wsWindowFocusOut; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
580 wsWindowList[l]->Focused=wsNone; |
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
581 goto expose; |
1693 | 582 case VisibilityNotify: |
583 switch( Event->xvisibility.state ) | |
584 { | |
585 case VisibilityUnobscured: i=wsWindowVisible; wsWindowList[l]->Visible=wsVisible; goto expose; | |
586 case VisibilityFullyObscured: i=wsWindowNotVisible; wsWindowList[l]->Visible=wsNotVisible; goto expose; | |
587 case VisibilityPartiallyObscured: i=wsWindowPartialVisible; wsWindowList[l]->Visible=wsPVisible; goto expose; | |
588 } | |
589 expose: | |
590 wsWindowList[l]->State=i; | |
591 if ( wsWindowList[l]->ReDraw ) wsWindowList[l]->ReDraw( wsDisplay,Event->xany.window ); | |
592 break; | |
593 | |
594 case Expose: | |
595 wsWindowList[l]->State=wsWindowExpose; | |
596 if ( ( wsWindowList[l]->ReDraw )&&( !Event->xexpose.count ) ) wsWindowList[l]->ReDraw( wsDisplay,Event->xany.window ); | |
597 break; | |
598 | |
599 case ConfigureNotify: | |
600 XTranslateCoordinates( wsDisplay,wsWindowList[l]->WindowID,wsRootWin,0,0,&x,&y,&child_window ); | |
601 if ( ( wsWindowList[l]->X != x )||( wsWindowList[l]->Y != y )||( wsWindowList[l]->Width != Event->xconfigure.width )||( wsWindowList[l]->Height != Event->xconfigure.height ) ) | |
602 { | |
603 wsWindowList[l]->X=x; wsWindowList[l]->Y=y; | |
604 wsWindowList[l]->Width=Event->xconfigure.width; wsWindowList[l]->Height=Event->xconfigure.height; | |
605 if ( wsWindowList[l]->ReSize ) wsWindowList[l]->ReSize( wsWindowList[l]->X,wsWindowList[l]->Y,wsWindowList[l]->Width,wsWindowList[l]->Height ); | |
606 } | |
607 | |
608 wsWindowList[l]->Rolled=wsNone; | |
609 if ( Event->xconfigure.y < 0 ) | |
610 { i=wsWindowRolled; wsWindowList[l]->Rolled=wsRolled; goto expose; } | |
611 | |
612 break; | |
613 | |
614 case KeyPress: i=wsKeyPressed; goto keypressed; | |
615 case KeyRelease: i=wsKeyReleased; | |
616 keypressed: | |
617 wsWindowList[l]->Alt=0; | |
618 wsWindowList[l]->Shift=0; | |
619 wsWindowList[l]->NumLock=0; | |
620 wsWindowList[l]->Control=0; | |
621 wsWindowList[l]->CapsLock=0; | |
622 if ( Event->xkey.state & Mod1Mask ) wsWindowList[l]->Alt=1; | |
623 if ( Event->xkey.state & Mod2Mask ) wsWindowList[l]->NumLock=1; | |
624 if ( Event->xkey.state & ControlMask ) wsWindowList[l]->Control=1; | |
625 if ( Event->xkey.state & ShiftMask ) wsWindowList[l]->Shift=1; | |
626 if ( Event->xkey.state & LockMask ) wsWindowList[l]->CapsLock=1; | |
6089 | 627 #if 0 |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
628 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
629 KeySym keySym; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
630 keySym=XKeycodeToKeysym( wsDisplay,Event->xkey.keycode,0 ); |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
631 if ( keySym != NoSymbol ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
632 { |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
633 keySym=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ); |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
634 wsKeyTable[ keySym ]=i; |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
635 if ( wsWindowList[l]->KeyHandler ) |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
636 wsWindowList[l]->KeyHandler( Event->xkey.state,i,keySym ); |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
637 } |
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
638 } |
6089 | 639 #else |
640 { | |
641 int key; | |
642 char buf[100]; | |
643 KeySym keySym; | |
644 static XComposeStatus stat; | |
645 | |
646 XLookupString( &Event->xkey,buf,sizeof(buf),&keySym,&stat ); | |
647 key=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ); | |
648 wsKeyTable[ key ]=i; | |
6183
a4bbda72ce86
fix two small bug and add multimedia keyboard support ( i tested with Acer AirKey V only )
pontscho
parents:
6159
diff
changeset
|
649 if ( wsWindowList[l]->KeyHandler ) wsWindowList[l]->KeyHandler( Event->xkey.keycode,i,key ); |
6089 | 650 } |
651 #endif | |
1693 | 652 break; |
653 | |
654 case MotionNotify: i=wsMoveMouse; goto buttonreleased; | |
655 case ButtonRelease: i=Event->xbutton.button + 128; goto buttonreleased; | |
656 case ButtonPress: i=Event->xbutton.button; goto buttonreleased; | |
657 case EnterNotify: i=wsEnterWindow; goto buttonreleased; | |
658 case LeaveNotify: i=wsLeaveWindow; | |
659 buttonreleased: | |
660 if ( wsWindowList[l]->MouseHandler ) | |
661 wsWindowList[l]->MouseHandler( i,Event->xbutton.x,Event->xbutton.y,Event->xmotion.x_root,Event->xmotion.y_root ); | |
662 break; | |
663 | |
664 case PropertyNotify: | |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
665 { |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
666 char * name = XGetAtomName( wsDisplay,Event->xproperty.atom ); |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
667 |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
668 if ( !name ) break; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
669 if ( !strncmp( name,"_ICEWM_TRAY",11 ) ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
670 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
671 wsWMType=wsWMIceWM; |
6622
da08877b9512
fix window hiding bug with some wms (kde, gnome, icewm, mwm, wmaker)
pontscho
parents:
6619
diff
changeset
|
672 // mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is IceWM.\n" ); |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
673 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
674 if ( !strncmp( name,"_KDE_",5 ) ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
675 { |
6622
da08877b9512
fix window hiding bug with some wms (kde, gnome, icewm, mwm, wmaker)
pontscho
parents:
6619
diff
changeset
|
676 // mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is KDE.\n" ); |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
677 wsWMType=wsWMKDE; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
678 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
679 if ( !strncmp( name,"KWM_WIN_DESKTOP",15 ) ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
680 { |
6622
da08877b9512
fix window hiding bug with some wms (kde, gnome, icewm, mwm, wmaker)
pontscho
parents:
6619
diff
changeset
|
681 // mp_dbg( MSGT_GPLAYER,MSGL_STATUS,"[ws] Detected wm is WindowMaker style.\n" ); |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
682 wsWMType=wsWMWMaker; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
683 } |
5919 | 684 |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
685 // fprintf(stderr,"[ws] PropertyNotify %s ( 0x%x )\n",name,Event->xproperty.atom ); |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
686 |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
687 XFree( name ); |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
688 } |
1693 | 689 break; |
690 | |
6967
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
691 case SelectionNotify: |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
692 /* Handle DandD */ |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
693 wsXDNDProcessSelection(wsWindowList[l],Event); |
0fa27966ac47
add xdnd support (from Gregory Kovriga <gkovriga@techunix.technion.ac.il>) and fix -subdelay bug
pontscho
parents:
6794
diff
changeset
|
694 break; |
1693 | 695 } |
696 XFlush( wsDisplay ); | |
697 XSync( wsDisplay,False ); | |
698 return !wsTrue; | |
699 } | |
700 | |
701 Bool wsDummyEvents( Display * display,XEvent * Event,XPointer arg ) | |
702 { return True; } | |
703 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
4566
diff
changeset
|
704 void wsHandleEvents( void ){ |
1709 | 705 // handle pending events |
706 while ( XPending(wsDisplay) ){ | |
707 XNextEvent( wsDisplay,&wsEvent ); | |
708 // printf("### X event: %d [%d]\n",wsEvent.type,delay); | |
709 wsEvents( wsDisplay,&wsEvent,NULL ); | |
710 } | |
711 } | |
712 | |
1693 | 713 void wsMainLoop( void ) |
714 { | |
1699 | 715 int delay=20; |
5919 | 716 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[ws] init threads: %d\n",XInitThreads() ); |
1693 | 717 XSynchronize( wsDisplay,False ); |
718 XLockDisplay( wsDisplay ); | |
719 // XIfEvent( wsDisplay,&wsEvent,wsEvents,NULL ); | |
1699 | 720 |
721 #if 1 | |
722 | |
723 while(wsTrue){ | |
724 // handle pending events | |
725 while ( XPending(wsDisplay) ){ | |
726 XNextEvent( wsDisplay,&wsEvent ); | |
727 wsEvents( wsDisplay,&wsEvent,NULL ); | |
1701 | 728 delay=0; |
1699 | 729 } |
730 usleep(delay*1000); // FIXME! | |
1701 | 731 if(delay<10*20) delay+=20; // pump up delay up to 0.2 sec (low activity) |
1699 | 732 } |
733 | |
734 #else | |
735 | |
1693 | 736 while( wsTrue ) |
737 { | |
738 XIfEvent( wsDisplay,&wsEvent,wsDummyEvents,NULL ); | |
739 wsEvents( wsDisplay,&wsEvent,NULL ); | |
740 } | |
1699 | 741 #endif |
742 | |
1693 | 743 XUnlockDisplay( wsDisplay ); |
744 } | |
745 | |
746 // ---------------------------------------------------------------------------------------------- | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
747 // Move window to selected layer |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
748 // ---------------------------------------------------------------------------------------------- |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
749 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
750 #define WIN_LAYER_ONBOTTOM 2 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
751 #define WIN_LAYER_NORMAL 4 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
752 #define WIN_LAYER_ONTOP 6 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
753 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
754 void wsSetLayer( Display * wsDisplay, Window win, int layer ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
755 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
756 Atom type; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
757 int format; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
758 unsigned long nitems, bytesafter; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
759 unsigned char * args = NULL; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
760 |
6034
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
761 if ( wsWMType == wsWMIceWM ) |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
762 { |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
763 switch ( layer ) |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
764 { |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
765 case -1: layer=2; break; // WinLayerBelow |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
766 case 0: layer=4; break; // WinLayerNormal |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
767 case 1: layer=8; break; // WinLayerOnTop |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
768 } |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
769 XChangeProperty( wsDisplay,win, |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
770 XInternAtom( wsDisplay,"_WIN_LAYER",False ),XA_CARDINAL,32,PropModeReplace,(unsigned char *)&layer,1 ); |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
771 return; |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
772 } |
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
773 |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
774 type=XInternAtom( wsDisplay,"_NET_SUPPORTED",False ); |
6159
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6146
diff
changeset
|
775 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
776 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
777 XEvent e; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
778 e.xclient.type=ClientMessage; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
779 e.xclient.message_type=XInternAtom( wsDisplay,"_NET_WM_STATE",False ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
780 e.xclient.display=wsDisplay; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
781 e.xclient.window=win; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
782 e.xclient.format=32; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
783 e.xclient.data.l[0]=layer; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
784 e.xclient.data.l[1]=XInternAtom( wsDisplay,"_NET_WM_STATE_STAYS_ON_TOP",False ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
785 e.xclient.data.l[2]=0l; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
786 e.xclient.data.l[3]=0l; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
787 e.xclient.data.l[4]=0l; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
788 XSendEvent( wsDisplay,wsRootWin,False,SubstructureRedirectMask,&e ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
789 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
790 XFree( args ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
791 return; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
792 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
793 type=XInternAtom( wsDisplay,"_WIN_SUPPORTING_WM_CHECK",False ); |
6159
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6146
diff
changeset
|
794 if ( Success == XGetWindowProperty( wsDisplay,wsRootWin,type,0,65536 / sizeof( int32_t ),False,AnyPropertyType,&type,&format,&nitems,&bytesafter,&args ) && nitems > 0 ) |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
795 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
796 XClientMessageEvent xev; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
797 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
798 memset( &xev,0,sizeof( xev ) ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
799 xev.type=ClientMessage; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
800 xev.window=win; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
801 xev.message_type=XInternAtom( wsDisplay,"_WIN_LAYER",False ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
802 xev.format=32; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
803 switch ( layer ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
804 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
805 case -1: xev.data.l[0] = WIN_LAYER_ONBOTTOM; break; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
806 case 0: xev.data.l[0] = WIN_LAYER_NORMAL; break; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
807 case 1: xev.data.l[0] = WIN_LAYER_ONTOP; break; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
808 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
809 XSendEvent( wsDisplay,wsRootWin,False,SubstructureNotifyMask,(XEvent*)&xev ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
810 if ( layer ) XRaiseWindow( wsDisplay,win ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
811 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
812 XFree( args ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
813 return; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
814 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
815 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
816 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
817 // ---------------------------------------------------------------------------------------------- |
1693 | 818 // Switch to fullscreen. |
819 // ---------------------------------------------------------------------------------------------- | |
820 void wsFullScreen( wsTWindow * win ) | |
821 { | |
822 int decoration = 0; | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
823 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
824 switch ( wsWMType ) |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
825 { |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
826 case wsWMUnknown: |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
827 XUnmapWindow( wsDisplay,win->WindowID ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
828 break; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
829 case wsWMIceWM: |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
830 if ( !win->isFullScreen ) XUnmapWindow( wsDisplay,win->WindowID ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
831 break; |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
832 } |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
833 |
1693 | 834 if ( win->isFullScreen ) |
835 { | |
836 win->X=win->OldX; | |
837 win->Y=win->OldY; | |
838 win->Width=win->OldWidth; | |
839 win->Height=win->OldHeight; | |
840 win->isFullScreen=False; | |
841 decoration=win->Decorations; | |
842 wsScreenSaverOn( wsDisplay ); | |
843 } | |
844 else | |
845 { | |
846 win->OldX=win->X; win->OldY=win->Y; | |
847 win->OldWidth=win->Width; win->OldHeight=win->Height; | |
848 win->X=0; win->Y=0; | |
849 win->Width=wsMaxX; win->Height=wsMaxY; | |
850 win->isFullScreen=True; | |
851 wsScreenSaverOff( wsDisplay ); | |
852 } | |
853 | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
854 win->SizeHint.flags=PPosition | PSize | PWinGravity;// | PBaseSize; |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
855 win->SizeHint.x=win->X; win->SizeHint.y=win->Y; |
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
856 win->SizeHint.width=win->Width; win->SizeHint.height=win->Height; |
6034
7570f4666c15
fullscreen -- round three -- icewm fullscreen fixed
pontscho
parents:
6013
diff
changeset
|
857 // win->SizeHint.base_width=win->Width; win->SizeHint.base_height=win->Height; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
858 |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
859 win->SizeHint.win_gravity=StaticGravity; |
1860 | 860 if ( win->Property & wsMaxSize ) |
861 { | |
862 win->SizeHint.flags|=PMaxSize; | |
863 win->SizeHint.max_width=win->Width; | |
864 win->SizeHint.max_height=win->Height; | |
865 } | |
866 if ( win->Property & wsMinSize ) | |
867 { | |
868 win->SizeHint.flags|=PMinSize; | |
869 win->SizeHint.min_width=win->Width; | |
870 win->SizeHint.min_height=win->Height; | |
871 } | |
1693 | 872 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); |
873 | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
874 wsSetLayer( wsDisplay,win->WindowID,win->isFullScreen ); |
1693 | 875 XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height ); |
876 wsWindowDecoration( win,decoration ); | |
5910
20c335d98ab3
fix fullscreen bug es ilyen libvo not initialized bug with gui igy
pontscho
parents:
5031
diff
changeset
|
877 XMapRaised( wsDisplay,win->WindowID ); |
1693 | 878 XRaiseWindow( wsDisplay,win->WindowID ); |
879 } | |
880 | |
881 // ---------------------------------------------------------------------------------------------- | |
882 // Redraw screen. | |
883 // ---------------------------------------------------------------------------------------------- | |
884 void wsPostRedisplay( wsTWindow * win ) | |
885 { | |
886 if ( win->ReDraw ) | |
887 { | |
6794 | 888 win->State=wsWindowExpose; |
1693 | 889 win->ReDraw( wsDisplay,win->WindowID ); |
890 XFlush( wsDisplay ); | |
891 } | |
892 } | |
893 | |
894 // ---------------------------------------------------------------------------------------------- | |
895 // Do Exit. | |
896 // ---------------------------------------------------------------------------------------------- | |
897 void wsDoExit( void ) | |
898 { wsTrue=False; wsResizeWindow( wsWindowList[0],32,32 ); } | |
899 | |
900 // ---------------------------------------------------------------------------------------------- | |
901 // Put 'Image' to window. | |
902 // ---------------------------------------------------------------------------------------------- | |
903 void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size ) | |
2733 | 904 { if ( wsConvFunc ) wsConvFunc( Image,win->ImageData,win->xImage->width * win->xImage->height * 4 ); } |
1693 | 905 |
906 void wsPutImage( wsTWindow * win ) | |
907 { | |
908 if ( wsUseXShm ) | |
909 { | |
910 XShmPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage, | |
911 0,0, | |
912 ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2, | |
913 win->xImage->width,win->xImage->height,0 ); | |
914 } | |
915 else | |
916 { | |
917 XPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage, | |
918 0,0, | |
919 ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2, | |
920 win->xImage->width,win->xImage->height ); | |
921 } | |
922 } | |
923 | |
924 // ---------------------------------------------------------------------------------------------- | |
925 // Move window to x, y. | |
926 // ---------------------------------------------------------------------------------------------- | |
2854 | 927 void wsMoveWindow( wsTWindow * win,int b,int x, int y ) |
1693 | 928 { |
2854 | 929 if ( b ) |
1693 | 930 { |
2854 | 931 switch ( x ) |
932 { | |
933 case -1: win->X=( wsMaxX / 2 ) - ( win->Width / 2 ); break; | |
934 case -2: win->X=wsMaxX - win->Width; break; | |
935 default: win->X=x; break; | |
936 } | |
937 switch ( y ) | |
938 { | |
939 case -1: win->Y=( wsMaxY / 2 ) - ( win->Height / 2 ); break; | |
940 case -2: win->Y=wsMaxY - win->Height; break; | |
941 default: win->Y=y; break; | |
942 } | |
1693 | 943 } |
2854 | 944 else { win->X=x; win->Y=y; } |
1693 | 945 |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
946 win->SizeHint.flags=PPosition | PWinGravity; |
1693 | 947 win->SizeHint.x=win->X; |
948 win->SizeHint.y=win->Y; | |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
949 win->SizeHint.win_gravity=StaticGravity; |
1693 | 950 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); |
951 | |
952 XMoveWindow( wsDisplay,win->WindowID,win->X,win->Y ); | |
1810 | 953 if ( win->ReSize ) win->ReSize( win->X,win->Y,win->Width,win->Height ); |
1693 | 954 } |
955 | |
956 // ---------------------------------------------------------------------------------------------- | |
957 // Resize window to sx, sy. | |
958 // ---------------------------------------------------------------------------------------------- | |
959 void wsResizeWindow( wsTWindow * win,int sx, int sy ) | |
960 { | |
961 win->Width=sx; | |
962 win->Height=sy; | |
963 | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
964 win->SizeHint.flags=PPosition | PSize | PWinGravity;// | PBaseSize; |
5986 | 965 win->SizeHint.x=win->X; |
966 win->SizeHint.y=win->Y; | |
1693 | 967 win->SizeHint.width=win->Width; |
968 win->SizeHint.height=win->Height; | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
969 |
1693 | 970 if ( win->Property & wsMinSize ) |
971 { | |
972 win->SizeHint.flags|=PMinSize; | |
973 win->SizeHint.min_width=win->Width; | |
974 win->SizeHint.min_height=win->Height; | |
975 } | |
976 if ( win->Property & wsMaxSize ) | |
977 { | |
978 win->SizeHint.flags|=PMaxSize; | |
979 win->SizeHint.max_width=win->Width; | |
980 win->SizeHint.max_height=win->Height; | |
981 } | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
982 |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
983 win->SizeHint.win_gravity=StaticGravity; |
5986 | 984 win->SizeHint.base_width=sx; win->SizeHint.base_height=sy; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
985 |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
986 if ( wsWMType == wsWMUnknown ) XUnmapWindow( wsDisplay,win->WindowID ); |
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
987 |
1693 | 988 XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); |
989 XResizeWindow( wsDisplay,win->WindowID,sx,sy ); | |
5986 | 990 XMapRaised( wsDisplay,win->WindowID ); |
1810 | 991 if ( win->ReSize ) win->ReSize( win->X,win->Y,win->Width,win->Height ); |
1693 | 992 } |
993 | |
994 // ---------------------------------------------------------------------------------------------- | |
995 // Iconify window. | |
996 // ---------------------------------------------------------------------------------------------- | |
997 void wsIconify( wsTWindow win ) | |
998 { XIconifyWindow( wsDisplay,win.WindowID,0 ); } | |
999 | |
1000 // ---------------------------------------------------------------------------------------------- | |
1001 // Move top the window. | |
1002 // ---------------------------------------------------------------------------------------------- | |
6146 | 1003 void wsMoveTopWindow( Display * wsDisplay,Window win ) |
2851
b64fa5d25142
add roleld mouse support and some small bugfix. neked jol a testedbe.
pontscho
parents:
2782
diff
changeset
|
1004 { |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1005 switch ( wsWMType ) |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
1006 { |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1007 case wsWMIceWM: |
6146 | 1008 XUnmapWindow( wsDisplay,win ); |
1009 XMapWindow( wsDisplay,win ); | |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1010 break; |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1011 case wsWMNetWM: |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1012 case wsWMKDE: |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1013 { |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1014 XEvent e; |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1015 e.xclient.type=ClientMessage; |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1016 e.xclient.message_type=XInternAtom( wsDisplay,"_NET_ACTIVE_WINDOW",False ); |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1017 e.xclient.display=wsDisplay; |
6146 | 1018 e.xclient.window=win; |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1019 e.xclient.format=32; |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1020 e.xclient.data.l[0]=0; |
6146 | 1021 XSendEvent( wsDisplay,RootWindow( wsDisplay,DefaultScreen( wsDisplay ) ),False,SubstructureRedirectMask,&e ); |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1022 break; |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1023 } |
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1024 default: |
6146 | 1025 XMapRaised( wsDisplay,win ); |
1026 XRaiseWindow( wsDisplay,win ); | |
6013
7f6e02a16ac4
some bugfix, x[11|mga|v] ( fullscreen with more files )
pontscho
parents:
6009
diff
changeset
|
1027 break; |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
1028 } |
2045 | 1029 } |
1693 | 1030 |
1031 // ---------------------------------------------------------------------------------------------- | |
1032 // Set window background to 'color'. | |
1033 // ---------------------------------------------------------------------------------------------- | |
1034 void wsSetBackground( wsTWindow * win,int color ) | |
1035 { XSetWindowBackground( wsDisplay,win->WindowID,color ); } | |
1036 | |
1037 void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b ) | |
1038 { | |
1039 int color = 0; | |
1040 switch ( wsOutMask ) | |
1041 { | |
1042 case wsRGB32: | |
1043 case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break; | |
1044 case wsBGR32: | |
1045 case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break; | |
2733 | 1046 case wsRGB16: PACK_RGB16( b,g,r,color ); break; |
1047 case wsBGR16: PACK_RGB16( r,g,b,color ); break; | |
1048 case wsRGB15: PACK_RGB15( b,g,r,color ); break; | |
1049 case wsBGR15: PACK_RGB15( r,g,b,color ); break; | |
1693 | 1050 } |
1051 XSetWindowBackground( wsDisplay,win->WindowID,color ); | |
1052 } | |
1053 | |
1814 | 1054 void wsSetForegroundRGB( wsTWindow * win,int r,int g,int b ) |
1055 { | |
1056 int color = 0; | |
1057 switch ( wsOutMask ) | |
1058 { | |
1059 case wsRGB32: | |
1060 case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break; | |
1061 case wsBGR32: | |
1062 case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break; | |
2733 | 1063 case wsRGB16: PACK_RGB16( b,g,r,color ); break; |
1064 case wsBGR16: PACK_RGB16( r,g,b,color ); break; | |
1065 case wsRGB15: PACK_RGB15( b,g,r,color ); break; | |
1066 case wsBGR15: PACK_RGB15( r,g,b,color ); break; | |
1814 | 1067 } |
1068 XSetForeground( wsDisplay,win->wGC,color ); | |
1069 } | |
1693 | 1070 |
1071 // ---------------------------------------------------------------------------------------------- | |
1072 // Draw string at x,y with fc ( foreground color ) and bc ( background color ). | |
1073 // ---------------------------------------------------------------------------------------------- | |
1074 void wsDrawString( wsTWindow win,int x,int y,char * str,int fc,int bc ) | |
1075 { | |
1076 XSetForeground( wsDisplay,win.wGC,bc ); | |
1077 XFillRectangle( wsDisplay,win.WindowID,win.wGC,x,y, | |
1078 XTextWidth( win.Font,str,strlen( str ) ) + 20, | |
1079 win.FontHeight + 2 ); | |
1080 XSetForeground( wsDisplay,win.wGC,fc ); | |
1081 XDrawString( wsDisplay,win.WindowID,win.wGC,x + 10,y + 13,str,strlen( str ) ); | |
1082 } | |
1083 | |
1084 // ---------------------------------------------------------------------------------------------- | |
1085 // Calculation string width. | |
1086 // ---------------------------------------------------------------------------------------------- | |
1087 int wsTextWidth( wsTWindow win,char * str ) | |
1088 { return XTextWidth( win.Font,str,strlen( str ) ) + 20; } | |
1089 | |
1090 // ---------------------------------------------------------------------------------------------- | |
1091 // Show / hide mouse cursor. | |
1092 // ---------------------------------------------------------------------------------------------- | |
1093 void wsVisibleMouse( wsTWindow * win,int m ) | |
1094 { | |
1095 switch ( m ) | |
1096 { | |
1097 case wsShowMouseCursor: | |
1098 if ( win->wsCursor != None ) | |
1099 { | |
1100 XFreeCursor( wsDisplay,win->wsCursor ); | |
1101 win->wsCursor=None; | |
1102 } | |
1103 XDefineCursor( wsDisplay,win->WindowID,0 ); | |
1104 break; | |
1105 case wsHideMouseCursor: | |
1106 win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 ); | |
1107 XDefineCursor( wsDisplay,win->WindowID,win->wsCursor ); | |
1108 break; | |
1109 } | |
1110 XFlush( wsDisplay ); | |
1111 } | |
1112 | |
1113 int wsGetDepthOnScreen( void ) | |
1114 { | |
1115 int bpp,ibpp; | |
1116 XImage * mXImage; | |
1117 XWindowAttributes attribs; | |
1118 | |
1119 mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap ); | |
1120 bpp=mXImage->bits_per_pixel; | |
1121 | |
1122 XGetWindowAttributes( wsDisplay,wsRootWin,&attribs ); | |
1123 ibpp=attribs.depth; | |
1124 mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap ); | |
1125 bpp=mXImage->bits_per_pixel; | |
1126 if ( ( ibpp + 7 ) / 8 != ( bpp + 7 ) / 8 ) ibpp=bpp; | |
1127 wsDepthOnScreen=ibpp; | |
1128 wsRedMask=mXImage->red_mask; | |
1129 wsGreenMask=mXImage->green_mask; | |
1130 wsBlueMask=mXImage->blue_mask; | |
1131 XDestroyImage( mXImage ); | |
1132 return ibpp; | |
1133 } | |
1134 | |
1135 void wsXDone( void ) | |
1136 { | |
1137 XCloseDisplay( wsDisplay ); | |
1138 } | |
1139 | |
1140 void wsVisibleWindow( wsTWindow * win,int show ) | |
1141 { | |
1142 switch( show ) | |
1143 { | |
5997
b5fb9a927bf3
add WM detection, and wm specific fullscreen code. (???)
pontscho
parents:
5986
diff
changeset
|
1144 case wsShowWindow: XMapRaised( wsDisplay,win->WindowID ); break; |
1693 | 1145 case wsHideWindow: XUnmapWindow( wsDisplay,win->WindowID ); break; |
1146 } | |
1147 XFlush( wsDisplay ); | |
1148 } | |
1149 | |
1150 void wsDestroyImage( wsTWindow * win ) | |
1151 { | |
1152 if ( win->xImage ) | |
1153 { | |
1154 XDestroyImage( win->xImage ); | |
1155 if ( wsUseXShm ) | |
1156 { | |
1157 XShmDetach( wsDisplay,&win->Shminfo ); | |
1158 shmdt( win->Shminfo.shmaddr ); | |
1159 } | |
1160 } | |
1161 win->xImage=NULL; | |
1162 } | |
1163 | |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1853
diff
changeset
|
1164 void wsCreateImage( wsTWindow * win,int Width,int Height ) |
1693 | 1165 { |
1166 int CompletionType = -1; | |
1167 if ( wsUseXShm ) | |
1168 { | |
1169 CompletionType=XShmGetEventBase( wsDisplay ) + ShmCompletion; | |
1170 win->xImage=XShmCreateImage( wsDisplay,win->VisualInfo.visual, | |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1853
diff
changeset
|
1171 win->Attribs.depth,ZPixmap,NULL,&win->Shminfo,Width,Height ); |
1693 | 1172 if ( win->xImage == NULL ) |
1173 { | |
5919 | 1174 mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] shared memory extension error.\n" ); |
1693 | 1175 exit( 0 ); |
1176 } | |
1177 win->Shminfo.shmid=shmget( IPC_PRIVATE,win->xImage->bytes_per_line * win->xImage->height,IPC_CREAT|0777 ); | |
1178 if ( win->Shminfo.shmid < 0 ) | |
1179 { | |
1180 XDestroyImage( win->xImage ); | |
5919 | 1181 mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] shared memory extension error.\n" ); |
1693 | 1182 exit( 0 ); |
1183 } | |
1184 win->Shminfo.shmaddr=(char *)shmat( win->Shminfo.shmid,0,0 ); | |
1185 | |
1186 if ( win->Shminfo.shmaddr == ((char *) -1) ) | |
1187 { | |
1188 XDestroyImage( win->xImage ); | |
1189 if ( win->Shminfo.shmaddr != ((char *) -1) ) shmdt( win->Shminfo.shmaddr ); | |
5919 | 1190 mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] shared memory extension error.\n" ); |
1693 | 1191 exit( 0 ); |
1192 } | |
1193 win->xImage->data=win->Shminfo.shmaddr; | |
1194 win->Shminfo.readOnly=0; | |
1195 XShmAttach( wsDisplay,&win->Shminfo ); | |
1196 shmctl( win->Shminfo.shmid,IPC_RMID,0 ); | |
1197 } | |
1198 else | |
1199 { | |
1200 win->xImage=XCreateImage( wsDisplay,win->VisualInfo.visual,win->Attribs.depth, | |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1853
diff
changeset
|
1201 ZPixmap,0,0,Width,Height, |
1693 | 1202 (wsDepthOnScreen == 3) ? 32 : wsDepthOnScreen, |
1203 0 ); | |
1204 if ( ( win->xImage->data=malloc( win->xImage->bytes_per_line * win->xImage->height ) ) == NULL ) | |
1205 { | |
5919 | 1206 mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[ws] sorry, not enough memory for draw buffer.\n" ); |
1693 | 1207 exit( 0 ); |
1208 } | |
1209 } | |
1210 win->ImageData=(unsigned char *)win->xImage->data; | |
1211 win->ImageDataw=(unsigned short int *)win->xImage->data; | |
1212 win->ImageDatadw=(unsigned int *)win->xImage->data; | |
1213 } | |
1214 | |
1858
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1853
diff
changeset
|
1215 void wsResizeImage( wsTWindow * win,int Width,int Height ) |
88a88d0a3f94
fix skin changing, xv fullscreen redraw bug, etc.
pontscho
parents:
1853
diff
changeset
|
1216 { wsDestroyImage( win ); wsCreateImage( win,Width,Height ); } |
1693 | 1217 |
1218 int wsGetOutMask( void ) | |
1219 { | |
1220 if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB32; | |
1221 if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR32; | |
1222 if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB24; | |
1223 if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR24; | |
1224 if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0xf800 )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB16; | |
1225 if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0xf800 ) ) return wsBGR16; | |
1226 if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x7c00 )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB15; | |
1227 if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x7c00 ) ) return wsBGR15; | |
1228 return 0; | |
1229 } | |
1230 | |
1231 void wsSetTitle( wsTWindow * win,char * name ) | |
1232 { XStoreName( wsDisplay,win->WindowID,name ); } | |
1233 | |
1234 void wsSetMousePosition( wsTWindow * win,int x, int y ) | |
1235 { XWarpPointer( wsDisplay,wsRootWin,win->WindowID,0,0,0,0,x,y ); } | |
1236 | |
1237 static int dpms_disabled=0; | |
1238 static int timeout_save=0; | |
1239 | |
1240 void wsScreenSaverOn( Display *mDisplay ) | |
1241 { | |
1242 int nothing; | |
4566 | 1243 #ifdef HAVE_XDPMS |
1693 | 1244 if ( dpms_disabled ) |
1245 { | |
1246 if ( DPMSQueryExtension( mDisplay,¬hing,¬hing ) ) | |
1247 { | |
5919 | 1248 if ( !DPMSEnable( mDisplay ) ) mp_msg( MSGT_GPLAYER,MSGL_ERR,"DPMS not available ?\n" ); // restoring power saving settings |
1693 | 1249 else |
1250 { | |
1251 // DPMS does not seem to be enabled unless we call DPMSInfo | |
1252 BOOL onoff; | |
1253 CARD16 state; | |
1254 DPMSInfo( mDisplay,&state,&onoff ); | |
5919 | 1255 if ( onoff ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"Successfully enabled DPMS.\n" ); |
1256 else mp_msg( MSGT_GPLAYER,MSGL_STATUS,"Could not enable DPMS.\n" ); | |
1693 | 1257 } |
1258 } | |
1259 } | |
4566 | 1260 #endif |
1693 | 1261 if ( timeout_save ) |
1262 { | |
1263 int dummy, interval, prefer_blank, allow_exp; | |
1264 XGetScreenSaver( mDisplay,&dummy,&interval,&prefer_blank,&allow_exp ); | |
1265 XSetScreenSaver( mDisplay,timeout_save,interval,prefer_blank,allow_exp ); | |
1266 XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp ); | |
1267 } | |
1268 } | |
1269 | |
1270 void wsScreenSaverOff( Display * mDisplay ) | |
1271 { | |
1272 int interval,prefer_blank,allow_exp,nothing; | |
4566 | 1273 #ifdef HAVE_XDPMS |
1693 | 1274 if ( DPMSQueryExtension( mDisplay,¬hing,¬hing ) ) |
1275 { | |
1276 BOOL onoff; | |
1277 CARD16 state; | |
1278 DPMSInfo( mDisplay,&state,&onoff ); | |
1279 if ( onoff ) | |
1280 { | |
1281 Status stat; | |
5919 | 1282 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"Disabling DPMS.\n" ); |
1693 | 1283 dpms_disabled=1; |
1284 stat=DPMSDisable( mDisplay ); // monitor powersave off | |
5919 | 1285 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"stat: %d.\n",stat ); |
1693 | 1286 } |
1287 } | |
4566 | 1288 #endif |
1693 | 1289 XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp ); |
1290 if ( timeout_save ) XSetScreenSaver( mDisplay,0,interval,prefer_blank,allow_exp ); // turning off screensaver | |
1291 } | |
1292 | |
1293 void wsSetShape( wsTWindow * win,char * data ) | |
1294 { | |
1295 #ifdef HAVE_XSHAPE | |
1852 | 1296 if ( !wsUseXShape ) return; |
1297 if ( data ) | |
1298 { | |
1299 win->Mask=XCreateBitmapFromData( wsDisplay,win->WindowID,data,win->Width,win->Height ); | |
1300 XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,win->Mask,ShapeSet ); | |
1301 XFreePixmap( wsDisplay,win->Mask ); | |
1302 } | |
1303 else XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,None,ShapeSet ); | |
1693 | 1304 #endif |
1305 } | |
1306 | |
6651 | 1307 void wsSetIcon( Display * dsp,Window win,Pixmap icon,Pixmap mask ) |
1308 { | |
1309 XWMHints * wm; | |
1310 long data[2]; | |
1311 Atom iconatom; | |
1312 | |
1313 wm=XGetWMHints( dsp,win ); | |
1314 if ( !wm ) wm=XAllocWMHints(); | |
1315 | |
1316 wm->icon_pixmap=icon; | |
1317 wm->icon_mask=mask; | |
1318 wm->flags|=IconPixmapHint | IconMaskHint; | |
1319 | |
1320 XSetWMHints( dsp,win,wm ); | |
1321 | |
1322 data[0]=icon; | |
1323 data[1]=mask; | |
1324 iconatom=XInternAtom( dsp,"KWM_WIN_ICON",0 ); | |
1325 XChangeProperty( dsp,win,iconatom,iconatom,32,PropModeReplace,(unsigned char *)data,2 ); | |
1326 | |
1327 XFree( wm ); | |
1328 } | |
1329 | |
1693 | 1330 #include "wsmkeys.h" |