Changeset 18610 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Apr 1, 2009 5:20:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_agl.c
r18568 r18610 25 25 GLint gCurrentBufferName = 1; 26 26 uint64_t gDockUpdateTS = 0; 27 static EventHandlerUPP gParentEventHandler = NULL; 27 28 28 29 enum … … 36 37 kEventVBoxResizeWindow = 'rwin', 37 38 kEventVBoxDisposeWindow = 'dwin', 38 kEventVBoxUpdateDock = 'udck' 39 kEventVBoxUpdateDock = 'udck', 40 kEventVBoxUpdateContext = 'uctx' 39 41 }; 40 42 … … 88 90 windowEvtHndlr(EventHandlerCallRef myHandler, EventRef event, void* userData) 89 91 { 90 /* Currently this is *NOT* used */91 92 #pragma unused (userData)93 92 WindowRef window = NULL; 94 Rect rectPort = { 0, 0, 0, 0 };95 93 OSStatus result = eventNotHandledErr; 96 UInt32 class = GetEventClass ( event);97 UInt32 kind = GetEventKind ( event);94 UInt32 class = GetEventClass (event); 95 UInt32 kind = GetEventKind (event); 98 96 99 97 GetEventParameter(event, kEventParamDirectObject, typeWindowRef, 100 98 NULL, sizeof(WindowRef), NULL, &window); 99 /* 100 Rect rectPort = { 0, 0, 0, 0 }; 101 101 if( window ) 102 102 GetWindowPortBounds( window, &rectPort ); 103 104 switch (class) { 105 case kEventClassWindow: 106 switch (kind) { 107 case kEventWindowActivated: 103 */ 104 105 switch (class) 106 { 107 case kEventClassWindow: 108 { 109 WindowInfo *wi = (WindowInfo*)userData; 110 switch (kind) 111 { 108 112 #ifndef __LP64__ /* not available for 64-bit processes? */ 109 case kEventWindowDrawContent: 110 #endif 113 case kEventWindowDrawContent: 114 { 115 break; 116 } 117 #endif 118 #ifndef __LP64__ /** @todo port to 64-bit darwin! Need to cehck if this event is generated or not (it probably isn't). */ 119 case kEventWindowShown: 120 { 121 //InvalWindowRect( window, &rectPort ); 122 break; 123 } 124 #endif 125 case kEventWindowBoundsChanged: 126 { 127 GLboolean result = true; 128 ContextInfo *context = renderspuGetWindowContext(wi); 129 130 if (context && 131 context->context) 132 { 133 DEBUG_MSG_POETZSCH (("kEventWindowBoundsChanged %x %x\n", wi->window, context->context)); 134 //result = render_spu.ws.aglSetCurrentContext(context->context); 135 //result = render_spu.ws.aglUpdateContext(context->context); 136 //CHECK_AGL_RC (result, "Render SPU (windowEvtHndlr): UpdateContext Failed"); 137 //render_spu.self.Flush(); 138 } 139 //InvalWindowRect (window, &rectPort); 140 break; 141 } 142 }; 111 143 break; 112 113 case kEventWindowClose: 114 HideWindow( window ); 115 #ifdef __LP64__ /** @todo port to 64-bit darwin. */ 116 #else 117 SetWRefCon( window, (int)NULL ); 118 #endif 119 120 crWarning( "Render SPU: caught kEventWindowClose -- quitting." ); 121 break; 122 123 case kEventWindowShown: 124 /* build gl */ 144 } 145 case kEventClassVBox: 146 { 147 switch (kind) 148 { 149 case kEventVBoxUpdateContext: 150 { 125 151 #ifndef __LP64__ /** @todo port to 64-bit darwin! Need to cehck if this event is generated or not (it probably isn't). */ 126 if( window == FrontWindow() ) 127 SetUserFocusWindow( window ); 128 InvalWindowRect( window, &rectPort ); 129 #endif 130 break; 131 132 case kEventWindowBoundsChanged: 133 /* resize 134 update */ 135 break; 136 137 case kEventWindowZoomed: 138 /* zoom button */ 152 WindowInfo *wi1; 153 GetEventParameter(event, kEventParamUserData, typeVoidPtr, 154 NULL, sizeof(wi1), NULL, &wi1); 155 ContextInfo *context = renderspuGetWindowContext(wi1); 156 GLboolean result1 = true; 157 if (context && 158 context->context) 159 { 160 DEBUG_MSG_POETZSCH (("kEventVBoxUpdateContext %x %x\n", window, context->context)); 161 result1 = render_spu.ws.aglSetCurrentContext(context->context); 162 result1 = render_spu.ws.aglUpdateContext(context->context); 163 CHECK_AGL_RC (result, "Render SPU (windowEvtHndlr): UpdateContext Failed"); 164 //glFlush(); 165 } 166 result = noErr; 167 #endif 168 break; 169 } 170 }; 139 171 break; 140 172 } 141 173 break; 142 } 174 }; 143 175 144 176 return result; … … 149 181 { 150 182 if(visual->visAttribs & CR_PBUFFER_BIT) 151 crWarning("Render SPU : PBuffers not support on Darwin/AGL yet.");183 crWarning("Render SPU (renderspu_SystemInitVisual): PBuffers not support on Darwin/AGL yet."); 152 184 153 185 return GL_TRUE; … … 231 263 232 264 if( !renderspuChoosePixelFormat(context, &pix) ) { 233 crError( "Render SPU : Unable to create pixel format" );265 crError( "Render SPU (renderspu_SystemCreateContext): Unable to create pixel format" ); 234 266 return GL_FALSE; 235 267 } … … 239 271 240 272 if( !context->context ) { 241 crError( "Render SPU : Could not create rendering context" );273 crError( "Render SPU (renderspu_SystemCreateContext): Could not create rendering context" ); 242 274 return GL_FALSE; 243 275 } … … 292 324 if( !renderspuChoosePixelFormat(context, &pix) ) 293 325 { 294 crError( "Render SPU : Unable to create pixel format" );326 crError( "Render SPU (renderspuWindowAttachContext): Unable to create pixel format" ); 295 327 return GL_FALSE; 296 328 } … … 300 332 if( !wi->dummyContext ) 301 333 { 302 crError( "Render SPU : Could not create rendering context" );334 crError( "Render SPU (renderspuWindowAttachContext): Could not create rendering context" ); 303 335 return GL_FALSE; 304 336 } … … 314 346 * sharing of the same hardware buffer afterwards. */ 315 347 result = render_spu.ws.aglSetInteger(wi->dummyContext, AGL_BUFFER_NAME, &wi->bufferName); 316 CHECK_AGL_RC (result, "Render SPU : SetInteger Failed");348 CHECK_AGL_RC (result, "Render SPU (renderspuWindowAttachContext): SetInteger Failed"); 317 349 /* Assign the dummy context to the window */ 318 350 result = render_spu.ws.aglSetDrawable(wi->dummyContext, drawable); 319 CHECK_AGL_RC (result, "Render SPU : SetDrawable Failed");351 CHECK_AGL_RC (result, "Render SPU (renderspuWindowAttachContext): SetDrawable Failed"); 320 352 } 321 353 … … 334 366 /* Reset the current context */ 335 367 result = render_spu.ws.aglSetDrawable(context->context, NULL); 336 CHECK_AGL_RC (result, "Render SPU : SetDrawable Failed");368 CHECK_AGL_RC (result, "Render SPU (renderspuWindowAttachContext): SetDrawable Failed"); 337 369 /* Set the buffer name of the dummy context to the current context 338 370 * also. After that both share the same hardware buffer. */ 339 371 render_spu.ws.aglSetInteger (context->context, AGL_BUFFER_NAME, &wi->bufferName); 340 CHECK_AGL_RC (result, "Render SPU : SetInteger Failed");372 CHECK_AGL_RC (result, "Render SPU (renderspuWindowAttachContext): SetInteger Failed"); 341 373 /* Set the new drawable */ 342 374 #ifdef __LP64__ /** @todo port to 64-bit darwin. */ … … 345 377 result = render_spu.ws.aglSetDrawable(context->context, newDrawable); 346 378 #endif 347 CHECK_AGL_RC (result, "Render SPU : SetDrawable Failed");379 CHECK_AGL_RC (result, "Render SPU (renderspuWindowAttachContext): SetDrawable Failed"); 348 380 renderspuSetWindowContext( window, context ); 349 381 } 350 382 result = render_spu.ws.aglSetCurrentContext(context->context); 351 CHECK_AGL_RC (result, "Render SPU : SetCurrentContext Failed");383 CHECK_AGL_RC (result, "Render SPU (renderspuWindowAttachContext): SetCurrentContext Failed"); 352 384 result = render_spu.ws.aglUpdateContext(context->context); 353 CHECK_AGL_RC (result, "Render SPU : UpdateContext Failed");385 CHECK_AGL_RC (result, "Render SPU (renderspuWindowAttachContext): UpdateContext Failed"); 354 386 355 387 return result; … … 373 405 EventRef evt; 374 406 OSStatus status = CreateEvent(NULL, kEventClassVBox, kEventVBoxDisposeWindow, 0, kEventAttributeNone, &evt); 375 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : CreateEvent Failed");407 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemDestroyWindow): CreateEvent Failed"); 376 408 status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window); 377 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed"); 378 status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 379 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed"); 409 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemDestroyWindow): SetEventParameter Failed"); 410 //status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 411 status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard); 412 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemDestroyWindow): PostEventToQueue Failed"); 380 413 } 381 414 … … 405 438 EventRef evt; 406 439 status = CreateEvent(NULL, kEventClassVBox, kEventVBoxResizeWindow, 0, kEventAttributeNone, &evt); 407 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : CreateEvent Failed");440 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowSize): CreateEvent Failed "); 408 441 status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof(window->window), &window->window); 409 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : SetEventParameter Failed");442 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowSize): SetEventParameter Failed"); 410 443 HISize s = CGSizeMake (w, h); 411 444 status = SetEventParameter(evt, kEventParamDimensions, typeHISize, sizeof (s), &s); 412 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed"); 413 status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 414 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed"); 415 416 /* Update the context */ 417 GLboolean result = true; 418 ContextInfo *context = renderspuGetWindowContext(window); 419 if (context && 420 context->context) 421 { 422 DEBUG_MSG_POETZSCH (("Size %d context %x visible %d\n", window->id, context->context, IsWindowVisible (window->window))); 423 result = render_spu.ws.aglUpdateContext(context->context); 424 CHECK_AGL_RC (result, "Render SPU: UpdateContext Failed"); 425 render_spu.self.Flush(); 426 } 445 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowSize): SetEventParameter Failed"); 446 status = SetEventParameter(evt, kEventParamUserData, typeVoidPtr, sizeof (window), &window); 447 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowSize): SetEventParameter Failed"); 448 //status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 449 status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard); 450 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowSize): SendEventToEventTarget Failed"); 451 452 /* We are tracking the position of the overlay window ourself. If the user 453 switch to fullscreen/seamless there is no hint that the position has 454 changed. (In the guest point of view it hasn't changed when the pos is 455 at (0, 0). So to be on the save side we post an additional pos event if 456 this is the case. */ 457 if (window->x == 0 && 458 window->y == 0) 459 renderspu_SystemWindowPosition (window, 0, 0); 460 else 461 { 462 /* Update the context. If the above position call is done this isn't 463 necessary cause its already done there. */ 464 GLboolean result = true; 465 ContextInfo *context = renderspuGetWindowContext(window); 466 if (context && 467 context->context) 468 { 469 //result = render_spu.ws.aglUpdateContext(context->context); 470 //CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowSize): UpdateContext Failed"); 471 //glFlush(); 472 } 473 } 474 DEBUG_MSG_POETZSCH (("Size %d visible %d\n", window->id, IsWindowVisible (window->window))); 427 475 /* save the new size */ 428 476 window->width = w; … … 441 489 Rect r; 442 490 status = GetWindowBounds(window->window, kWindowStructureRgn, &r); 443 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : GetWindowBounds Failed");491 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemGetWindowGeometry): GetWindowBounds Failed"); 444 492 445 493 *x = (int) r.left; … … 463 511 status = GetWindowResizeLimits (window->window, NULL, &s); 464 512 #endif 465 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : GetWindowResizeLimits Failed");513 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemGetMaxWindowSize): GetWindowResizeLimits Failed"); 466 514 467 515 *w = s.width; … … 481 529 EventRef evt; 482 530 status = CreateEvent(NULL, kEventClassVBox, kEventVBoxMoveWindow, 0, kEventAttributeNone, &evt); 483 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : CreateEvent Failed");531 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowPosition): CreateEvent Failed"); 484 532 status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof(window->window), &window->window); 485 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : SetEventParameter Failed");533 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowPosition): SetEventParameter Failed"); 486 534 HIPoint p = CGPointMake (x, y); 487 535 status = SetEventParameter(evt, kEventParamOrigin, typeHIPoint, sizeof (p), &p); 488 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed"); 489 status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 490 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed"); 536 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowPosition): SetEventParameter Failed"); 537 status = SetEventParameter(evt, kEventParamUserData, typeVoidPtr, sizeof (window), &window); 538 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowPosition): SetEventParameter Failed"); 539 //status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 540 status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard); 541 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowPosition): PostEventToQueue Failed"); 491 542 492 543 /* Update the context */ … … 497 548 { 498 549 DEBUG_MSG_POETZSCH (("Position %d context %x visible %d\n", window->id, context->context, IsWindowVisible (window->window))); 499 result = render_spu.ws.aglUpdateContext(context->context); 500 CHECK_AGL_RC (result, "Render SPU: UpdateContext Failed"); 501 render_spu.self.Flush(); 502 } 550 //result = render_spu.ws.aglUpdateContext(context->context); 551 //CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowPosition): UpdateContext Failed"); 552 //glFlush(); 553 } 554 /* save the new pos */ 555 window->x = x; 556 window->y = y; 503 557 } 504 558 … … 522 576 EventRef evt; 523 577 status = CreateEvent(NULL, kEventClassVBox, kEventVBoxShowWindow, 0, kEventAttributeNone, &evt); 524 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : CreateEvent Failed");578 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemShowWindow): CreateEvent Failed"); 525 579 status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window); 526 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed"); 527 status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 528 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed"); 580 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemShowWindow): SetEventParameter Failed"); 581 status = SetEventParameter(evt, kEventParamUserData, typeVoidPtr, sizeof (window), &window); 582 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemWindowShow): SetEventParameter Failed"); 583 //status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 584 status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard); 585 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemShowWindow): PostEventToQueue Failed"); 529 586 } 530 587 else … … 532 589 EventRef evt; 533 590 OSStatus status = CreateEvent(NULL, kEventClassVBox, kEventVBoxHideWindow, 0, kEventAttributeNone, &evt); 534 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : CreateEvent Failed");591 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemShowWindow): CreateEvent Failed"); 535 592 status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window); 536 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: SetEventParameter Failed"); 537 status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 538 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU: PostEventToQueue Failed"); 593 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemShowWindow): SetEventParameter Failed"); 594 //status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 595 status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard); 596 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemShowWindow): PostEventToQueue Failed"); 539 597 } 540 598 … … 547 605 DEBUG_MSG_POETZSCH (("Showed %d context %x visible %d\n", window->id, context->context, IsWindowVisible (window->window))); 548 606 result = render_spu.ws.aglUpdateContext(context->context); 549 CHECK_AGL_RC (result, "Render SPU : UpdateContext Failed");550 render_spu.self.Flush();607 CHECK_AGL_RC (result, "Render SPU (renderspu_SystemShowWindow): UpdateContext Failed"); 608 glFlush(); 551 609 } 552 610 … … 562 620 563 621 CRASSERT(render_spu.ws.aglSetCurrentContext); 564 crDebug( "renderspu_SystemMakeCurrent( %x, %i, %x )", window, nativeWindow, context );622 //crDebug( "renderspu_SystemMakeCurrent( %x, %i, %x )", window, nativeWindow, context ); 565 623 566 624 if(window && context) … … 571 629 if(window->visual != context->visual) 572 630 { 573 crDebug("Render SPU :MakeCurrent visual mismatch (0x%x != 0x%x); remaking window.",631 crDebug("Render SPU (renderspu_SystemMakeCurrent): MakeCurrent visual mismatch (0x%x != 0x%x); remaking window.", 574 632 (uint)window->visual->visAttribs, (uint)context->visual->visAttribs); 575 633 /* … … 594 652 if (!window->everCurrent || f[1] < 0.0) 595 653 { 596 crDebug("Render SPU : Resetting raster pos");654 crDebug("Render SPU (renderspu_SystemMakeCurrent): Resetting raster pos"); 597 655 render_spu.self.WindowPos2iARB(0, 0); 598 656 } … … 612 670 613 671 if(!context) 614 crError("Render SPU: SwapBuffers got a null context from the window"); 615 616 DEBUG_MSG_POETZSCH (("Swapped %d context %x visible: %d\n", window->id, context->context, IsWindowVisible (window->window))); 617 render_spu.ws.aglSwapBuffers(context->context); 672 crError("Render SPU (renderspu_SystemSwapBuffers): SwapBuffers got a null context from the window"); 673 674 // DEBUG_MSG_POETZSCH (("Swapped %d context %x visible: %d\n", window->id, context->context, IsWindowVisible (window->window))); 675 if (context->visual->visAttribs & CR_DOUBLE_BIT) 676 render_spu.ws.aglSwapBuffers(context->context); 677 else 678 glFlush(); 618 679 619 680 /* This method seems called very often. To prevent the dock using all free … … 627 688 EventRef evt; 628 689 status = CreateEvent(NULL, kEventClassVBox, kEventVBoxUpdateDock, 0, kEventAttributeNone, &evt); 629 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : CreateEvent Failed");690 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemSwapBuffers): CreateEvent Failed"); 630 691 status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard); 631 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU : PostEventToQueue Failed");692 CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemSwapBuffers): PostEventToQueue Failed"); 632 693 633 694 gDockUpdateTS = curTS; … … 640 701 CRASSERT(window->window); 641 702 703 DEBUG_MSG_POETZSCH (("Visible region \n")); 642 704 ContextInfo *c; 643 705 c = renderspuGetWindowContext (window); … … 662 724 /* Set the clip region to the context */ 663 725 result = render_spu.ws.aglSetInteger(c->context, AGL_CLIP_REGION, (const GLint*)rgn); 664 CHECK_AGL_RC (result, "Render SPU : SetInteger Failed");726 CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): SetInteger Failed"); 665 727 result = render_spu.ws.aglEnable(c->context, AGL_CLIP_REGION); 666 CHECK_AGL_RC (result, "Render SPU : Enable Failed");728 CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): Enable Failed"); 667 729 /* Clear the region structure */ 668 730 DisposeRgn (rgn); … … 689 751 EventRef evt; 690 752 status = CreateEvent(NULL, kEventClassVBox, kEventVBoxDisposeWindow, 0, kEventAttributeNone, &evt); 691 CHECK_CARBON_RC_RETURN (status, "Render SPU : CreateEvent Failed", false);753 CHECK_CARBON_RC_RETURN (status, "Render SPU (renderspu_SystemVBoxCreateWindow): CreateEvent Failed", false); 692 754 status = SetEventParameter(evt, kEventParamWindowRef, typeWindowRef, sizeof (window->window), &window->window); 693 CHECK_CARBON_RC_RETURN (status, "Render SPU: SetEventParameter Failed", false); 694 status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 695 CHECK_CARBON_RC_RETURN (status, "Render SPU: PostEventToQueue Failed", false); 755 CHECK_CARBON_RC_RETURN (status, "Render SPU (renderspu_SystemVBoxCreateWindow): SetEventParameter Failed", false); 756 //status = SendEventToEventTarget (evt, GetWindowEventTarget (HIViewGetWindow ((HIViewRef)render_spu_parent_window_id))); 757 status = PostEventToQueue(GetMainEventQueue(), evt, kEventPriorityStandard); 758 CHECK_CARBON_RC_RETURN (status, "Render SPU (renderspu_SystemVBoxCreateWindow): PostEventToQueue Failed", false); 696 759 } 697 760 … … 702 765 703 766 status = CreateNewWindow(winClass, winAttr, &windowRect, &window->window); 704 CHECK_CARBON_RC_RETURN (status, "Render SPU : CreateNewWindow Failed", GL_FALSE);767 CHECK_CARBON_RC_RETURN (status, "Render SPU (renderspu_SystemVBoxCreateWindow): CreateNewWindow Failed", GL_FALSE); 705 768 706 769 /* We set a title for debugging purposes */ … … 716 779 { 717 780 status = CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &gMasterGroup); 718 CHECK_CARBON_RC_RETURN (status, "Render SPU : CreateWindowGroup Failed", GL_FALSE);781 CHECK_CARBON_RC_RETURN (status, "Render SPU (renderspu_SystemVBoxCreateWindow): CreateWindowGroup Failed", GL_FALSE); 719 782 status = CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &gParentGroup); 720 CHECK_CARBON_RC_RETURN (status, "Render SPU : CreateWindowGroup Failed", GL_FALSE);783 CHECK_CARBON_RC_RETURN (status, "Render SPU (renderspu_SystemVBoxCreateWindow): CreateWindowGroup Failed", GL_FALSE); 721 784 /* Make the correct z-layering */ 722 785 SendWindowGroupBehind (gParentGroup, gMasterGroup); … … 734 797 parent = HIViewGetWindow ((HIViewRef)render_spu_parent_window_id); 735 798 SetWindowGroup (parent, gParentGroup); 799 800 /* We need to process events from our main window */ 801 if(!gParentEventHandler) 802 { 803 /* Install the event handlers */ 804 EventTypeSpec eventList[] = 805 { 806 {kEventClassVBox, kEventVBoxUpdateContext} 807 }; 808 809 gParentEventHandler = NewEventHandlerUPP(windowEvtHndlr); 810 811 InstallApplicationEventHandler (gParentEventHandler, 812 GetEventTypeCount(eventList), eventList, 813 NULL, NULL); 814 } 736 815 } 737 816 /* Add the new window to the master group */ … … 742 821 /* Even though there are still issues with the windows themselves, 743 822 install the event handlers */ 744 EventTypeSpec event_list[] = { {kEventClassWindow, kEventWindow Close} };823 EventTypeSpec event_list[] = { {kEventClassWindow, kEventWindowBoundsChanged} }; 745 824 746 825 window->event_handler = NewEventHandlerUPP( windowEvtHndlr ); 747 826 748 /*InstallWindowEventHandler(window->window, window->event_handler, 749 GetEventTypeCount(event_list), event_list, 750 NULL, NULL);*/ 751 } 827 /* 828 InstallWindowEventHandler(window->window, window->event_handler, 829 GetEventTypeCount(event_list), event_list, 830 window, NULL); 831 */ 832 } 833 752 834 753 835 /* This will be initialized on the first attempt to attach the global … … 759 841 renderspu_SystemShowWindow(window, GL_TRUE); 760 842 761 crDebug("Render SPU : actual window (x, y, width, height): %d, %d, %d, %d",843 crDebug("Render SPU (renderspu_SystemVBoxCreateWindow): actual window (x, y, width, height): %d, %d, %d, %d", 762 844 window->x, window->y, window->width, window->height); 763 845
Note:
See TracChangeset
for help on using the changeset viewer.