Mercurial > mplayer.hg
comparison libvo/vo_quartz.c @ 15702:9dbea0b7f3ce
Fix Live Resize to match vo_macosx behavior
author | nplourde |
---|---|
date | Thu, 09 Jun 2005 12:39:52 +0000 |
parents | 21252725b639 |
children | ac7dcf4a1f8a |
comparison
equal
deleted
inserted
replaced
15701:8816b33b8948 | 15702:9dbea0b7f3ce |
---|---|
8 YUV support Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org> | 8 YUV support Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org> |
9 | 9 |
10 MPlayer Mac OSX Quartz video out module. | 10 MPlayer Mac OSX Quartz video out module. |
11 | 11 |
12 todo: -screen overlay output | 12 todo: -screen overlay output |
13 -clear window background after live resize | |
14 -fit osd in black bar when available | 13 -fit osd in black bar when available |
15 -RGB32 lost HW accel in fullscreen | 14 -fix RGB32 |
16 -(add sugestion here) | 15 -(add sugestion here) |
17 */ | 16 */ |
18 | 17 |
19 //SYS | 18 //SYS |
20 #include <stdio.h> | 19 #include <stdio.h> |
115 | 114 |
116 static MenuRef windMenu; | 115 static MenuRef windMenu; |
117 static MenuRef movMenu; | 116 static MenuRef movMenu; |
118 static MenuRef aspectMenu; | 117 static MenuRef aspectMenu; |
119 | 118 |
120 static int border = 15; | |
121 enum | 119 enum |
122 { | 120 { |
123 kQuitCmd = 1, | 121 kQuitCmd = 1, |
124 kHalfScreenCmd = 2, | 122 kHalfScreenCmd = 2, |
125 kNormalScreenCmd = 3, | 123 kNormalScreenCmd = 3, |
131 kAspectWideCmd = 9, | 129 kAspectWideCmd = 9, |
132 kPanScanCmd = 10 | 130 kPanScanCmd = 10 |
133 }; | 131 }; |
134 | 132 |
135 #include "osdep/keycodes.h" | 133 #include "osdep/keycodes.h" |
134 | |
136 extern void mplayer_put_key(int code); | 135 extern void mplayer_put_key(int code); |
137 | |
138 extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); | 136 extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); |
139 | 137 |
140 //PROTOTYPE///////////////////////////////////////////////////////////////// | 138 //PROTOTYPE///////////////////////////////////////////////////////////////// |
139 static OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); | |
140 static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); | |
141 static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); | |
141 void window_resized(); | 142 void window_resized(); |
142 void window_ontop(); | 143 void window_ontop(); |
143 void window_fullscreen(); | 144 void window_fullscreen(); |
144 void window_panscan(); | 145 void window_panscan(); |
145 | 146 |
195 case QZ_KP9: return KEY_KP9; | 196 case QZ_KP9: return KEY_KP9; |
196 default: return charcode; | 197 default: return charcode; |
197 } | 198 } |
198 } | 199 } |
199 | 200 |
200 static OSStatus MainWindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); | |
201 static OSStatus MainWindowCommandHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); | |
202 | |
203 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) | 201 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) |
204 { | 202 { |
205 switch (image_format) | 203 switch (image_format) |
206 { | 204 { |
207 case IMGFMT_RGB32: | 205 case IMGFMT_RGB32: |
219 vo_draw_alpha_yuy2(w,h,src,srca,stride,((char*)P) + (x0 + y0 * imgRect.right) * 2,imgRect.right*2); | 217 vo_draw_alpha_yuy2(w,h,src,srca,stride,((char*)P) + (x0 + y0 * imgRect.right) * 2,imgRect.right*2); |
220 break; | 218 break; |
221 } | 219 } |
222 } | 220 } |
223 | 221 |
224 //default window event handler | 222 //default keyboard event handler |
225 static OSStatus MainWindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) | 223 static OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) |
226 { | 224 { |
227 OSStatus result = noErr; | 225 OSStatus result = noErr; |
228 UInt32 class = GetEventClass (event); | 226 UInt32 class = GetEventClass (event); |
229 UInt32 kind = GetEventKind (event); | 227 UInt32 kind = GetEventKind (event); |
230 | 228 |
258 } | 256 } |
259 } | 257 } |
260 else | 258 else |
261 result = eventNotHandledErr; | 259 result = eventNotHandledErr; |
262 } | 260 } |
263 else if(class == kEventClassMouse) | 261 |
262 return result; | |
263 } | |
264 | |
265 //default mouse event handler | |
266 static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) | |
267 { | |
268 OSStatus result = noErr; | |
269 UInt32 class = GetEventClass (event); | |
270 UInt32 kind = GetEventKind (event); | |
271 | |
272 result = CallNextEventHandler(nextHandler, event); | |
273 | |
274 if(class == kEventClassMouse) | |
264 { | 275 { |
265 WindowPtr tmpWin; | 276 WindowPtr tmpWin; |
266 Point mousePos; | 277 Point mousePos; |
278 Point winMousePos; | |
267 | 279 |
268 GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(Point), 0, &mousePos); | 280 GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(Point), 0, &mousePos); |
281 GetEventParameter(event, kEventParamWindowMouseLocation, typeQDPoint, 0, sizeof(Point), 0, &winMousePos); | |
269 | 282 |
270 switch (kind) | 283 switch (kind) |
271 { | 284 { |
285 case kEventMouseWheelMoved: | |
286 { | |
287 int wheel; | |
288 short part; | |
289 | |
290 GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0, sizeof(int), 0, &wheel); | |
291 | |
292 part = FindWindow(mousePos,&tmpWin); | |
293 | |
294 if(part == inContent) | |
295 { | |
296 if(wheel > 0) | |
297 mplayer_put_key(MOUSE_BTN3); | |
298 else | |
299 mplayer_put_key(MOUSE_BTN4); | |
300 } | |
301 } | |
302 break; | |
303 | |
272 case kEventMouseDown: | 304 case kEventMouseDown: |
273 { | 305 { |
274 EventMouseButton button; | 306 EventMouseButton button; |
275 short part; | 307 short part; |
276 | 308 Rect bounds; |
309 | |
310 GetWindowPortBounds(theWindow, &bounds); | |
277 GetEventParameter(event, kEventParamMouseButton, typeMouseButton, 0, sizeof(EventMouseButton), 0, &button); | 311 GetEventParameter(event, kEventParamMouseButton, typeMouseButton, 0, sizeof(EventMouseButton), 0, &button); |
278 | 312 |
279 part = FindWindow(mousePos,&tmpWin); | 313 part = FindWindow(mousePos,&tmpWin); |
280 | 314 |
281 if(part == inMenuBar) | 315 if( (winMousePos.h > (bounds.right - 15)) && (winMousePos.v > (bounds.bottom)) ) |
316 { | |
317 GrowWindow(theWindow, mousePos, NULL); | |
318 } | |
319 else if(part == inMenuBar) | |
282 { | 320 { |
283 MenuSelect(mousePos); | 321 MenuSelect(mousePos); |
284 HiliteMenu(0); | 322 HiliteMenu(0); |
285 } | 323 } |
286 else if(part == inContent) | 324 else if(part == inContent) |
295 } | 333 } |
296 } | 334 } |
297 } | 335 } |
298 break; | 336 break; |
299 | 337 |
300 case kEventMouseWheelMoved: | 338 case kEventMouseUp: |
301 { | 339 break; |
302 int wheel; | 340 |
303 short part; | 341 case kEventMouseDragged: |
304 | 342 break; |
305 GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0, sizeof(int), 0, &wheel); | 343 |
306 | |
307 part = FindWindow(mousePos,&tmpWin); | |
308 | |
309 if(part == inContent) | |
310 { | |
311 if(wheel > 0) | |
312 mplayer_put_key(MOUSE_BTN3); | |
313 else | |
314 mplayer_put_key(MOUSE_BTN4); | |
315 } | |
316 } | |
317 break; | |
318 | |
319 default:result = eventNotHandledErr;break; | 344 default:result = eventNotHandledErr;break; |
320 } | 345 } |
321 } | 346 } |
322 | 347 |
323 return result; | 348 return result; |
324 } | 349 } |
325 | 350 |
326 //default window command handler | 351 //default window event handler |
327 static OSStatus MainWindowCommandHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) | 352 static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData) |
328 { | 353 { |
329 OSStatus result = noErr; | 354 OSStatus result = noErr; |
330 uint32_t d_width; | 355 uint32_t d_width; |
331 uint32_t d_height; | 356 uint32_t d_height; |
332 UInt32 class = GetEventClass (event); | 357 UInt32 class = GetEventClass (event); |
351 if(vo_quartz_fs) | 376 if(vo_quartz_fs) |
352 { | 377 { |
353 vo_fs = (!(vo_fs)); window_fullscreen(); | 378 vo_fs = (!(vo_fs)); window_fullscreen(); |
354 } | 379 } |
355 | 380 |
356 SizeWindow(theWindow, (d_width/2), ((d_width/movie_aspect)/2)+border, 1); | 381 SizeWindow(theWindow, (d_width/2), ((d_width/movie_aspect)/2), 1); |
357 window_resized(); | 382 window_resized(); |
358 break; | 383 break; |
359 | 384 |
360 case kNormalScreenCmd: | 385 case kNormalScreenCmd: |
361 if(vo_quartz_fs) | 386 if(vo_quartz_fs) |
362 { | 387 { |
363 vo_fs = (!(vo_fs)); window_fullscreen(); | 388 vo_fs = (!(vo_fs)); window_fullscreen(); |
364 } | 389 } |
365 | 390 |
366 SizeWindow(theWindow, d_width, (d_width/movie_aspect)+border, 1); | 391 SizeWindow(theWindow, d_width, (d_width/movie_aspect), 1); |
367 window_resized(); | 392 window_resized(); |
368 break; | 393 break; |
369 | 394 |
370 case kDoubleScreenCmd: | 395 case kDoubleScreenCmd: |
371 if(vo_quartz_fs) | 396 if(vo_quartz_fs) |
372 { | 397 { |
373 vo_fs = (!(vo_fs)); window_fullscreen(); | 398 vo_fs = (!(vo_fs)); window_fullscreen(); |
374 } | 399 } |
375 | 400 |
376 SizeWindow(theWindow, (d_width*2), ((d_width/movie_aspect)*2)+border, 1); | 401 SizeWindow(theWindow, (d_width*2), ((d_width/movie_aspect)*2), 1); |
377 window_resized(); | 402 window_resized(); |
378 break; | 403 break; |
379 | 404 |
380 case kFullScreenCmd: | 405 case kFullScreenCmd: |
381 vo_fs = (!(vo_fs)); window_fullscreen(); | 406 vo_fs = (!(vo_fs)); window_fullscreen(); |
386 CheckMenuItem (aspectMenu, 1, vo_keepaspect); | 411 CheckMenuItem (aspectMenu, 1, vo_keepaspect); |
387 break; | 412 break; |
388 | 413 |
389 case kAspectOrgCmd: | 414 case kAspectOrgCmd: |
390 movie_aspect = old_movie_aspect; | 415 movie_aspect = old_movie_aspect; |
391 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect)+border,1); | 416 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect),1); |
392 window_resized(); | 417 window_resized(); |
393 break; | 418 break; |
394 | 419 |
395 case kAspectFullCmd: | 420 case kAspectFullCmd: |
396 movie_aspect = 4.0f/3.0f; | 421 movie_aspect = 4.0f/3.0f; |
397 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect)+border,1); | 422 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect),1); |
398 window_resized(); | 423 window_resized(); |
399 break; | 424 break; |
400 | 425 |
401 case kAspectWideCmd: | 426 case kAspectWideCmd: |
402 movie_aspect = 16.0f/9.0f; | 427 movie_aspect = 16.0f/9.0f; |
403 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect)+border,1); | 428 SizeWindow(theWindow, dstRect.right, (dstRect.right/movie_aspect),1); |
404 window_resized(); | 429 window_resized(); |
405 break; | 430 break; |
406 | 431 |
407 case kPanScanCmd: | 432 case kPanScanCmd: |
408 vo_panscan = (!(vo_panscan)); | 433 vo_panscan = (!(vo_panscan)); |
432 theWindow = NULL; | 457 theWindow = NULL; |
433 mplayer_put_key(KEY_ESC); | 458 mplayer_put_key(KEY_ESC); |
434 break; | 459 break; |
435 | 460 |
436 //resize window | 461 //resize window |
462 case kEventWindowZoomed: | |
437 case kEventWindowBoundsChanged: | 463 case kEventWindowBoundsChanged: |
438 window_resized(); | 464 window_resized(); |
439 flip_page(); | 465 flip_page(); |
440 break; | 466 break; |
441 | 467 |
521 result = SetWindowTitleWithCFString(theWindow, windowTitle); | 547 result = SetWindowTitleWithCFString(theWindow, windowTitle); |
522 CFRelease(titleKey); | 548 CFRelease(titleKey); |
523 CFRelease(windowTitle); | 549 CFRelease(windowTitle); |
524 | 550 |
525 //Install event handler | 551 //Install event handler |
526 const EventTypeSpec commands[] = { | 552 const EventTypeSpec win_events[] = { |
527 { kEventClassWindow, kEventWindowClosed }, | 553 { kEventClassWindow, kEventWindowClosed }, |
528 { kEventClassWindow, kEventWindowBoundsChanged }, | 554 { kEventClassWindow, kEventWindowBoundsChanged }, |
529 { kEventClassCommand, kEventCommandProcess } | 555 { kEventClassCommand, kEventCommandProcess } |
530 }; | 556 }; |
531 | 557 |
532 const EventTypeSpec events[] = { | 558 const EventTypeSpec key_events[] = { |
533 { kEventClassKeyboard, kEventRawKeyDown }, | 559 { kEventClassKeyboard, kEventRawKeyDown }, |
534 { kEventClassKeyboard, kEventRawKeyRepeat }, | 560 { kEventClassKeyboard, kEventRawKeyRepeat } |
561 }; | |
562 | |
563 const EventTypeSpec mouse_events[] = { | |
564 { kEventClassMouse, kEventMouseWheelMoved }, | |
535 { kEventClassMouse, kEventMouseDown }, | 565 { kEventClassMouse, kEventMouseDown }, |
536 { kEventClassMouse, kEventMouseWheelMoved } | 566 { kEventClassMouse, kEventMouseUp }, |
537 }; | 567 { kEventClassMouse, kEventMouseDragged } |
538 | 568 }; |
539 | 569 |
540 InstallApplicationEventHandler (NewEventHandlerUPP (MainWindowEventHandler), GetEventTypeCount(events), events, NULL, NULL); | 570 InstallApplicationEventHandler (NewEventHandlerUPP (KeyEventHandler), GetEventTypeCount(key_events), key_events, NULL, NULL); |
541 InstallWindowEventHandler (theWindow, NewEventHandlerUPP (MainWindowCommandHandler), GetEventTypeCount(commands), commands, theWindow, NULL); | 571 InstallApplicationEventHandler (NewEventHandlerUPP (MouseEventHandler), GetEventTypeCount(mouse_events), mouse_events, NULL, NULL); |
572 InstallWindowEventHandler (theWindow, NewEventHandlerUPP (WindowEventHandler), GetEventTypeCount(win_events), win_events, theWindow, NULL); | |
542 } | 573 } |
543 | 574 |
544 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) | 575 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
545 { | 576 { |
546 WindowAttributes windowAttrs; | 577 WindowAttributes windowAttrs; |
547 OSErr qterr; | 578 OSErr qterr; |
548 int i; | 579 int i; |
580 CGRect tmpBounds; | |
549 | 581 |
550 //Get Main device info/////////////////////////////////////////////////// | 582 //Get Main device info/////////////////////////////////////////////////// |
551 | 583 |
552 | 584 |
553 deviceHdl = GetMainDevice(); | 585 deviceHdl = GetMainDevice(); |
607 image_data = malloc(image_size); | 639 image_data = malloc(image_size); |
608 | 640 |
609 //Create player window////////////////////////////////////////////////// | 641 //Create player window////////////////////////////////////////////////// |
610 windowAttrs = kWindowStandardDocumentAttributes | 642 windowAttrs = kWindowStandardDocumentAttributes |
611 | kWindowStandardHandlerAttribute | 643 | kWindowStandardHandlerAttribute |
612 | kWindowCompositingAttribute | |
613 | kWindowLiveResizeAttribute; | 644 | kWindowLiveResizeAttribute; |
614 | 645 |
646 windowAttrs &= (~kWindowResizableAttribute); | |
647 | |
615 if (theWindow == NULL) | 648 if (theWindow == NULL) |
616 { | 649 { |
617 quartz_CreateWindow(d_width, d_height+border, windowAttrs); | 650 quartz_CreateWindow(d_width, d_height, windowAttrs); |
618 | 651 |
619 if (theWindow == NULL) | 652 if (theWindow == NULL) |
620 { | 653 { |
621 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: Couldn't create window !!!!!\n"); | 654 mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: Couldn't create window !!!!!\n"); |
622 return -1; | 655 return -1; |
623 } | 656 } |
657 tmpBounds = CGRectMake( 0, 0, winRect.right, winRect.bottom); | |
658 CreateCGContextForPort(GetWindowPort(theWindow),&context); | |
659 CGContextFillRect(context, tmpBounds); | |
624 } | 660 } |
625 else | 661 else |
626 { | 662 { |
627 HideWindow(theWindow); | 663 HideWindow(theWindow); |
628 ChangeWindowAttributes(theWindow, ~windowAttrs, windowAttrs); | 664 ChangeWindowAttributes(theWindow, ~windowAttrs, windowAttrs); |
629 SetRect(&winRect, 0, 0, d_width, d_height); | 665 SetRect(&winRect, 0, 0, d_width, d_height); |
630 SetRect(&oldWinRect, 0, 0, d_width, d_height); | 666 SetRect(&oldWinRect, 0, 0, d_width, d_height); |
631 SizeWindow (theWindow, d_width, d_height, 1); | 667 SizeWindow (theWindow, d_width, d_height, 1); |
632 } | 668 } |
633 | |
634 //Show window | |
635 SetThemeWindowBackground( theWindow, kThemeBrushModelessDialogBackgroundActive, TRUE); | |
636 RepositionWindow(theWindow, NULL, kWindowCenterOnMainScreen); | |
637 ShowWindow (theWindow); | |
638 | 669 |
639 switch (image_format) | 670 switch (image_format) |
640 { | 671 { |
641 case IMGFMT_RGB32: | 672 case IMGFMT_RGB32: |
642 { | 673 { |
809 winLevel = 0; | 840 winLevel = 0; |
810 SetWindowGroupLevel(winGroup, CGWindowLevelForKey(levelList[winLevel])); | 841 SetWindowGroupLevel(winGroup, CGWindowLevelForKey(levelList[winLevel])); |
811 window_fullscreen(); | 842 window_fullscreen(); |
812 } | 843 } |
813 | 844 |
845 //Show window | |
846 RepositionWindow(theWindow, NULL, kWindowCenterOnMainScreen); | |
847 ShowWindow (theWindow); | |
848 | |
814 return 0; | 849 return 0; |
815 } | 850 } |
816 | 851 |
817 static void check_events(void) | 852 static void check_events(void) |
818 { | 853 { |
1165 { | 1200 { |
1166 aspect( &d_width, &d_height, A_NOZOOM); | 1201 aspect( &d_width, &d_height, A_NOZOOM); |
1167 d_height = ((float)d_width/movie_aspect); | 1202 d_height = ((float)d_width/movie_aspect); |
1168 | 1203 |
1169 aspectX = (float)((float)winRect.right/(float)d_width); | 1204 aspectX = (float)((float)winRect.right/(float)d_width); |
1170 aspectY = (float)((float)(winRect.bottom-border)/(float)d_height); | 1205 aspectY = (float)((float)(winRect.bottom)/(float)d_height); |
1171 | 1206 |
1172 if((d_height*aspectX)>(winRect.bottom-border)) | 1207 if((d_height*aspectX)>(winRect.bottom)) |
1173 { | 1208 { |
1174 padding = (winRect.right - d_width*aspectY)/2; | 1209 padding = (winRect.right - d_width*aspectY)/2; |
1175 SetRect(&dstRect, padding, 0, d_width*aspectY+padding, d_height*aspectY); | 1210 SetRect(&dstRect, padding, 0, d_width*aspectY+padding, d_height*aspectY); |
1176 } | 1211 } |
1177 else | 1212 else |
1178 { | 1213 { |
1179 padding = ((winRect.bottom-border) - d_height*aspectX)/2; | 1214 padding = ((winRect.bottom) - d_height*aspectX)/2; |
1180 SetRect(&dstRect, 0, padding, (d_width*aspectX), d_height*aspectX+padding); | 1215 SetRect(&dstRect, 0, padding, (d_width*aspectX), d_height*aspectX+padding); |
1181 } | 1216 } |
1182 } | 1217 } |
1183 else | 1218 else |
1184 { | 1219 { |
1185 SetRect(&dstRect, 0, 0, winRect.right, winRect.bottom-border); | 1220 SetRect(&dstRect, 0, 0, winRect.right, winRect.bottom); |
1186 } | 1221 } |
1187 | |
1188 //Clear Background | |
1189 SetThemeWindowBackground( theWindow, kThemeBrushUtilityWindowBackgroundInactive, TRUE); | |
1190 tmpBounds = CGRectMake( 0, border, winRect.right, winRect.bottom); | |
1191 CreateCGContextForPort(GetWindowPort(theWindow),&context); | |
1192 CGContextClearRect(context, tmpBounds); | |
1193 | 1222 |
1194 switch (image_format) | 1223 switch (image_format) |
1195 { | 1224 { |
1196 case IMGFMT_RGB32: | 1225 case IMGFMT_RGB32: |
1197 { | 1226 { |
1198 bounds = CGRectMake(dstRect.left, dstRect.top+border, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top); | 1227 bounds = CGRectMake(dstRect.left, dstRect.top, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top); |
1199 CreateCGContextForPort (GetWindowPort (theWindow), &context); | 1228 CreateCGContextForPort (GetWindowPort (theWindow), &context); |
1200 break; | 1229 break; |
1201 } | 1230 } |
1202 case IMGFMT_YV12: | 1231 case IMGFMT_YV12: |
1203 case IMGFMT_IYUV: | 1232 case IMGFMT_IYUV: |
1223 break; | 1252 break; |
1224 } | 1253 } |
1225 default: | 1254 default: |
1226 break; | 1255 break; |
1227 } | 1256 } |
1257 | |
1258 //Clear Background | |
1259 tmpBounds = CGRectMake( 0, 0, winRect.right, winRect.bottom); | |
1260 CreateCGContextForPort(GetWindowPort(theWindow),&context); | |
1261 CGContextFillRect(context, tmpBounds); | |
1228 } | 1262 } |
1229 | 1263 |
1230 void window_ontop() | 1264 void window_ontop() |
1231 { | 1265 { |
1232 if(!vo_quartz_fs) | 1266 if(!vo_quartz_fs) |
1272 GetWindowPortBounds(theWindow, &oldWinRect); | 1306 GetWindowPortBounds(theWindow, &oldWinRect); |
1273 GetWindowBounds(theWindow, kWindowContentRgn, &oldWinBounds); | 1307 GetWindowBounds(theWindow, kWindowContentRgn, &oldWinBounds); |
1274 } | 1308 } |
1275 | 1309 |
1276 //go fullscreen | 1310 //go fullscreen |
1277 border = 0; | |
1278 panscan_calc(); | 1311 panscan_calc(); |
1279 ChangeWindowAttributes(theWindow, kWindowNoShadowAttribute, kWindowResizableAttribute); | 1312 ChangeWindowAttributes(theWindow, kWindowNoShadowAttribute, 0); |
1280 MoveWindow(theWindow, deviceRect.left-(vo_panscan_x >> 1), deviceRect.top-(vo_panscan_y >> 1), 1); | 1313 MoveWindow(theWindow, deviceRect.left-(vo_panscan_x >> 1), deviceRect.top-(vo_panscan_y >> 1), 1); |
1281 SizeWindow(theWindow, device_width+vo_panscan_x, device_height+vo_panscan_y,1); | 1314 SizeWindow(theWindow, device_width+vo_panscan_x, device_height+vo_panscan_y,1); |
1282 | 1315 |
1283 vo_quartz_fs = 1; | 1316 vo_quartz_fs = 1; |
1284 } | 1317 } |
1299 | 1332 |
1300 //show mouse cursor | 1333 //show mouse cursor |
1301 ShowCursor(); | 1334 ShowCursor(); |
1302 | 1335 |
1303 //revert window to previous setting | 1336 //revert window to previous setting |
1304 border = 15; | 1337 ChangeWindowAttributes(theWindow, 0, kWindowNoShadowAttribute); |
1305 ChangeWindowAttributes(theWindow, kWindowResizableAttribute, kWindowNoShadowAttribute); | |
1306 SizeWindow(theWindow, oldWinRect.right, oldWinRect.bottom,1); | 1338 SizeWindow(theWindow, oldWinRect.right, oldWinRect.bottom,1); |
1307 MoveWindow(theWindow, oldWinBounds.left, oldWinBounds.top, 1); | 1339 MoveWindow(theWindow, oldWinBounds.left, oldWinBounds.top, 1); |
1308 | 1340 |
1309 vo_quartz_fs = 0; | 1341 vo_quartz_fs = 0; |
1310 } | 1342 } |
1311 | 1343 window_resized(); |
1312 } | 1344 } |
1313 | 1345 |
1314 void window_panscan() | 1346 void window_panscan() |
1315 { | 1347 { |
1316 panscan_calc(); | 1348 panscan_calc(); |