[Win] Use command-line argument to launch in regular or High DPI mode.
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Sep 2015 22:02:38 +0000 (22:02 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Sep 2015 22:02:38 +0000 (22:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149417

Reviewed by Dean Jackson.

* MiniBrowser/win/Common.cpp:
(parseCommandLine): Ignore the '--highDPI' argument. It's used at the
very start of execution, before the MiniBrowser.dll is loaded.
* win/DLLLauncher/DLLLauncherMain.cpp:
(shouldUseHighDPI): Check for '--highDPI', and use this mode if
present. On WinCairo, always use High DPI.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190082 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/win/Common.cpp
Tools/win/DLLLauncher/DLLLauncherMain.cpp

index 4b5b5ac..e56049a 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-21  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Use command-line argument to launch in regular or High DPI mode.
+        https://bugs.webkit.org/show_bug.cgi?id=149417
+
+        Reviewed by Dean Jackson.
+
+        * MiniBrowser/win/Common.cpp:
+        (parseCommandLine): Ignore the '--highDPI' argument. It's used at the
+        very start of execution, before the MiniBrowser.dll is loaded.
+        * win/DLLLauncher/DLLLauncherMain.cpp:
+        (shouldUseHighDPI): Check for '--highDPI', and use this mode if
+        present. On WinCairo, always use High DPI.
+
 2015-09-21  Ryosuke Niwa  <rniwa@webkit.org>
 
         32-bit Mac build fix attempt after r190065.
index db4346c..6acd7ce 100644 (file)
@@ -848,10 +848,12 @@ static void parseCommandLine(bool& usesLayeredWebView, bool& useFullDesktop, boo
             usesLayeredWebView = true;
         else if (!wcsicmp(argv[i], L"--desktop"))
             useFullDesktop = true;
-        else if (!requestedURL)
-            requestedURL = argv[i];
         else if (!wcsicmp(argv[i], L"--performance"))
             pageLoadTesting = true;
+        else if (!wcsicmp(argv[i], L"--highDPI"))
+            continue; // ignore
+        else if (!requestedURL)
+            requestedURL = argv[i];
     }
 }
 
index 32c2846..a48e336 100644 (file)
@@ -178,6 +178,22 @@ static wstring getLastErrorString(HRESULT hr)
     return errorMessage;
 }
 
+static bool shouldUseHighDPI()
+{
+#ifdef WIN_CAIRO
+    return true;
+#else
+    int argc = 0;
+    WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+    for (int i = 1; i < argc; ++i) {
+        if (!wcsicmp(argv[i], L"--highDPI"))
+            return true;
+    }
+
+    return false;
+#endif
+}
+
 #if USE_CONSOLE_ENTRY_POINT
 int main(int argc, const char* argv[])
 #else
@@ -193,8 +209,10 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
     _set_FMA3_enable(0);
 #endif
 
-    BOOL didIt = SetProcessDPIAware();
-    _ASSERT(didIt);
+    if (shouldUseHighDPI()) {
+        BOOL didIt = SetProcessDPIAware();
+        _ASSERT(didIt);
+    }
 
 #ifdef _CRTDBG_MAP_ALLOC
     _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);