diff options
author | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
commit | 2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch) | |
tree | 95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/llwindow/llwindowmacosx.cpp | |
parent | Second Life viewer sources 1.20.6 (diff) | |
download | meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2 meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz |
Second Life viewer sources 1.20.7
Diffstat (limited to 'linden/indra/llwindow/llwindowmacosx.cpp')
-rw-r--r-- | linden/indra/llwindow/llwindowmacosx.cpp | 71 |
1 files changed, 40 insertions, 31 deletions
diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp index f5cc8c6..5ab0ba6 100644 --- a/linden/indra/llwindow/llwindowmacosx.cpp +++ b/linden/indra/llwindow/llwindowmacosx.cpp | |||
@@ -359,7 +359,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
359 | 359 | ||
360 | if (mFullscreen && (mOldDisplayMode == NULL)) | 360 | if (mFullscreen && (mOldDisplayMode == NULL)) |
361 | { | 361 | { |
362 | llinfos << "createContext: setting up fullscreen " << width << "x" << height << llendl; | 362 | LL_INFOS("Window") << "createContext: setting up fullscreen " << width << "x" << height << LL_ENDL; |
363 | 363 | ||
364 | // NOTE: The refresh rate will be REPORTED AS 0 for many DVI and notebook displays. Plan accordingly. | 364 | // NOTE: The refresh rate will be REPORTED AS 0 for many DVI and notebook displays. Plan accordingly. |
365 | double refresh = getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate); | 365 | double refresh = getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate); |
@@ -380,18 +380,18 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
380 | U32 closestWidth = 0; | 380 | U32 closestWidth = 0; |
381 | int i; | 381 | int i; |
382 | 382 | ||
383 | llinfos << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << llendl; | 383 | LL_DEBUGS("Window") << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << LL_ENDL; |
384 | 384 | ||
385 | for(i=0; i < resolutionCount; i++) | 385 | for(i=0; i < resolutionCount; i++) |
386 | { | 386 | { |
387 | F32 aspect = (F32)resolutionList[i].mWidth / (F32)resolutionList[i].mHeight; | 387 | F32 aspect = (F32)resolutionList[i].mWidth / (F32)resolutionList[i].mHeight; |
388 | 388 | ||
389 | llinfos << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << llendl; | 389 | LL_DEBUGS("Window") << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << LL_ENDL; |
390 | 390 | ||
391 | if( (resolutionList[i].mHeight >= 700) && (resolutionList[i].mHeight <= 800) && | 391 | if( (resolutionList[i].mHeight >= 700) && (resolutionList[i].mHeight <= 800) && |
392 | (fabs(aspect - mOriginalAspectRatio) < fabs(closestAspect - mOriginalAspectRatio))) | 392 | (fabs(aspect - mOriginalAspectRatio) < fabs(closestAspect - mOriginalAspectRatio))) |
393 | { | 393 | { |
394 | llinfos << " (new closest mode) " << llendl; | 394 | LL_DEBUGS("Window") << " (new closest mode) " << LL_ENDL; |
395 | 395 | ||
396 | // This is the closest mode we've seen yet. | 396 | // This is the closest mode we've seen yet. |
397 | closestWidth = resolutionList[i].mWidth; | 397 | closestWidth = resolutionList[i].mWidth; |
@@ -437,7 +437,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
437 | 437 | ||
438 | if (refDisplayMode) | 438 | if (refDisplayMode) |
439 | { | 439 | { |
440 | llinfos << "createContext: switching display resolution" << llendl; | 440 | LL_DEBUGS("Window") << "createContext: switching display resolution" << LL_ENDL; |
441 | mOldDisplayMode = CGDisplayCurrentMode (mDisplay); | 441 | mOldDisplayMode = CGDisplayCurrentMode (mDisplay); |
442 | CGDisplaySwitchToMode (mDisplay, refDisplayMode); | 442 | CGDisplaySwitchToMode (mDisplay, refDisplayMode); |
443 | // CFRelease(refDisplayMode); | 443 | // CFRelease(refDisplayMode); |
@@ -452,11 +452,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
452 | mFullscreenBits = CGDisplayBitsPerPixel(mDisplay); | 452 | mFullscreenBits = CGDisplayBitsPerPixel(mDisplay); |
453 | mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate)); | 453 | mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate)); |
454 | 454 | ||
455 | llinfos << "Running at " << mFullscreenWidth | 455 | LL_INFOS("Window") << "Running at " << mFullscreenWidth |
456 | << "x" << mFullscreenHeight | 456 | << "x" << mFullscreenHeight |
457 | << "x" << mFullscreenBits | 457 | << "x" << mFullscreenBits |
458 | << " @ " << mFullscreenRefresh | 458 | << " @ " << mFullscreenRefresh |
459 | << llendl; | 459 | << LL_ENDL; |
460 | } | 460 | } |
461 | else | 461 | else |
462 | { | 462 | { |
@@ -480,7 +480,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
480 | //int displayHeight = CGDisplayPixelsHigh(mDisplay); | 480 | //int displayHeight = CGDisplayPixelsHigh(mDisplay); |
481 | //const int menuBarPlusTitleBar = 44; // Ugly magic number. | 481 | //const int menuBarPlusTitleBar = 44; // Ugly magic number. |
482 | 482 | ||
483 | llinfos << "createContext: creating window" << llendl; | 483 | LL_DEBUGS("Window") << "createContext: creating window" << LL_ENDL; |
484 | 484 | ||
485 | window_rect.left = (long) x; | 485 | window_rect.left = (long) x; |
486 | window_rect.right = (long) x + width; | 486 | window_rect.right = (long) x + width; |
@@ -534,7 +534,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
534 | err = NewTSMDocument(1, types, &mTSMDocument, 0); | 534 | err = NewTSMDocument(1, types, &mTSMDocument, 0); |
535 | if (err != noErr) | 535 | if (err != noErr) |
536 | { | 536 | { |
537 | llwarns << "createContext: couldn't create a TSMDocument (" << err << ")" << llendl; | 537 | LL_WARNS("Window") << "createContext: couldn't create a TSMDocument (" << err << ")" << LL_ENDL; |
538 | } | 538 | } |
539 | if (mTSMDocument) | 539 | if (mTSMDocument) |
540 | { | 540 | { |
@@ -575,7 +575,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
575 | AGL_NONE | 575 | AGL_NONE |
576 | }; | 576 | }; |
577 | 577 | ||
578 | llinfos << "createContext: creating fullscreen pixelformat" << llendl; | 578 | LL_DEBUGS("Window") << "createContext: creating fullscreen pixelformat" << LL_ENDL; |
579 | 579 | ||
580 | GDHandle gdhDisplay = NULL; | 580 | GDHandle gdhDisplay = NULL; |
581 | err = DMGetGDeviceByDisplayID ((DisplayIDType)mDisplay, &gdhDisplay, false); | 581 | err = DMGetGDeviceByDisplayID ((DisplayIDType)mDisplay, &gdhDisplay, false); |
@@ -602,7 +602,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
602 | AGL_NONE | 602 | AGL_NONE |
603 | }; | 603 | }; |
604 | 604 | ||
605 | llinfos << "createContext: creating windowed pixelformat" << llendl; | 605 | LL_DEBUGS("Window") << "createContext: creating windowed pixelformat" << LL_ENDL; |
606 | 606 | ||
607 | mPixelFormat = aglChoosePixelFormat(NULL, 0, windowedAttrib); | 607 | mPixelFormat = aglChoosePixelFormat(NULL, 0, windowedAttrib); |
608 | 608 | ||
@@ -622,7 +622,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
622 | 622 | ||
623 | if(mPixelFormat) | 623 | if(mPixelFormat) |
624 | { | 624 | { |
625 | llinfos << "createContext: creating GL context" << llendl; | 625 | LL_DEBUGS("Window") << "createContext: creating GL context" << LL_ENDL; |
626 | mContext = aglCreateContext(mPixelFormat, NULL); | 626 | mContext = aglCreateContext(mPixelFormat, NULL); |
627 | } | 627 | } |
628 | 628 | ||
@@ -670,7 +670,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
670 | { | 670 | { |
671 | // We successfully captured the display. Use a fullscreen drawable | 671 | // We successfully captured the display. Use a fullscreen drawable |
672 | 672 | ||
673 | llinfos << "createContext: attaching fullscreen drawable" << llendl; | 673 | LL_DEBUGS("Window") << "createContext: attaching fullscreen drawable" << LL_ENDL; |
674 | 674 | ||
675 | #if CAPTURE_ALL_DISPLAYS | 675 | #if CAPTURE_ALL_DISPLAYS |
676 | // Capture all displays (may want to do this for final build) | 676 | // Capture all displays (may want to do this for final build) |
@@ -688,7 +688,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
688 | } | 688 | } |
689 | else if(!mFullscreen && (mWindow != NULL)) | 689 | else if(!mFullscreen && (mWindow != NULL)) |
690 | { | 690 | { |
691 | llinfos << "createContext: attaching windowed drawable" << llendl; | 691 | LL_DEBUGS("Window") << "createContext: attaching windowed drawable" << LL_ENDL; |
692 | 692 | ||
693 | // We created a window. Use it as the drawable. | 693 | // We created a window. Use it as the drawable. |
694 | if(!aglSetDrawable(mContext, GetWindowPort (mWindow))) | 694 | if(!aglSetDrawable(mContext, GetWindowPort (mWindow))) |
@@ -705,7 +705,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
705 | 705 | ||
706 | if(mContext != NULL) | 706 | if(mContext != NULL) |
707 | { | 707 | { |
708 | llinfos << "createContext: setting current context" << llendl; | 708 | LL_DEBUGS("Window") << "createContext: setting current context" << LL_ENDL; |
709 | 709 | ||
710 | if (!aglSetCurrentContext(mContext)) | 710 | if (!aglSetCurrentContext(mContext)) |
711 | { | 711 | { |
@@ -759,11 +759,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
759 | return FALSE; | 759 | return FALSE; |
760 | } | 760 | } |
761 | 761 | ||
762 | llinfos << "GL buffer: Color Bits " << S32(colorBits) | 762 | LL_INFOS("GLInit") << "GL buffer: Color Bits " << S32(colorBits) |
763 | << " Alpha Bits " << S32(alphaBits) | 763 | << " Alpha Bits " << S32(alphaBits) |
764 | << " Depth Bits " << S32(depthBits) | 764 | << " Depth Bits " << S32(depthBits) |
765 | << " Stencil Bits" << S32(stencilBits) | 765 | << " Stencil Bits" << S32(stencilBits) |
766 | << llendl; | 766 | << LL_ENDL; |
767 | 767 | ||
768 | if (colorBits < 32) | 768 | if (colorBits < 32) |
769 | { | 769 | { |
@@ -798,12 +798,12 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
798 | GLint frames_per_swap = 0; | 798 | GLint frames_per_swap = 0; |
799 | if (disable_vsync) | 799 | if (disable_vsync) |
800 | { | 800 | { |
801 | llinfos << "Disabling vertical sync" << llendl; | 801 | LL_DEBUGS("GLInit") << "Disabling vertical sync" << LL_ENDL; |
802 | frames_per_swap = 0; | 802 | frames_per_swap = 0; |
803 | } | 803 | } |
804 | else | 804 | else |
805 | { | 805 | { |
806 | llinfos << "Keeping vertical sync" << llendl; | 806 | LL_DEBUGS("GLinit") << "Keeping vertical sync" << LL_ENDL; |
807 | frames_per_swap = 1; | 807 | frames_per_swap = 1; |
808 | } | 808 | } |
809 | aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap); | 809 | aglSetInteger(mContext, AGL_SWAP_INTERVAL, &frames_per_swap); |
@@ -818,11 +818,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits | |||
818 | 818 | ||
819 | if (cgl_err != kCGLNoError ) | 819 | if (cgl_err != kCGLNoError ) |
820 | { | 820 | { |
821 | llinfos << "Multi-threaded OpenGL not available." << llendl; | 821 | LL_DEBUGS("GLInit") << "Multi-threaded OpenGL not available." << LL_ENDL; |
822 | } | 822 | } |
823 | else | 823 | else |
824 | { | 824 | { |
825 | llinfos << "Multi-threaded OpenGL enabled." << llendl; | 825 | LL_DEBUGS("GLInit") << "Multi-threaded OpenGL enabled." << LL_ENDL; |
826 | } | 826 | } |
827 | } | 827 | } |
828 | 828 | ||
@@ -869,11 +869,11 @@ BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, B | |||
869 | mFullscreenBits = CGDisplayBitsPerPixel(mDisplay); | 869 | mFullscreenBits = CGDisplayBitsPerPixel(mDisplay); |
870 | mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate)); | 870 | mFullscreenRefresh = llround(getDictDouble (CGDisplayCurrentMode (mDisplay), kCGDisplayRefreshRate)); |
871 | 871 | ||
872 | llinfos << "Switched resolution to " << mFullscreenWidth | 872 | LL_INFOS("Window") << "Switched resolution to " << mFullscreenWidth |
873 | << "x" << mFullscreenHeight | 873 | << "x" << mFullscreenHeight |
874 | << "x" << mFullscreenBits | 874 | << "x" << mFullscreenBits |
875 | << " @ " << mFullscreenRefresh | 875 | << " @ " << mFullscreenRefresh |
876 | << llendl; | 876 | << LL_ENDL; |
877 | 877 | ||
878 | // Update the GL context to the new screen size | 878 | // Update the GL context to the new screen size |
879 | if (!aglUpdateContext(mContext)) | 879 | if (!aglUpdateContext(mContext)) |
@@ -943,7 +943,7 @@ void LLWindowMacOSX::destroyContext() | |||
943 | // Unhook the GL context from any drawable it may have | 943 | // Unhook the GL context from any drawable it may have |
944 | if(mContext != NULL) | 944 | if(mContext != NULL) |
945 | { | 945 | { |
946 | llinfos << "destroyContext: unhooking drawable " << llendl; | 946 | LL_DEBUGS("Window") << "destroyContext: unhooking drawable " << LL_ENDL; |
947 | 947 | ||
948 | aglSetCurrentContext (NULL); | 948 | aglSetCurrentContext (NULL); |
949 | aglSetDrawable(mContext, NULL); | 949 | aglSetDrawable(mContext, NULL); |
@@ -952,7 +952,7 @@ void LLWindowMacOSX::destroyContext() | |||
952 | // Make sure the display resolution gets restored | 952 | // Make sure the display resolution gets restored |
953 | if(mOldDisplayMode != NULL) | 953 | if(mOldDisplayMode != NULL) |
954 | { | 954 | { |
955 | llinfos << "destroyContext: restoring display resolution " << llendl; | 955 | LL_DEBUGS("Window") << "destroyContext: restoring display resolution " << LL_ENDL; |
956 | 956 | ||
957 | CGDisplaySwitchToMode (mDisplay, mOldDisplayMode); | 957 | CGDisplaySwitchToMode (mDisplay, mOldDisplayMode); |
958 | 958 | ||
@@ -978,7 +978,7 @@ void LLWindowMacOSX::destroyContext() | |||
978 | // Clean up the pixel format | 978 | // Clean up the pixel format |
979 | if(mPixelFormat != NULL) | 979 | if(mPixelFormat != NULL) |
980 | { | 980 | { |
981 | llinfos << "destroyContext: destroying pixel format " << llendl; | 981 | LL_DEBUGS("Window") << "destroyContext: destroying pixel format " << LL_ENDL; |
982 | aglDestroyPixelFormat(mPixelFormat); | 982 | aglDestroyPixelFormat(mPixelFormat); |
983 | mPixelFormat = NULL; | 983 | mPixelFormat = NULL; |
984 | } | 984 | } |
@@ -986,14 +986,14 @@ void LLWindowMacOSX::destroyContext() | |||
986 | // Remove any Carbon Event handlers we installed | 986 | // Remove any Carbon Event handlers we installed |
987 | if(mGlobalHandlerRef != NULL) | 987 | if(mGlobalHandlerRef != NULL) |
988 | { | 988 | { |
989 | llinfos << "destroyContext: removing global event handler" << llendl; | 989 | LL_DEBUGS("Window") << "destroyContext: removing global event handler" << LL_ENDL; |
990 | RemoveEventHandler(mGlobalHandlerRef); | 990 | RemoveEventHandler(mGlobalHandlerRef); |
991 | mGlobalHandlerRef = NULL; | 991 | mGlobalHandlerRef = NULL; |
992 | } | 992 | } |
993 | 993 | ||
994 | if(mWindowHandlerRef != NULL) | 994 | if(mWindowHandlerRef != NULL) |
995 | { | 995 | { |
996 | llinfos << "destroyContext: removing window event handler" << llendl; | 996 | LL_DEBUGS("Window") << "destroyContext: removing window event handler" << LL_ENDL; |
997 | RemoveEventHandler(mWindowHandlerRef); | 997 | RemoveEventHandler(mWindowHandlerRef); |
998 | mWindowHandlerRef = NULL; | 998 | mWindowHandlerRef = NULL; |
999 | } | 999 | } |
@@ -1001,7 +1001,7 @@ void LLWindowMacOSX::destroyContext() | |||
1001 | // Cleanup any TSM document we created. | 1001 | // Cleanup any TSM document we created. |
1002 | if(mTSMDocument != NULL) | 1002 | if(mTSMDocument != NULL) |
1003 | { | 1003 | { |
1004 | llinfos << "destroyContext: deleting TSM document" << llendl; | 1004 | LL_DEBUGS("Window") << "destroyContext: deleting TSM document" << LL_ENDL; |
1005 | DeactivateTSMDocument(mTSMDocument); | 1005 | DeactivateTSMDocument(mTSMDocument); |
1006 | DeleteTSMDocument(mTSMDocument); | 1006 | DeleteTSMDocument(mTSMDocument); |
1007 | mTSMDocument = NULL; | 1007 | mTSMDocument = NULL; |
@@ -1010,7 +1010,7 @@ void LLWindowMacOSX::destroyContext() | |||
1010 | // Close the window | 1010 | // Close the window |
1011 | if(mWindow != NULL) | 1011 | if(mWindow != NULL) |
1012 | { | 1012 | { |
1013 | llinfos << "destroyContext: disposing window" << llendl; | 1013 | LL_DEBUGS("Window") << "destroyContext: disposing window" << LL_ENDL; |
1014 | DisposeWindow(mWindow); | 1014 | DisposeWindow(mWindow); |
1015 | mWindow = NULL; | 1015 | mWindow = NULL; |
1016 | } | 1016 | } |
@@ -1018,7 +1018,7 @@ void LLWindowMacOSX::destroyContext() | |||
1018 | // Clean up the GL context | 1018 | // Clean up the GL context |
1019 | if(mContext != NULL) | 1019 | if(mContext != NULL) |
1020 | { | 1020 | { |
1021 | llinfos << "destroyContext: destroying GL context" << llendl; | 1021 | LL_DEBUGS("Window") << "destroyContext: destroying GL context" << LL_ENDL; |
1022 | aglDestroyContext(mContext); | 1022 | aglDestroyContext(mContext); |
1023 | mContext = NULL; | 1023 | mContext = NULL; |
1024 | } | 1024 | } |
@@ -3394,4 +3394,13 @@ void LLWindowMacOSX::interruptLanguageTextInput() | |||
3394 | // Well, if Apple's TSM document is correct, we don't. | 3394 | // Well, if Apple's TSM document is correct, we don't. |
3395 | } | 3395 | } |
3396 | 3396 | ||
3397 | //static | ||
3398 | std::string LLWindowMacOSX::getFontListSans() | ||
3399 | { | ||
3400 | // This is a fairly complete Japanese font that ships with Mac OS X. | ||
3401 | // The first filename is in UTF8, but it shows up in the font menu as "Hiragino Kaku Gothic Pro W3". | ||
3402 | // The third filename is in UTF8, but it shows up in the font menu as "STHeiti Light" | ||
3403 | return "\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 Pro W3.otf;\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 ProN W3.otf;AppleGothic.dfont;AppleGothic.ttf;\xe5\x8d\x8e\xe6\x96\x87\xe7\xbb\x86\xe9\xbb\x91.ttf"; | ||
3404 | } | ||
3405 | |||
3397 | #endif // LL_DARWIN | 3406 | #endif // LL_DARWIN |