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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 // WM_MOUSEACTIVATE handler and don't activate the window if the property is | 1542 // WM_MOUSEACTIVATE handler and don't activate the window if the property is |
1543 // set. | 1543 // set. |
1544 if (::GetProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow)) { | 1544 if (::GetProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow)) { |
1545 ::RemoveProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow); | 1545 ::RemoveProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow); |
1546 return MA_NOACTIVATE; | 1546 return MA_NOACTIVATE; |
1547 } | 1547 } |
1548 // A child window activation should be treated as if we lost activation. | 1548 // A child window activation should be treated as if we lost activation. |
1549 POINT cursor_pos = {0}; | 1549 POINT cursor_pos = {0}; |
1550 ::GetCursorPos(&cursor_pos); | 1550 ::GetCursorPos(&cursor_pos); |
1551 ::ScreenToClient(hwnd(), &cursor_pos); | 1551 ::ScreenToClient(hwnd(), &cursor_pos); |
| 1552 // The code below exists for child windows like NPAPI plugins etc which need |
| 1553 // to be activated whenever we receive a WM_MOUSEACTIVATE message. Don't put |
| 1554 // transparent child windows in this bucket as they are not supposed to grab |
| 1555 // activation. |
| 1556 // TODO(ananta) |
| 1557 // Get rid of this code when we deprecate NPAPI plugins. |
1552 HWND child = ::RealChildWindowFromPoint(hwnd(), cursor_pos); | 1558 HWND child = ::RealChildWindowFromPoint(hwnd(), cursor_pos); |
1553 if (::IsWindow(child) && child != hwnd() && ::IsWindowVisible(child)) | 1559 if (::IsWindow(child) && child != hwnd() && ::IsWindowVisible(child) && |
| 1560 !(::GetWindowLong(child, GWL_EXSTYLE) & WS_EX_TRANSPARENT)) |
1554 PostProcessActivateMessage(WA_INACTIVE, false); | 1561 PostProcessActivateMessage(WA_INACTIVE, false); |
1555 | 1562 |
1556 // TODO(beng): resolve this with the GetWindowLong() check on the subsequent | 1563 // TODO(beng): resolve this with the GetWindowLong() check on the subsequent |
1557 // line. | 1564 // line. |
1558 if (delegate_->IsWidgetWindow()) | 1565 if (delegate_->IsWidgetWindow()) |
1559 return delegate_->CanActivate() ? MA_ACTIVATE : MA_NOACTIVATEANDEAT; | 1566 return delegate_->CanActivate() ? MA_ACTIVATE : MA_NOACTIVATEANDEAT; |
1560 if (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE) | 1567 if (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE) |
1561 return MA_NOACTIVATE; | 1568 return MA_NOACTIVATE; |
1562 SetMsgHandled(FALSE); | 1569 SetMsgHandled(FALSE); |
1563 return MA_ACTIVATE; | 1570 return MA_ACTIVATE; |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); | 2492 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); |
2486 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); | 2493 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); |
2487 } | 2494 } |
2488 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 2495 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
2489 // to notify our children too, since we can have MDI child windows who need to | 2496 // to notify our children too, since we can have MDI child windows who need to |
2490 // update their appearance. | 2497 // update their appearance. |
2491 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 2498 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
2492 } | 2499 } |
2493 | 2500 |
2494 } // namespace views | 2501 } // namespace views |
OLD | NEW |