OLD | NEW |
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 <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
13 #include "ui/base/events/event.h" | 13 #include "ui/base/events/event.h" |
14 #include "ui/base/events/event_utils.h" | 14 #include "ui/base/events/event_utils.h" |
15 #include "ui/base/gestures/gesture_sequence.h" | 15 #include "ui/base/gestures/gesture_sequence.h" |
16 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 16 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
| 17 #include "ui/base/touch/touch_enabled.h" |
17 #include "ui/base/win/dpi.h" | 18 #include "ui/base/win/dpi.h" |
18 #include "ui/base/win/hwnd_util.h" | 19 #include "ui/base/win/hwnd_util.h" |
19 #include "ui/base/win/mouse_wheel_util.h" | 20 #include "ui/base/win/mouse_wheel_util.h" |
20 #include "ui/base/win/shell.h" | 21 #include "ui/base/win/shell.h" |
21 #include "ui/base/win/touch_input.h" | 22 #include "ui/base/win/touch_input.h" |
22 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/canvas_skia_paint.h" | 24 #include "ui/gfx/canvas_skia_paint.h" |
24 #include "ui/gfx/icon_util.h" | 25 #include "ui/gfx/icon_util.h" |
25 #include "ui/gfx/insets.h" | 26 #include "ui/gfx/insets.h" |
26 #include "ui/gfx/path.h" | 27 #include "ui/gfx/path.h" |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 | 1281 |
1281 if (remove_standard_frame_) { | 1282 if (remove_standard_frame_) { |
1282 SetWindowLong(hwnd(), GWL_STYLE, | 1283 SetWindowLong(hwnd(), GWL_STYLE, |
1283 GetWindowLong(hwnd(), GWL_STYLE) & ~WS_CAPTION); | 1284 GetWindowLong(hwnd(), GWL_STYLE) & ~WS_CAPTION); |
1284 SendFrameChanged(); | 1285 SendFrameChanged(); |
1285 } | 1286 } |
1286 | 1287 |
1287 // Get access to a modifiable copy of the system menu. | 1288 // Get access to a modifiable copy of the system menu. |
1288 GetSystemMenu(hwnd(), false); | 1289 GetSystemMenu(hwnd(), false); |
1289 | 1290 |
1290 if (base::win::GetVersion() >= base::win::VERSION_WIN7) | 1291 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && |
1291 RegisterTouchWindow(hwnd(), 0); | 1292 ui::AreTouchEventsEnabled()) |
| 1293 RegisterTouchWindow(hwnd(), TWF_WANTPALM); |
1292 | 1294 |
1293 // We need to allow the delegate to size its contents since the window may not | 1295 // We need to allow the delegate to size its contents since the window may not |
1294 // receive a size notification when its initial bounds are specified at window | 1296 // receive a size notification when its initial bounds are specified at window |
1295 // creation time. | 1297 // creation time. |
1296 ClientAreaSizeChanged(); | 1298 ClientAreaSizeChanged(); |
1297 | 1299 |
1298 // We need to add ourselves as a message loop observer so that we can repaint | 1300 // We need to add ourselves as a message loop observer so that we can repaint |
1299 // aggressively if the contents of our window become invalid. Unfortunately | 1301 // aggressively if the contents of our window become invalid. Unfortunately |
1300 // WM_PAINT messages are starved and we get flickery redrawing when resizing | 1302 // WM_PAINT messages are starved and we get flickery redrawing when resizing |
1301 // if we do not do this. | 1303 // if we do not do this. |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 DwmExtendFrameIntoClientArea(hwnd(), &m); | 2149 DwmExtendFrameIntoClientArea(hwnd(), &m); |
2148 } | 2150 } |
2149 if (window_pos->flags & SWP_SHOWWINDOW) | 2151 if (window_pos->flags & SWP_SHOWWINDOW) |
2150 delegate_->HandleVisibilityChanged(true); | 2152 delegate_->HandleVisibilityChanged(true); |
2151 else if (window_pos->flags & SWP_HIDEWINDOW) | 2153 else if (window_pos->flags & SWP_HIDEWINDOW) |
2152 delegate_->HandleVisibilityChanged(false); | 2154 delegate_->HandleVisibilityChanged(false); |
2153 SetMsgHandled(FALSE); | 2155 SetMsgHandled(FALSE); |
2154 } | 2156 } |
2155 | 2157 |
2156 } // namespace views | 2158 } // namespace views |
OLD | NEW |