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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 659883002: Enable hidpi on Linux, refactor a bit on Windows to share Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 6 years, 1 month 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
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/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <wtsapi32.h> 10 #include <wtsapi32.h>
11 #pragma comment(lib, "wtsapi32.lib") 11 #pragma comment(lib, "wtsapi32.lib")
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.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/touch/touch_enabled.h" 17 #include "ui/base/touch/touch_enabled.h"
18 #include "ui/base/view_prop.h" 18 #include "ui/base/view_prop.h"
19 #include "ui/base/win/internal_constants.h" 19 #include "ui/base/win/internal_constants.h"
20 #include "ui/base/win/lock_state.h" 20 #include "ui/base/win/lock_state.h"
21 #include "ui/base/win/mouse_wheel_util.h" 21 #include "ui/base/win/mouse_wheel_util.h"
22 #include "ui/base/win/shell.h" 22 #include "ui/base/win/shell.h"
23 #include "ui/base/win/touch_input.h" 23 #include "ui/base/win/touch_input.h"
24 #include "ui/events/event.h" 24 #include "ui/events/event.h"
25 #include "ui/events/event_utils.h" 25 #include "ui/events/event_utils.h"
26 #include "ui/events/keycodes/keyboard_code_conversion_win.h" 26 #include "ui/events/keycodes/keyboard_code_conversion_win.h"
27 #include "ui/gfx/canvas.h" 27 #include "ui/gfx/canvas.h"
28 #include "ui/gfx/canvas_skia_paint.h" 28 #include "ui/gfx/canvas_skia_paint.h"
29 #include "ui/gfx/dpi.h"
29 #include "ui/gfx/icon_util.h" 30 #include "ui/gfx/icon_util.h"
30 #include "ui/gfx/insets.h" 31 #include "ui/gfx/insets.h"
31 #include "ui/gfx/path.h" 32 #include "ui/gfx/path.h"
32 #include "ui/gfx/path_win.h" 33 #include "ui/gfx/path_win.h"
33 #include "ui/gfx/screen.h" 34 #include "ui/gfx/screen.h"
34 #include "ui/gfx/win/dpi.h"
35 #include "ui/gfx/win/hwnd_util.h" 35 #include "ui/gfx/win/hwnd_util.h"
36 #include "ui/native_theme/native_theme_win.h" 36 #include "ui/native_theme/native_theme_win.h"
37 #include "ui/views/views_delegate.h" 37 #include "ui/views/views_delegate.h"
38 #include "ui/views/widget/monitor_win.h" 38 #include "ui/views/widget/monitor_win.h"
39 #include "ui/views/widget/widget_hwnd_utils.h" 39 #include "ui/views/widget/widget_hwnd_utils.h"
40 #include "ui/views/win/fullscreen_handler.h" 40 #include "ui/views/win/fullscreen_handler.h"
41 #include "ui/views/win/hwnd_message_handler_delegate.h" 41 #include "ui/views/win/hwnd_message_handler_delegate.h"
42 #include "ui/views/win/scoped_fullscreen_visibility.h" 42 #include "ui/views/win/scoped_fullscreen_visibility.h"
43 43
44 namespace views { 44 namespace views {
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 } 1212 }
1213 } 1213 }
1214 1214
1215 void HWNDMessageHandler::RedrawLayeredWindowContents() { 1215 void HWNDMessageHandler::RedrawLayeredWindowContents() {
1216 waiting_for_redraw_layered_window_contents_ = false; 1216 waiting_for_redraw_layered_window_contents_ = false;
1217 if (invalid_rect_.IsEmpty()) 1217 if (invalid_rect_.IsEmpty())
1218 return; 1218 return;
1219 1219
1220 // We need to clip to the dirty rect ourselves. 1220 // We need to clip to the dirty rect ourselves.
1221 layered_window_contents_->sk_canvas()->save(); 1221 layered_window_contents_->sk_canvas()->save();
1222 double scale = gfx::win::GetDeviceScaleFactor(); 1222 double scale = gfx::GetDeviceScaleFactor();
1223 layered_window_contents_->sk_canvas()->scale( 1223 layered_window_contents_->sk_canvas()->scale(
1224 SkScalar(scale),SkScalar(scale)); 1224 SkScalar(scale),SkScalar(scale));
1225 layered_window_contents_->ClipRect(invalid_rect_); 1225 layered_window_contents_->ClipRect(invalid_rect_);
1226 delegate_->PaintLayeredWindow(layered_window_contents_.get()); 1226 delegate_->PaintLayeredWindow(layered_window_contents_.get());
1227 layered_window_contents_->sk_canvas()->scale( 1227 layered_window_contents_->sk_canvas()->scale(
1228 SkScalar(1.0/scale),SkScalar(1.0/scale)); 1228 SkScalar(1.0/scale),SkScalar(1.0/scale));
1229 layered_window_contents_->sk_canvas()->restore(); 1229 layered_window_contents_->sk_canvas()->restore();
1230 1230
1231 RECT wr; 1231 RECT wr;
1232 GetWindowRect(hwnd(), &wr); 1232 GetWindowRect(hwnd(), &wr);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 // to add the scroll styles back to ensure that scrolling works in legacy 1411 // to add the scroll styles back to ensure that scrolling works in legacy
1412 // trackpoint drivers. 1412 // trackpoint drivers.
1413 if (in_size_loop_ && needs_scroll_styles_) 1413 if (in_size_loop_ && needs_scroll_styles_)
1414 AddScrollStylesToWindow(hwnd()); 1414 AddScrollStylesToWindow(hwnd());
1415 } 1415 }
1416 1416
1417 void HWNDMessageHandler::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { 1417 void HWNDMessageHandler::OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
1418 gfx::Size min_window_size; 1418 gfx::Size min_window_size;
1419 gfx::Size max_window_size; 1419 gfx::Size max_window_size;
1420 delegate_->GetMinMaxSize(&min_window_size, &max_window_size); 1420 delegate_->GetMinMaxSize(&min_window_size, &max_window_size);
1421 min_window_size = gfx::win::DIPToScreenSize(min_window_size); 1421 min_window_size = gfx::DIPToScreenSize(min_window_size);
1422 max_window_size = gfx::win::DIPToScreenSize(max_window_size); 1422 max_window_size = gfx::DIPToScreenSize(max_window_size);
1423 1423
1424 1424
1425 // Add the native frame border size to the minimum and maximum size if the 1425 // Add the native frame border size to the minimum and maximum size if the
1426 // view reports its size as the client size. 1426 // view reports its size as the client size.
1427 if (delegate_->WidgetSizeIsClientSize()) { 1427 if (delegate_->WidgetSizeIsClientSize()) {
1428 RECT client_rect, window_rect; 1428 RECT client_rect, window_rect;
1429 GetClientRect(hwnd(), &client_rect); 1429 GetClientRect(hwnd(), &client_rect);
1430 GetWindowRect(hwnd(), &window_rect); 1430 GetWindowRect(hwnd(), &window_rect);
1431 CR_DEFLATE_RECT(&window_rect, &client_rect); 1431 CR_DEFLATE_RECT(&window_rect, &client_rect);
1432 min_window_size.Enlarge(window_rect.right - window_rect.left, 1432 min_window_size.Enlarge(window_rect.right - window_rect.left,
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2493 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2494 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2494 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2495 } 2495 }
2496 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2496 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
2497 // to notify our children too, since we can have MDI child windows who need to 2497 // to notify our children too, since we can have MDI child windows who need to
2498 // update their appearance. 2498 // update their appearance.
2499 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2499 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2500 } 2500 }
2501 2501
2502 } // namespace views 2502 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698