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" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 | 288 |
289 #endif | 289 #endif |
290 | 290 |
291 // A custom MSAA object id used to determine if a screen reader is actively | 291 // A custom MSAA object id used to determine if a screen reader is actively |
292 // listening for MSAA events. | 292 // listening for MSAA events. |
293 const int kCustomObjectID = 1; | 293 const int kCustomObjectID = 1; |
294 | 294 |
295 // The thickness of an auto-hide taskbar in pixels. | 295 // The thickness of an auto-hide taskbar in pixels. |
296 const int kAutoHideTaskbarThicknessPx = 2; | 296 const int kAutoHideTaskbarThicknessPx = 2; |
297 | 297 |
298 // The touch id to be used for touch events coming in from Windows Aura | |
299 // Desktop. | |
300 const int kDesktopChromeAuraTouchId = 9; | |
sky
2013/01/07 15:53:45
Do we need to make sure this doesn't conflict with
ananta
2013/01/08 00:50:22
We shouldn't be conflicting with anything. We have
| |
301 | |
298 } // namespace | 302 } // namespace |
299 | 303 |
300 // A scoping class that prevents a window from being able to redraw in response | 304 // A scoping class that prevents a window from being able to redraw in response |
301 // to invalidations that may occur within it for the lifetime of the object. | 305 // to invalidations that may occur within it for the lifetime of the object. |
302 // | 306 // |
303 // Why would we want such a thing? Well, it turns out Windows has some | 307 // Why would we want such a thing? Well, it turns out Windows has some |
304 // "unorthodox" behavior when it comes to painting its non-client areas. | 308 // "unorthodox" behavior when it comes to painting its non-client areas. |
305 // Occasionally, Windows will paint portions of the default non-client area | 309 // Occasionally, Windows will paint portions of the default non-client area |
306 // right over the top of the custom frame. This is not simply fixed by handling | 310 // right over the top of the custom frame. This is not simply fixed by handling |
307 // WM_NCPAINT/WM_PAINT, with some investigation it turns out that this | 311 // WM_NCPAINT/WM_PAINT, with some investigation it turns out that this |
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1967 } | 1971 } |
1968 | 1972 |
1969 LRESULT HWNDMessageHandler::OnTouchEvent(UINT message, | 1973 LRESULT HWNDMessageHandler::OnTouchEvent(UINT message, |
1970 WPARAM w_param, | 1974 WPARAM w_param, |
1971 LPARAM l_param) { | 1975 LPARAM l_param) { |
1972 int num_points = LOWORD(w_param); | 1976 int num_points = LOWORD(w_param); |
1973 scoped_array<TOUCHINPUT> input(new TOUCHINPUT[num_points]); | 1977 scoped_array<TOUCHINPUT> input(new TOUCHINPUT[num_points]); |
1974 if (GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(l_param), | 1978 if (GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(l_param), |
1975 num_points, input.get(), sizeof(TOUCHINPUT))) { | 1979 num_points, input.get(), sizeof(TOUCHINPUT))) { |
1976 for (int i = 0; i < num_points; ++i) { | 1980 for (int i = 0; i < num_points; ++i) { |
1977 if (input[i].dwFlags & TOUCHEVENTF_DOWN) | 1981 ui::EventType touch_event_type = ui::ET_UNKNOWN; |
1982 | |
1983 if (input[i].dwFlags & TOUCHEVENTF_DOWN) { | |
1978 touch_ids_.insert(input[i].dwID); | 1984 touch_ids_.insert(input[i].dwID); |
1979 if (input[i].dwFlags & TOUCHEVENTF_UP) | 1985 touch_event_type = ui::ET_TOUCH_PRESSED; |
1986 } else if (input[i].dwFlags & TOUCHEVENTF_UP) { | |
1980 touch_ids_.erase(input[i].dwID); | 1987 touch_ids_.erase(input[i].dwID); |
1988 touch_event_type = ui::ET_TOUCH_RELEASED; | |
1989 } else if (input[i].dwFlags & TOUCHEVENTF_MOVE) { | |
1990 touch_event_type = ui::ET_TOUCH_MOVED; | |
1991 } | |
1992 | |
1993 if (touch_event_type != ui::ET_UNKNOWN) { | |
1994 ui::TouchEvent event( | |
1995 touch_event_type, | |
1996 gfx::Point(TOUCH_COORD_TO_PIXEL(input[i].x), | |
1997 TOUCH_COORD_TO_PIXEL(input[i].y)), | |
1998 kDesktopChromeAuraTouchId, | |
1999 base::TimeDelta::FromMilliseconds(input[i].dwTime)); | |
2000 delegate_->HandleTouchEvent(event); | |
2001 } | |
1981 } | 2002 } |
1982 } | 2003 } |
1983 CloseTouchInputHandle(reinterpret_cast<HTOUCHINPUT>(l_param)); | 2004 CloseTouchInputHandle(reinterpret_cast<HTOUCHINPUT>(l_param)); |
1984 SetMsgHandled(FALSE); | 2005 SetMsgHandled(FALSE); |
1985 return 0; | 2006 return 0; |
1986 } | 2007 } |
1987 | 2008 |
1988 void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) { | 2009 void HWNDMessageHandler::OnWindowPosChanging(WINDOWPOS* window_pos) { |
1989 if (ignore_window_pos_changes_) { | 2010 if (ignore_window_pos_changes_) { |
1990 // If somebody's trying to toggle our visibility, change the nonclient area, | 2011 // If somebody's trying to toggle our visibility, change the nonclient area, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2070 DwmExtendFrameIntoClientArea(hwnd(), &m); | 2091 DwmExtendFrameIntoClientArea(hwnd(), &m); |
2071 } | 2092 } |
2072 if (window_pos->flags & SWP_SHOWWINDOW) | 2093 if (window_pos->flags & SWP_SHOWWINDOW) |
2073 delegate_->HandleVisibilityChanged(true); | 2094 delegate_->HandleVisibilityChanged(true); |
2074 else if (window_pos->flags & SWP_HIDEWINDOW) | 2095 else if (window_pos->flags & SWP_HIDEWINDOW) |
2075 delegate_->HandleVisibilityChanged(false); | 2096 delegate_->HandleVisibilityChanged(false); |
2076 SetMsgHandled(FALSE); | 2097 SetMsgHandled(FALSE); |
2077 } | 2098 } |
2078 | 2099 |
2079 } // namespace views | 2100 } // namespace views |
OLD | NEW |