Windows: cefclient: Improve high-dpi display (issue #1674).

- Add high-dpi support to the OSR example.
- Apply DPI scaling to the buttons and URL bar.
This commit is contained in:
Marshall Greenblatt
2015-08-07 19:00:07 -04:00
parent 9e0d84d94a
commit 41669141eb
5 changed files with 174 additions and 36 deletions

View File

@@ -9,6 +9,8 @@
#include <windows.h>
#include <string>
#include "include/internal/cef_types_wrappers.h"
namespace client {
// Set the window's user data pointer.
@@ -30,6 +32,19 @@ int GetCefMouseModifiers(WPARAM wparam);
int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
bool IsKeyDown(WPARAM wparam);
// Returns the device scale factor. For example, 200% display scaling will
// return 2.0.
float GetDeviceScaleFactor();
// Convert |value| from logical coordinates to device coordinates.
int LogicalToDevice(int value, float device_scale_factor);
CefRect LogicalToDevice(const CefRect& value, float device_scale_factor);
// Convert |value| from device coordinates to logical coordinates.
int DeviceToLogical(int value, float device_scale_factor);
CefRect DeviceToLogical(const CefRect& value, float device_scale_factor);
void DeviceToLogical(CefMouseEvent& value, float device_scale_factor);
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_