15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright (c) 2014 The Chromium Authors. All rights reserved. 25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file. 45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/browser/renderer_host/legacy_render_widget_host_win.h" 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/command_line.h" 85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/win/windows_version.h" 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/browser/accessibility/browser_accessibility_manager_win.h" 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/browser/accessibility/browser_accessibility_win.h" 125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "content/browser/renderer_host/render_widget_host_impl.h" 13116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "content/browser/renderer_host/render_widget_host_view_aura.h" 140de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles)#include "content/public/browser/browser_accessibility_state.h" 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/common/content_switches.h" 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/base/touch/touch_enabled.h" 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/base/view_prop.h" 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/base/win/internal_constants.h" 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/base/win/window_event_target.h" 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/gfx/geometry/rect.h" 21f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "ui/gfx/win/dpi.h" 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace content { 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 250de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles)// A custom MSAA object id used to determine if a screen reader or some 260de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles)// other client is listening on MSAA events - if so, we enable full web 270de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles)// accessibility support. 280de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles)const int kIdScreenReaderHoneyPot = 1; 290de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) 305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// static 31116680a4aac90f2aa7413d9095a592090648e557Ben MurdochLegacyRenderWidgetHostHWND* LegacyRenderWidgetHostHWND::Create( 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) HWND parent) { 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // content_unittests passes in the desktop window as the parent. We allow 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // the LegacyRenderWidgetHostHWND instance to be created in this case for 35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // these tests to pass. 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (CommandLine::ForCurrentProcess()->HasSwitch( 37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) switches::kDisableLegacyIntermediateWindow) || 38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) (!GetWindowEventTarget(parent) && parent != ::GetDesktopWindow())) 39116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return NULL; 405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 41116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch LegacyRenderWidgetHostHWND* legacy_window_instance = 42116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch new LegacyRenderWidgetHostHWND(parent); 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // If we failed to create the child, or if the switch to disable the legacy 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // window is passed in, then return NULL. 45116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch if (!::IsWindow(legacy_window_instance->hwnd())) { 46116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch delete legacy_window_instance; 47116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return NULL; 48116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch } 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) legacy_window_instance->Init(); 50116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return legacy_window_instance; 51116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 52116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 53116680a4aac90f2aa7413d9095a592090648e557Ben Murdochvoid LegacyRenderWidgetHostHWND::Destroy() { 54116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch if (::IsWindow(hwnd())) 55116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ::DestroyWindow(hwnd()); 565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void LegacyRenderWidgetHostHWND::UpdateParent(HWND parent) { 595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::SetParent(hwnd(), parent); 605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // If the new parent is the desktop Window, then we disable the child window 615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // to ensure that it does not receive any input events. It should not because 625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // of WS_EX_TRANSPARENT. This is only for safety. 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (parent == ::GetDesktopWindow()) { 645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::EnableWindow(hwnd(), FALSE); 655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } else { 665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::EnableWindow(hwnd(), TRUE); 675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)HWND LegacyRenderWidgetHostHWND::GetParent() { 715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return ::GetParent(hwnd()); 725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void LegacyRenderWidgetHostHWND::Show() { 755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::ShowWindow(hwnd(), SW_SHOW); 765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void LegacyRenderWidgetHostHWND::Hide() { 795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::ShowWindow(hwnd(), SW_HIDE); 805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) { 83f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) gfx::Rect bounds_in_pixel = gfx::win::DIPToScreenRect(bounds); 84f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) ::SetWindowPos(hwnd(), NULL, bounds_in_pixel.x(), bounds_in_pixel.y(), 855f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) bounds_in_pixel.width(), bounds_in_pixel.height(), 865f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) SWP_NOREDRAW); 875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { 90116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch if (host_) { 91116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch host_->OnLegacyWindowDestroyed(); 92116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch host_ = NULL; 93116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch } 94116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch delete this; 955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LegacyRenderWidgetHostHWND::LegacyRenderWidgetHostHWND(HWND parent) 985f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) : mouse_tracking_enabled_(false), 99116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch host_(NULL) { 1005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) RECT rect = {0}; 1015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) Base::Create(parent, rect, L"Chrome Legacy Window", 1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WS_EX_TRANSPARENT); 1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 1055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 106116680a4aac90f2aa7413d9095a592090648e557Ben MurdochLegacyRenderWidgetHostHWND::~LegacyRenderWidgetHostHWND() { 107116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch DCHECK(!::IsWindow(hwnd())); 108116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch} 109116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 1105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)bool LegacyRenderWidgetHostHWND::Init() { 1115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (base::win::GetVersion() >= base::win::VERSION_WIN7 && 1125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::AreTouchEventsEnabled()) 1135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) RegisterTouchWindow(hwnd(), TWF_WANTPALM); 1145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) HRESULT hr = ::CreateStdAccessibleObject( 1165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) hwnd(), OBJID_WINDOW, IID_IAccessible, 1175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) reinterpret_cast<void **>(window_accessible_.Receive())); 1185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) DCHECK(SUCCEEDED(hr)); 1190de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) 1200de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) if (!BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) { 1210de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) // Attempt to detect screen readers or other clients who want full 1220de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) // accessibility support, by seeing if they respond to this event. 1230de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd(), kIdScreenReaderHoneyPot, 1240de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) CHILDID_SELF); 1250de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) } 1260de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) 1275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return !!SUCCEEDED(hr); 1285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 1295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 130a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// static 131a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)ui::WindowEventTarget* LegacyRenderWidgetHostHWND::GetWindowEventTarget( 132a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) HWND parent) { 133a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return reinterpret_cast<ui::WindowEventTarget*>(ui::ViewProp::GetValue( 134a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) parent, ui::WindowEventTarget::kWin32InputEventTarget)); 135a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 136a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 1375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnEraseBkGnd(UINT message, 1385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 1395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 1405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return 1; 1415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 1425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnGetObject(UINT message, 1445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 1455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 146116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Only the lower 32 bits of l_param are valid when checking the object id 147116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // because it sometimes gets sign-extended incorrectly (but not always). 148116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(l_param)); 149116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 150116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch if (kIdScreenReaderHoneyPot == obj_id) { 1510de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) // When an MSAA client has responded to our fake event on this id, 1520de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) // enable screen reader support. 1530de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); 1540de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) return static_cast<LRESULT>(0L); 1550de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) } 1560de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) 1575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) if (OBJID_CLIENT != obj_id || !host_) 1585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) return static_cast<LRESULT>(0L); 1595f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 1605f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From( 1615f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) host_->GetRenderWidgetHost()); 1625f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) if (!rwhi) 1635f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) return static_cast<LRESULT>(0L); 1645f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 1655f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) BrowserAccessibilityManagerWin* manager = 1665f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) static_cast<BrowserAccessibilityManagerWin*>( 1675f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) rwhi->GetRootBrowserAccessibilityManager()); 1685f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) if (!manager) 1695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return static_cast<LRESULT>(0L); 1705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::win::ScopedComPtr<IAccessible> root( 1725f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) manager->GetRoot()->ToBrowserAccessibilityWin()); 1735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return LresultFromObject(IID_IAccessible, w_param, 1745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) static_cast<IAccessible*>(root.Detach())); 1755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 1765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// We send keyboard/mouse/touch messages to the parent window via SendMessage. 1785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// While this works, this has the side effect of converting input messages into 1795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// sent messages which changes their priority and could technically result 1805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// in these messages starving other messages in the queue. Additionally 1815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// keyboard/mouse hooks would not see these messages. The alternative approach 1825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// is to set and release capture as needed on the parent to ensure that it 1835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// receives all mouse events. However that was shelved due to possible issues 1845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// with capture changes. 1855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnKeyboardRange(UINT message, 1865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 1875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param, 1885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) BOOL& handled) { 189116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch LRESULT ret = 0; 190a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (GetWindowEventTarget(GetParent())) { 191116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool msg_handled = false; 192116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ret = GetWindowEventTarget(GetParent())->HandleKeyboardMessage( 193116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch message, w_param, l_param, &msg_handled); 194116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch handled = msg_handled; 195a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 196116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return ret; 1975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 1985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, 2005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 2015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param, 2025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) BOOL& handled) { 2035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (message == WM_MOUSEMOVE) { 2045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (!mouse_tracking_enabled_) { 2055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) mouse_tracking_enabled_ = true; 2065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) TRACKMOUSEEVENT tme; 2075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) tme.cbSize = sizeof(tme); 2085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) tme.dwFlags = TME_LEAVE; 2095d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) tme.hwndTrack = hwnd(); 2105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) tme.dwHoverTime = 0; 2115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) TrackMouseEvent(&tme); 2125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 2135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 214a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // The offsets for WM_NCXXX and WM_MOUSEWHEEL and WM_MOUSEHWHEEL messages are 215a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // in screen coordinates. We should not be converting them to parent 216a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // coordinates. 217a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if ((message >= WM_MOUSEFIRST && message <= WM_MOUSELAST) && 218a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) (message != WM_MOUSEWHEEL && message != WM_MOUSEHWHEEL)) { 2195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) POINT mouse_coords; 2205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) mouse_coords.x = GET_X_LPARAM(l_param); 2215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) mouse_coords.y = GET_Y_LPARAM(l_param); 2225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::MapWindowPoints(hwnd(), GetParent(), &mouse_coords, 1); 2235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) l_param = MAKELPARAM(mouse_coords.x, mouse_coords.y); 2245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 225116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 226116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch LRESULT ret = 0; 227116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 228a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (GetWindowEventTarget(GetParent())) { 229116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool msg_handled = false; 230116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ret = GetWindowEventTarget(GetParent())->HandleMouseMessage( 231116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch message, w_param, l_param, &msg_handled); 232116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch handled = msg_handled; 233116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // If the parent did not handle non client mouse messages, we call 234116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // DefWindowProc on the message with the parent window handle. This 235116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // ensures that WM_SYSCOMMAND is generated for the parent and we are 236116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // out of the picture. 237116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch if (!handled && 238116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch (message >= WM_NCMOUSEMOVE && message <= WM_NCXBUTTONDBLCLK)) { 239116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ret = ::DefWindowProc(GetParent(), message, w_param, l_param); 240116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch handled = TRUE; 241116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch } 242a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 243116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return ret; 2445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 2455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 2465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnMouseLeave(UINT message, 2475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 2485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 2495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) mouse_tracking_enabled_ = false; 250116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch LRESULT ret = 0; 251a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if ((::GetCapture() != GetParent()) && GetWindowEventTarget(GetParent())) { 2525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // We should send a WM_MOUSELEAVE to the parent window only if the mouse 2535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // has moved outside the bounds of the parent. 2545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) POINT cursor_pos; 2555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::GetCursorPos(&cursor_pos); 256a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (::WindowFromPoint(cursor_pos) != GetParent()) { 257116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool msg_handled = false; 258116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ret = GetWindowEventTarget(GetParent())->HandleMouseMessage( 259116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch message, w_param, l_param, &msg_handled); 260116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch SetMsgHandled(msg_handled); 261a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 2625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 263116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return ret; 2645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 2655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 2665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnMouseActivate(UINT message, 2675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 2685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 2695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Don't pass this to DefWindowProc. That results in the WM_MOUSEACTIVATE 2705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // message going all the way to the parent which then messes up state 2715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // related to focused views, etc. This is because it treats this as if 2725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // it lost activation. 2735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Our dummy window should not interfere with focus and activation in 2745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // the parent. Return MA_ACTIVATE here ensures that focus state in the parent 2755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // is preserved. The only exception is if the parent was created with the 2765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // WS_EX_NOACTIVATE style. 2775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (::GetWindowLong(GetParent(), GWL_EXSTYLE) & WS_EX_NOACTIVATE) 2785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return MA_NOACTIVATE; 279a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // On Windows, if we select the menu item by touch and if the window at the 280a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // location is another window on the same thread, that window gets a 281a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // WM_MOUSEACTIVATE message and ends up activating itself, which is not 282a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // correct. We workaround this by setting a property on the window at the 283a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // current cursor location. We check for this property in our 284a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // WM_MOUSEACTIVATE handler and don't activate the window if the property is 285a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // set. 286a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (::GetProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow)) { 287a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ::RemoveProp(hwnd(), ui::kIgnoreTouchMouseActivateForWindow); 288a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return MA_NOACTIVATE; 289a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 2905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return MA_ACTIVATE; 2915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 2925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 2935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnTouch(UINT message, 2945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 2955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 296116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch LRESULT ret = 0; 297a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (GetWindowEventTarget(GetParent())) { 298116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool msg_handled = false; 299116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ret = GetWindowEventTarget(GetParent())->HandleTouchMessage( 300116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch message, w_param, l_param, &msg_handled); 301116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch SetMsgHandled(msg_handled); 302a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 303116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return ret; 3045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 3055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnScroll(UINT message, 3075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 3085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 309116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch LRESULT ret = 0; 310a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (GetWindowEventTarget(GetParent())) { 311116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool msg_handled = false; 312116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch ret = GetWindowEventTarget(GetParent())->HandleScrollMessage( 313116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch message, w_param, l_param, &msg_handled); 314116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch SetMsgHandled(msg_handled); 315a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 316116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch return ret; 317a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 318a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 319a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnNCHitTest(UINT message, 320a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WPARAM w_param, 321a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) LPARAM l_param) { 322a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (GetWindowEventTarget(GetParent())) { 323116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool msg_handled = false; 324a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) LRESULT hit_test = GetWindowEventTarget( 325116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch GetParent())->HandleNcHitTestMessage(message, w_param, l_param, 326116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch &msg_handled); 327a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // If the parent returns HTNOWHERE which can happen for popup windows, etc 328a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // we return HTCLIENT. 329a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) if (hit_test == HTNOWHERE) 330a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) hit_test = HTCLIENT; 331a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return hit_test; 332a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 333a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return HTNOWHERE; 3345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 3355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnNCPaint(UINT message, 3375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 3385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 3395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return 0; 3405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 3415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnPaint(UINT message, 3435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 3445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 3455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PAINTSTRUCT ps = {0}; 3465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::BeginPaint(hwnd(), &ps); 3475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ::EndPaint(hwnd(), &ps); 3485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return 0; 3495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 3505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnSetCursor(UINT message, 3525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) WPARAM w_param, 3535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LPARAM l_param) { 3545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return 0; 3555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 3565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 357a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnNCCalcSize(UINT message, 358a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WPARAM w_param, 359a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) LPARAM l_param) { 360a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Prevent scrollbars, etc from drawing. 361a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return 0; 362a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 363a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 364a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)LRESULT LegacyRenderWidgetHostHWND::OnSize(UINT message, 365a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) WPARAM w_param, 366a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) LPARAM l_param) { 367a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Certain trackpad drivers on Windows have bugs where in they don't generate 368a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // WM_MOUSEWHEEL messages for the trackpoint and trackpad scrolling gestures 369a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // unless there is an entry for Chrome with the class name of the Window. 370a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Additionally others check if the window WS_VSCROLL/WS_HSCROLL styles and 371a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // generate the legacy WM_VSCROLL/WM_HSCROLL messages. 372a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // We add these styles to ensure that trackpad/trackpoint scrolling 373a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // work. 374a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); 375a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ::SetWindowLong(hwnd(), GWL_STYLE, 376a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) current_style | WS_VSCROLL | WS_HSCROLL); 377a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return 0; 378a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 379a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 3800de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles)} // namespace content 381