diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2011-04-27 16:20:44 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2011-04-27 16:20:44 -0700 |
commit | d4ee7ac7489df97d006c5bba8ee00ef63ec9e4b0 (patch) | |
tree | e33a1660a399ad8b86a66c2f420cad13319c805b /indra | |
parent | 368173b7d602aa1d790a4510c4bf9e6d9e102d1d (diff) | |
parent | d952f97459a04d64b698380b777406f1644f9bb2 (diff) |
Merge
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 101 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.h | 3 | ||||
-rw-r--r-- | indra/newview/llavataractions.cpp | 10 |
3 files changed, 77 insertions, 37 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index affd7276cc..447e3661db 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -108,9 +108,6 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key); static EventTypeSpec WindowHandlerEventList[] = { // Window-related events - // { kEventClassWindow, kEventWindowCollapsing }, - // { kEventClassWindow, kEventWindowCollapsed }, - // { kEventClassWindow, kEventWindowShown }, { kEventClassWindow, kEventWindowActivated }, { kEventClassWindow, kEventWindowDeactivated }, { kEventClassWindow, kEventWindowShown }, @@ -121,8 +118,7 @@ static EventTypeSpec WindowHandlerEventList[] = { kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowBoundsChanging }, { kEventClassWindow, kEventWindowBoundsChanged }, - // { kEventClassWindow, kEventWindowZoomed }, - // { kEventClassWindow, kEventWindowDrawContent }, + { kEventClassWindow, kEventWindowGetIdealSize }, // Mouse events { kEventClassMouse, kEventMouseDown }, @@ -248,6 +244,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, mCursorIgnoreNextDelta = FALSE; mNeedsResize = FALSE; mOverrideAspectRatio = 0.f; + mMaximized = FALSE; mMinimized = FALSE; mTSMDocument = NULL; // Just in case. mLanguageTextInputAllowed = FALSE; @@ -455,24 +452,23 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits if(!mFullscreen && (mWindow == NULL)) { - Rect window_rect; //int displayWidth = CGDisplayPixelsWide(mDisplay); //int displayHeight = CGDisplayPixelsHigh(mDisplay); //const int menuBarPlusTitleBar = 44; // Ugly magic number. LL_DEBUGS("Window") << "createContext: creating window" << LL_ENDL; - window_rect.left = (long) x; - window_rect.right = (long) x + width; - window_rect.top = (long) y; - window_rect.bottom = (long) y + height; + mPreviousWindowRect.left = (long) x; + mPreviousWindowRect.right = (long) x + width; + mPreviousWindowRect.top = (long) y; + mPreviousWindowRect.bottom = (long) y + height; //----------------------------------------------------------------------- // Create the window //----------------------------------------------------------------------- mWindow = NewCWindow( NULL, - &window_rect, + &mPreviousWindowRect, mWindowTitle, false, // Create the window invisible. Whoever calls createContext() should show it after any moving/resizing. // noGrowDocProc, // Window with no grow box and no zoom box @@ -481,8 +477,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits kFirstWindowOfClass, true, (long)this); - - + if (!mWindow) { setupFailure("Window creation error", "Error", OSMB_OK); @@ -1093,31 +1088,22 @@ BOOL LLWindowMacOSX::getVisible() BOOL LLWindowMacOSX::getMinimized() { - BOOL result = FALSE; - - // Since the set of states where we want to act "minimized" is non-trivial, it's easier to - // track things locally than to try and retrieve the state from the window manager. - result = mMinimized; - - return(result); + return mMinimized; } BOOL LLWindowMacOSX::getMaximized() { - BOOL result = FALSE; - - if (mWindow) - { - // TODO - } - - return(result); + return mMaximized; } BOOL LLWindowMacOSX::maximize() { - // TODO - return FALSE; + if (mWindow && !mMaximized) + { + ZoomWindow(mWindow, inContent, true); + } + + return mMaximized; } BOOL LLWindowMacOSX::getFullscreen() @@ -2559,7 +2545,24 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, ¤tBounds); GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds); - + + // Put an offset into window un-maximize operation since the kEventWindowGetIdealSize + // event only allows the specification of size and not position. + if (mMaximized) + { + short leftOffset = mPreviousWindowRect.left - currentBounds.left; + currentBounds.left += leftOffset; + currentBounds.right += leftOffset; + + short topOffset = mPreviousWindowRect.top - currentBounds.top; + currentBounds.top += topOffset; + currentBounds.bottom += topOffset; + } + else + { + // Store off the size for future un-maximize operations + mPreviousWindowRect = previousBounds; + } if ((currentBounds.right - currentBounds.left) < MIN_WIDTH) { @@ -2578,13 +2581,43 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e case kEventWindowBoundsChanged: { + // Get new window bounds Rect newBounds; - GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &newBounds); + + // Get previous window bounds + Rect oldBounds; + GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &oldBounds); + + // Determine if the new size is larger than the old + bool newBoundsLarger = ((newBounds.right - newBounds.left) >= (oldBounds.right - oldBounds.left)); + newBoundsLarger &= ((newBounds.bottom - newBounds.top) >= (oldBounds.bottom - oldBounds.top)); + + // Check to see if this is a zoom event (+ button on window pane) + unsigned int eventParams; + GetEventParameter(event, kEventParamAttributes, typeUInt32, NULL, sizeof(int), NULL, &eventParams); + bool isZoomEvent = ((eventParams & kWindowBoundsChangeZoom) != 0); + + // Maximized flag is if zoom event and increasing window size + mMaximized = (isZoomEvent && newBoundsLarger); + aglUpdateContext(mContext); + mCallbacks->handleResize(this, newBounds.right - newBounds.left, newBounds.bottom - newBounds.top); - - + } + break; + + case kEventWindowGetIdealSize: + // Only recommend a new ideal size when un-maximizing + if (mMaximized == TRUE) + { + Point nonMaximizedSize; + + nonMaximizedSize.v = mPreviousWindowRect.bottom - mPreviousWindowRect.top; + nonMaximizedSize.h = mPreviousWindowRect.right - mPreviousWindowRect.left; + + SetEventParameter(event, kEventParamDimensions, typeQDPoint, sizeof(Point), &nonMaximizedSize); + result = noErr; } break; diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 6dc093b4be..6c9e075a21 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -156,7 +156,6 @@ protected: static pascal Boolean staticMoveEventComparator( EventRef event, void* data); OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event); void adjustCursorDecouple(bool warpingMouse = false); - void fixWindowSize(void); void stopDockTileBounce(); static MASK modifiersToMask(SInt16 modifiers); @@ -182,6 +181,7 @@ protected: EventComparatorUPP mMoveEventCampartorUPP; Rect mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse() + Rect mPreviousWindowRect; // Save previous window for un-maximize event Str255 mWindowTitle; double mOriginalAspectRatio; BOOL mSimulatedRightClick; @@ -195,6 +195,7 @@ protected: BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize. LLCoordScreen mNeedsResizeSize; F32 mOverrideAspectRatio; + BOOL mMaximized; BOOL mMinimized; U32 mFSAASamples; BOOL mForceRebuild; diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index ca7ec7cc30..cbbdcb2983 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -302,8 +302,14 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids) static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name) { - llinfos << "opening web profile for " << av_name.mUsername << llendl; - std::string url = getProfileURL(av_name.mUsername); + std::string username = av_name.mUsername; + if (username.empty()) + { + username = LLCacheName::buildUsername(av_name.mDisplayName); + } + + llinfos << "opening web profile for " << username << llendl; + std::string url = getProfileURL(username); // PROFILES: open in webkit window LLWeb::loadWebURLInternal(url, "", agent_id.asString()); |