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 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 // location is another window on the same thread, that window gets a | 1512 // location is another window on the same thread, that window gets a |
1513 // WM_MOUSEACTIVATE message and ends up activating itself, which is not | 1513 // WM_MOUSEACTIVATE message and ends up activating itself, which is not |
1514 // correct. We workaround this by setting a property on the window at the | 1514 // correct. We workaround this by setting a property on the window at the |
1515 // current cursor location. We check for this property in our | 1515 // current cursor location. We check for this property in our |
1516 // WM_MOUSEACTIVATE handler and don't activate the window if the property is | 1516 // WM_MOUSEACTIVATE handler and don't activate the window if the property is |
1517 // set. | 1517 // set. |
1518 if (::GetProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow)) { | 1518 if (::GetProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow)) { |
1519 ::RemoveProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow); | 1519 ::RemoveProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow); |
1520 return MA_NOACTIVATE; | 1520 return MA_NOACTIVATE; |
1521 } | 1521 } |
1522 // A child window activation should be treated as if we lost activation. | |
1523 POINT cursor_pos = {0}; | |
1524 ::GetCursorPos(&cursor_pos); | |
1525 ::ScreenToClient(hwnd(), &cursor_pos); | |
1526 // The code below exists for child windows like NPAPI plugins etc which need | |
1527 // to be activated whenever we receive a WM_MOUSEACTIVATE message. Don't put | |
1528 // transparent child windows in this bucket as they are not supposed to grab | |
1529 // activation. | |
1530 // TODO(ananta) | |
1531 // Get rid of this code when we deprecate NPAPI plugins. | |
1532 HWND child = ::RealChildWindowFromPoint(hwnd(), cursor_pos); | |
1533 if (::IsWindow(child) && child != hwnd() && ::IsWindowVisible(child) && | |
1534 !(::GetWindowLong(child, GWL_EXSTYLE) & WS_EX_TRANSPARENT)) | |
1535 PostProcessActivateMessage(WA_INACTIVE, false); | |
1536 | 1522 |
1537 // TODO(beng): resolve this with the GetWindowLong() check on the subsequent | 1523 // TODO(beng): resolve this with the GetWindowLong() check on the subsequent |
1538 // line. | 1524 // line. |
1539 if (delegate_->IsWidgetWindow()) { | 1525 if (delegate_->IsWidgetWindow()) { |
1540 if (delegate_->CanActivate()) | 1526 if (delegate_->CanActivate()) |
1541 return MA_ACTIVATE; | 1527 return MA_ACTIVATE; |
1542 if (delegate_->WantsMouseEventsWhenInactive()) | 1528 if (delegate_->WantsMouseEventsWhenInactive()) |
1543 return MA_NOACTIVATE; | 1529 return MA_NOACTIVATE; |
1544 return MA_NOACTIVATEANDEAT; | 1530 return MA_NOACTIVATEANDEAT; |
1545 } | 1531 } |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 | 2558 |
2573 default: | 2559 default: |
2574 left_button_down_on_caption_ = false; | 2560 left_button_down_on_caption_ = false; |
2575 break; | 2561 break; |
2576 } | 2562 } |
2577 return handled; | 2563 return handled; |
2578 } | 2564 } |
2579 | 2565 |
2580 | 2566 |
2581 } // namespace views | 2567 } // namespace views |
OLD | NEW |