Chromium Code Reviews| Index: ui/views/win/hwnd_message_handler.cc |
| =================================================================== |
| --- ui/views/win/hwnd_message_handler.cc (revision 243629) |
| +++ ui/views/win/hwnd_message_handler.cc (working copy) |
| @@ -299,6 +299,14 @@ |
| // The thickness of an auto-hide taskbar in pixels. |
| const int kAutoHideTaskbarThicknessPx = 2; |
| +void AddScrollStylesToWindow(HWND window) { |
| + if (::IsWindow(window)) { |
| + long current_style = ::GetWindowLong(window, GWL_STYLE); |
| + ::SetWindowLong(window, GWL_STYLE, |
| + current_style | WS_VSCROLL | WS_HSCROLL); |
| + } |
| +} |
| + |
| } // namespace |
| // A scoping class that prevents a window from being able to redraw in response |
| @@ -390,7 +398,8 @@ |
| is_first_nccalc_(true), |
| menu_depth_(0), |
| autohide_factory_(this), |
| - id_generator_(0) { |
| + id_generator_(0), |
| + scroll_styles_set_(false) { |
| } |
| HWNDMessageHandler::~HWNDMessageHandler() { |
| @@ -1343,6 +1352,7 @@ |
| delegate_->HandleCreate(); |
| + scroll_styles_set_ = !!(create_struct->style & (WS_VSCROLL | WS_HSCROLL)); |
| // TODO(beng): move more of NWW::OnCreate here. |
| return 0; |
| } |
| @@ -1965,6 +1975,15 @@ |
| return 0; |
| } |
| +LRESULT HWNDMessageHandler::OnScrollMessage(UINT message, |
| + WPARAM w_param, |
| + LPARAM l_param) { |
| + MSG msg = { hwnd(), message, w_param, l_param, GetMessageTime() }; |
| + ui::ScrollEvent event(msg); |
| + delegate_->HandleScrollEvent(event); |
| + return 0; |
| +} |
| + |
| LRESULT HWNDMessageHandler::OnSetCursor(UINT message, |
| WPARAM w_param, |
| LPARAM l_param) { |
| @@ -2042,6 +2061,23 @@ |
| // ResetWindowRegion is going to trigger WM_NCPAINT. By doing it after we've |
| // invoked OnSize we ensure the RootView has been laid out. |
| ResetWindowRegion(false, true); |
| + |
| +#if defined(USE_AURA) |
| + // We add the WS_VSCROLL and WS_HSCROLL styles to top level windows to ensure |
| + // that legacy trackpad/trackpoint drivers generate the WM_VSCROLL and |
| + // WM_HSCROLL messages and scrolling works. |
| + // We want the style to be present on the window. However we don't want |
| + // Windows to draw the scrollbars. To achieve this we hide the scroll bars |
| + // and readd them to the window style in a posted task which works. |
| + if (scroll_styles_set_) { |
| + BOOL visible = ::IsWindowVisible(hwnd()); |
| + ShowScrollBar(hwnd(), SB_BOTH, FALSE); |
| + long current_style = ::GetWindowLong(hwnd(), GWL_STYLE); |
|
cpu_(ooo_6.6-7.5)
2014/01/10 21:10:18
current_style not used also visible not used.
ananta
2014/01/11 00:20:29
Done.
|
| + base::MessageLoop::current()->PostTask( |
| + FROM_HERE, |
| + base::Bind(&AddScrollStylesToWindow, hwnd())); |
| +#endif |
| + } |
| } |
| void HWNDMessageHandler::OnSysCommand(UINT notification_code, |