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.h" | 5 #include "ui/views/widget/widget.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/events/event.h" | 10 #include "ui/base/events/event.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 disable_inactive_rendering_(false), | 193 disable_inactive_rendering_(false), |
194 widget_closed_(false), | 194 widget_closed_(false), |
195 saved_show_state_(ui::SHOW_STATE_DEFAULT), | 195 saved_show_state_(ui::SHOW_STATE_DEFAULT), |
196 focus_on_creation_(true), | 196 focus_on_creation_(true), |
197 is_top_level_(false), | 197 is_top_level_(false), |
198 native_widget_initialized_(false), | 198 native_widget_initialized_(false), |
199 native_widget_destroyed_(false), | 199 native_widget_destroyed_(false), |
200 is_mouse_button_pressed_(false), | 200 is_mouse_button_pressed_(false), |
201 is_touch_down_(false), | 201 is_touch_down_(false), |
202 last_mouse_event_was_move_(false), | 202 last_mouse_event_was_move_(false), |
203 root_layers_dirty_(false) { | 203 root_layers_dirty_(false), |
| 204 movement_disabled_(false) { |
204 } | 205 } |
205 | 206 |
206 Widget::~Widget() { | 207 Widget::~Widget() { |
207 while (!event_stack_.empty()) { | 208 while (!event_stack_.empty()) { |
208 event_stack_.top()->reset(); | 209 event_stack_.top()->reset(); |
209 event_stack_.pop(); | 210 event_stack_.pop(); |
210 } | 211 } |
211 | 212 |
212 DestroyRootView(); | 213 DestroyRootView(); |
213 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { | 214 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 } | 1118 } |
1118 | 1119 |
1119 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { | 1120 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { |
1120 // On Linux Aura, we can get here during Init() because of the | 1121 // On Linux Aura, we can get here during Init() because of the |
1121 // SetInitialBounds call. | 1122 // SetInitialBounds call. |
1122 if (native_widget_initialized_) | 1123 if (native_widget_initialized_) |
1123 GetRootView()->Paint(canvas); | 1124 GetRootView()->Paint(canvas); |
1124 } | 1125 } |
1125 | 1126 |
1126 int Widget::GetNonClientComponent(const gfx::Point& point) { | 1127 int Widget::GetNonClientComponent(const gfx::Point& point) { |
1127 return non_client_view_ ? | 1128 int component = non_client_view_ ? |
1128 non_client_view_->NonClientHitTest(point) : | 1129 non_client_view_->NonClientHitTest(point) : |
1129 HTNOWHERE; | 1130 HTNOWHERE; |
| 1131 |
| 1132 if (movement_disabled_ && (component == HTCAPTION || component == HTSYSMENU)) |
| 1133 return HTNOWHERE; |
| 1134 |
| 1135 return component; |
1130 } | 1136 } |
1131 | 1137 |
1132 void Widget::OnKeyEvent(ui::KeyEvent* event) { | 1138 void Widget::OnKeyEvent(ui::KeyEvent* event) { |
1133 ScopedEvent scoped(this, *event); | 1139 ScopedEvent scoped(this, *event); |
1134 static_cast<internal::RootView*>(GetRootView())-> | 1140 static_cast<internal::RootView*>(GetRootView())-> |
1135 DispatchKeyEvent(event); | 1141 DispatchKeyEvent(event); |
1136 } | 1142 } |
1137 | 1143 |
1138 void Widget::OnMouseEvent(ui::MouseEvent* event) { | 1144 void Widget::OnMouseEvent(ui::MouseEvent* event) { |
1139 ScopedEvent scoped(this, *event); | 1145 ScopedEvent scoped(this, *event); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 | 1414 |
1409 //////////////////////////////////////////////////////////////////////////////// | 1415 //////////////////////////////////////////////////////////////////////////////// |
1410 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1416 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1411 | 1417 |
1412 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1418 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1413 return this; | 1419 return this; |
1414 } | 1420 } |
1415 | 1421 |
1416 } // namespace internal | 1422 } // namespace internal |
1417 } // namespace views | 1423 } // namespace views |
OLD | NEW |