SL-9766 [Render] [Mac] Alt + left mouse click has severely impaired functions

SL-10019 - [Mac] [Render] Right-click context menu immediately disappears when clicking any place in the ‘Inventory’ floater
SL-9984 - [Retina] Camera frustum, do not display correctly on "WORLD MAP" window.
SL-10027 - [Mac] [Render] Add toggle for Retina support to mitigate FPS loss

Re-FIX for Retina support.
meow-7.2.2
ruslantproductengine 2018-11-26 18:02:44 +02:00
parent 3df143dd41
commit b4d4aac1c2
13 changed files with 83 additions and 37 deletions

View File

@ -3292,8 +3292,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
menu->arrangeAndClear();
LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y);
F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor();
LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x/dev_scale_factor, mouse_y/dev_scale_factor);
LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y);
const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect();

View File

@ -488,10 +488,6 @@ void LLToolTipMgr::show(const LLToolTip::Params& params)
return;
}
S32 mouse_x;
S32 mouse_y;
LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y);
// are we ready to show the tooltip?
if (!mToolTipsBlocked // we haven't hit a key, moved the mouse, etc.
&& LLUI::getMouseIdleTime() > params_with_defaults.delay_time) // the mouse has been still long enough
@ -573,12 +569,12 @@ void LLToolTipMgr::updateToolTipVisibility()
}
// hide existing tooltips if they have timed out
S32 mouse_x, mouse_y;
LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y);
F32 tooltip_timeout = 0.f;
if (toolTipVisible())
{
S32 mouse_x, mouse_y;
LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y);
// mouse far away from tooltip
tooltip_timeout = mLastToolTipParams.visible_time_far;
// mouse near rect will only include the tooltip if the

View File

@ -263,11 +263,14 @@ void LLUI::dirtyRect(LLRect rect)
//static
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor();
S32 screen_x, screen_y;
screen_x = ll_round(((F32)x * getScaleFactor().mV[VX]) / dev_scale_factor);
screen_y = ll_round(((F32)y * getScaleFactor().mV[VY]) / dev_scale_factor);
#if defined(LL_DARWIN)
screen_x = ll_round((F32)x);
screen_y = ll_round((F32)y);
#else
screen_x = ll_round((F32)x * getScaleFactor().mV[VX]);
screen_y = ll_round((F32)y * getScaleFactor().mV[VY]);
#endif
LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
@ -275,11 +278,10 @@ void LLUI::setMousePositionScreen(S32 x, S32 y)
void LLUI::getMousePositionScreen(S32 *x, S32 *y)
{
LLCoordWindow cursor_pos_window;
F32 dev_scale_factor = LLView::getWindow()->getDeviceScaleFactor();
getWindow()->getCursorPosition(&cursor_pos_window);
LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
*x = ll_round(((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]) * dev_scale_factor);
*y = ll_round(((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]) * dev_scale_factor);
*x = ll_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
*y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VY]);
}
//static

View File

@ -28,6 +28,8 @@
#import "llwindowmacosx-objc.h"
#import "llappdelegate-objc.h"
extern BOOL gHiDPISupport;
#pragma mark local functions
NativeKeyEventData extractKeyDataFromKeyEvent(NSEvent* theEvent)
@ -189,7 +191,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
{
if (!mOldResize) //Maint-3288
{
NSSize dev_sz = [self convertSizeToBacking:[self frame].size];
NSSize dev_sz = gHiDPISupport ? [self convertSizeToBacking:[self frame].size] : [self frame].size;
callResize(dev_sz.width, dev_sz.height);
}
}
@ -283,7 +285,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
[self setPixelFormat:pixelFormat];
//for retina support
[self setWantsBestResolutionOpenGLSurface:YES];
[self setWantsBestResolutionOpenGLSurface:gHiDPISupport];
[self setOpenGLContext:glContext];
@ -379,7 +381,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
callRightMouseUp(mMousePos, [theEvent modifierFlags]);
mSimulatedRightClick = false;
} else {
NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]];
NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y;
callLeftMouseUp(mMousePos, [theEvent modifierFlags]);
@ -398,7 +400,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
- (void)mouseMoved:(NSEvent *)theEvent
{
NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])];
NSPoint dev_delta = gHiDPISupport ? [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])] : NSMakePoint([theEvent deltaX], [theEvent deltaY]);
float mouseDeltas[] = {
float(dev_delta.x),
@ -407,7 +409,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
callDeltaUpdate(mouseDeltas, 0);
NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]];
NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y;
callMouseMoved(mMousePos, 0);
@ -422,7 +424,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
// The old CoreGraphics APIs we previously relied on are now flagged as obsolete.
// NSEvent isn't obsolete, and provides us with the correct deltas.
NSPoint dev_delta = [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])];
NSPoint dev_delta = gHiDPISupport ? [self convertPointToBacking:NSMakePoint([theEvent deltaX], [theEvent deltaY])] : NSMakePoint([theEvent deltaX], [theEvent deltaY]);
float mouseDeltas[] = {
float(dev_delta.x),
@ -431,7 +433,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
callDeltaUpdate(mouseDeltas, 0);
NSPoint mPoint = [self convertPointToBacking:[theEvent locationInWindow]];
NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y;
callMouseDragged(mMousePos, 0);

View File

@ -111,7 +111,8 @@ void glSwapBuffers(void* context);
CGLContextObj getCGLContextObj(GLViewRef view);
unsigned long getVramSize(GLViewRef view);
float getDeviceUnitSize(GLViewRef view);
void getContentViewBounds(NSWindowRef window, float* bounds);
const CGPoint & getContentViewBoundsPosition(NSWindowRef window);
const CGSize & getContentViewBoundsSize(NSWindowRef window);
const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view);
void getWindowSize(NSWindowRef window, float* size);
void setWindowSize(NSWindowRef window, int width, int height);

View File

@ -264,12 +264,14 @@ float getDeviceUnitSize(GLViewRef view)
return [(LLOpenGLView*)view convertSizeToBacking:NSMakeSize(1, 1)].width;
}
void getContentViewBounds(NSWindowRef window, float* bounds)
const CGPoint & getContentViewBoundsPosition(NSWindowRef window)
{
bounds[0] = [[(LLNSWindow*)window contentView] bounds].origin.x;
bounds[1] = [[(LLNSWindow*)window contentView] bounds].origin.y;
bounds[2] = [[(LLNSWindow*)window contentView] bounds].size.width;
bounds[3] = [[(LLNSWindow*)window contentView] bounds].size.height;
return [[(LLNSWindow*)window contentView] bounds].origin;
}
const CGSize & getContentViewBoundsSize(NSWindowRef window)
{
return [[(LLNSWindow*)window contentView] bounds].size;
}
const CGSize & getDeviceContentViewSize(NSWindowRef window, GLViewRef view)

View File

@ -43,6 +43,7 @@
#include <CoreServices/CoreServices.h>
extern BOOL gDebugWindowProc;
BOOL gHiDPISupport = TRUE;
const S32 BITS_PER_PIXEL = 32;
const S32 MAX_NUM_RESOLUTIONS = 32;
@ -837,7 +838,6 @@ void LLWindowMacOSX::gatherInput()
BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position)
{
float rect[4];
S32 err = -1;
if(mFullscreen)
@ -848,10 +848,12 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position)
}
else if(mWindow)
{
getContentViewBounds(mWindow, rect);
const CGPoint & pos = getContentViewBoundsPosition(mWindow);
position->mX = rect[0];
position->mY = rect[1];
position->mX = pos.x;
position->mY = pos.y;
err = noErr;
}
else
{
@ -873,7 +875,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size)
}
else if(mWindow)
{
const CGSize & sz = getDeviceContentViewSize(mWindow, mGLView);
const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow);
size->mX = sz.width;
size->mY = sz.height;
@ -898,7 +900,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size)
}
else if(mWindow)
{
const CGSize & sz = getDeviceContentViewSize(mWindow, mGLView);
const CGSize & sz = gHiDPISupport ? getDeviceContentViewSize(mWindow, mGLView) : getContentViewBoundsSize(mWindow);
size->mX = sz.width;
size->mY = sz.height;
@ -1110,6 +1112,9 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position)
// trigger mouse move callback
LLCoordGL gl_pos;
convertCoords(position, &gl_pos);
float scale = getDeviceScaleFactor();
gl_pos.mX *= scale;
gl_pos.mY *= scale;
mCallbacks->handleMouseMove(this, gl_pos, (MASK)0);
return result;
@ -1954,7 +1959,7 @@ MASK LLWindowMacOSX::modifiersToMask(S16 modifiers)
F32 LLWindowMacOSX::getDeviceScaleFactor()
{
return ::getDeviceUnitSize(mGLView);
return gHiDPISupport ? ::getDeviceUnitSize(mGLView) : LLWindow::getDeviceScaleFactor();
}
#if LL_OS_DRAGDROP_ENABLED

View File

@ -11432,6 +11432,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>RenderHiDPI</key>
<map>
<key>Comment</key>
<string>Enable support for HiDPI displays, like Retina (MacOS X ONLY, requires restart)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>RenderPerformanceTest</key>
<map>

View File

@ -306,6 +306,10 @@ extern BOOL gRandomizeFramerate;
extern BOOL gPeriodicSlowFrame;
extern BOOL gDebugGL;
#if LL_DARWIN
extern BOOL gHiDPISupport;
#endif
////////////////////////////////////////////////////////////
// All from the last globals push...
@ -658,6 +662,10 @@ static void settings_to_globals()
gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc");
gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale");
#if LL_DARWIN
gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI");
#endif
}
static void settings_modify()

View File

@ -4358,6 +4358,9 @@ BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild()
combo->remove("8x");
combo->remove("16x");
}
LLCheckBoxCtrl *use_HiDPI = getChild<LLCheckBoxCtrl>("use HiDPI");
use_HiDPI->setVisible(FALSE);
#endif
return TRUE;

View File

@ -3499,7 +3499,7 @@ void LLViewerWindow::moveCursorToCenter()
//on a forced move, all deltas get zeroed out to prevent jumping
mCurrentMousePoint.set(x,y);
mLastMousePoint.set(x,y);
mCurrentMouseDelta.set(0,0);
mCurrentMouseDelta.set(0,0);
}
}

View File

@ -1051,8 +1051,13 @@ void LLWorldMapView::drawFrustum()
// Compute the frustum coordinates. Take the UI scale into account.
F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor");
#if defined(LL_DARWIN)
F32 ctr_x = ((getLocalRect().getWidth() * 0.5f + sPanX) * ui_scale_factor) * LLUI::getScaleFactor().mV[VX];
F32 ctr_y = ((getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor) * LLUI::getScaleFactor().mV[VY];
#else
F32 ctr_x = ((getLocalRect().getWidth() * 0.5f + sPanX) * ui_scale_factor);
F32 ctr_y = ((getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor);
#endif
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

View File

@ -357,6 +357,18 @@
tool_tip="Compresses textures in video memory, allowing for higher resolution textures to be loaded at the cost of some color quality."
width="315" />
<check_box
control_name="RenderHiDPI"
height="16"
initial_value="true"
label="Enable support for HiDPI displays (requires restart)"
layout="topleft"
left="30"
top_delta="16"
name="use HiDPI"
tool_tip="Enable OpenGL for High-Resolution Drawing."
width="315" />
<text
type="string"
length="1"