Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 626183002: Fix a long standing bug with the browser window losing focus when the user scrolled on the page usi… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
sky 2014/10/03 22:53:09 Document why we don't include transparent ones.
ananta 2014/10/04 00:10:09 Done.
1555 // TODO(ananta)
1556 // Get rid of this code when we deprecate NPAPI plugins.
1552 HWND child = ::RealChildWindowFromPoint(hwnd(), cursor_pos); 1557 HWND child = ::RealChildWindowFromPoint(hwnd(), cursor_pos);
1553 if (::IsWindow(child) && child != hwnd() && ::IsWindowVisible(child)) 1558 if (::IsWindow(child) && child != hwnd() && ::IsWindowVisible(child) &&
1559 !(::GetWindowLong(child, GWL_EXSTYLE) & WS_EX_TRANSPARENT))
1554 PostProcessActivateMessage(WA_INACTIVE, false); 1560 PostProcessActivateMessage(WA_INACTIVE, false);
1555 1561
1556 // TODO(beng): resolve this with the GetWindowLong() check on the subsequent 1562 // TODO(beng): resolve this with the GetWindowLong() check on the subsequent
1557 // line. 1563 // line.
1558 if (delegate_->IsWidgetWindow()) 1564 if (delegate_->IsWidgetWindow())
1559 return delegate_->CanActivate() ? MA_ACTIVATE : MA_NOACTIVATEANDEAT; 1565 return delegate_->CanActivate() ? MA_ACTIVATE : MA_NOACTIVATEANDEAT;
1560 if (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE) 1566 if (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE)
1561 return MA_NOACTIVATE; 1567 return MA_NOACTIVATE;
1562 SetMsgHandled(FALSE); 1568 SetMsgHandled(FALSE);
1563 return MA_ACTIVATE; 1569 return MA_ACTIVATE;
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2491 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2486 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2492 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2487 } 2493 }
2488 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2494 // 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 2495 // to notify our children too, since we can have MDI child windows who need to
2490 // update their appearance. 2496 // update their appearance.
2491 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2497 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2492 } 2498 }
2493 2499
2494 } // namespace views 2500 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698