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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1114 } | 1115 } |
1115 | 1116 |
1116 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { | 1117 void Widget::OnNativeWidgetPaint(gfx::Canvas* canvas) { |
1117 // On Linux Aura, we can get here during Init() because of the | 1118 // On Linux Aura, we can get here during Init() because of the |
1118 // SetInitialBounds call. | 1119 // SetInitialBounds call. |
1119 if (native_widget_initialized_) | 1120 if (native_widget_initialized_) |
1120 GetRootView()->Paint(canvas); | 1121 GetRootView()->Paint(canvas); |
1121 } | 1122 } |
1122 | 1123 |
1123 int Widget::GetNonClientComponent(const gfx::Point& point) { | 1124 int Widget::GetNonClientComponent(const gfx::Point& point) { |
1124 return non_client_view_ ? | 1125 int component = non_client_view_ ? |
1125 non_client_view_->NonClientHitTest(point) : | 1126 non_client_view_->NonClientHitTest(point) : |
1126 HTNOWHERE; | 1127 HTNOWHERE; |
1128 | |
1129 if (movement_disabled_ && (component == HTCAPTION || component == HTSYSMENU)) | |
Ben Goodger (Google)
2013/01/23 19:10:46
HTNOWHERE... will this cause events to get sent st
Mike Wittman
2013/01/23 21:52:31
Yes, I checked and we still get mouse events in Wi
| |
1130 return HTNOWHERE; | |
1131 else | |
1132 return component; | |
Ben Goodger (Google)
2013/01/23 19:10:46
nit: no else after return
Mike Wittman
2013/01/23 21:52:31
Done.
| |
1127 } | 1133 } |
1128 | 1134 |
1129 void Widget::OnKeyEvent(ui::KeyEvent* event) { | 1135 void Widget::OnKeyEvent(ui::KeyEvent* event) { |
1130 ScopedEvent scoped(this, *event); | 1136 ScopedEvent scoped(this, *event); |
1131 static_cast<internal::RootView*>(GetRootView())-> | 1137 static_cast<internal::RootView*>(GetRootView())-> |
1132 DispatchKeyEvent(event); | 1138 DispatchKeyEvent(event); |
1133 } | 1139 } |
1134 | 1140 |
1135 void Widget::OnMouseEvent(ui::MouseEvent* event) { | 1141 void Widget::OnMouseEvent(ui::MouseEvent* event) { |
1136 ScopedEvent scoped(this, *event); | 1142 ScopedEvent scoped(this, *event); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1405 | 1411 |
1406 //////////////////////////////////////////////////////////////////////////////// | 1412 //////////////////////////////////////////////////////////////////////////////// |
1407 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1413 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1408 | 1414 |
1409 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1415 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1410 return this; | 1416 return this; |
1411 } | 1417 } |
1412 | 1418 |
1413 } // namespace internal | 1419 } // namespace internal |
1414 } // namespace views | 1420 } // namespace views |
OLD | NEW |