Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: ui/views/widget/tooltip_manager_win.cc

Issue 16336027: Enable high dpi in win/views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/native_widget_win.cc ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/tooltip_manager_win.cc
diff --git a/ui/views/widget/tooltip_manager_win.cc b/ui/views/widget/tooltip_manager_win.cc
index d90bb367caebe53c4f8a55099adddf0b10718ba5..ed6f4e9bb1a0c6c92d9c1c9798a0dbaea22bc0e0 100644
--- a/ui/views/widget/tooltip_manager_win.cc
+++ b/ui/views/widget/tooltip_manager_win.cc
@@ -16,6 +16,7 @@
#include "base/win/scoped_hdc.h"
#include "base/win/scoped_select_object.h"
#include "ui/base/l10n/l10n_util_win.h"
+#include "ui/base/win/dpi.h"
#include "ui/base/win/hwnd_util.h"
#include "ui/base/win/scoped_set_map_mode.h"
#include "ui/gfx/font.h"
@@ -29,7 +30,7 @@ namespace views {
static int tooltip_height_ = 0;
// Default timeout for the tooltip displayed using keyboard.
-// Timeout is mentioned in milliseconds.
+// Timeout is measured in milliseconds.
static const int kDefaultTimeout = 4000;
// static
@@ -226,6 +227,7 @@ bool TooltipManagerWin::SetTooltipPosition(int text_x, int text_y) {
// Calculate the bounds the tooltip will get.
gfx::Point view_loc;
View::ConvertPointToScreen(last_tooltip_view_, &view_loc);
+ view_loc = ui::win::DIPToScreenPoint(view_loc);
RECT bounds = { view_loc.x() + text_x,
view_loc.y() + text_y,
view_loc.x() + text_x + tooltip_width_,
@@ -298,13 +300,15 @@ void TooltipManagerWin::UpdateTooltip(const gfx::Point& mouse_pos) {
}
void TooltipManagerWin::OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param) {
- gfx::Point mouse_pos(l_param);
+ gfx::Point mouse_pos_in_pixels(l_param);
+ gfx::Point mouse_pos = ui::win::ScreenToDIPPoint(mouse_pos_in_pixels);
if (u_msg >= WM_NCMOUSEMOVE && u_msg <= WM_NCXBUTTONDBLCLK) {
// NC message coordinates are in screen coordinates.
- POINT temp = mouse_pos.ToPOINT();
+ POINT temp = mouse_pos_in_pixels.ToPOINT();
::MapWindowPoints(HWND_DESKTOP, GetParent(), &temp, 1);
- mouse_pos.SetPoint(temp.x, temp.y);
+ mouse_pos_in_pixels.SetPoint(temp.x, temp.y);
+ mouse_pos = ui::win::ScreenToDIPPoint(mouse_pos_in_pixels);
}
if (u_msg != WM_MOUSEMOVE || last_mouse_pos_ != mouse_pos) {
« no previous file with comments | « ui/views/widget/native_widget_win.cc ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698