comparison libvo/vo_xmga.c @ 4981:bfc652fc7f43

rewrite fullscreen support in some libvo driver
author pontscho
date Thu, 07 Mar 2002 17:50:25 +0000
parents f21d15f0cba6
children 01bcb7a9bb4e
comparison
equal deleted inserted replaced
4980:0e6e50c02f7b 4981:bfc652fc7f43
86 static uint32_t mvHeight; 86 static uint32_t mvHeight;
87 static uint32_t mvWidth; 87 static uint32_t mvWidth;
88 88
89 static Window mRoot; 89 static Window mRoot;
90 static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth; 90 static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
91 static uint32_t drwcX,drwcY,dwidth,dheight,mFullscreen; 91 static uint32_t drwcX,drwcY,dwidth,dheight;
92 92
93 #ifdef HAVE_NEW_GUI 93 #ifdef HAVE_NEW_GUI
94 static uint32_t mdwidth,mdheight; 94 static uint32_t mdwidth,mdheight;
95 #endif 95 #endif
96 96
97 static XSetWindowAttributes xWAttribs; 97 static XSetWindowAttributes xWAttribs;
98 98
99 #define VO_XMGA
99 #include "mga_common.c" 100 #include "mga_common.c"
101 #undef VO_XMGA
100 102
101 static void mDrawColorKey( void ) 103 static void mDrawColorKey( void )
102 { 104 {
103 XSetBackground( mDisplay,vo_gc,0 ); 105 XSetBackground( mDisplay,vo_gc,0 );
104 XClearWindow( mDisplay,vo_window ); 106 XClearWindow( mDisplay,vo_window );
105 XSetForeground( mDisplay,vo_gc,fgColor ); 107 XSetForeground( mDisplay,vo_gc,fgColor );
106 XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight) ); 108 XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
107 XFlush( mDisplay ); 109 XFlush( mDisplay );
108 } 110 }
109 111
110 static void set_window(){ 112 static void set_window(){
111 113
112 #ifdef HAVE_NEW_GUI 114 dwidth=mdwidth; dheight=mdheight;
113 if ( vo_window != None ) 115 if ( vo_fs )
114 { 116 {
115 mFullscreen=0; 117 dwidth=vo_screenwidth;
116 dwidth=mdwidth; dheight=mdheight; 118 dheight=vo_screenwidth * mdheight / mdwidth;
117 if ( ( vo_dwidth == vo_screenwidth )&&( vo_dheight == vo_screenheight ) ) 119 }
118 {
119 mFullscreen=1;
120 dwidth=vo_screenwidth;
121 dheight=vo_screenwidth * mdheight / mdwidth;
122 }
123 }
124 #endif
125 120
126 XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); 121 XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
127 drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight; 122 drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight;
128 XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); 123 XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot );
129 fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); 124 fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
130 125
131 aspect(&dwidth,&dheight,A_NOZOOM); 126 aspect(&dwidth,&dheight,A_NOZOOM);
132 if ( mFullscreen ) 127 if ( vo_fs )
133 { 128 {
134 aspect(&dwidth,&dheight,A_ZOOM); 129 aspect(&dwidth,&dheight,A_ZOOM);
135 drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; 130 drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
136 drwcX+=drwX; 131 drwcX+=drwX;
137 drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; 132 drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2;
260 255
261 mvWidth=width; mvHeight=height; 256 mvWidth=width; mvHeight=height;
262 257
263 wndX=0; wndY=0; 258 wndX=0; wndY=0;
264 wndWidth=d_width; wndHeight=d_height; 259 wndWidth=d_width; wndHeight=d_height;
265 mFullscreen=fullscreen&1; 260 vo_fs=fullscreen&1;
261 vo_dwidth=d_width; vo_dheight=d_height;
262 if ( vo_fs )
263 { vo_old_width=d_width; vo_old_height=d_height; }
266 264
267 switch ( vo_depthonscreen ) 265 switch ( vo_depthonscreen )
268 { 266 {
269 case 32: 267 case 32:
270 case 24: fgColor=0x00ff00ffL; break; 268 case 24: fgColor=0x00ff00ffL; break;
277 #ifdef HAVE_NEW_GUI 275 #ifdef HAVE_NEW_GUI
278 mdwidth=width; mdheight=height; 276 mdwidth=width; mdheight=height;
279 if ( vo_window == None ) 277 if ( vo_window == None )
280 { 278 {
281 #endif 279 #endif
282 if ( mFullscreen ) 280 if ( vo_fs )
283 { 281 {
284 wndWidth=vo_screenwidth; 282 wndWidth=vo_screenwidth;
285 wndHeight=vo_screenheight; 283 wndHeight=vo_screenheight;
286 #ifdef X11_FULLSCREEN 284 #ifdef X11_FULLSCREEN
287 aspect(&d_width,&d_height,A_ZOOM); 285 aspect(&d_width,&d_height,A_ZOOM);
312 InputOutput, 310 InputOutput,
313 vinfo.visual,xswamask,&xWAttribs ); 311 vinfo.visual,xswamask,&xWAttribs );
314 vo_x11_classhint( mDisplay,vo_window,"xmga" ); 312 vo_x11_classhint( mDisplay,vo_window,"xmga" );
315 vo_hidecursor(mDisplay,vo_window); 313 vo_hidecursor(mDisplay,vo_window);
316 314
317 if ( mFullscreen ) vo_x11_decoration( mDisplay,vo_window,0 ); 315 if ( vo_fs ) vo_x11_decoration( mDisplay,vo_window,0 );
318 316
319 XGetNormalHints( mDisplay,vo_window,&hint ); 317 XGetNormalHints( mDisplay,vo_window,&hint );
320 hint.x=wndX; hint.y=wndY; 318 hint.x=wndX; hint.y=wndY;
321 hint.width=wndWidth; hint.height=wndHeight; 319 hint.width=wndWidth; hint.height=wndHeight;
322 hint.base_width=wndWidth; hint.base_height=wndHeight; 320 hint.base_width=wndWidth; hint.base_height=wndHeight;