comparison libvo/vo_x11.c @ 2094:dc11de07b5e7

grabs mouse with -vm - patch by Uwe Reder <Uwe.Reder@3SOFT.de>
author arpi
date Fri, 05 Oct 2001 16:07:17 +0000
parents 6185fef2703a
children d9ea650b2c24
comparison
equal deleted inserted replaced
2093:d2bed9c43e3b 2094:dc11de07b5e7
147 XEvent xev; 147 XEvent xev;
148 XGCValues xgcv; 148 XGCValues xgcv;
149 Colormap theCmap; 149 Colormap theCmap;
150 XSetWindowAttributes xswa; 150 XSetWindowAttributes xswa;
151 unsigned long xswamask; 151 unsigned long xswamask;
152 unsigned int modeline_width, modeline_height;
152 153
153 image_height=height; 154 image_height=height;
154 image_width=width; 155 image_width=width;
155 image_format=format; 156 image_format=format;
156 157
180 hint.height=image_height; 181 hint.height=image_height;
181 182
182 183
183 #ifdef HAVE_XF86VM 184 #ifdef HAVE_XF86VM
184 if (vm) { 185 if (vm) {
185 unsigned int modeline_width, modeline_height, vm_event, vm_error; 186 unsigned int vm_event, vm_error;
186 unsigned int vm_ver, vm_rev; 187 unsigned int vm_ver, vm_rev;
187 int i,j,have_vm=0,X,Y; 188 int i,j,have_vm=0,X,Y;
188 189
189 int modecount; 190 int modecount;
190 191
224 XF86VidModeSetViewPort(mDisplay,mScreen,X,Y); 225 XF86VidModeSetViewPort(mDisplay,mScreen,X,Y);
225 } 226 }
226 } 227 }
227 #endif 228 #endif
228 229
229 230 #ifdef HAVE_XF86VM
231 if ( vm )
232 {
233 hint.x=(vo_screenwidth-modeline_width)/2;
234 hint.y=(vo_screenheight-modeline_height)/2;
235 hint.width=modeline_width;
236 hint.height=modeline_height;
237 }
238 else
239 #endif
230 if ( fullscreen ) 240 if ( fullscreen )
231 { 241 {
232 hint.width=vo_screenwidth; 242 hint.width=vo_screenwidth;
233 hint.height=vo_screenheight; 243 hint.height=vo_screenheight;
234 } 244 }
241 251
242 theCmap =XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ), 252 theCmap =XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ),
243 vinfo.visual,AllocNone ); 253 vinfo.visual,AllocNone );
244 254
245 xswa.background_pixel=0; 255 xswa.background_pixel=0;
246 xswa.border_pixel=1; 256 xswa.border_pixel=0;
247 xswa.colormap=theCmap; 257 xswa.colormap=theCmap;
248 xswamask=CWBackPixel | CWBorderPixel |CWColormap; 258 xswamask=CWBackPixel | CWBorderPixel | CWColormap;
249 259
260 #ifdef HAVE_XF86VM
261 if ( vm )
262 {
263 xswa.override_redirect=True;
264 xswamask|=CWOverrideRedirect;
265 }
266 #endif
267
250 mywindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ), 268 mywindow=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ),
251 hint.x,hint.y, 269 hint.x,hint.y,
252 hint.width,hint.height, 270 hint.width,hint.height,
253 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); 271 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
272
254 vo_x11_classhint( mDisplay,mywindow,"x11" ); 273 vo_x11_classhint( mDisplay,mywindow,"x11" );
255 vo_hidecursor(mDisplay,mywindow); 274 vo_hidecursor(mDisplay,mywindow);
256 if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 ); 275 if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
257 XSelectInput( mDisplay,mywindow,StructureNotifyMask ); 276 XSelectInput( mDisplay,mywindow,StructureNotifyMask );
258 XSetStandardProperties( mDisplay,mywindow,hello,hello,None,NULL,0,&hint ); 277 XSetStandardProperties( mDisplay,mywindow,hello,hello,None,NULL,0,&hint );
260 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != mywindow ); 279 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != mywindow );
261 XSelectInput( mDisplay,mywindow,NoEventMask ); 280 XSelectInput( mDisplay,mywindow,NoEventMask );
262 281
263 XFlush( mDisplay ); 282 XFlush( mDisplay );
264 XSync( mDisplay,False ); 283 XSync( mDisplay,False );
265
266 mygc=XCreateGC( mDisplay,mywindow,0L,&xgcv ); 284 mygc=XCreateGC( mDisplay,mywindow,0L,&xgcv );
285
286 #ifdef HAVE_XF86VM
287 if ( vm )
288 {
289 /* Grab the mouse pointer in our window */
290 XGrabPointer(mDisplay, mywindow, True, 0,
291 GrabModeAsync, GrabModeAsync,
292 mywindow, None, CurrentTime);
293 XSetInputFocus(mDisplay, mywindow, RevertToNone, CurrentTime);
294 }
295 #endif
267 } 296 }
268 297
269 #ifdef SH_MEM 298 #ifdef SH_MEM
270 if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; 299 if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1;
271 else 300 else