| 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/widget/widget_hwnd_utils.h" | 5 #include "ui/views/widget/widget_hwnd_utils.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 case Widget::InitParams::TYPE_POPUP: | 126 case Widget::InitParams::TYPE_POPUP: |
| 127 *style |= WS_POPUP; | 127 *style |= WS_POPUP; |
| 128 *ex_style |= WS_EX_TOOLWINDOW; | 128 *ex_style |= WS_EX_TOOLWINDOW; |
| 129 break; | 129 break; |
| 130 case Widget::InitParams::TYPE_MENU: | 130 case Widget::InitParams::TYPE_MENU: |
| 131 *style |= WS_POPUP; | 131 *style |= WS_POPUP; |
| 132 break; | 132 break; |
| 133 default: | 133 default: |
| 134 NOTREACHED(); | 134 NOTREACHED(); |
| 135 } | 135 } |
| 136 |
| 137 #if defined(USE_AURA) |
| 138 // Certain trackpad drivers on Windows have bugs where in they don't generate |
| 139 // WM_MOUSEWHEEL messages for the trackpoint and trackpad scrolling gestures |
| 140 // unless there is an entry for Chrome with the class name of the Window. |
| 141 // These drivers check if the window under the trackpoint has the WS_VSCROLL/ |
| 142 // WS_HSCROLL style and if yes they generate the legacy WM_VSCROLL/WM_HSCROLL |
| 143 // messages. We add these styles to ensure that trackpad/trackpoint scrolling |
| 144 // work. |
| 145 if (!params.child) |
| 146 *style |= WS_VSCROLL | WS_HSCROLL; |
| 147 #endif |
| 136 } | 148 } |
| 137 | 149 |
| 138 } // namespace | 150 } // namespace |
| 139 | 151 |
| 140 bool DidClientAreaSizeChange(const WINDOWPOS* window_pos) { | 152 bool DidClientAreaSizeChange(const WINDOWPOS* window_pos) { |
| 141 return !(window_pos->flags & SWP_NOSIZE) || | 153 return !(window_pos->flags & SWP_NOSIZE) || |
| 142 window_pos->flags & SWP_FRAMECHANGED; | 154 window_pos->flags & SWP_FRAMECHANGED; |
| 143 } | 155 } |
| 144 | 156 |
| 145 void ConfigureWindowStyles( | 157 void ConfigureWindowStyles( |
| 146 HWNDMessageHandler* handler, | 158 HWNDMessageHandler* handler, |
| 147 const Widget::InitParams& params, | 159 const Widget::InitParams& params, |
| 148 WidgetDelegate* widget_delegate, | 160 WidgetDelegate* widget_delegate, |
| 149 internal::NativeWidgetDelegate* native_widget_delegate) { | 161 internal::NativeWidgetDelegate* native_widget_delegate) { |
| 150 // Configure the HWNDMessageHandler with the appropriate | 162 // Configure the HWNDMessageHandler with the appropriate |
| 151 DWORD style = 0; | 163 DWORD style = 0; |
| 152 DWORD ex_style = 0; | 164 DWORD ex_style = 0; |
| 153 DWORD class_style = 0; | 165 DWORD class_style = 0; |
| 154 CalculateWindowStylesFromInitParams(params, widget_delegate, | 166 CalculateWindowStylesFromInitParams(params, widget_delegate, |
| 155 native_widget_delegate, &style, &ex_style, | 167 native_widget_delegate, &style, &ex_style, |
| 156 &class_style); | 168 &class_style); |
| 157 handler->set_initial_class_style(class_style); | 169 handler->set_initial_class_style(class_style); |
| 158 handler->set_window_style(handler->window_style() | style); | 170 handler->set_window_style(handler->window_style() | style); |
| 159 handler->set_window_ex_style(handler->window_ex_style() | ex_style); | 171 handler->set_window_ex_style(handler->window_ex_style() | ex_style); |
| 160 } | 172 } |
| 161 | 173 |
| 162 } // namespace views | 174 } // namespace views |
| OLD | NEW |