summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llwindow/llwindow.h2
-rw-r--r--indra/llwindow/llwindowwin32.cpp65
-rw-r--r--indra/llwindow/llwindowwin32.h2
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llappviewer.cpp11
-rw-r--r--indra/newview/llappviewer.h1
-rw-r--r--indra/newview/llstartup.cpp6
-rw-r--r--indra/newview/llviewerwindow.cpp35
-rw-r--r--indra/newview/llviewerwindow.h8
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml12
10 files changed, 147 insertions, 6 deletions
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 0a30f4c807..a05ba8cbba 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -166,6 +166,8 @@ public:
// Provide native key event data
virtual LLSD getNativeKeyData() { return LLSD::emptyMap(); }
+ // Get system UI size based on DPI (for 96 DPI UI size should be 1.0)
+ virtual F32 getSystemUISize() { return 1.0; }
protected:
LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags);
virtual ~LLWindow();
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 875ffe4cd4..2a39029eee 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -78,6 +78,31 @@ LPWSTR gIconResource = IDI_APPLICATION;
LLW32MsgCallback gAsyncMsgCallback = NULL;
+#ifndef DPI_ENUMS_DECLARED
+
+typedef enum PROCESS_DPI_AWARENESS {
+ PROCESS_DPI_UNAWARE = 0,
+ PROCESS_SYSTEM_DPI_AWARE = 1,
+ PROCESS_PER_MONITOR_DPI_AWARE = 2
+} PROCESS_DPI_AWARENESS;
+
+typedef enum MONITOR_DPI_TYPE {
+ MDT_EFFECTIVE_DPI = 0,
+ MDT_ANGULAR_DPI = 1,
+ MDT_RAW_DPI = 2,
+ MDT_DEFAULT = MDT_EFFECTIVE_DPI
+} MONITOR_DPI_TYPE;
+
+#endif
+
+typedef HRESULT(STDAPICALLTYPE *SetProcessDpiAwarenessType)(_In_ PROCESS_DPI_AWARENESS value);
+
+typedef HRESULT(STDAPICALLTYPE *GetDpiForMonitorType)(
+ _In_ HMONITOR hmonitor,
+ _In_ MONITOR_DPI_TYPE dpiType,
+ _Out_ UINT *dpiX,
+ _Out_ UINT *dpiY);
+
//
// LLWindowWin32
//
@@ -3878,6 +3903,46 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
return FALSE;
}
+F32 LLWindowWin32::getSystemUISize()
+{
+ float scale_value = 0;
+ HWND hWnd = (HWND)getPlatformWindow();
+ HDC hdc = GetDC(hWnd);
+ HMONITOR hMonitor;
+
+ HMODULE hShcore = LoadLibrary(L"shcore.dll");
+
+ if (hShcore != NULL)
+ {
+ SetProcessDpiAwarenessType pSPDA;
+ pSPDA = (SetProcessDpiAwarenessType)GetProcAddress(hShcore, "SetProcessDpiAwareness");
+ GetDpiForMonitorType pGDFM;
+ pGDFM = (GetDpiForMonitorType)GetProcAddress(hShcore, "GetDpiForMonitor");
+ if (pSPDA != NULL && pGDFM != NULL)
+ {
+ pSPDA(PROCESS_PER_MONITOR_DPI_AWARE);
+ POINT pt;
+ UINT dpix = 0, dpiy = 0;
+ HRESULT hr = E_FAIL;
+
+ // Get the DPI for the main monitor, and set the scaling factor
+ pt.x = 1;
+ pt.y = 1;
+ hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
+ hr = pGDFM(hMonitor, MDT_EFFECTIVE_DPI, &dpix, &dpiy);
+ scale_value = dpix / 96.0f;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Could not load shcore.dll library (included by <ShellScalingAPI.h> from Win 8.1 SDK). Using legacy DPI awareness API of Win XP/7" << LL_ENDL;
+ scale_value = GetDeviceCaps(hdc, LOGPIXELSX) / 96.0f;
+ }
+
+ ReleaseDC(hWnd, hdc);
+ return scale_value;
+}
+
//static
std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()
{
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 1a775eadaf..1386321912 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -110,6 +110,8 @@ public:
/*virtual*/ void interruptLanguageTextInput();
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
+ /*virtual*/ F32 getSystemUISize();
+
LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url );
static std::vector<std::string> getDynamicFallbackFontList();
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 6106dde734..90ad5a605d 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -12792,6 +12792,17 @@
<key>Value</key>
<real>1.0</real>
</map>
+ <key>LastSystemUIScaleFactor</key>
+ <map>
+ <key>Comment</key>
+ <string>Size of system UI during last run. On Windows 100% (96 DPI) system setting is 1.0 UI size</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
<key>UIScrollbarSize</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index acbcb4f8b7..724eb56286 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -696,7 +696,8 @@ LLAppViewer::LLAppViewer()
mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)),
mFastTimerLogThread(NULL),
mUpdater(new LLUpdaterService()),
- mSettingsLocationList(NULL)
+ mSettingsLocationList(NULL),
+ mIsFirstRun(false)
{
if(NULL != sInstance)
{
@@ -2485,7 +2486,10 @@ bool LLAppViewer::initConfiguration()
if (gSavedSettings.getBOOL("FirstRunThisInstall"))
{
- // Note that the "FirstRunThisInstall" settings is currently unused.
+ // Set firstrun flag to indicate that some further init actiona should be taken
+ // like determining screen DPI value and so on
+ mIsFirstRun = true;
+
gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
}
@@ -3142,7 +3146,8 @@ bool LLAppViewer::initWindow()
.min_width(gSavedSettings.getU32("MinWindowWidth"))
.min_height(gSavedSettings.getU32("MinWindowHeight"))
.fullscreen(gSavedSettings.getBOOL("FullScreen"))
- .ignore_pixel_depth(ignorePixelDepth);
+ .ignore_pixel_depth(ignorePixelDepth)
+ .first_run(mIsFirstRun);
gViewerWindow = new LLViewerWindow(window_params);
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 07bef11dbc..d4af2440be 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -318,6 +318,7 @@ private:
// llcorehttp library init/shutdown helper
LLAppCoreHttp mAppCoreHttp;
+ bool mIsFirstRun;
//---------------------------------------------
//*NOTE: Mani - legacy updater stuff
// Still useable?
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index a2c8e7772e..4e81d78455 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -771,7 +771,11 @@ bool idle_startup()
LL_DEBUGS("AppInit") << "FirstLoginThisInstall off" << LL_ENDL;
}
}
-
+ display_startup();
+ if (gViewerWindow->getSystemUIScaleFactorChanged())
+ {
+ LLViewerWindow::showSystemUIScaleFactorChanged();
+ }
LLStartUp::setStartupState( STATE_LOGIN_WAIT ); // Wait for user input
}
else
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index c17c50fd88..f47a37fcda 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1655,7 +1655,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mResDirty(false),
mStatesDirty(false),
mCurrResolutionIndex(0),
- mProgressView(NULL)
+ mProgressView(NULL),
+ mSystemUIScaleFactorChanged(false)
{
// gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
// pass its value right now. Instead, pass it a nullary function that
@@ -1743,6 +1744,16 @@ LLViewerWindow::LLViewerWindow(const Params& p)
gSavedSettings.setS32("FullScreenHeight",scr.mY);
}
+
+ F32 system_scale_factor = mWindow->getSystemUISize();
+ if (p.first_run || gSavedSettings.getF32("LastSystemUIScaleFactor") != system_scale_factor)
+ {
+ mSystemUIScaleFactorChanged = true;
+ gSavedSettings.setF32("LastSystemUIScaleFactor", system_scale_factor);
+ gSavedSettings.setF32("UIScaleFactor", system_scale_factor);
+ }
+
+
// Get the real window rect the window was created with (since there are various OS-dependent reasons why
// the size of a window or fullscreen context may have been adjusted slightly...)
F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor");
@@ -1838,6 +1849,28 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale);
}
+//static
+void LLViewerWindow::showSystemUIScaleFactorChanged()
+{
+ LLNotificationsUtil::add("SystemUIScaleFactorChanged", LLSD(), LLSD(), onSystemUIScaleFactorChanged);
+}
+
+//static
+bool LLViewerWindow::onSystemUIScaleFactorChanged(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if(option == 0)
+ {
+ LLFloaterReg::toggleInstanceOrBringToFront("preferences");
+ LLFloater* pref_floater = LLFloaterReg::getInstance("preferences");
+ LLTabContainer* tab_container = pref_floater->getChild<LLTabContainer>("pref core");
+ tab_container->selectTabByName("advanced1");
+
+ }
+ return false;
+}
+
+
void LLViewerWindow::initGLDefaults()
{
gGL.setSceneBlendType(LLRender::BT_ALPHA);
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index ad06f00234..afe80358ca 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -155,7 +155,8 @@ public:
min_width,
min_height;
Optional<bool> fullscreen,
- ignore_pixel_depth;
+ ignore_pixel_depth,
+ first_run;
Params();
};
@@ -418,6 +419,9 @@ public:
void calcDisplayScale();
static LLRect calcScaledRect(const LLRect & rect, const LLVector2& display_scale);
+ bool getSystemUIScaleFactorChanged() { return mSystemUIScaleFactorChanged; }
+ static void showSystemUIScaleFactorChanged();
+
private:
bool shouldShowToolTipFor(LLMouseHandler *mh);
@@ -431,6 +435,7 @@ private:
S32 getChatConsoleBottomPad(); // Vertical padding for child console rect, varied by bottom clutter
LLRect getChatConsoleRect(); // Get optimal cosole rect.
+ static bool onSystemUIScaleFactorChanged(const LLSD& notification, const LLSD& response);
private:
LLWindow* mWindow; // graphical window object
bool mActive;
@@ -509,6 +514,7 @@ private:
LLPointer<LLViewerObject> mDragHoveredObject;
static LLTrace::SampleStatHandle<> sMouseVelocityStat;
+ bool mSystemUIScaleFactorChanged; // system UI scale factor changed from last run
};
//
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index b0d8a3cf7e..54e90ac496 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4073,6 +4073,18 @@ Do you want to open your Web browser to view this content?
<notification
icon="alertmodal.tga"
+ name="SystemUIScaleFactorChanged"
+ type="alertmodal">
+System UI size factor has changed since last run. Do you want to open UI size adjustment settings page?
+ <tag>confirm</tag>
+ <usetemplate
+ name="okcancelbuttons"
+ notext="Cancel"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="WebLaunchJoinNow"
type="alertmodal">
Go to your [http://secondlife.com/account/ Dashboard] to manage your account?