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

Side by Side Diff: ui/views/controls/native/native_view_host_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 unified diff | Download patch
« no previous file with comments | « ui/gfx/canvas_paint_win.h ('k') | ui/views/widget/aero_tooltip_manager.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/controls/native/native_view_host_win.h" 5 #include "ui/views/controls/native/native_view_host_win.h"
6 6
7 #include <oleacc.h> 7 #include <oleacc.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/win/dpi.h"
10 #include "ui/base/win/hidden_window.h" 11 #include "ui/base/win/hidden_window.h"
11 #include "ui/base/win/window_impl.h" 12 #include "ui/base/win/window_impl.h"
12 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
13 #include "ui/views/controls/native/native_view_host.h" 14 #include "ui/views/controls/native/native_view_host.h"
14 #include "ui/views/focus/focus_manager.h" 15 #include "ui/views/focus/focus_manager.h"
15 #include "ui/views/widget/native_widget.h" 16 #include "ui/views/widget/native_widget.h"
16 #include "ui/views/widget/root_view.h" 17 #include "ui/views/widget/root_view.h"
17 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
18 19
19 namespace views { 20 namespace views {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 SetWindowRgn(host_->native_view(), 0, TRUE); 84 SetWindowRgn(host_->native_view(), 0, TRUE);
84 installed_clip_ = false; 85 installed_clip_ = false;
85 } 86 }
86 87
87 void NativeViewHostWin::ShowWidget(int x, int y, int w, int h) { 88 void NativeViewHostWin::ShowWidget(int x, int y, int w, int h) {
88 UINT swp_flags = SWP_DEFERERASE | 89 UINT swp_flags = SWP_DEFERERASE |
89 SWP_NOACTIVATE | 90 SWP_NOACTIVATE |
90 SWP_NOCOPYBITS | 91 SWP_NOCOPYBITS |
91 SWP_NOOWNERZORDER | 92 SWP_NOOWNERZORDER |
92 SWP_NOZORDER; 93 SWP_NOZORDER;
94 gfx::Rect bounds = ui::win::DIPToScreenRect(gfx::Rect(x,y,w,h));
95
93 // Only send the SHOWWINDOW flag if we're invisible, to avoid flashing. 96 // Only send the SHOWWINDOW flag if we're invisible, to avoid flashing.
94 if (!IsWindowVisible(host_->native_view())) 97 if (!IsWindowVisible(host_->native_view()))
95 swp_flags = (swp_flags | SWP_SHOWWINDOW) & ~SWP_NOREDRAW; 98 swp_flags = (swp_flags | SWP_SHOWWINDOW) & ~SWP_NOREDRAW;
96 99
97 if (host_->fast_resize()) { 100 if (host_->fast_resize()) {
98 // In a fast resize, we move the window and clip it with SetWindowRgn. 101 // In a fast resize, we move the window and clip it with SetWindowRgn.
99 RECT win_rect; 102 RECT win_rect;
100 GetWindowRect(host_->native_view(), &win_rect); 103 GetWindowRect(host_->native_view(), &win_rect);
101 gfx::Rect rect(win_rect); 104 gfx::Rect rect(win_rect);
102 SetWindowPos(host_->native_view(), 0, x, y, rect.width(), rect.height(), 105 SetWindowPos(host_->native_view(), 0, bounds.x(), bounds.y(),
106 rect.width(), rect.height(),
103 swp_flags); 107 swp_flags);
104 108
105 InstallClip(0, 0, w, h); 109 InstallClip(0, 0, bounds.width(), bounds.height());
106 } else { 110 } else {
107 SetWindowPos(host_->native_view(), 0, x, y, w, h, swp_flags); 111 SetWindowPos(host_->native_view(), 0, bounds.x(), bounds.y(),
112 bounds.width(), bounds.height(), swp_flags);
108 } 113 }
109 } 114 }
110 115
111 void NativeViewHostWin::HideWidget() { 116 void NativeViewHostWin::HideWidget() {
112 if (!IsWindowVisible(host_->native_view())) 117 if (!IsWindowVisible(host_->native_view()))
113 return; // Currently not visible, nothing to do. 118 return; // Currently not visible, nothing to do.
114 119
115 // The window is currently visible, but its clipped by another view. Hide 120 // The window is currently visible, but its clipped by another view. Hide
116 // it. 121 // it.
117 SetWindowPos(host_->native_view(), 0, 0, 0, 0, 0, 122 SetWindowPos(host_->native_view(), 0, 0, 0, 0, 0,
(...skipping 25 matching lines...) Expand all
143 //////////////////////////////////////////////////////////////////////////////// 148 ////////////////////////////////////////////////////////////////////////////////
144 // NativeViewHostWrapper, public: 149 // NativeViewHostWrapper, public:
145 150
146 // static 151 // static
147 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( 152 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper(
148 NativeViewHost* host) { 153 NativeViewHost* host) {
149 return new NativeViewHostWin(host); 154 return new NativeViewHostWin(host);
150 } 155 }
151 156
152 } // namespace views 157 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/canvas_paint_win.h ('k') | ui/views/widget/aero_tooltip_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698