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

Side by Side Diff: ui/views/widget/native_widget_win.cc

Issue 14348033: NOT FOR SUBMIT - Windows Views HiDPI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Revert spurious changes, plus some corrections. 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/aero_tooltip_manager.cc ('k') | ui/views/widget/tooltip_manager_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/native_widget_win.h" 5 #include "ui/views/widget/native_widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/win/scoped_gdi_object.h" 14 #include "base/win/scoped_gdi_object.h"
15 #include "base/win/win_util.h" 15 #include "base/win/win_util.h"
16 #include "base/win/windows_version.h" 16 #include "base/win/windows_version.h"
17 #include "ui/base/dragdrop/drag_drop_types.h" 17 #include "ui/base/dragdrop/drag_drop_types.h"
18 #include "ui/base/dragdrop/drag_source_win.h" 18 #include "ui/base/dragdrop/drag_source_win.h"
19 #include "ui/base/dragdrop/os_exchange_data.h" 19 #include "ui/base/dragdrop/os_exchange_data.h"
20 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" 20 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
21 #include "ui/base/events/event.h" 21 #include "ui/base/events/event.h"
22 #include "ui/base/keycodes/keyboard_code_conversion_win.h" 22 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
23 #include "ui/base/l10n/l10n_util_win.h" 23 #include "ui/base/l10n/l10n_util_win.h"
24 #include "ui/base/theme_provider.h" 24 #include "ui/base/theme_provider.h"
25 #include "ui/base/view_prop.h" 25 #include "ui/base/view_prop.h"
26 #include "ui/base/win/dpi.h"
26 #include "ui/base/win/hwnd_util.h" 27 #include "ui/base/win/hwnd_util.h"
27 #include "ui/base/win/mouse_wheel_util.h" 28 #include "ui/base/win/mouse_wheel_util.h"
28 #include "ui/base/win/shell.h" 29 #include "ui/base/win/shell.h"
29 #include "ui/gfx/canvas.h" 30 #include "ui/gfx/canvas.h"
30 #include "ui/gfx/canvas_paint.h" 31 #include "ui/gfx/canvas_paint.h"
31 #include "ui/gfx/canvas_skia_paint.h" 32 #include "ui/gfx/canvas_skia_paint.h"
32 #include "ui/gfx/path.h" 33 #include "ui/gfx/path.h"
34 #include "ui/gfx/point_conversions.h"
33 #include "ui/gfx/screen.h" 35 #include "ui/gfx/screen.h"
36 #include "ui/gfx/size_conversions.h"
34 #include "ui/native_theme/native_theme.h" 37 #include "ui/native_theme/native_theme.h"
35 #include "ui/views/controls/native_control_win.h" 38 #include "ui/views/controls/native_control_win.h"
36 #include "ui/views/controls/textfield/textfield.h" 39 #include "ui/views/controls/textfield/textfield.h"
37 #include "ui/views/drag_utils.h" 40 #include "ui/views/drag_utils.h"
38 #include "ui/views/focus/accelerator_handler.h" 41 #include "ui/views/focus/accelerator_handler.h"
39 #include "ui/views/focus/view_storage.h" 42 #include "ui/views/focus/view_storage.h"
40 #include "ui/views/focus/widget_focus_manager.h" 43 #include "ui/views/focus/widget_focus_manager.h"
41 #include "ui/views/ime/input_method_win.h" 44 #include "ui/views/ime/input_method_win.h"
42 #include "ui/views/widget/aero_tooltip_manager.h" 45 #include "ui/views/widget/aero_tooltip_manager.h"
43 #include "ui/views/widget/drop_target_win.h" 46 #include "ui/views/widget/drop_target_win.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 107 }
105 108
106 void NativeWidgetWin::Show(int show_state) { 109 void NativeWidgetWin::Show(int show_state) {
107 message_handler_->Show(show_state); 110 message_handler_->Show(show_state);
108 } 111 }
109 112
110 //////////////////////////////////////////////////////////////////////////////// 113 ////////////////////////////////////////////////////////////////////////////////
111 // NativeWidgetWin, NativeWidget implementation: 114 // NativeWidgetWin, NativeWidget implementation:
112 115
113 void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) { 116 void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) {
114 SetInitParams(params); 117 gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(params.bounds);
115 message_handler_->Init(params.parent, params.bounds); 118 Widget::InitParams params_in_pixel(params);
119 params_in_pixel.bounds = pixel_bounds;
120 SetInitParams(params_in_pixel);
121 message_handler_->Init(params.parent, pixel_bounds);
116 } 122 }
117 123
118 NonClientFrameView* NativeWidgetWin::CreateNonClientFrameView() { 124 NonClientFrameView* NativeWidgetWin::CreateNonClientFrameView() {
119 return GetWidget()->ShouldUseNativeFrame() ? 125 return GetWidget()->ShouldUseNativeFrame() ?
120 new NativeFrameView(GetWidget()) : NULL; 126 new NativeFrameView(GetWidget()) : NULL;
121 } 127 }
122 128
123 bool NativeWidgetWin::ShouldUseNativeFrame() const { 129 bool NativeWidgetWin::ShouldUseNativeFrame() const {
124 return ui::win::IsAeroGlassEnabled(); 130 return ui::win::IsAeroGlassEnabled();
125 } 131 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 207
202 InputMethod* NativeWidgetWin::CreateInputMethod() { 208 InputMethod* NativeWidgetWin::CreateInputMethod() {
203 return new InputMethodWin(GetMessageHandler(), GetNativeWindow(), NULL); 209 return new InputMethodWin(GetMessageHandler(), GetNativeWindow(), NULL);
204 } 210 }
205 211
206 internal::InputMethodDelegate* NativeWidgetWin::GetInputMethodDelegate() { 212 internal::InputMethodDelegate* NativeWidgetWin::GetInputMethodDelegate() {
207 return message_handler_.get(); 213 return message_handler_.get();
208 } 214 }
209 215
210 void NativeWidgetWin::CenterWindow(const gfx::Size& size) { 216 void NativeWidgetWin::CenterWindow(const gfx::Size& size) {
211 message_handler_->CenterWindow(size); 217 gfx::Size size_in_pixels = ui::win::DIPToScreenSize(size);
218 message_handler_->CenterWindow(size_in_pixels);
212 } 219 }
213 220
214 void NativeWidgetWin::GetWindowPlacement( 221 void NativeWidgetWin::GetWindowPlacement(
215 gfx::Rect* bounds, 222 gfx::Rect* bounds,
216 ui::WindowShowState* show_state) const { 223 ui::WindowShowState* show_state) const {
217 message_handler_->GetWindowPlacement(bounds, show_state); 224 message_handler_->GetWindowPlacement(bounds, show_state);
225 *bounds = ui::win::ScreenToDIPRect(*bounds);
218 } 226 }
219 227
220 void NativeWidgetWin::SetWindowTitle(const string16& title) { 228 void NativeWidgetWin::SetWindowTitle(const string16& title) {
221 message_handler_->SetTitle(title); 229 message_handler_->SetTitle(title);
222 } 230 }
223 231
224 void NativeWidgetWin::SetWindowIcons(const gfx::ImageSkia& window_icon, 232 void NativeWidgetWin::SetWindowIcons(const gfx::ImageSkia& window_icon,
225 const gfx::ImageSkia& app_icon) { 233 const gfx::ImageSkia& app_icon) {
226 message_handler_->SetWindowIcons(window_icon, app_icon); 234 message_handler_->SetWindowIcons(window_icon, app_icon);
227 } 235 }
228 236
229 void NativeWidgetWin::InitModalType(ui::ModalType modal_type) { 237 void NativeWidgetWin::InitModalType(ui::ModalType modal_type) {
230 message_handler_->InitModalType(modal_type); 238 message_handler_->InitModalType(modal_type);
231 } 239 }
232 240
233 gfx::Rect NativeWidgetWin::GetWindowBoundsInScreen() const { 241 gfx::Rect NativeWidgetWin::GetWindowBoundsInScreen() const {
234 return message_handler_->GetWindowBoundsInScreen(); 242 gfx::Rect bounds_in_pixels = message_handler_->GetWindowBoundsInScreen();
243 return ui::win::ScreenToDIPRect(bounds_in_pixels);
235 } 244 }
236 245
237 gfx::Rect NativeWidgetWin::GetClientAreaBoundsInScreen() const { 246 gfx::Rect NativeWidgetWin::GetClientAreaBoundsInScreen() const {
238 return message_handler_->GetClientAreaBoundsInScreen(); 247 gfx::Rect bounds_in_pixels = message_handler_->GetClientAreaBoundsInScreen();
248 return ui::win::ScreenToDIPRect(bounds_in_pixels);
239 } 249 }
240 250
241 gfx::Rect NativeWidgetWin::GetRestoredBounds() const { 251 gfx::Rect NativeWidgetWin::GetRestoredBounds() const {
242 return message_handler_->GetRestoredBounds(); 252 gfx::Rect bounds_in_pixels = message_handler_->GetRestoredBounds();
253 return ui::win::ScreenToDIPRect(bounds_in_pixels);
243 } 254 }
244 255
245 void NativeWidgetWin::SetBounds(const gfx::Rect& bounds) { 256 void NativeWidgetWin::SetBounds(const gfx::Rect& bounds) {
246 message_handler_->SetBounds(bounds); 257 float scale = ui::win::GetDeviceScaleFactor();
258 gfx::Rect bounds_in_pixels(
259 gfx::ToCeiledPoint(gfx::ScalePoint(bounds.origin(), scale)),
260 gfx::ToFlooredSize(gfx::ScaleSize(bounds.size(), scale)));
261 message_handler_->SetBounds(bounds_in_pixels);
247 } 262 }
248 263
249 void NativeWidgetWin::SetSize(const gfx::Size& size) { 264 void NativeWidgetWin::SetSize(const gfx::Size& size) {
250 message_handler_->SetSize(size); 265 message_handler_->SetSize(size);
251 } 266 }
252 267
253 void NativeWidgetWin::StackAbove(gfx::NativeView native_view) { 268 void NativeWidgetWin::StackAbove(gfx::NativeView native_view) {
254 message_handler_->StackAbove(native_view); 269 message_handler_->StackAbove(native_view);
255 } 270 }
256 271
(...skipping 20 matching lines...) Expand all
277 void NativeWidgetWin::Show() { 292 void NativeWidgetWin::Show() {
278 message_handler_->Show(); 293 message_handler_->Show();
279 } 294 }
280 295
281 void NativeWidgetWin::Hide() { 296 void NativeWidgetWin::Hide() {
282 message_handler_->Hide(); 297 message_handler_->Hide();
283 } 298 }
284 299
285 void NativeWidgetWin::ShowMaximizedWithBounds( 300 void NativeWidgetWin::ShowMaximizedWithBounds(
286 const gfx::Rect& restored_bounds) { 301 const gfx::Rect& restored_bounds) {
287 message_handler_->ShowMaximizedWithBounds(restored_bounds); 302 gfx::Rect pixel_bounds = ui::win::DIPToScreenRect(restored_bounds);
303 message_handler_->ShowMaximizedWithBounds(pixel_bounds);
288 } 304 }
289 305
290 void NativeWidgetWin::ShowWithWindowState(ui::WindowShowState show_state) { 306 void NativeWidgetWin::ShowWithWindowState(ui::WindowShowState show_state) {
291 message_handler_->ShowWindowWithState(show_state); 307 message_handler_->ShowWindowWithState(show_state);
292 } 308 }
293 309
294 bool NativeWidgetWin::IsVisible() const { 310 bool NativeWidgetWin::IsVisible() const {
295 return message_handler_->IsVisible(); 311 return message_handler_->IsVisible();
296 } 312 }
297 313
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 399
384 void NativeWidgetWin::RunShellDrag(View* view, 400 void NativeWidgetWin::RunShellDrag(View* view,
385 const ui::OSExchangeData& data, 401 const ui::OSExchangeData& data,
386 const gfx::Point& location, 402 const gfx::Point& location,
387 int operation, 403 int operation,
388 ui::DragDropTypes::DragEventSource source) { 404 ui::DragDropTypes::DragEventSource source) {
389 views::RunShellDrag(NULL, data, location, operation, source); 405 views::RunShellDrag(NULL, data, location, operation, source);
390 } 406 }
391 407
392 void NativeWidgetWin::SchedulePaintInRect(const gfx::Rect& rect) { 408 void NativeWidgetWin::SchedulePaintInRect(const gfx::Rect& rect) {
393 message_handler_->SchedulePaintInRect(rect); 409 gfx::Rect pixel_rect = ui::win::DIPToScreenRect(rect);
410 message_handler_->SchedulePaintInRect(pixel_rect);
394 } 411 }
395 412
396 void NativeWidgetWin::SetCursor(gfx::NativeCursor cursor) { 413 void NativeWidgetWin::SetCursor(gfx::NativeCursor cursor) {
397 message_handler_->SetCursor(cursor); 414 message_handler_->SetCursor(cursor);
398 } 415 }
399 416
400 void NativeWidgetWin::ClearNativeFocus() { 417 void NativeWidgetWin::ClearNativeFocus() {
401 message_handler_->ClearNativeFocus(); 418 message_handler_->ClearNativeFocus();
402 } 419 }
403 420
404 gfx::Rect NativeWidgetWin::GetWorkAreaBoundsInScreen() const { 421 gfx::Rect NativeWidgetWin::GetWorkAreaBoundsInScreen() const {
405 return gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( 422 return ui::win::ScreenToDIPRect(
406 GetNativeView()).work_area(); 423 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
424 GetNativeView()).work_area());
407 } 425 }
408 426
409 void NativeWidgetWin::SetInactiveRenderingDisabled(bool value) { 427 void NativeWidgetWin::SetInactiveRenderingDisabled(bool value) {
410 } 428 }
411 429
412 Widget::MoveLoopResult NativeWidgetWin::RunMoveLoop( 430 Widget::MoveLoopResult NativeWidgetWin::RunMoveLoop(
413 const gfx::Vector2d& drag_offset, 431 const gfx::Vector2d& drag_offset,
414 Widget::MoveLoopSource source) { 432 Widget::MoveLoopSource source) {
415 return message_handler_->RunMoveLoop(drag_offset) ? 433 return message_handler_->RunMoveLoop(drag_offset) ?
416 Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; 434 Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 541
524 int NativeWidgetWin::GetInitialShowState() const { 542 int NativeWidgetWin::GetInitialShowState() const {
525 return SW_SHOWNORMAL; 543 return SW_SHOWNORMAL;
526 } 544 }
527 545
528 bool NativeWidgetWin::WillProcessWorkAreaChange() const { 546 bool NativeWidgetWin::WillProcessWorkAreaChange() const {
529 return GetWidget()->widget_delegate()->WillProcessWorkAreaChange(); 547 return GetWidget()->widget_delegate()->WillProcessWorkAreaChange();
530 } 548 }
531 549
532 int NativeWidgetWin::GetNonClientComponent(const gfx::Point& point) const { 550 int NativeWidgetWin::GetNonClientComponent(const gfx::Point& point) const {
533 return delegate_->GetNonClientComponent(point); 551 gfx::Point point_in_dip = ui::win::ScreenToDIPPoint(point);
552 return delegate_->GetNonClientComponent(point_in_dip);
534 } 553 }
535 554
536 void NativeWidgetWin::GetWindowMask(const gfx::Size& size, gfx::Path* path) { 555 void NativeWidgetWin::GetWindowMask(const gfx::Size& size, gfx::Path* path) {
537 if (GetWidget()->non_client_view()) 556 if (GetWidget()->non_client_view())
538 GetWidget()->non_client_view()->GetWindowMask(size, path); 557 GetWidget()->non_client_view()->GetWindowMask(size, path);
539 } 558 }
540 559
541 bool NativeWidgetWin::GetClientAreaInsets(gfx::Insets* insets) const { 560 bool NativeWidgetWin::GetClientAreaInsets(gfx::Insets* insets) const {
542 return false; 561 return false;
543 } 562 }
544 563
545 void NativeWidgetWin::GetMinMaxSize(gfx::Size* min_size, 564 void NativeWidgetWin::GetMinMaxSize(gfx::Size* min_size,
546 gfx::Size* max_size) const { 565 gfx::Size* max_size) const {
547 *min_size = delegate_->GetMinimumSize(); 566 *min_size = ui::win::ScreenToDIPSize(delegate_->GetMinimumSize());
548 *max_size = delegate_->GetMaximumSize(); 567 *max_size = ui::win::ScreenToDIPSize(delegate_->GetMaximumSize());
549 } 568 }
550 569
551 gfx::Size NativeWidgetWin::GetRootViewSize() const { 570 gfx::Size NativeWidgetWin::GetRootViewSize() const {
552 return GetWidget()->GetRootView()->size(); 571 gfx::Size pixel_size = GetWidget()->GetRootView()->size();
572 return ui::win::ScreenToDIPSize(pixel_size);
553 } 573 }
554 574
555 void NativeWidgetWin::ResetWindowControls() { 575 void NativeWidgetWin::ResetWindowControls() {
556 GetWidget()->non_client_view()->ResetWindowControls(); 576 GetWidget()->non_client_view()->ResetWindowControls();
557 } 577 }
558 578
559 void NativeWidgetWin::PaintLayeredWindow(gfx::Canvas* canvas) { 579 void NativeWidgetWin::PaintLayeredWindow(gfx::Canvas* canvas) {
560 GetWidget()->GetRootView()->Paint(canvas); 580 GetWidget()->GetRootView()->Paint(canvas);
561 } 581 }
562 582
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 697
678 void NativeWidgetWin::HandleWorkAreaChanged() { 698 void NativeWidgetWin::HandleWorkAreaChanged() {
679 GetWidget()->widget_delegate()->OnWorkAreaChanged(); 699 GetWidget()->widget_delegate()->OnWorkAreaChanged();
680 } 700 }
681 701
682 void NativeWidgetWin::HandleVisibilityChanged(bool visible) { 702 void NativeWidgetWin::HandleVisibilityChanged(bool visible) {
683 delegate_->OnNativeWidgetVisibilityChanged(visible); 703 delegate_->OnNativeWidgetVisibilityChanged(visible);
684 } 704 }
685 705
686 void NativeWidgetWin::HandleClientSizeChanged(const gfx::Size& new_size) { 706 void NativeWidgetWin::HandleClientSizeChanged(const gfx::Size& new_size) {
687 delegate_->OnNativeWidgetSizeChanged(new_size); 707 gfx::Size size_in_dip = ui::win::ScreenToDIPSize(new_size);
708 delegate_->OnNativeWidgetSizeChanged(size_in_dip);
688 } 709 }
689 710
690 void NativeWidgetWin::HandleFrameChanged() { 711 void NativeWidgetWin::HandleFrameChanged() {
691 // Replace the frame and layout the contents. 712 // Replace the frame and layout the contents.
692 GetWidget()->non_client_view()->UpdateFrame(true); 713 GetWidget()->non_client_view()->UpdateFrame(true);
693 } 714 }
694 715
695 void NativeWidgetWin::HandleNativeFocus(HWND last_focused_window) { 716 void NativeWidgetWin::HandleNativeFocus(HWND last_focused_window) {
696 delegate_->OnNativeFocus(last_focused_window); 717 delegate_->OnNativeFocus(last_focused_window);
697 InputMethod* input_method = GetInputMethod(); 718 InputMethod* input_method = GetInputMethod();
698 if (input_method) 719 if (input_method)
699 input_method->OnFocus(); 720 input_method->OnFocus();
700 } 721 }
701 722
702 void NativeWidgetWin::HandleNativeBlur(HWND focused_window) { 723 void NativeWidgetWin::HandleNativeBlur(HWND focused_window) {
703 delegate_->OnNativeBlur(focused_window); 724 delegate_->OnNativeBlur(focused_window);
704 InputMethod* input_method = GetInputMethod(); 725 InputMethod* input_method = GetInputMethod();
705 if (input_method) 726 if (input_method)
706 input_method->OnBlur(); 727 input_method->OnBlur();
707 } 728 }
708 729
709 bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) { 730 bool NativeWidgetWin::HandleMouseEvent(const ui::MouseEvent& event) {
710 delegate_->OnMouseEvent(const_cast<ui::MouseEvent*>(&event)); 731 ui::MouseEvent dpi_event(event);
711 return event.handled(); 732 dpi_event.set_location(ui::win::ScreenToDIPPoint(event.location()));
733 dpi_event.set_root_location(ui::win::ScreenToDIPPoint(event.location()));
734 delegate_->OnMouseEvent(&dpi_event);
735 return dpi_event.handled();
712 } 736 }
713 737
714 bool NativeWidgetWin::HandleKeyEvent(const ui::KeyEvent& event) { 738 bool NativeWidgetWin::HandleKeyEvent(const ui::KeyEvent& event) {
715 delegate_->OnKeyEvent(const_cast<ui::KeyEvent*>(&event)); 739 delegate_->OnKeyEvent(const_cast<ui::KeyEvent*>(&event));
716 return event.handled(); 740 return event.handled();
717 } 741 }
718 742
719 bool NativeWidgetWin::HandleUntranslatedKeyEvent(const ui::KeyEvent& event) { 743 bool NativeWidgetWin::HandleUntranslatedKeyEvent(const ui::KeyEvent& event) {
720 InputMethod* input_method = GetInputMethod(); 744 InputMethod* input_method = GetInputMethod();
721 if (input_method) 745 if (input_method)
(...skipping 25 matching lines...) Expand all
747 void NativeWidgetWin::HandleInputLanguageChange(DWORD character_set, 771 void NativeWidgetWin::HandleInputLanguageChange(DWORD character_set,
748 HKL input_language_id) { 772 HKL input_language_id) {
749 InputMethod* input_method = GetInputMethod(); 773 InputMethod* input_method = GetInputMethod();
750 if (input_method && !input_method->IsMock()) { 774 if (input_method && !input_method->IsMock()) {
751 static_cast<InputMethodWin*>(input_method)->OnInputLangChange( 775 static_cast<InputMethodWin*>(input_method)->OnInputLangChange(
752 character_set, input_language_id); 776 character_set, input_language_id);
753 } 777 }
754 } 778 }
755 779
756 bool NativeWidgetWin::HandlePaintAccelerated(const gfx::Rect& invalid_rect) { 780 bool NativeWidgetWin::HandlePaintAccelerated(const gfx::Rect& invalid_rect) {
757 return delegate_->OnNativeWidgetPaintAccelerated(gfx::Rect(invalid_rect)); 781 gfx::Rect dpi_rect = ui::win::ScreenToDIPRect(invalid_rect);
782 return delegate_->OnNativeWidgetPaintAccelerated(dpi_rect);
758 } 783 }
759 784
760 void NativeWidgetWin::HandlePaint(gfx::Canvas* canvas) { 785 void NativeWidgetWin::HandlePaint(gfx::Canvas* canvas) {
761 delegate_->OnNativeWidgetPaint(canvas); 786 delegate_->OnNativeWidgetPaint(canvas);
762 } 787 }
763 788
764 bool NativeWidgetWin::HandleTooltipNotify(int w_param, 789 bool NativeWidgetWin::HandleTooltipNotify(int w_param,
765 NMHDR* l_param, 790 NMHDR* l_param,
766 LRESULT* l_result) { 791 LRESULT* l_result) {
767 // We can be sent this message before the tooltip manager is created, if a 792 // We can be sent this message before the tooltip manager is created, if a
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 gfx::Rect* rect) { 861 gfx::Rect* rect) {
837 DCHECK(source); 862 DCHECK(source);
838 DCHECK(target); 863 DCHECK(target);
839 DCHECK(rect); 864 DCHECK(rect);
840 865
841 HWND source_hwnd = source->GetNativeView(); 866 HWND source_hwnd = source->GetNativeView();
842 HWND target_hwnd = target->GetNativeView(); 867 HWND target_hwnd = target->GetNativeView();
843 if (source_hwnd == target_hwnd) 868 if (source_hwnd == target_hwnd)
844 return true; 869 return true;
845 870
846 RECT win_rect = rect->ToRECT(); 871 RECT win_rect = ui::win::DIPToScreenRect(*rect).ToRECT();
847 if (::MapWindowPoints(source_hwnd, target_hwnd, 872 if (::MapWindowPoints(source_hwnd, target_hwnd,
848 reinterpret_cast<LPPOINT>(&win_rect), 873 reinterpret_cast<LPPOINT>(&win_rect),
849 sizeof(RECT)/sizeof(POINT))) { 874 sizeof(RECT)/sizeof(POINT))) {
850 *rect = gfx::Rect(win_rect); 875 *rect = ui::win::ScreenToDIPRect(gfx::Rect(win_rect));
851 return true; 876 return true;
852 } 877 }
853 return false; 878 return false;
854 } 879 }
855 880
856 namespace internal { 881 namespace internal {
857 882
858 //////////////////////////////////////////////////////////////////////////////// 883 ////////////////////////////////////////////////////////////////////////////////
859 // internal::NativeWidgetPrivate, public: 884 // internal::NativeWidgetPrivate, public:
860 885
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 // static 997 // static
973 bool NativeWidgetPrivate::IsTouchDown() { 998 bool NativeWidgetPrivate::IsTouchDown() {
974 // This currently isn't necessary because we're not generating touch events on 999 // This currently isn't necessary because we're not generating touch events on
975 // windows. When we do, this will need to be updated. 1000 // windows. When we do, this will need to be updated.
976 return false; 1001 return false;
977 } 1002 }
978 1003
979 } // namespace internal 1004 } // namespace internal
980 1005
981 } // namespace views 1006 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/aero_tooltip_manager.cc ('k') | ui/views/widget/tooltip_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698