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 <tchar.h> | 10 #include <tchar.h> |
(...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 } | 2550 } |
2551 if (should_handle_pending_ncl_button_down) { | 2551 if (should_handle_pending_ncl_button_down) { |
2552 l_param = MAKELPARAM(caption_left_button_click_pos_.x(), | 2552 l_param = MAKELPARAM(caption_left_button_click_pos_.x(), |
2553 caption_left_button_click_pos_.y()); | 2553 caption_left_button_click_pos_.y()); |
2554 // TODO(msw): Eliminate undesired painting, or re-evaluate this | 2554 // TODO(msw): Eliminate undesired painting, or re-evaluate this |
2555 // workaround. | 2555 // workaround. |
2556 // DefWindowProc for WM_NCLBUTTONDOWN does weird non-client painting, | 2556 // DefWindowProc for WM_NCLBUTTONDOWN does weird non-client painting, |
2557 // so we need to call it inside a ScopedRedrawLock. This may cause | 2557 // so we need to call it inside a ScopedRedrawLock. This may cause |
2558 // other negative side-effects | 2558 // other negative side-effects |
2559 // (ex/ stifling non-client mouse releases). | 2559 // (ex/ stifling non-client mouse releases). |
| 2560 // We may be deleted in the context of DefWindowProc. Don't refer to |
| 2561 // any member variables after the DefWindowProc call. |
| 2562 left_button_down_on_caption_ = false; |
| 2563 |
2560 if (delegate_->IsUsingCustomFrame()) { | 2564 if (delegate_->IsUsingCustomFrame()) { |
2561 DefWindowProcWithRedrawLock(WM_NCLBUTTONDOWN, HTCAPTION, l_param); | 2565 DefWindowProcWithRedrawLock(WM_NCLBUTTONDOWN, HTCAPTION, l_param); |
2562 } else { | 2566 } else { |
2563 DefWindowProc(hwnd(), WM_NCLBUTTONDOWN, HTCAPTION, l_param); | 2567 DefWindowProc(hwnd(), WM_NCLBUTTONDOWN, HTCAPTION, l_param); |
2564 } | 2568 } |
2565 left_button_down_on_caption_ = false; | |
2566 } | 2569 } |
2567 break; | 2570 break; |
2568 } | 2571 } |
2569 | 2572 |
2570 case WM_NCMOUSELEAVE: | 2573 case WM_NCMOUSELEAVE: |
2571 break; | 2574 break; |
2572 | 2575 |
2573 default: | 2576 default: |
2574 left_button_down_on_caption_ = false; | 2577 left_button_down_on_caption_ = false; |
2575 break; | 2578 break; |
2576 } | 2579 } |
2577 return handled; | 2580 return handled; |
2578 } | 2581 } |
2579 | 2582 |
2580 | 2583 |
2581 } // namespace views | 2584 } // namespace views |
OLD | NEW |