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 <oleacc.h> | 8 #include <oleacc.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <wtsapi32.h> | 10 #include <wtsapi32.h> |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 last_monitor_(NULL), | 352 last_monitor_(NULL), |
353 use_layered_buffer_(false), | 353 use_layered_buffer_(false), |
354 layered_alpha_(255), | 354 layered_alpha_(255), |
355 waiting_for_redraw_layered_window_contents_(false), | 355 waiting_for_redraw_layered_window_contents_(false), |
356 is_first_nccalc_(true), | 356 is_first_nccalc_(true), |
357 menu_depth_(0), | 357 menu_depth_(0), |
358 autohide_factory_(this), | 358 autohide_factory_(this), |
359 id_generator_(0), | 359 id_generator_(0), |
360 needs_scroll_styles_(false), | 360 needs_scroll_styles_(false), |
361 in_size_loop_(false), | 361 in_size_loop_(false), |
362 touch_down_context_(false) { | 362 touch_down_context_(false), |
| 363 last_mouse_hwheel_time_(0) { |
363 } | 364 } |
364 | 365 |
365 HWNDMessageHandler::~HWNDMessageHandler() { | 366 HWNDMessageHandler::~HWNDMessageHandler() { |
366 delegate_ = NULL; | 367 delegate_ = NULL; |
367 // Prevent calls back into this class via WNDPROC now that we've been | 368 // Prevent calls back into this class via WNDPROC now that we've been |
368 // destroyed. | 369 // destroyed. |
369 ClearUserData(); | 370 ClearUserData(); |
370 } | 371 } |
371 | 372 |
372 void HWNDMessageHandler::Init(HWND parent, const gfx::Rect& bounds) { | 373 void HWNDMessageHandler::Init(HWND parent, const gfx::Rect& bounds) { |
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 if (message != WM_MOUSEWHEEL && message != WM_MOUSEHWHEEL) { | 2309 if (message != WM_MOUSEWHEEL && message != WM_MOUSEHWHEEL) { |
2309 POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param_ht); | 2310 POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param_ht); |
2310 MapWindowPoints(hwnd(), HWND_DESKTOP, &screen_point, 1); | 2311 MapWindowPoints(hwnd(), HWND_DESKTOP, &screen_point, 1); |
2311 l_param_ht = MAKELPARAM(screen_point.x, screen_point.y); | 2312 l_param_ht = MAKELPARAM(screen_point.x, screen_point.y); |
2312 } | 2313 } |
2313 LRESULT hittest = SendMessage(hwnd(), WM_NCHITTEST, 0, l_param_ht); | 2314 LRESULT hittest = SendMessage(hwnd(), WM_NCHITTEST, 0, l_param_ht); |
2314 if (hittest == HTCLIENT || hittest == HTNOWHERE) | 2315 if (hittest == HTCLIENT || hittest == HTNOWHERE) |
2315 return 0; | 2316 return 0; |
2316 } | 2317 } |
2317 | 2318 |
| 2319 // Certain logitech drivers send the WM_MOUSEHWHEEL message to the parent |
| 2320 // followed by WM_MOUSEWHEEL messages to the child window causing a vertical |
| 2321 // scroll. We treat these WM_MOUSEWHEEL messages as WM_MOUSEHWHEEL |
| 2322 // messages. |
| 2323 if (message == WM_MOUSEHWHEEL) |
| 2324 last_mouse_hwheel_time_ = ::GetMessageTime(); |
| 2325 |
| 2326 if (message == WM_MOUSEWHEEL && |
| 2327 ::GetMessageTime() == last_mouse_hwheel_time_) { |
| 2328 message = WM_MOUSEHWHEEL; |
| 2329 } |
| 2330 |
2318 if (message == WM_RBUTTONUP && is_right_mouse_pressed_on_caption_) { | 2331 if (message == WM_RBUTTONUP && is_right_mouse_pressed_on_caption_) { |
2319 is_right_mouse_pressed_on_caption_ = false; | 2332 is_right_mouse_pressed_on_caption_ = false; |
2320 ReleaseCapture(); | 2333 ReleaseCapture(); |
2321 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() | 2334 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() |
2322 // expect screen coordinates. | 2335 // expect screen coordinates. |
2323 POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); | 2336 POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); |
2324 MapWindowPoints(hwnd(), HWND_DESKTOP, &screen_point, 1); | 2337 MapWindowPoints(hwnd(), HWND_DESKTOP, &screen_point, 1); |
2325 w_param = SendMessage(hwnd(), WM_NCHITTEST, 0, | 2338 w_param = SendMessage(hwnd(), WM_NCHITTEST, 0, |
2326 MAKELPARAM(screen_point.x, screen_point.y)); | 2339 MAKELPARAM(screen_point.x, screen_point.y)); |
2327 if (w_param == HTCAPTION || w_param == HTSYSMENU) { | 2340 if (w_param == HTCAPTION || w_param == HTSYSMENU) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 POINT cursor_pos = {0}; | 2435 POINT cursor_pos = {0}; |
2423 ::GetCursorPos(&cursor_pos); | 2436 ::GetCursorPos(&cursor_pos); |
2424 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) | 2437 if (memcmp(&cursor_pos, &mouse_location, sizeof(POINT))) |
2425 return false; | 2438 return false; |
2426 return true; | 2439 return true; |
2427 } | 2440 } |
2428 return false; | 2441 return false; |
2429 } | 2442 } |
2430 | 2443 |
2431 } // namespace views | 2444 } // namespace views |
OLD | NEW |