| Index: ui/views/win/hwnd_message_handler.cc
|
| ===================================================================
|
| --- ui/views/win/hwnd_message_handler.cc (revision 244605)
|
| +++ ui/views/win/hwnd_message_handler.cc (working copy)
|
| @@ -315,6 +315,18 @@
|
| }
|
| }
|
|
|
| +void HideWindowsScrollBar(HWND window) {
|
| + ShowScrollBar(window, SB_BOTH, FALSE);
|
| + // Hiding the scrollbar also removes the WS_VSCROLL and WS_HSCROLL styles.
|
| + // We need to add the styles back to ensure that some trackpoint drivers
|
| + // which rely on them for scrolling work. However as this function can get
|
| + // called in the context of WM_SIZE we don't want to do this synchronously
|
| + // as that may trigger a WM_SIZE in some cases.
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&AddScrollStylesToWindow, window));
|
| +}
|
| +
|
| } // namespace
|
|
|
| // A scoping class that prevents a window from being able to redraw in response
|
| @@ -407,7 +419,8 @@
|
| menu_depth_(0),
|
| autohide_factory_(this),
|
| id_generator_(0),
|
| - scroll_styles_set_(false) {
|
| + needs_scroll_styles_(false),
|
| + size_move_loop_(false) {
|
| }
|
|
|
| HWNDMessageHandler::~HWNDMessageHandler() {
|
| @@ -424,6 +437,27 @@
|
|
|
| // Create the window.
|
| WindowImpl::Init(parent, bounds);
|
| +
|
| +#if defined(USE_AURA)
|
| + // Certain trackpad drivers on Windows have bugs where in they don't generate
|
| + // WM_MOUSEWHEEL messages for the trackpoint and trackpad scrolling gestures
|
| + // unless there is an entry for Chrome with the class name of the Window.
|
| + // These drivers check if the window under the trackpoint has the WS_VSCROLL/
|
| + // WS_HSCROLL style and if yes they generate the legacy WM_VSCROLL/WM_HSCROLL
|
| + // messages. We add these styles to ensure that trackpad/trackpoint scrolling
|
| + // work.
|
| + // TODO(ananta)
|
| + // Look into moving the WS_VSCROLL and WS_HSCROLL style setting logic to the
|
| + // CalculateWindowStylesFromInitParams function. Doing it there seems to
|
| + // cause some interactive tests to fail. Investigation needed.
|
| + if (IsTopLevelWindow(hwnd())) {
|
| + long current_style = ::GetWindowLong(hwnd(), GWL_STYLE);
|
| + if (!(current_style & WS_POPUP)) {
|
| + AddScrollStylesToWindow(hwnd());
|
| + needs_scroll_styles_ = true;
|
| + }
|
| + }
|
| +#endif
|
| }
|
|
|
| void HWNDMessageHandler::InitModalType(ui::ModalType modal_type) {
|
| @@ -1366,25 +1400,6 @@
|
|
|
| delegate_->HandleCreate();
|
|
|
| -#if defined(USE_AURA)
|
| - // Certain trackpad drivers on Windows have bugs where in they don't generate
|
| - // WM_MOUSEWHEEL messages for the trackpoint and trackpad scrolling gestures
|
| - // unless there is an entry for Chrome with the class name of the Window.
|
| - // These drivers check if the window under the trackpoint has the WS_VSCROLL/
|
| - // WS_HSCROLL style and if yes they generate the legacy WM_VSCROLL/WM_HSCROLL
|
| - // messages. We add these styles to ensure that trackpad/trackpoint scrolling
|
| - // work.
|
| - // TODO(ananta)
|
| - // Look into moving the WS_VSCROLL and WS_HSCROLL style setting logic to the
|
| - // CalculateWindowStylesFromInitParams function. Doing it there seems to
|
| - // cause some interactive tests to fail. Investigation needed.
|
| - if (IsTopLevelWindow(hwnd())) {
|
| - long current_style = ::GetWindowLong(hwnd(), GWL_STYLE);
|
| - ::SetWindowLong(hwnd(), GWL_STYLE,
|
| - current_style | WS_VSCROLL | WS_HSCROLL);
|
| - scroll_styles_set_ = true;
|
| - }
|
| -#endif
|
| // TODO(beng): move more of NWW::OnCreate here.
|
| return 0;
|
| }
|
| @@ -1416,6 +1431,7 @@
|
| }
|
|
|
| void HWNDMessageHandler::OnEnterSizeMove() {
|
| + size_move_loop_ = true;
|
| delegate_->HandleBeginWMSizeMove();
|
| SetMsgHandled(FALSE);
|
| }
|
| @@ -1434,6 +1450,11 @@
|
| void HWNDMessageHandler::OnExitSizeMove() {
|
| delegate_->HandleEndWMSizeMove();
|
| SetMsgHandled(FALSE);
|
| + size_move_loop_ = false;
|
| + // Please refer to the notes in the OnSize function for information about
|
| + // the scrolling hack.
|
| + if (needs_scroll_styles_)
|
| + HideWindowsScrollBar(hwnd());
|
| }
|
|
|
| void HWNDMessageHandler::OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
|
| @@ -2101,13 +2122,11 @@
|
| // 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_) {
|
| - ShowScrollBar(hwnd(), SB_BOTH, FALSE);
|
| - base::MessageLoop::current()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&AddScrollStylesToWindow, hwnd()));
|
| + // If we are in the context of a size loop operation, we do this when the
|
| + // sizing operation completes.
|
| + if (needs_scroll_styles_ && !size_move_loop_)
|
| + HideWindowsScrollBar(hwnd());
|
| #endif
|
| - }
|
| }
|
|
|
| void HWNDMessageHandler::OnSysCommand(UINT notification_code,
|
|
|